I am trying to understand this syntax of primitive \def


Why this primitive nesting? And I do not get to understand why there is two \def sentences concatenated.


Generally you'll see these \DeclareOption{<opt>}{<stuff>} declarations in style (.sty) and class (.cls) files. The allow the user to use the style/package or class with certain parameter specification which could influence the usage. In the above case, the option man is declared that \defines \def@man to be \@manmode, or in short


It should also be noted that inside a .sty or .cls, the @ character has special meaning, or TeXnically, a different category code. Specifically, @ acts like any other non-numeric letter, and can therefore form part of a macro name. That is, it makes \def@man a valid macro name, similar to \@manmode. Another way of stating the above inside a regular document would have required something like


Above, \makeatletter and \makeatother perform the same task inherent to style and class files.

  • Ok werner i understand, even i was testing with \def-man , \def_man , \def.man and errors occurred but \def@man ¡Work! – Ajedrez Ivan Jan 4 '15 at 15:19
  • @AjedrezIvan: Yes. That's because @ is special and set to being similar to other letters inside a .sty or .cls. -, _ and . are not considered letters and therefore do not work out-of-the-box for macro names. It is possible to use them, but not using a straight \def. – Werner Jan 4 '15 at 15:21

There are two ways how to read \def\def@man{...}. If catcode of @ is set to 11 (letter) at the time the text above is read from the file then the control sequence def@man is defined here.

If catcode of @ is set to 12 (other, this is more usual) then \def\def@man{...} redefines the TeX primitive \def as a macro with mandatory separator @man and (probably) the next TeX processing is broken because many macros use \def and assume that \def is primitive.

  • Thanks wipet, however the firts paragraph of your answer It was what I was looking for – Ajedrez Ivan Jan 4 '15 at 15:23

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.