4

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}
3
+50

\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}\quad\symrm{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?

| improve this answer | |
  • I have a basic question if you don't mind; what is the difference in meaning between math-rm = \symup and math-rm = \symrm? Out of curiosity, I replaced the former with the latter in your code, and the result didn't change. So, Would you please explain the meaning of each one? – Diaa Sep 27 at 0:59
  • Interestingly, this document doesn't need math-rm=\symup to make \num copy the surrounding font attributes when using the same family for both text and math :). Apparently, I created an issue out accidentally out of nothing. – Diaa Sep 27 at 1:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.