Upright Greek font fitting to Computer Modern
Here, I take Bruno's answer at Shear transform a "box", and use it to unslant the computer-modern greek letters. I introduce \unslant[slant]{math-symbol}
, where the default value of unslant correction is set to -0.25.
As you can see, the unslanted font is very visually very compatible with the original, both of which are shown. No packages required.
\documentclass[a4paper]{article}
\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][-.25]{\slantbox[#1]{$#2$}}
\begin{document}
$\alpha\beta\gamma\delta\epsilon\eta\mu\phi\sigma\tau\omega\xi\psi\zeta$\par
\unslant\alpha\unslant\beta\unslant\gamma\unslant[-.1]\delta\unslant[-.1]\epsilon%
\unslant\eta\unslant\mu\unslant\phi\unslant\sigma\unslant\tau\unslant\omega%
\unslant[-.15]\xi\unslant\psi\unslant[-.15]\zeta
\end{document}
And while the default and particular slants may need some tweaking for each font, the really nice thing about this approach is that it will work, in principle, on any math font. Here, I use it on mathptmx
, adjusting the default unslant
to [-.18]
\documentclass[a4paper]{article}
\usepackage{mathptmx}
\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][-.18]{\slantbox[#1]{$#2$}}
\begin{document}
$\alpha\beta\gamma\delta\epsilon\eta\mu\phi\sigma\tau\omega\xi\psi\zeta$\par
\unslant\alpha\unslant\beta\unslant\gamma\unslant\delta\unslant\epsilon%
\unslant\eta\unslant\mu\unslant\phi\unslant\sigma\unslant\tau\unslant\omega%
\unslant\xi\unslant\psi\unslant\zeta
\end{document}
adding \showoutput
to your document you see
....\OT1/cmr/m/n/10 m
....\hbox(4.37393+1.94397)x5.5542
.....\TS1/cmr/m/n/10 �
which means that siunitx is using TS1 ie the text companion font you would get from
\usepackage{textcomp}
which means basically you are out of luck as the TS1 encoding doesn't have a Greek alphabet, just
\DeclareTextSymbol{\textmu}{TS1}{181} % micro sign
see ts1enc.def
in the base LaTeX distribution.
I realize I’m a few years late here, but as of 2018, we can stop doing workarounds like the earlier answers, clever and impressive as they are.
The simplest approach is just to load unicode-math
and use \symup{\alpha}
and so on, or to get that by default, load unicode-math
with the [math-style=upright]
option. Latin Modern Math, the default math font for unicode-math
, contains an upright Greek math alphabet, and so so most other OpenType math fonts.
The Computer Modern Unicode project has a font very similar to the unslanted italics: CMU Serif Upright Italic. (It does not come in bold, but you might fall back on the FakeBold=
feature from fontspec
or use the defaults.) You can load this only for upright math letters, as follows:
\documentclass[varwidth, preview]{standalone}
\usepackage[math-style=upright]{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont[range=up/{Latin,latin,Greek,greek}]{CMU Serif Upright Italic}
\begin{document}
\( \alpha + \beta = \pi \)
\end{document}
You can also load this font with the fontspec
package, and there’s an option to load it to replace the italic font in the CMU family, or load it as the normal font and the slanted italic as its companion.