1

So I'm working on a LaTeX document that is written mostly with a serif font. But I want to have some blocks of text in a sans-serif font so it's easier to distinguish them. However I haven't found yet a way to have a block of text written in sans-serif that automatically changes the math font to one that is sans-serif when in \sffamily.

I've tried using mathhastext and this changes the alphabet symbols on math mode but it does not change math symbols.

Specifically I would like to use newtxsf for the sans-serif font and newpxmath for the serif one.

  • Take a look here or here. – Skillmon Aug 16 '17 at 9:11
  • @Skillmon That seems to work but I can't get the two fonts above to work together, which is part of the problem :( – José María Aug 16 '17 at 9:51
  • It is quite some work at least if you want a full-fledge solution. One would have to build a sans mathversion starting from newtxsf. This involves looking at all the definitions in newtexsf and newpxmath to check for differences (both styles have nearly 2000 lines of code), and perhaps fighting against the problem that too many alphabets are used. It is probably easier to write the equations in an external document and include them as graphics. – Ulrike Fischer Aug 16 '17 at 9:56
  • @UlrikeFischer Hmm, that seems a lot of work... Do you know any fonts (serif and sans-serif) that work together? – José María Aug 16 '17 at 10:00
  • 2
    Not quite sure if I understand what you mean. In general math doesn't change in a document. The font carries meaning in math, and so you don't write an x in one part in serif and in the next in sans serif. Also consider if you really need a sans-serif block -- im my opinion it is seldom needed. An excurs can be easily marked by some indent, smaller font, a frame, or by banning it to the end where is doesn't disturb the first reading. – Ulrike Fischer Aug 16 '17 at 10:07

Your Answer

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

Browse other questions tagged or ask your own question.