[Tex/LaTex] How to make \text{} in math mode fit the math font

fontsmath-modesans-serif

I am having a problem with text in formulas. I am setting tables in sans-serif in order to improve the readability. The math font stays serif for formulas or symbols within the table, when I switch with \sffamiliy directly before \begin{tabular}. I think that's good, because the symbols stay the same over the whole document and are recognizable.

But, when setting indices which are used as abbreviations with _\text{index}, this text of course changes to sans, too. That gives me three different symbols where two different what be easier to understand.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
The mass flow $q_m$ is different from the average heat flow $q_\text{m}$

\sffamily
The mass flow $q_m$ is different from the average heat flow $q_\text{m}$
\end{document}

First of all I wonder how to prevent this behavior and second: What is best practice for this case? How do you type set text indices? Should the math mode follow the text mode and possibly confuse the lector?

An other example are characteristic numbers which should be (Forssmann/Jong) set to circumferential Mach-number $\textit{Ma}_u$ or Reynolds-number over hyd. diameter $\textit{Re}_{D_{\text{h}}}$.

Edit

I am playing around a little with \mathrm and \text. Still not sure, what should be used where. The font is the same for serifs. Using unicode-math or redefining \mathrm however would give different appearances for those outputs. I think that is good, as d for differential should/could look different as d for abbreviation of dynamic. $\frac{\mathrm{d}p_\text{d}}{\mathrm{d}t}$

What I noticed further more:

  • \mathrm ignores spaces but not \, etc.
  • \mathrm and \text are setting indices in a different distance

This code:

Mach-number, total, mean and mass specific values:

$\textit{Ma}_u$; $\mathit{Ma}_u$

$q_m$; $q_{\text{m\,tot}}$; $q_{\text{m tot}}$; $q_{\text{m,tot}}$; $q_{\text{m, tot}}$

$q_m$; $q_{\mathrm{m\,tot}}$; $q_{\mathrm{m tot}}$; $q_{\mathrm{m,tot}}$; $q_{\mathrm{m, tot}}$

\sffamily
Mach-number, total, mean and mass specific values:

$\textit{Ma}_u$; $\mathit{Ma}_u$

$q_m$; $q_{\text{m\,tot}}$; $q_{\text{m tot}}$; $q_{\text{m,tot}}$; $q_{\text{m, tot}}$

$q_m$; $q_{\mathrm{m\,tot}}$; $q_{\mathrm{m tot}}$; $q_{\mathrm{m,tot}}$; $q_{\mathrm{m, tot}}$

looks like:

enter image description here

Best Answer

When using \text{} you just switch to the family around the mathmode. You could always use \textrm to force the serif family. So I would write

\documentclass{article}
\usepackage{mathtools}
\begin{document}
The mass flow $q_m$ is different from the average heat flow $q_\textrm{m}$

\sffamily
The mass flow $q_m$ is different from the average heat flow $q_\textrm{m}$
\end{document}
Related Question