TransWikia.com

Why is it necessary to specify textnormal?

TeX - LaTeX Asked on June 4, 2021

I pose this question in the context of a specific example, but the question is more general.

On page 125 of Stefan Kottwitz’s LaTeX beginners guide, a new command is defined for headings in a table. This is done as follows:

documentclass{article}
newcommand{head}[1]{textnormal{textbf{#1}}}
begin{document}

Why is textnormal necessary? That is, what could go wrong if I failed to include this?

One Answer

The LaTeX kernel defines textnormal as follows:

DeclareTextFontCommand{textnormal}{normalfont}

The instruction normalfont, in turn, is defined as follows:

DeclareRobustCommandnormalfont{%
   fontencodingencodingdefault
   edeff@family{familydefault}%
   edeff@series{seriesdefault}%
   edeff@shape{shapedefault}%
   @defaultfamilyhook
   selectfont}

So, normalfont sets the font encoding back to its default, and also resets to their respective defaults the font family (usually rmfamily, i.e., some serif font, as opposed to, say, sffamily or ttfamily), the font series (usually mdseries, as opposed to, say, bfseries), and the font shape (usually upshape, as opposed to, say, itshape or scshape).

As @campa has pointed out in a comment, specifying either the low-level normalfont directive or the slightly higher-level textnormal directive is highly advisable as it frees you from having to make potentially invalid assumptions about the font attribute combination that's in effect at the time you need to change just one of the attributes.

Correct answer by Mico on June 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP