I was writing some macros for drawing timelines in Tikz and thought that it might be good to name the internal help coordinates with an @ in it. The idea is that in this way it will not conflict with the coordinates of a potential user of those macros (not that I will be able to produce a package because of my recurrent coding problems).

However, I was surprised that I can use an @ in the name of a coordinate without placing it within \makeatletter and \makatother:

  \draw (0,0)--(2,0) coordinate (A@1);
  \draw (1,1)--(A@1);

My question is: why does it work?

Then, if the @ can be used freely, the help coordinates will not be protected against an unintentional use.

  • The fact that one can use @ in coordinate names is well known and has used e.g. in tex.stackexchange.com/a/316050/121799. The idea is still that using these makes it less likely that "random users" accidentally use the same symbols. Same is true for underscores, e.g. \begin{tikzpicture} \draw (0,0) --(2,0) coordinate (A@1) (4,0) coordinate (X_Y); \draw (1,1)--(A@1) -- (X_Y); \end{tikzpicture}. – user121799 Apr 27 at 19:23

the distinction between letters and non letters (catcode 11 or not) is just when parsing after the escape character (usually \) so \foo@bar normally parses as the 5 tokens \foo, @, b, a, r. But the foo@bar csname can be accessed without changing the catcode of @ by using \csname foo@bar\endcsname for example.

You see a similar thing with environment names where \begin{tabular*} access the command with name tabular* even though \tabular* would not access that but the two tokens \tabular and * unless you change the catcode of * to 11.

  • So the coordinate names are converted to commands through \csname? – Raoul Kessels Apr 27 at 19:45
  • @RaoulKessels most likely, but whatever tikz does with them, the catcode status of @ has no effect on anything but the parsing of \abc@xyz so it will not affect the use you show with coordinate (A@1) (well other than explicit testing with \ifcat ) – David Carlisle Apr 27 at 19:48

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.