# Sans serif symbols in XeLaTeX

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}

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

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}


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}


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}


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.

• 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
• 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. Feb 8, 2021 at 10:36