TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Initial question

Is there an easy way to vary the thickness of a path along its length to create a wedge (for instance, to create a stereochemical cue)?

e.g. cis-cyclohexane-1,2-diol, drawn in ACD/ChemSketch.


The expanding waves decorator looks perfect for receding bonds, but there is no listed equivalent for approaching bonds.

Playing with expanding waves decorator

Based on the thread that Jake linked, I had a look at variables that can be tweaked with the expanding waves decorator. I don't think the current PGF/TikZ manual explicitly mentions it, but the expanding waves decorator has a segment length variable, as used in this example - setting it to my linewidth of 0.4 pt yields a solid wedge.


As Jake points out, this is the Wrong Way to approach this problem for performance reasons.

share|improve this question
If you want a general solution for varying the thickness of a (possibly curved) path, take a look at Altermundus' answer to Trait with Variable Thickness. However, this might be overkill if all you're really looking for is a triangle. – Jake Jun 30 '11 at 4:43
@Jake - Strange that I didn't see that when searching for precedents. That is indeed total overkill, however it gives me an idea - if I control the spacing of waves with the expanding waves decorator, they could converge into a wedge... Trying this... – Richard Terrett Jun 30 '11 at 5:09
Oh no, don't do that! Decorations are really slow, and you won't get a very "proper" result with this approach. Give it an hour or so, once Altermundus and Andrew Stacey see this, they will no doubt come up with something stunningly simple and beautiful. – Jake Jun 30 '11 at 5:12
@Jake - I suspected speed would be an issue. I had a go at it before I read your reply. Looks good on screen and is reasonably performant however I don't know how it would work in bulk or when printed. – Richard Terrett Jun 30 '11 at 5:30
up vote 6 down vote accepted

Here's a triangle decoration. It replaces the first segment of a path with an isosceles triangle. You use it by specifying the option triangle path in a draw or fill command. The width can be specified with the optional argument (i.e. triangle path=2cm will make the triangle 2 cm wide).

The following commands

\draw [fill=yellow,triangle path] (0,0) -- (3,2);
\fill [triangle path=4ex] (4,1) -- (7,0);

will yield

triangle decoration



  \state{start}[width=0.99\pgfdecoratedinputsegmentremainingdistance,next state=up from center]
  \state{up from center}[next state=do nothing]
  \state{do nothing}[width=\pgfdecorationsegmentlength,next state=do nothing]{

    triangle path/.style={decoration={triangle,amplitude=#1}, decorate},
    triangle path/.default=1ex}

\draw [fill=yellow,triangle path] (0,0) -- (3,2);
\fill [triangle path=4ex] (4,1) -- (7,0);
share|improve this answer
That works brilliantly – Richard Terrett Jun 30 '11 at 5:53
Very nice. Once of these days I'll have to learn about decorations. (I'd've used a to path, but only because I'm scared of decorations.) – Loop Space Jun 30 '11 at 13:32

Your Answer


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.