0

I wanted to get a triangle by positioning nodes in relative to each other. Here is what I did

\begin{tikzpicture}[auto, node distance=4em]

% Gridline
\draw [step=0.5cm,draw=gray] (-4,-4) grid (4,4);

\coordinate (A) at (-4,+4);

\draw [blue] (A) -- +(1,0) -- +(0,-1) -- (A) %line1
\draw [green] (A) -- +(1,0) -- ($ (A) + (1,0) $)+(0,-1) -- (A);  %line2

\end{tikzpicture}

Problem: LINE-1: All points are positioned relative to A. I thought that "+(1,0) -- +(0,-1)" will place (0,-1) relative to A+(1,0) but that didnt happen.

LINE-2: For this line points are at right position but leg is missing at "+(1,0) -- ($ (A) + (1,0) $)+(0,-1)"

how can I fix this.

1

Did you look in pgfmanual? This is a fragment from page 140 explaining that your problem comes because you wanted to use --++ but used --+.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.