I have a document with several tables containing mathematic expressions. While I want to use roman fonts for the normal text, everything inside a table should be sans-serif. Therefor, I load the sansmath-package and turn on \sffamilyas well as \sansmathto make sure the sans-serif font is used in text and math mode.
The fonts I use come from the packages newtxtext and newtxsf. When all three packages (the fonts and sansmath) are loaded, strange things happen:
\documentclass{article}
\usepackage{newtxtext}
\usepackage{newtxsf}
\usepackage{sansmath}
%----------------------------------
\begin{document}
\section{Without sansmath}
If just sffamily (without sansmath) is active, everything in the tabular but the formula in the left column will be set in the sans-serif font.\\[1ex]
{\sffamily
\begin{tabular}[t]{ll}
Math & Text\\\hline
$4/2=2$ & 4/2=2\\
\end{tabular}
}
\section{With sansmath}
If both sffamily and sansmath are active, everything in the tabular (including the formula in the left column) will be set in the sans-serif font. Now, however, the formula is rendered incorrectly: ``$4/2$'' is contracted to ``$42$''.\\[1ex]
{\sffamily
\sansmath
\begin{tabular}[t]{ll}
Math & Text\\\hline
$4/2=2$ & 4/2=2\\
\end{tabular}
}
\end{document}
If you compile the MWE, you will see that the sans-serif font is only used in text mode if \sansmath is not activated. If it is active, everything in math mode will use the sans-serif font, too -- but the operator / in the formula has disappeared. Now, comment out \usepackage{newtxsf} and compile again to see everything as expected (everything but the formula using sans-serif in the first example, and everything using sans-serif, with an intact formula, in the second example).
Is that a bug, or am I missing something?
newtxmath: if used together withsansmath, the/will also disappear. – Andreas Nov 28 '16 at 16:35sansmathwithnewtxsf? The latter already makes math symbols sans serif – mbert Nov 27 '23 at 01:24