Why are these commands considered as bad practice?
I beg to disagree with some of the opinions expressed in the linked page. The list of commands to avoid doesn't distinguish between commands to avoid at all costs and ones that should be used to define personal macros in the preamble, for instance; some of the commands listed do have their place in a document body.
Note The following should not be taken as "do so or you're wrong"; most of the recommendations make little sense for a short document where one look is sufficient to control it as a whole and where defining personal commands for just a single use would be a waste of time. For short documents only the first two sections are to be strictly followed.
Commands that must never be used
The two letter font changing commands such as \bf
, \it
, \tt
or \sf
must never be used in a document, either in the body or in the preamble. They have been obsolete since the introduction of LaTeX2e in 1992.
The trouble with \\
Somebody may remember Alfred Hitchcock's movie "The Trouble with Harry" where a dead body appears and causes any sort of troubles among a quiet small town in New England. Our \\
is quite similar.
The \\
command should very rarely mean "break a line" except in environments where line breaks are to be marked explicitly: flushleft
, flushright
, center
, tabular
, tabbing
, align
, gather
, multline
and derived ones. However, in some cases it can be used, but not for denoting an end of paragraph or to "leave a blank line".
The \noindent
command is quite similar: I don't think to have used it in a document body other than in very particular situations involving explanations of TeX programming (such documents often require manual tweakings, but are the exception rather than the rule). If one needs \noindent
once in a document, then there's something wrong with the way the document is being prepared.
Font changing commands
The "modern" font changing commands are to be considered as tools for building logical structures. For instance, \textit
or \mathit
(the difference is that the former respects spaces in the input because it switches to text mode) should be used for multiletter identifiers in math formulas. If our variable is called difference, then $difference=a-b$
is wrong, while $\mathit{difference}=a-b$
is right. However, it's much better to say, in the preamble
\newcommand{\mli}[1]{\mathit{#1}}
% macho programmer version
% \newcommand{\mli}{\mathit}
so that it can be redefined at will, if we change our mind about how to denote those variables: just modify the definition of \mli
, which avoids hunting in the document for \mathit
.
If we want a uniform appearance of symbols for number sets, it's better to say
\usepackage{amssymb} % or amsfonts
\newcommand{\numberset}[1]{\mathbb{#1}} % or \newcommand{\numberset}{\mathbb}
\newcommand{\N}{\numberset{N}}
\newcommand{\Z}{\numberset{Z}}
\newcommand{\Q}{\numberset{Q}}
so that changing the meaning of \numberset
will modify all renderings of \N
, \Z
and \Q
.
The same considerations hold for the other font changing commands: look for what appears to be a logical unit in your document and define a macro (or environment) for it.
An exception is \emph
which already is a high level command: it means emphasize and it's left to the class (or to the user) how to implement emphasis.
Spacing commands
From a theoretical point of view, \hspace
and \vspace
have no place in the document body. However, an occasional construction may need them without bothering to define an environment for a single usage. For instance, if we want a dedication page, it's easy to say
\cleardoublepage
\thispagestyle{empty}
\vspace*{\stretch{1}}
\begin{flushleft}
\sffamily\slshape
To the masters in directing,\\
John Ford, John Ford and John Ford
\end{flushleft}
\vspace*{\stretch{2}}
\cleardoublepage
(I assume that the package emptypage
is loaded or the class allows for specifying that blank pages automatically inserted are really blank) rather than defining a dedication
environment to be used only once.
In the body of the document \medskip
or \bigskip
may be used, but also for them it would be better to define our personal spacing commands that use them, so that we can rely on uniformity of appearance.
Line and page breaking commands
One should avoid explicit line and page breaking commands, with the exception possibly for \cleardoublepage
that's sometimes necessary when dealing with manually inserted hyperlinks.
In the final revision of a document it may be necessary to insert some \linebreak
, \pagebreak
or \clearpage
command. The choice is between defining a personal command that can so be disabled in case a new edition is prepared or inserting them accompanied with a clear and univocal comment line. In both cases, the final TeX document shouldn't have trace of such commands that reveal to be obsolete in the new edition, so a search for them has to be made anyway.
The same considerations apply for \enlargethispage
.
Math mode commands
While \limits
in inline math formulas should not be used, it reveals useful after \int
; if you have an integral over a domain rather than with bounds and the domain symbol is "large", saying \int\limits_{\partial A\int B}
is surely better than setting the domain on the side.
I don't agree with the assertion that \dfrac
and \displaystyle
should not be used in the document body. This is false and there are many situations in which they are useful: complicated formulas must be built from smaller pieces and some of them may need particular treatment.
\tag
and \eqno
While \eqno
is not a LaTeX command and should not be used, \tag
is surely something that can be employed. In many fields of mathematics, papers don't have numbered equations and only some of them need a reference. Many authors prefer not having numbers that would be difficult to find, but rather a symbol or word that can better identify a formula.
(Prof. A. J. Roberts does Mathematical Analysis, where numbered equations are the norm. It's common among analysts to think that what's done in their field is done in the same way elsewhere. Well, it isn't.)
These commands are usually disadvised because they do not go "the LaTeX way" : WYSIWYM (what you see is what you mean).
Authors are encouraged to use macros that are specific to the meaning of the content, instead of its aspect.
One easy (and classical) example : imagine you're writing a mathematical paper, and you decide to write your vectors in \mathbf
style, as well as your operators (det, ker, etc).
Now you realise you'd prefer using arrows over vectors and put the operators simply in roman style. You will have to go through a long process of search/replace to fix it.
Instead, you should have used definitions like these :
\newcommand{\vector}[1]{\mathbf{#1}}
\newcommand{\operator}[1]{\mathbf{#1}}
So that when you need to change the aspect of vectors and operators separately, all you have to do is change the respective command definitions.
Another relevant point for this matter is the readability of the code, but that really depends on whether someone else will be reading your code, and on your/their habbits.
Note also that there will always be some case where you won't have any other easy choice but to use low-level display hacks, some of which will be much dirtier than simply \textbf
. As such, this advice should only be taken as such, not as a strongly-enforced rule.