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.

I am trying to position nodes on a parabola curve. However, it seems tikz cannot calculate the midway positions. Neither of the following examples works:

    \draw (-1,0) parabola[parabola height=2cm] (3,0)
        node[sloped, above, pos=0.5] {0.5};

\begin{tikzpicture}[to path={
    parabola[parabola height=2cm] (\tikztotarget) \tikztonodes}]
    \draw (0,0) to
        node[above, sloped] {0.5} (3,0);

Any suggestions? Thanks!

share|improve this question
You can format your code examples by selecting the code and clicking on the 101 icon. I fixed this for you. –  Alan Munn Jan 16 '11 at 4:31
Thanks! Alan. I will keep it in mind next time. –  ltxsun Jan 16 '11 at 6:39
add comment

1 Answer

up vote 1 down vote accepted

From the TikZ manual (section 16.8 “Placing Nodes on a Line or Curve Explicitly” in v2.10):

In the simplest case, the previous path operation was a “line-to” operation, that is, a -- coordinate operation [...]

The next case is the curve-to operation (the .. operation). [...]

Another interesting case are the horizontal/vertical line-to operations |- and -|. For them, the position (or time) 0.5 is exactly the corner point. [...]

For all other path construction operations, the position placement does not work, currently. This will hopefully change in the future (especially for the arc operation).

(emphasis mine)

So you either have to position the node by hand, or draw the parabola with an explicit Bézier curve.

share|improve this answer
add comment

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.