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




\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}

    \emph{h}$h \sum_i \bigl[\bigr]  \to \lim_{\alpha} \Xi\ \mathbf{aB\Xi}\mathrm{aB}\mathit{aB\Xi}\mathfrak{aB}\mathcal{A}$


enter image description here

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 using phv as there seems to be no upright version of ntxsfmi. 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.

  • 1
    You talk about \mathrm{\Xi} but your code does not contain it. Do you mean \mathbf{\Xi}? Anyway the issue is that T1 has the dieresis where OT1 has Xi, and you set \mathbf to use T1. Change that to OT1 and replace phv by qhv (that's tgheros, an Helvetica clone which however contains all symbols).
    – campa
    Commented Mar 4, 2021 at 17:04
  • 1
    Also you talk about the math version normal and serif, but there is no math version serif here. Please edit such that your questions do actually match your code.
    – campa
    Commented Mar 4, 2021 at 17:10
  • @campa You are absolutely right; I meant sans mathversion and mathbf. Thank you for mentioning qhv; I wasn't aware that this seems to be the sfdefault font set by newtxtext anyway.
    – Bubaya
    Commented Mar 5, 2021 at 17:53

2 Answers 2


What you have looks fine actually (akthough you probably want to use OT1 not T1 in math as campa noted in comments).

The 16 math group limit is 16 fonts per math version so adding two new math versions is exactly the right approach.

The issue with the mis-aligned [] is not your fault, it appears to be an error in the txfonts setup that you should perhaps report:




$[], \bigl[\bigr], \Bigl[\Bigr]$

enter image description here

  • Thanks for clarifying that the 16 fonts are per math version. Do you know why the Fraktur letters are of slightly different weight?
    – Bubaya
    Commented Mar 5, 2021 at 19:10
  • @Bubaya they are different fonts so no reason they should have the same weight really the two non bold fraktur B are \U/ntxmia/m/it/10.95 B and \U/ntxsfmia/m/it/10.95 B Commented Mar 5, 2021 at 20:20
  • I guess I only expected them to be equal because they almost are. But yes, I figured out how to change this. All this font stuff is really strange if you've been raised with Word…
    – Bubaya
    Commented Mar 5, 2021 at 20:30
  • @Bubaya the opentype font setup in Davislor's answer is much closer to Word setup, in fact the opentype Math Font layout used by luatex or xetex via the unicode-math package is built on the OpenType Math table which was specified by Microsoft while designing its math zones and the cambria math font. Commented Mar 5, 2021 at 20:34
  • Michael has submitted an update to newtx. The output should be fine now.
    – campa
    Commented Mar 25, 2021 at 12:18

For completeness, here is how you might do the same thing in the modern toolchain. The \versionsymbol code should work in any engine.


\defaultfontfeatures{ Scale=MatchLowercase,
                      Ligatures = TeX }
\setmainfont{TeX Gyre Pagella}[Scale=1.0]
\setmathfont[version=sansbold, FakeBold=1.2]{KpMath-Sans}

% A higher-order version of \boldsymbol from amsbsy.sty:
  \let\@nomath\@gobble \mathversion{#1}%



\( [x] \, \boldsymbol{[x]} \, \sanssymbol{[x]} \, \sansboldsymbol{[x]} \)

Default \( (r, \theta, \phi ) \)

{\bfseries\boldmath Bold \( (r, \theta, \phi ) \) }

{\sffamily\sansmath Sans-serif \( (r, \theta, \phi ) \) }

{\sffamily\bfseries\sansboldmath Sans-serif bold \( (r, \theta, \phi ) \)}


KP Fonts sample

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .