Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Unfortunately due to the way search engines work, this information isn't that easy to find.

Sometimes examples draw using --, sometimes -- +, sometimes -- ++.

I don't get the meaning!

For example, for this command:

\draw[fill=gray!50] (1,1) -- + (0:.5) arc (0:60:1) -- cycle;

What is the -- + there?

What does it mean if I change that to -- ?

share|improve this question
1  
I've added a reference to the manual for further reading. –  Loop Space Aug 6 '12 at 19:14
    
Which is here –  bobobobo Aug 9 '12 at 16:26

1 Answer 1

up vote 15 down vote accepted

The pluses modify the following coordinate making it relative to the previous saved coordinate. The difference between a single and a double plus is whether or not the saved coordinate is updated.

Thus:

\draw (1,1) -- ++(1,0) -- ++(0,1);

the second coordinate is actually (1,1) + (1,0) = (2,1) and the third is (2,1) + (0,1) = (2,2).

\draw (1,1) -- +(1,0) -- ++(0,1);

the second coordinate is actually (1,1) + (1,0) = (2,1) but the second coordinate is not saved so the third is relative to the first and thus is (1,1) + (0,1) = (1,2).

There's a slight change for bezier curves. If you do \draw (1,1) .. controls +(1,0) and +(0,1) .. ++(2,2) then the second control point is computed relative to the end point (which is very useful) and thus the controls are (1,1) + (1,0) for the first and (2,2) + (1,1) + (0,1) for the second (as the end point is itself relative to the initial position since the control points were specified with a single plus).

(Forgot to add the reference to the manual: to learn more, see Section 13.4 in the PGF manual (PGF2.10 version, might be a different section in other versions))

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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