TransWikia.com

Description environment and textrm in math

TeX - LaTeX Asked on April 9, 2021

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}

2 Answers

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}

Correct answer by David Carlisle on April 9, 2021

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{upshapermfamily #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 bfseriesboldmath 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.

Answered by Davislor on April 9, 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