Most of the bloated preambles I see have dozens of lines like


While I can easily code a macro to loop over a list and define the corresponding control sequences, it is not pretty. For instance,

\def\letterdef#1#2#3{\def\letterdef@##1{\expandafter\def\csname #1\endcsname{#2}}%

Used as \letterdef{#1cal}{\mathcal{#1}}{ABCDEFG}. Putting that in a preamble makes it look ugly. Is there already a package providing that kind of functionality?

  • 1
    I’m not convinced of the benefit of having such macros. They don’t define semantics, just questionable shorthands. So while I can’t answer your question, I actually advise against this practice. – Konrad Rudolph Oct 3 '11 at 19:24
  • 1
    @Konrad I agree that these macros are not semantic, but they are very useful, and I've seen them used a lot by coauthors (everyone has their own convention, though). They reduce the clutter in formulas compared to the full version. – Bruno Le Floch Oct 3 '11 at 20:01

The \docsvlist from etoolbox can make this much easier:



(Alternatively, there’s also \forcsvlist command which uses an inline handler instead of a pre-defined \do macro.)

But, as I’ve said in a comment above, I’m opposed to this kind of non-semantic shortcuts. While \Acal certainly is shorter than \mathcal{A}, it’s not necessarily cleaner. I prefer to always use semantic shortcuts, e.g. defining \bigO for \mathcal{O} (of the Landau symbols) or \laplace for \mathcal{L}.

  • I want to add that I am a big fan of what you call "semantic" shortcuts, and I would encourage their use. I often have a list of math commands that are not used to reduce length but to make my intent clearer. This is especially helpful for working across departments, each of which has its own idiomatic requirements for the same mathematical statements. – Carl Morris Sep 25 '12 at 16:42
  • With etoolbox you can also use \csdef instead of \@namedef which would avoid the need for \makeatletter ... \makeatother – clemens Jul 27 '14 at 12:33

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.