In typing up some small examples that might create errors in LaTeX (for Documents with typical LaTeX errors), I tried the following:
\documentclass{article}
\def\my@macro#1{-#1-}% This is magic
\begin{document}
\my@macro{hi}% Print -hi-
\end{document}
Since I almost religiously encompass @
-symbol definitions and/or usage with \makeatletter
and \makeatother
(see What do \makeatletter
and \makeatother
do?), and since latex.ltx
issues \makeatother
at literally the 4th-to-last line, I thought this would flash an error.
It didn't.
Not only was I able to define the macro, I was able to use it without problem after it is defined. Why is this the case?
One clue here, although I don't know why, is that I'm using the TeX \def
syntax, rather than \newcommand
, which does produce an error.
@
somewhere betweenbegin/end {document}
it gets printed. So in fact it seems to be a letter. Maybe a change in pdflatex? – bloodworks Jan 6 '12 at 23:39@
is not a letter but a symbol just like1
or/
etc. And yes symbols print but they can't be used in macros "names". they can however be used inargument delimiters when using\def
to define macros. – Frank Mittelbach Jan 7 '12 at 0:05