[Tex/LaTex] the difference between normal text and Roman/upright

roman

What is the LaTeX command to have Roman/upright characters?

Best Answer

This answers the question in the subject line. I'm not clear what the question in the body is so I'm not certain if this answers it or not. As others have pointed out, upright roman is default so you don't usually need to do anything at all to get it. However, the question might be how to get back to it after changing the font with other commands. If so, this answer should help.

Initial Demonstration

\documentclass{article}
\usepackage[T1]{fontenc}

\begin{document}

\verb|\normalfont| \normalfont produces text in the default family (usually roman), the default weight (normally medium) and the default shape (normally upright).

That is, it is typically equivalent to \verb|\rmfamily\mdseries\upshape| \rmfamily\mdseries\upshape which switches to roman, medium, upright.

If you switch to \verb|\sffamily\bfseries\itshape| \sffamily\bfseries\itshape to produce sans, bold, italic, then issuing \verb|\rmfamily| \rmfamily will result in roman, bold, italic, whereas issuing \verb|\normalfont| \normalfont will result in roman, medium, upright.

Similarly, starting with \verb|\ttfamily\bfseries\itshape| \ttfamily\bfseries\itshape for typewriter, bold, italic, issuing \verb|\upshape| \upshape will produce typewriter, bold, upright, whereas \verb|\normalfont| \normalfont will return all font dimensions to their defaults i.e.\ roman, medium, upright.

\end{document}

To see the effect:

Various font commands with differing effects

Points to Note

Note that this shows how commands such as \upshape, \itshape etc. are context-dependent. That is, their effect depends on the font in use when they are issued. The same is true for \sffamily, \rmfamily, \mdseries etc. They each change a single dimension of the current font (provided this is possible i.e. provided a suitable font exists which isn't always the case).

In contrast, \normalfont resets all font attributes to their defaults. So it potentially alters all attributes of the current font - family, weight and shape.

Explanation

I've used standard LaTeX commands and assumed a standard font configuration. That is, I've assumed that the document uses a class relevantly similar to article, report or book. As Speravir points out, some document classes set up different defaults. For example, beamer makes the default family sans rather than serif (roman). Similarly, a package could change the default family in this way. But the fact that different classes and packages can configure things differently is not a peculiarity of font setups.

I hoped to link to another answer providing a fuller explanation of what is going on here. Unfortunately, I can't find one. This answer may be helpful though it is more focused on future developments.

NFSS

The way the above code works is specific to LaTeX2e. Previous versions of LaTeX managed fonts differently. Here I ignore those. I am also ignoring alternative ways of managing fonts using different macro packages (e.g. ConTeXt), different engines (e.g. XeTeX/LuaTeX) and TeX's low-level font mechanisms.

The New Font Selection Scheme (which is no longer very new) manages font attributes along three dimensions.

  1. Family: serif (roman); sans; typewriter are provided as standard. \rmfamily, \textsf{} etc. alter this dimension of the active font. So if you are using italic, bold roman, then \sffamily will switch to italic, bold sans provided such a font is available.
    • \rmfamily / \textrm{} - roman i.e. serif
    • \sffamily / \textsf{} - sans
    • \ttfamily / \texttt{} - 'typewriter' (possibly monospaced)
  2. Weight: medium (m); bold (bx) are provided as standard. \mdseries, \textbf{} etc. alter this dimension of the active font. So if you are using italic, sans medium, then \bfseries will switch to italic, sans bold provided such a font is available.
    • \mdseries / \textmd{} - medium
    • \bfseries / \textbf{} - bold extended (i.e. bold and a bit wider)
  3. shape: upright (n); italic (it); oblique (sl); small-caps (sc) are provided as standard. \itshape, \textsc{} etc. alter this dimension of the active font. So if you are using upright, bold typewriter, then slshape will switch to oblique, bold typewriter provided such a font is available.
    • \upshape / \textup{} - upright
    • \itshape / \textit{} - italic
    • \slshape / \textsl{} - oblique (slanted)
    • \scshape / \textsc{} - small-caps

LaTeX uses font definition files (.fd) to figure out which font corresponds to which shape, series etc. Generally these files define not only mappings for the fonts in a family but also mappings for font substitutions. For example, if the font comes in bold (b) but not bold extended (bx) then the file will usually tell LaTeX to substitute fonts from the bold series if asked for fonts from a bold extended series. This enables the use of commands like \bfseries which actually request bold extended rather than simply bold. Similarly, if the font provides an oblique but not italic shape, a substitution is usually used so that \itshape gets the oblique font, rather than an upright default. Conversely for fonts which provide italic but not oblique shapes.

The actual effect of these commands depends on the families used in the document i.e. on the settings of \rmdefault, \sfdefault and \ttdefault. By default, these select families from Computer Modern but font packages enable different fonts by redefining them. Obviously, the specific weights and shapes provided depends on the specific families in use. So if the font does not provide small-caps, for example, LaTeX will substitute a different shape. It will try first of all to use a substitution from the .fd file for the family. If that doesn't help, it will fall back to a default value (e.g. upright). Some default should always be specified - TeX should never error out due to the use of a standard font selection command provided by LaTeX. It may use upright medium when you'd hoped for bold italic. But it should find something to typeset the text with unless things are fundamentally screwed up.

The upshot of this is that \upshape or \textup{} changes only the shape, leaving the active family and weight unchanged (provided an upright shape in that weight is available in that family). In contrast, \normalfont resets all three dimensions to defaults - shape, weight, family. [\normalfont does not, however, affect the size of the font. That is what \normalsize is for.]

Limitations

There are some limitations to NFSS. For example, no standard commands are provided to access:

  1. other weights such as light or heavy;
  2. other widths such as condensed or extended (\bfseries enables bold extended but what if you want medium extended or bold condensed?);
  3. other shapes such as swash or, especially problematic, italic small-caps;
  4. different styles of figures e.g. oldstyle vs. lining; proportional vs. tabular; superior and inferior digits etc.

Some of these limitations are greater than others. While it is easy to define commands to access a light weight, it is trickier to provide distinct commands for weight and width which behave as expected. Similarly, you can provide a command to access italic small-caps but it is trickier to make sure \textit{italic \textsc{small-caps}} behaves as expected. Since the two commands affect the same font dimension, the second shape declaration overrides the first resulting in upright small-caps.

Various packages exist to extend NFSS and work around some of these limitations but these packages work only for specific fonts which are configured to work with them. The solutions typically rely on fonts being named in specific ways. This is true of both fontaxes and nfssext/nfssext-cfr, for example. However, the packages make different assumptions about font naming so that commands provided by one package do not work with fonts supported by the other. (In particular, nfssext-cfr assumes fonts are named according to Karl Berry's naming scheme, whereas fontaxes assumes they are named according to an alternative.)

Related Question