3

Hi everybody: I'm having issues with some symbols when writing using the sans serif font. More concretely: I load a font for math and text (mtpro lite in the example below) and also Fira Sans for sans serif. AFAIK Fira Sans has math support through the package newtxsf.

\documentclass[14pt, a4paper, reqno]{extarticle}
\usepackage[full]{textcomp}
\usepackage[T1]{fontenc}
\usepackage[lite]{mtpro2}
\usepackage[scale=0.85]{FiraSans}
\usepackage{newtxsf}
\renewcommand{\rmdefault}{ptm}

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amstext}
\usepackage{amsthm}
\usepackage[all]{xy}

My question is: is there a way to get full math support in certain paragraph that I need to type in sans serif? For example get also Fira Sans with its math symbols when using \mathsf. I tried with and without newtxsf, tried with sansmath package, even tried without specifying Fira Sans as sans serif font. Some symbols are not showed correctly (in some cases integrals, greek letters, etc). Thank you.

2
  • 1
    Welcome to tex.sx. Commented Sep 22, 2019 at 16:28
  • If you don’t insist on switching the math symbols, a nice way to switch to and from your sans-serif math alphabet of choice in PDFLaTeX is to load isomath.
    – Davislor
    Commented Sep 23, 2019 at 5:07

1 Answer 1

4

If I understand what you’re asking correctly, what you want is to declare a math version. Here is an example that uses the modern toolchain, and compiles with either LuaLaTeX or XeLateX:

\documentclass{article}
\usepackage{unicode-math}

\defaultfontfeatures{Scale = MatchLowercase}
\setmainfont{TeX Gyre Termes}[Scale=1.0]
\setsansfont{Fira Go}
\setmathfont{TeX Gyre Termes Math}
\setmathfont[version=sans]{Fira Math}

\begin{document}
This paragraph uses a serif font. \( x = yz^2 \).

{\sffamily\mathversion{sans}
This paragraph uses a sans-serif font. \( x = yz^2 \).}
\end{document}

Termes/Fira sample

If you have to use legacy 8-bit fonts with PDFLaTeX, you can accomplish something similar with \DeclareMathVersion and \SetMathAlphabet, but you have to look up the different math symbol fonts from both packages you want to combine. See “LaTeX2e Font Selection.”

6
  • Surely your answer is correct :-)
    – Sebastiano
    Commented Sep 22, 2019 at 22:18
  • Thank you Barbara and Davislor. And yes, you understood correctly. I was pretty sure that the problem would be more easily solvable using XeLaTeX as you indicated. But in this particular example I'm running PDFLaTeX, so I'll need to investigate more on the suggestions you've made. Thank you again.
    – Anibal
    Commented Sep 23, 2019 at 2:19
  • @Anibal One thing you can do is load \mathsf and related alphabets through isomath.
    – Davislor
    Commented Sep 23, 2019 at 18:21
  • @Anibal If you really want to load new math symbols as well, you could look at newtxsf.sty, copy its math-alphabet commands, and modify them slightly to load only for that math version. You’d probably want to switch between newtxmath and that, so the symbols are in the right slots.
    – Davislor
    Commented Sep 23, 2019 at 18:23
  • This a great site to answer questions...one can really learn here. I've been taking a look at isomath package and probably will solve the issue as you propose (I've never heard of it before). I'll try and let you know whether it solved it or whether I need some more help (hopefully not). I really appreciate your help. I'll post the news, of course. Thank you!
    – Anibal
    Commented Sep 24, 2019 at 2:31

You must log in to answer this question.

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