Using Plain or primitive commands in LaTeX

It's well-known that LaTeX commands tend to be more complex, and to run more slowly than, any Plain (or primitive) command that they replace. There is therefore great temptation not to use LaTeX commands when macro programming. Nevertheless, the general rule is that you should use LaTeX commands, if there are seeming equivalents. The exception is when you are sure you know the differences between the two commands and you know that you need the Plain version. So, for example, use \mbox in place of \hbox unless you know that the extras that LaTeX provides in \mbox would cause trouble in your application. Similarly, use \newcommand (or one of its relatives) unless you need one of the constructs that cannot be achieved without the use of \def (or friends).

As a general rule, any LaTeX text command will start a new paragraph if necessary; this isn't the case with Plain TeX commands, a fact which has a potential to confuse.

The commands \smallskip, \medskip and \bigskip exist both in Plain TeX and LaTeX, but behave slightly differently: in Plain TeX they terminate the current paragraph, but in LaTeX they don't. The command \line is part of picture mode in LaTeX, whereas it's defined as "\hbox to \hsize" in Plain TeX. (There's no equivalent for users of the Plain TeX command in LaTeX: an equivalent appears as the internal command \@@line).

Maths setting shows a case where the LaTeX version is essentially equivalent to the TeX primitive commands: the LaTeX \( ... \) does essentially no different to the TeX $ ... $ (except for checking that you're not attempting to open a maths environment when you're already in one, or vice versa). However, \[ ... \] isn't the same as $$ ... $$: the TeX version, used in LaTeX, contrives to miss the effect of the class option fleqn.

Font handling is, of course, wildly different in Plain TeX and LaTeX: even the LaTeX equivalent of the Plain TeX font-loading command (\newfont) should be avoided wherever possible: the possibilities of confusion with constructs that vary their behaviour according to the font size that LaTeX has recorded are (sadly) legion. A really rather funny example is to be had by saying:

\documentclass{article}
\begin{document}
\font \myfont=cmr17 scaled 2000
\myfont
\LaTeX
\end{document}
(the reader is encouraged to try this). The "A" of LaTeX has pretty much disappeared: LaTeX sets the "A" according to its idea of the font size (10pt), but "\myfont" is more than three times that size.

Another "\myfont" example arises from an entirely different source. The mini-document:

\documentclass{article}
\begin{document}
\font \myfont=ecrm1000
{\myfont par\`a}
\end{document}
gives you "German low double quotes" in place of the grave accent. This problem arises because ecrm1000 is in a different font encoding than LaTeX is expecting - if you use LaTeX font commands, all the tiresome encoding issues are solved for you, behind the scenes.

So, whether you're dealing with a one-off font or a major new family, you are far more likely to be satisfied with the LaTeX file selection system, so it's worth investing a small amount of effort to write declarations of the font's family and how it should be loaded. For details of the commands you need, see the LaTeX font usage guide, fntguide: this may be viewed on the archive, but you should find a copy of the document in your own system.

fntguide.pdf
macros/latex/doc/fntguide.pdf
fntguide.tex
Distributed with macros/latex/base (gzipped tar, browse)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=plninltx