Use Relative Coordinates in LaTeX TikZ — ++
vs. +
Jun. 06, 2025 • Updated Jun. 06, 2025
You can prefix coordinates by ++
to make them “relative”. A coordinate such as ++(1cm,0pt)
means “1cm to the right of the previous position, making this the new current position”.
Instead of ++
you can also use a single +
. This also specifies a relative coordinate, but it does not “update” the current point for subsequent usages of relative coordinates. Thus, you can use this notation to specify numerous points, all relative to the same “initial” point.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
\documentclass[border=5pt,tikz]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% Use `++` to specify relative coordinates
\draw[->] (0,0) -- ++(1,0);
\draw[->] (2,0) -- ++(1,0) -- ++(0,1);
\draw[->] (4,0) -- ++(1,0) -- ++(0,1) -- ++(-1,0);
\draw[->] (6,0) -- ++(1,0) -- ++(0,1) -- ++(-1,0) -- cycle;
% Use `+` to specify relative coordinates
\draw[->] (0,-2) -- +(1,0);
\draw[->] (2,-2) -- +(1,0) -- +(1,1);
\draw[->] (4,-2) -- +(1,0) -- +(1,1) -- +(0,1);
\draw[->] (6,-2) -- +(1,0) -- +(1,1) -- +(0,1) -- cycle;
\end{tikzpicture}
\end{document}
References