0

The document class my Uni provides has a bunch of lines that appear to define macros with "@" in the name, like this:

\newcommand{\uni@title}{}
\renewcommand{\title}[1]{\renewcommand{\uni@title}{#1}}

\newcommand{\uni@year}{}
\renewcommand{\year}[1]{\renewcommand{\uni@year}{#1}}

But when I tried defining macros with a @ in the name it didn't work:

%this works
\newcommand{\helloworld}[1]{Hello #1 !}
\hello{everyone}

%this gives tons of error messages and
%prints weird stuff to the document:
\newcommand{\hello@world}[1]{Hello #1 !}
\hello@world{everyone}

What are they @ signs doing in my document class file then?


Anyway, the reason I am asking all of this is that the \year macro is conflicting with a system package. I am thinking about renaming all the commands to something more namespaced and less ambiguous. Is camelCase the only way to go? I tried uni@year and uni_year and I'm getting the impression that macro names can only be alphanumeric...

| improve this question | | | | |
  • 1
    Please report the conflict to the maintainer of your universities class. – Johannes_B Apr 15 '15 at 16:06
  • TeX uses the @ symbol for internal macros that the user is not normally supposed to use directly. If you want to access a class or package macro with an @ in it, surround that section with \makeatletter (which means, read @ as a letter) and \makeatother (which means, read @ as a reserved character) so that TeX will read the @ symbol properly. – musarithmia Apr 15 '15 at 16:07
  • @AndrewCashner: so for "external" macros, the only way to avoid conflicts would be to define camelcased macros like UNIyear, right? – hugomg Apr 15 '15 at 16:13
  • Yes, use case to distinguish separate parts of the macro name, and use roman numerals if necessary for numbers. – musarithmia Apr 15 '15 at 16:18

Browse other questions tagged or ask your own question.