[Tex/LaTex] When to use bold, italics, small caps, typewriter etc.

best practicesfontsformattingtypography

I'm a little confused on the purposes of each kind of text in LaTeX. I know the function of some of them, but sometimes people use each for different reasons. For example:

  • \texttt is for code (no discussion right?).

  • \emph is to make emphasis.

  • \textsc is used for names, right?

  • \textbf when should I use it?

  • \textmd When should I use it?

And something more: If I write for example "HI-TECH C PIC Compiler" in between a paragraph, the capital words doesn't look very good. Is it convenient to use \textsf?

Can normal text be mixed with different types? Under which circumstances?

P.S: I'm using the article class with the normal font.

Best Answer

I think you are confusing visual markup with semantic markup.

\emph is semantic markup: it indicates that you want to emphasize some text, without specifying how that will affect the appearance of the text. The default is to make it italic, or for nested emph-within-emph to make it roman again. However, the default can be overridden if you later decide to use bold for emphasis: \renewcommand\emph{\textbf}.

\texttt, \textmd, \textsc and so on are visual markup. You should use them for implementing semantic markup. So, for example if you want to use the French convention of using small caps for family names, you could write \newcommand\familyname{\textsc} and have This was studied by John \familyname{Smith} and \familyname{Yao} Ming. If you then later decided that you no longer like this convention it is easy to change, in the preamble without needing to search through your text. Similarly you may want to write \newcommand\code{\texttt}

The visual \textXX commands will change 3 axes of the text: shape, family and weight.

  • The shape axis covers: \textup, \textit, \textsc and \textsl
  • The family axis covers: \textrm, \textsf, \texttt
  • The weight axis covers: \textbf, \textmd
  • Some fonts provide other options along these axes, or even as with MinionPro, completely new axes. (This functionality is now available independent of MinionPro in the fontaxes package, so that it can be used with other fonts.)

You can combine options from the different axes (some combinations, such as \textbf{\textt{...}} are not available by default, discussed here). For example:

  • \newcommand\keyword[1]{\textsf{\textbf{#1}}}
  • \newcommand\important[1]{\textbf{\textit{#1}}}

Regarding "HI-TECH C PIC Compiler": Some fonts (especially ones aimed at newspaper and magazine publishing) have a size of capitals that is intermediate between small-caps (\textsc) and full capitals, for exactly this purpose. The default tex computer modern fonts do not have this possibility, but the computer modern \textsc is not a true small-caps, being a little taller than the x-height of the font, so can be used this way: \newcommand\hitechcomp{\textsc{hi-tech c pic} compiler}