TransWikia.com

fonts / siunitx: Understanding how "detect-all" and "detect-inline-family=math" work

TeX - LaTeX Asked on September 28, 2020

For the following, I need to

  1. understand why neither detect-all nor detect-inline-family=math doesn’t make num print the same font as the surrounding inline math, and the only way to do so is through math-rm = symup as suggested by this answer.

  2. understand why I need to load the option math-rm = symup in order to make num copy the document default math font.

  3. know if it is possible to make the default math font-weight as light as the surrounding normal text since it looks a bit bolder for my eyes.

enter image description here

documentclass[14pt]{article}

usepackage[no-math]{fontspec}
setmainfont{Latin Modern Roman}

usepackage{unicode-math}
setmathfont[math-style=ISO]{Cambria Math}

usepackage[
detect-all,
detect-inline-family=math
]{siunitx}

begin{document}
    centering
    text: 123 num{123}
    inline math: $123~num{123}$
    display math: [123~num{123}]
    
    verb|sisetup{math-rm = symup}|
    sisetup{math-rm = symup} % https://tex.stackexchange.com/a/438342/2288
    
    vspace{baselineskip}
    text: 123 num{123}
    inline math: $123~num{123}$
    display math: [123~num{123}]
end{document}

One Answer

mathrm (and mathbf etc) uses in the default setup glyphs from the surrounding text font, symrm (and symbf? etc) uses glyphs from the math font:

documentclass[14pt]{article}

usepackage{unicode-math}
setmainfont{Arial}
setmathfont[math-style=ISO]{Cambria Math}
begin{document}pagestyle{empty}
$mathrm{mathrm}quadsymrm{symrm}$
end{document}

enter image description here

By default num uses one of the mathXXX fonts, and by default this mathXXX fonts uses text fonts, and so num uses a text font even in math. With math-rm = symup you can force it to use the math font.

detect-inline-family=math doesn't mean that num will use a math font, it means that num will react if it is inside a math command. Try for example

  $123~num{456}~mathsf{num{789}}$

enter image description here

  1. know if it is possible to make the default math font-weight as light as the surrounding

Well Cambria Math is a bit bolder. Why don't you use the default (latin modern math) which would fit better?

Correct answer by Ulrike Fischer on September 28, 2020

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