Graphics, Figures & TablestikZ | Fixed Length for a Line Segment

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

tikZ | Fixed Length for a Line Segment

Post by ghostanime2001 »

How do you make the line segment between two nodes fixed regardless of weather the nodes are placed relative to a coordinate ?

Code: Select all

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,chains,matrix}

\pagestyle{empty}

\begin{document}
\begin{tikzpicture}
\draw (0,0) node (A) {A};
\draw (30pt,0) node[above right] (B) {B};
\draw (A) -- (B);
\end{tikzpicture}
The line segment in between is not 30 points long even though the nodes are 30 points apart.
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

Post Reply