5

I'm running into a weird problem with TikZ. The following code

\node (A) [label=45:$A$] at (p2) {};

is rendered correctly in one document, but incorrectly in another, larger document (which uses incidentally more packages, this is why I suspect some package clash.

Surprisingly, the label specified by the portion of the code 45:$A$ is rendered explicitly as 45:A, rather than being interpreted as A at 45°. There is no warning or error raised.

Any idea of where the problem might come from?

egreg
  • 1,121,712
Greg
  • 513

1 Answers1

9

It is actually due to a clash with the package babel (see the manual). By using the command \shorthandoff before the tikz code, it works fine! For example, you could use:

\begin{tikzpicture}\shorthandoff{:}
[>=stealth']
...
\end{tikzpicture}
Werner
  • 603,163
Greg
  • 513
  • So the problem is, I presume, due to the fact that the colon is being made active and so TikZ no longer sees it as a colon. – Andrew Stacey Sep 21 '11 at 09:25
  • A tip: If you indent lines by 4 spaces or [enclose words in backticks ```](http://meta.tex.stackexchange.com/questions/863/how-do-i-mark-inline-code), they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it). – Tobi Feb 10 '12 at 18:57
  • I don't think it is the case anymore as of tikz-2.10. – cjorssen Feb 10 '12 at 20:46
  • Well, I was wrong in the comment above. This should now be fixed in the cvs version of tikz. – cjorssen May 08 '12 at 09:42
  • In version 2.10-1 (on Debian Wheezy), I'm still forced to comment out \usepackage[myoptions]{babel}. Well, it was worth a try. – Anthony Labarre Oct 09 '13 at 08:59