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.

Following this example, I write:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{
    decorations.text,
    }
\begin{document}
\begin{tikzpicture}
\coordinate (a) at (0,0);
\coordinate (b) at (6,0);
\draw[->, >=latex, blue!20!white, bend left=20, line width=15pt] (a) to (b) ;
\draw [bend left=20, decoration={raise=-0.8ex,text along path, text={{$start$}.}, text align={align=left}}, decorate] (a) to (b);
\draw [bend left=20, decoration={raise=-0.8ex,text along path, text={{$end\qquad$}.}, text align={align=right}}, decorate] (a) to (b);
\end{tikzpicture}
\end{document}

But, if I remove the "." characters, latex either repeats the text forever or else goes into an infinite loop.

share|improve this question
    
Which "." are you referring to? –  azetina Oct 1 '12 at 2:15
    
The ones in: {{$start$}.} and {{$end$}.} –  Neil G Oct 1 '12 at 2:20
    
What are you trying to achieve with the words start and end. Do you want them in italics? –  azetina Oct 1 '12 at 2:25
    
@azetina: No, they're actually macros in my code, which expand to bolded greek symbols. I'm finding this hard to read though, and investigating other options. –  Neil G Oct 1 '12 at 2:32
add comment

1 Answer

up vote 8 down vote accepted

Instead of your . use an empty pair of {}.

Instead of that \qquad hack I present

text align/right indent=1cm

That, sadly, does not work with em units …

Code

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
\coordinate (a) at (0,0);
\coordinate (b) at (6,0);
\draw[->, >=latex, blue!20!white, bend left=20, line width=15pt] (a) to (b) ;
\draw [name=reusepath,bend left=20, decoration={raise=-0.8ex,text along path, text={{$start$}{}}}, decorate] (a) to (b);
\draw [bend left=20, decoration={raise=-0.8ex,text along path, text={{$end$}}, text align/right indent=1cm, text align=right}, decorate] (a) to (b);
\end{tikzpicture}
\end{document}

Output

enter image description here

From the beamer manual

It is only possible to typeset text in math mode under considerable restrictions. Math mode is entered and exited using any character of category code 3 (e.g., in plain TeX this is $). Math subscripts and superscripts need to be contained within braces (e.g., {^y_i}) as do commands like \times or \cdot. However, even modestly complex mathematical typesetting is unlikely to be successful along a path (or even desirable).


Update

I allowed myself to "clean" your code a little bit, so that only one path is generated and the decorations are declared as a postaction.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text,intersections}
\begin{document}
\begin{tikzpicture}
\coordinate (a) at (0,0);
\coordinate (b) at (6,0);
\draw[->, >=latex,
      blue!20!white,
      bend left=20,
      line width=15pt,
      postaction={decorate,decoration={
          raise=-0.8ex,
          text along path,
          text={{$start$}{}}
        }
      },
      postaction={decorate,decoration={
          raise=-0.8ex,
          text along path,
          text={{$end$}},
          text align/right indent=1cm,
          text align=right
        }
      }
  ] (a) to (b) ;
\end{tikzpicture}
\end{document}
share|improve this answer
    
I like the cleaned code! –  Neil G Oct 1 '12 at 14:01
    
@NeilG While the indention is for the humans to be able to read the code easier, the implementation with postaction is easier to maintain, because you only have to change one path, not three, when you want a different path. –  Qrrbrbirlbel Oct 1 '12 at 14:06
    
Excellent point. In my case, I'm actually generating all of the tikz code using Python, so it's not so bad :) –  Neil G Oct 1 '12 at 15:27
add comment

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.