Defining custom commands is bad style?

Sorry, no, that is not true. Most journals do accept reasonable shortcuts:

\newcommand*\NN{\mathbb{N}} % natural numbers
\newcommand*\AAA{\mathcal{A}} % automaton
\newcommand*\WWW{\mathring{W}^2_1} % Sobolev space 2,1,o
\newcommand*\defined[1]{\emph{#1}} % used for defining new terms
\DeclarePairedDelimiter\abs{\lvert}{\rvert} % proper absolute value
...

However, the will likely not accept stupid definitions, such as:

\newcommand\pf{\begin{proof}} % don't hide a structure behind some ridiculous macros
\newcommand\pfe{\end{proof}}
\newcommand\eqa{\begin{eqnarray}} % twice bad, once for the shorthand ...
\newcommand\eqae{\end{eqnarray}} % ... and second time for using `eqnarray`
\newcommand\eqn{\begin{equation}}
\newcommand\eqne{\end{equation}}
\renewcommand\em{\sc} % not speaking about the fact that the ...
\renewcommand\bf{\it} % ... two-letter font macros are depricated
\newcommand\SPACE{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\newcommand\Hs{Hilbert space\xspace} % no text replacement shorthands like this please!
\def\A{{\cal A}} % this is bad in 3 ways -- can you guess what are they?
...

Nevertheless, please:

  1. Define everything only once (no \NN and \Naturals doing the same stuff).
  2. Define only things you really use (no 100 lines of definitions with only 5 of them being used).
  3. Do not re-define stuff that already exists.
  4. Use proper LaTeX's \newcommand instead of just \def.
  5. Place everything in the preamble.
  6. Include short comments to each \newcommand, like I did above. Especially if you do any dirty stuff. However:
  7. Do not do any dirty stuff.

(Speaking as a typesetting editor of a journal, and as an author of numerous publications where I use definitions like the good ones above.)


This is only partly true, and only in certain circumstances. Good LaTeX style depends on several things, but normally one tries for three things: 1. portability, 2. logical mark-up and 3. readability/editability.

Package use can affect portability, so one should normaly eliminate any that are not absolutely needed. A journal may send back a submission that fails because they don't have a particular package or because they have a different version. Often they will not debug to find out which package is at fault and ask you to omit them all!

Logical mark-up almosts requires making ones own commands. It is much better to define a macro with a name that reflects the reason for the \qquad\textnormal{...} than to have to repeat such a sequence often.

Readability is also improved with a well-chosen macro name, but editability is not. An editor may want to change that \qquad of space, but has to constantly go back to the preamble and read through the definitions to know which macro to edit. And if the author's mark-up is inconsistent (same command for spaces in different contexts), the editor may have to find every occurrence and change them to different size spaces.

Logical mark-up sometimes has to be balanced with editability. While it is easy to edit \qquad down to \quad, it may be harder to read your special command and deduce that that is what needs to be to changed. After many years of trying to get my papers to look as nice as possible, I now keep new commands to a minimum. Mostly only \newtheorems (because none are defined by default) and the few \DeclareMathOperators that LaTeX and amsmath neglected to supply. I use \documentclass{article} and load just a few packages, sometimes only amsmath. (Of course, if I self-publish a document for my own use, I go wild.)

I have seen many papers with hundreds of macros, most of then simply indecipherable shortcuts for some much more readable combination of commands, many never even used. Such things are a nightmare to edit. One appreciates why an editor or professor would not want to see that, and why a journal might include instructions (as many do) to write the paper "without any user-defined commands".

Your professor has probably seen many such instructions and jumped to the conclusion that it is "good style". Still, you should try to keep him happy. You might start by asking whether you need to have so many \qquad\textnormal and if some other approach might be better. In the event that you must have them, it should be trivial to turn all your single commands into this expanded version with global search-and-replace in your text editor.


I agree that some reasonable shortcuts should not pose a problem. However an editor needs to make sure that the layout is consistent throughout the issue. Avoid any constructs that break the layout / text flow / … Your code should be short and easy to understand. The command names should clearly indicate what the command does. Also consider that LaTeX has no namespace concept. It might be that the editor defined some commands with the same names himself. In this case you break his workflow.