I have the strong conviction that I have only understood 1% of how LaTeX selects (math) fonts, so I guess that most of my problems come from that, apart from the lack of a proper math font matching Helvetica.
My goal is to have sans serif math in surroundings where text is sans serif, and serif math where the text is serif. To that end I define mathversions sans
and sansbold
(I have heard about this 16-font limitation, so I guess I shouldn't be doing this, but now I'm curious). I have tried to copy at least some stuff from newtxsf.sty
(I think) I understand, ending with
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\usepackage{newtxtext,newtxmath}
\usepackage[scaled=0.87]{helvet}
\DeclareMathVersion{sans}
\DeclareMathVersion{boldsans}
\DeclareFontEncoding{LMS}{}{}
\DeclareFontSubstitution{LMS}{ntxsy}{m}{n}
\DeclareFontSubstitution{U}{ntxsfmia}{m}{it}
\SetSymbolFont{operators} {sans}{\encodingdefault}{\sfdefault}{m}{n}
\SetSymbolFont{letters} {sans}{OML}{ntxsfmi}{m}{it}
\SetSymbolFont{lettersA} {sans}{U}{ntxsfmia}{m}{it}
\SetSymbolFont{largesymbolsTXA} {sans}{U}{ntxexa}{m}{n}
\SetMathAlphabet{\mathbf} {sans}{T1}{phv}{b}{n}
\SetMathAlphabet{\mathit} {sans}{OML}{ntxsfmi}{m}{it}
\SetSymbolFont{operators} {boldsans}{\encodingdefault}{\sfdefault}{b}{n}
\SetSymbolFont{letters} {boldsans}{OML}{ntxsfmi}{b}{n}
\SetSymbolFont{symbols} {boldsans}{LMS}{ntxsy}{b}{n}
\SetSymbolFont{AMSm} {boldsans}{U}{ntxsym}{b}{n}
\SetSymbolFont{symbolsC} {boldsans}{U}{ntxsyc}{b}{n}
\SetSymbolFont{largesymbols} {boldsans}{LMX}{ntxexx}{b}{n}
\SetSymbolFont{largesymbolsTXA} {boldsans}{U}{ntxexa}{b}{n}
\SetSymbolFont{lettersA} {boldsans}{U}{ntxsfmia}{b}{it}
\SetMathAlphabet{\mathbf} {boldsans}{T1}{phv}{b}{n}
\SetMathAlphabet{\mathit} {boldsans}{OML}{ntxsfmi}{b}{it}
\newcommand\test{
\emph{h}$h \sum_i \bigl[\bigr] \to \lim_{\alpha} \Xi\ \mathbf{aB\Xi}\mathrm{aB}\mathit{aB\Xi}\mathfrak{aB}\mathcal{A}$
}
\begin{document}
\test
\bfseries\mathversion{bold}\test
\mdseries\sffamily\mathversion{sans}\test
\bfseries\mathversion{boldsans}\test
\end{document}
The obvious issues are
- The
\bigl[\bigr]
don't match. Other brackets and sizes seem to work. - The $\mathbf{\Xi}$ does not work (should it even?), which is because
\mathrm
is done usingphv
as there seems to be no upright version ofntxsfmi
. I'm not sure if I should care. - The Fraktur letters look different in
mathversion{normal}
and\mathversion{sans}
. Although it does not hurt so much, I wonder where it comes from.
Apart from that, should I be doing this? Did I miss something really important? You'll have noticed that I used scaled=.87
for helvet
instead of the common 0.95
, which I chose to be somewhere between Times and newtxsf
.
\mathrm{\Xi}
but your code does not contain it. Do you mean\mathbf{\Xi}
? Anyway the issue is thatT1
has the dieresis whereOT1
has Xi, and you set\mathbf
to useT1
. Change that toOT1
and replacephv
byqhv
(that's tgheros, an Helvetica clone which however contains all symbols).normal
andserif
, but there is no math versionserif
here. Please edit such that your questions do actually match your code.sans
mathversion andmathbf
. Thank you for mentioningqhv
; I wasn't aware that this seems to be thesfdefault
font set bynewtxtext
anyway.