0

I want to introduce a family of sans serif symbols using the TeX Gyre Heros italic font. I have only managed to use the upright font, How do I achieve this with the italic font?

\documentclass{article}
\usepackage{fontspec}
\setmathsf{TeX Gyre Heros}

\newcommand{\sfmu}{\mathsf{μ}}

\begin{document}

\[
\sfmu : X \to Y
\]

\end{document}
1
  • For reasons that are quite difficult to understand, Unicode reserves code points for Greek sans serif boldface italic, but not for medium weight.
    – egreg
    Feb 8, 2021 at 9:37

1 Answer 1

1

You can search "texgyrehero" in your computer and you can get a font texgyreheros-italic.otf, set mathsf to it like

\documentclass{article}
\usepackage{fontspec}
\setmathsf{texgyreheros-italic.otf}

\newcommand{\sfmu}{\mathsf{μ}}

\begin{document}

\[
\sfmu : X \to Y
\]

\end{document}

Another solution: Use unicode-math package

First you can refer to Greek sans serif math .

And you can try another opentype font which support "Math" script, like "Fira Math". Here are two examples:

  1. If you want to use sans serif \mu in total paper, you can use
\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{latinmodern-math.otf}
\setmathfont[range=\mitmu]{FiraMath-Regular.otf}

\begin{document}

\[
    \mitmu : X \to Y,
\]

\end{document}

\mitmu

  1. As you said, you can declare a sfit family, here I call it fira, you can use
\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{latinmodern-math.otf}
\setmathfontface\fira{FiraMath-Regular.otf}


\begin{document}

\[
    \fira{\mupmu, \mitmu} : X \to Y,
\]

\end{document}

\fira

  1. If you insist on using TeX Gyre Heros, you can use
\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{latinmodern-math.otf}
\setmathfontface\sfit{texgyreheros-italic.otf}
\setmathfontface\sfup{texgyreheros-regular.otf}

\begin{document}

\[
    \sfit{\mupmu}, \sfup{\mupmu} : X \to Y,
\]

\end{document}

\sfit

Because TeX Gyre Heros doesn't contain "Math" script, so we can't use \sfit{\mitmu} to get a italic \mu.

In those examples, \mupmu is a command declared by unicode-math, which means m(math)up(upright)mu(μ), so you can easily guess what \mitmu means.

2
  • I just found out that \setmathsf{TeX Gyre Heros Italic} will work, but then I can't use the upright sans serif font. I think what I really want is a way to define a new \mathsfit family.
    – FR09
    Feb 8, 2021 at 9:48
  • 1
    There is one thing you have to know: TeX Gyre Heros doesn't contain "Math" script, it mean you'd better not use it in math mode. If you want a sans serif math font, you can use Fira Math, a opentype sans serif math font.
    – Syvshc
    Feb 8, 2021 at 10:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.