0

In the description environment if the item includes a math formula with \textrm{} these parts are set bold (just like regular description items) which looks odd if the rest of the formula is not bold. How can I get rid of this boldface still using the description environment?

Sample code:

\begin{description}
    \item[$not-bold_\textrm{bold}$] lirum
\end{description}
1
  • use \mathrm the \text... commands by design pick up the current text font and shouldn't normally be used in math. Oct 14, 2020 at 18:12

2 Answers 2

3

The \text... commands by design pick up the surrounding text font settings. This is rarely what you want in normal mathematics, although it can be useful if using fractions and similar constructs with natural language numerator and denominator.

If you use \math... commands then the math alphabets keep a fixed style in all text contexts, so

enter image description here

\documentclass{article}

\begin{document}

\begin{description}
    \item[$not-bold_{\mathrm{notbold}} and x_{\mathbf{bold}}$] lirum
\end{description}

\end{document}
2

The \text{} command inherits the formatting of the surrounding text. If you’re in a sans-serif bold header, the sans-serif bold will bleed through. If you’re in an italicized theorem statement, the italics will bleed through.

You can also use \textrm, \textup, \textbf and so on. These will set only one font axis (family, shape, weight) and leave the others the same as the surrounding text. Sometimes, this is what you want: you might want a math formula inside a bold header to be bold, so you could use \textup or \text{\upshape\rmfamily #1} to leave the weight unchanged.

If you want to reset all text formatting, use \textnormal or \mathrm. It is possible to set \textnormal and \mathrm to different fonts or encodings, but by default, they should both work.

If you do want the entire formula inside the header to be bold, format your header with \bfseries\boldmath and use \textup or \textit. In unicode-math, you could use \symup or \symit for math letters. You will need to load a bold math font for this to work.

5
  • in almost all cases you should use \mathzz rather than \textzz in mathematics I think, you rarely want to pick up the surrounding text font. Oct 14, 2020 at 20:31
  • @DavidCarlisle I gave one example where you might. Another is if you want to insert a few words in a different language that needs a different font or encoding.
    – Davislor
    Oct 14, 2020 at 20:36
  • @DavidCarlisle Okay, \boldmath will compile without any extra packages. It just won’t work. :)
    – Davislor
    Oct 14, 2020 at 20:39
  • @DavidCarlisle I don’t really disagree about \mathrm (and I edited to give it more of an endorsement). As is, I think it’s useful to tell readers how to get the effect they want.
    – Davislor
    Oct 14, 2020 at 20:40
  • @DavidCarlisle OK, I deleted that comment.
    – Davislor
    Oct 14, 2020 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .