# Sans serif upright greek in math mode

I need to write a document with the Helvetica font and found sansmathfonts to be good matching counterpart for math, but I'm open for other suggestions.

Now I'm really struggling to get sans serif upright greek letters in math-mode. Is there any way to achieve that?

For serif fonts I was previously using either upgreek or this great answer. Both are not working for helvet+sansmathfonts.

\documentclass{article}

\usepackage[utf8]{luainputenc}
\usepackage[T1]{fontenc}
\usepackage{siunitx}
\usepackage{sansmathfonts}
\usepackage[scaled=0.95]{helvet}
\renewcommand{\familydefault}{\sfdefault}

\usepackage{upgreek}

\begin{document}

Upright greek in math mode:
$\mathrm{\mu\alpha\beta\gamma}$, $\upmu\upalpha\upbeta\upgamma$,

\end{document}


MWE regarding Steven B. Segletes comment:

\documentclass{article}

\usepackage[utf8]{luainputenc}
\usepackage[T1]{fontenc}
\usepackage{siunitx}
\usepackage{sansmathfonts}
\usepackage[scaled=0.95]{helvet}
\renewcommand{\familydefault}{\sfdefault}

\usepackage{tikz}

\usepackage{scalerel}
\newsavebox{\foobox}
\newcommand{\slantbox}[2][0]{\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}
\newcommand\unslant[2][-.2]{%
\mkern1mu%
\ThisStyle{\slantbox[#1]{$\SavedStyle#2$}}%
\mkern-1mu%
}

\newcommand\upmu{\unslant\mu}

\begin{document}

Upright greek in math mode: $\mathrm{\mu}$, $\upmu$,

\begin{tikzpicture}
\node[color=red,] {$\upmu$$\mu}; \end{tikzpicture} \end{document}  • If you are using pdflatex (which it seems you are not), my answer here is a direct fix: tex.stackexchange.com/questions/145926/…. (Note: for this font, set the default \unslant optional argument value to -.2) – Steven B. Segletes Jun 9 '16 at 16:59 • @StevenB.Segletes It actually works also with lualatex. The problem I always have with this solution when used with tikz (I tried it in multiple situations in the past) is that the letters do not adapt the color of nodes. Do you know how to fix that? I updated my MWE. – thewaywewalk Jun 9 '16 at 17:24 • @StevenB.Segletes By the way, you should make it a package ;) – thewaywewalk Jun 9 '16 at 17:25 • Well, a workaround is surely \node {\textcolor{red}{\upmu$$\mu$}}; – Steven B. Segletes Jun 9 '16 at 17:27
\end{tikzpicture}
\end{document}


• Thank you! Are you aware of this answer? It makes a great addition to you unslant approach as it recognizes also \mathrm. – thewaywewalk Jun 10 '16 at 11:15
• @thewaywewalk Thank you. And no, I was not aware of the answer, though I am certainly aware of wipet's proficiency at such things. That looks like a really useful approach. – Steven B. Segletes Jun 10 '16 at 11:35

You can use CB fonts

\documentclass{article}

\usepackage[scaled=0.95]{helvet}
\usepackage{sansmathfonts}
\renewcommand{\familydefault}{\sfdefault}

\DeclareFontEncoding{LGR}{}{}
\DeclareSymbolFont{sfgreek}{LGR}{cmss}{m}{n}
\SetSymbolFont{sfgreek}{bold}{LGR}{cmss}{bx}{n}
\DeclareMathSymbol{\alpha}{\mathord}{sfgreek}{a}
\DeclareMathSymbol{\beta}{\mathord}{sfgreek}{b}
\DeclareMathSymbol{\gamma}{\mathord}{sfgreek}{g}
\DeclareMathSymbol{\delta}{\mathord}{sfgreek}{d}
\DeclareMathSymbol{\epsilon}{\mathord}{sfgreek}{e}
\DeclareMathSymbol{\zeta}{\mathord}{sfgreek}{z}
\DeclareMathSymbol{\eta}{\mathord}{sfgreek}{h}
\DeclareMathSymbol{\theta}{\mathord}{sfgreek}{j}
\DeclareMathSymbol{\iota}{\mathord}{sfgreek}{i}
\DeclareMathSymbol{\kappa}{\mathord}{sfgreek}{k}
\DeclareMathSymbol{\lambda}{\mathord}{sfgreek}{l}
\DeclareMathSymbol{\mu}{\mathord}{sfgreek}{m}
\DeclareMathSymbol{\nu}{\mathord}{sfgreek}{n}
\DeclareMathSymbol{\xi}{\mathord}{sfgreek}{x}
\DeclareMathSymbol{\omicron}{\mathord}{sfgreek}{o}
\DeclareMathSymbol{\pi}{\mathord}{sfgreek}{p}
\DeclareMathSymbol{\rho}{\mathord}{sfgreek}{r}
\DeclareMathSymbol{\sigma}{\mathord}{sfgreek}{s}
\DeclareMathSymbol{\tau}{\mathord}{sfgreek}{t}
\DeclareMathSymbol{\upsilon}{\mathord}{sfgreek}{u}
\DeclareMathSymbol{\phi}{\mathord}{sfgreek}{f}
\DeclareMathSymbol{\chi}{\mathord}{sfgreek}{q}
\DeclareMathSymbol{\psi}{\mathord}{sfgreek}{y}
\DeclareMathSymbol{\omega}{\mathord}{sfgreek}{w}
\let\varepsilon\epsilon
\let\vartheta\theta
\let\varpi\pi
\let\varrho\rho
\DeclareMathSymbol{\varsigma}{\mathord}{sfgreek}{c}
\let\varphi\phi
\DeclareMathSymbol{\Gamma}{\mathalpha}{sfgreek}{G}
\DeclareMathSymbol{\Delta}{\mathalpha}{sfgreek}{D}
\DeclareMathSymbol{\Theta}{\mathalpha}{sfgreek}{J}
\DeclareMathSymbol{\Lambda}{\mathalpha}{sfgreek}{L}
\DeclareMathSymbol{\Xi}{\mathalpha}{sfgreek}{X}
\DeclareMathSymbol{\Pi}{\mathalpha}{sfgreek}{P}
\DeclareMathSymbol{\Sigma}{\mathalpha}{sfgreek}{S}
\DeclareMathSymbol{\Upsilon}{\mathalpha}{sfgreek}{U}
\DeclareMathSymbol{\Phi}{\mathalpha}{sfgreek}{F}
\DeclareMathSymbol{\Psi}{\mathalpha}{sfgreek}{Y}
\DeclareMathSymbol{\Omega}{\mathalpha}{sfgreek}{W}

\begin{document}

Upright greek in math mode:
$\mu\alpha\beta\gamma$

$\alpha\beta\gamma\delta\epsilon\zeta\eta\theta\iota\kappa\lambda\mu$

$\nu\xi\omicron\pi\rho\sigma\varsigma\tau\upsilon\phi\chi\psi\omega$

$\mathrm{A}\mathrm{B}\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega$

\end{document}


• If you declare the math symbols like \DeclareMathSymbol{\upGamma}{ ... than you can combine it with this answer - which is great. Thank you! – thewaywewalk Jun 10 '16 at 11:14
• Your use of \let\varepsilon\epsilon etc means there is no varepsilon provided by the font? – thewaywewalk Jun 10 '16 at 11:27
• @thewaywewalk Correct – egreg Jun 10 '16 at 11:27
• @egreg This is a wonderful solution. I was wondering whether there is some version for cmbr instead of cmss... by browsing the babel folder (e.g. in lib/texmf/tex/generic/babel) it seems that there is everything (cmr, cmtt, even cmro...) but cmbr... I'm wondering why... – Monte Carlo Nov 21 '16 at 23:45
• @MonteCarlo The problem are the lowercase letters, I'm not sure there is support for them with cmbr. – egreg Nov 22 '16 at 6:59