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?

2
  • 1
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. You don't have to sign with your name since it automatically appears in the lower right corner of your post.
    – egreg
    Sep 20, 2011 at 21:00
  • 2
    Do you compile the two documents on the same machine? Are are there potentially different versions of TikZ in play?
    – Caramdir
    Sep 20, 2011 at 21:01

1 Answer 1

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}
5
  • 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. Sep 21, 2011 at 9:25
  • A tip: If you indent lines by 4 spaces or enclose words in backticks `, 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, 2012 at 18:57
  • I don't think it is the case anymore as of tikz-2.10.
    – cjorssen
    Feb 10, 2012 at 20:46
  • Well, I was wrong in the comment above. This should now be fixed in the cvs version of tikz.
    – cjorssen
    May 8, 2012 at 9: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. Oct 9, 2013 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.