# \% symbol leads to superlong (forever?) compilations

This problem occurs when I am trying to improve my answer in this question.

You can compile this code very well

\documentclass[tikz]{standalone}
\usetikzlibrary{bending,decorations.text}
\begin{document}
\begin{tikzpicture}
\sffamily
\node (a) at (-2,0) {probability};
\node[align=center] (b) at (2,0) {percent\\change};
\draw[-latex,postaction={decorate,decoration={raise=1ex,text along path,text align=center,text={multiply by 100}}}] (a) to[out=60,in=120] (b);
\end{tikzpicture}
\end{document}


but don't compile this code!

\documentclass[tikz]{standalone}
\usetikzlibrary{bending,decorations.text}
\begin{document}
\begin{tikzpicture}
\sffamily
\node (a) at (-2,0) {probability};
\node[align=center] (b) at (2,0) {percent\\change};
\draw[-latex,postaction={decorate,decoration={raise=1ex,text along path,text align=center,text={multiply by 100\%}}}] (a) to[out=60,in=120] (b);
\end{tikzpicture}
\end{document}


I have been waiting for more than 200 seconds

Why? I just want to add a percent symbol (\%)!

I think TikZ understood my \% as %, but removing the \ throws many errors.

I even used siunitx, but got the same result.

\documentclass[tikz]{standalone}
\usetikzlibrary{bending,decorations.text}
\usepackage{siunitx}
\begin{document}
\begin{tikzpicture}
\sffamily
\node (a) at (-2,0) {probability};
\node[align=center] (b) at (2,0) {percent\\change};
\draw[-latex,postaction={decorate,decoration={raise=1ex,text along path,text align=center,text={multiply by \SI{100}{\percent}}}}] (a) to[out=60,in=120] (b);
\end{tikzpicture}
\end{document}


So, what's going on?

• Very nice your 2nd image: How do I find the compilation time? Do you have any specific software where you can see the build time? My regards. – Sebastiano Mar 28 at 16:22
• @Sebastiano I use VS Code. The LaTeX Workshop extension gives me a link to see the compilation process, which I don't use really often, but it is very useful in strange situations, like this situation. – JouleV Mar 28 at 16:24
• Is this :-)? marketplace.visualstudio.com/… – Sebastiano Mar 28 at 16:28
• @Sebastiano Yes, that's it. – JouleV Mar 28 at 16:28
• The infinite loop is triggered by any unexpandable control sequence token, even by \relax (except implicit character tokens that raise errors). Bracing the token is the right way to go. – egreg Mar 28 at 17:03

You only need to wrap \% into {...}.

\documentclass[tikz]{standalone}
\usetikzlibrary{bending,decorations.text}
\begin{document}
\begin{tikzpicture}
\sffamily
\node (a) at (-2,0) {probability};
\node[align=center] (b) at (2,0) {percent\\change};
\draw[-latex,postaction={decorate,decoration={raise=1ex,text along path,text
align=center,text={multiply by 100{\%}}}}] (a) to[out=60,in=120] (b);
\end{tikzpicture}
\end{document}


• Wow, that's easier (why didn't I try this?). Thumbs up! – Skillmon Mar 28 at 16:12
• @Skillmon I tried this only after recalling this discussion, which almost drove me crazy, – marmot Mar 28 at 16:13
• @Skillmon marmot really drove me crazy with this solution. I'm feeling stupid now :)) – JouleV Mar 28 at 16:15
• @JouleV So sorry. ;-) – marmot Mar 28 at 16:17
• @JouleV Most likely stackexchange is run by the sociology department of Harvard, who want to explore the mind sets of humans (and ducks, koalas and marmots ;-). – marmot Mar 28 at 17:02

You can make this work by changing the % character to not be the comment character anymore using \catcode:

\documentclass[tikz]{standalone}
\usetikzlibrary{bending,decorations.text}
\begin{document}
\begin{tikzpicture}
\sffamily
\node (a) at (-2,0) {probability};
\node[align=center] (b) at (2,0) {percent\\change};
\begin{scope}
\catcode\%=12
\draw[-latex,postaction={decorate,decoration={raise=1ex,text along path,text
align=center,text={multiply by 100%}}}] (a) to[out=60,in=120] (b);
\end{scope}
\end{tikzpicture}
\end{document}

• Thanks, it solved the problem. However, could you please add some explanation about why \%` doesn't work? – JouleV Mar 28 at 16:07
• @JouleV for that I'd have to dig through the internals of TikZ, which isn't something I feel like right now, sorry. – Skillmon Mar 28 at 16:10