# tikz shift coordinate rectangle

I cannot understand why, in the following example, the first coordinates of the rectangle is correctly shifted and not the second one.

\begin{tikzpicture}
\draw (0,0)+(1,2) rectangle (4,4)+(-1,-2);
\end{tikzpicture}


I see in other posts that I can use 'calc' library, which is working fine for me.

Thanks

• Does this produce your desired result? \draw (0,0)+(1,2) rectangle {(4,4)+(-1,-2)}; Sep 9, 2015 at 11:21
• I haven't seen that it also produces an error... Sep 9, 2015 at 11:30
• Please provide absolute coordinate where the rectangle you like to have. Between (1,2) and (3,2), i.e. actually it is line, not square? Sep 9, 2015 at 11:31
• You are right Zarko, but my problem is that I saw a rectangle and not a line, but now I understand with the answer of @Heiko Sep 10, 2015 at 8:56

After

\draw (0, 0) + (1, 2)


the starting point of the rectangle is (1, 2) as expected. Then

rectangle (4, 4)


draws the rectangle with end point (4, 4). The remaining stuff

+(-1, -2);


moves to the point (3, 2), but the movement is not visible.

A point can be given options in square brackets, where a shift can be specified:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw (0, 0) +(1, 2) rectangle ([shift={(-1, -2)}] 4, 4);
\fill[radius=2pt, red] (0, 0) circle[] (4, 4) circle[] ;
\end{tikzpicture}
\end{document}


The rectangle is now a line:

\draw (1, 2) rectangle (3, 2);

• thanks heiko, I now understand better. It solved my problem Sep 10, 2015 at 8:55