# Upright Greek font fitting to Computer Modern

I'm looking for an upright Greek font for single Greek characters (like "β-decay" or "µ-metal") which fits to the default CM/latin style, i.e. the upright version of the default italic math mode Greek letters (\beta, \mu).

The "default" upright Greek font (should be cbgreek), which is used when writing with babel or with the textgreek package (\textbeta, \textmu), doesn't quite fit to the CM/latin font, especially the µ symbol. There are packages replacing the entire font families, e.g. mathdesign or kpfonts, providing a complete set of Greek, but none of them was made for CM/latin. upgreek uses another font for math mode Greek (euler I guess, also accessible through textgreek with the respective option) which also doesn't quite fit with CM/latin.

I would already give up if it wasn't for the µ used by the siunitx package. Its default "micro" prefix (\si{\micro}) fits perfectly with CM/latin (see comparison below) and I wanted to know whether that µ is just a unique character of the CM font or whether there's a chance to also get an upright β and other letters in exactly that font. Also, how does the siunitx package get that µ? The characters µ (micro symbol) and μ (greek letter mu) print by default with the same character in cbgreek with UTF-8 encoding (see below)...

Here's a MWE (pdflatex):

\documentclass{minimal}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\usepackage{textgreek}
\usepackage{upgreek}

\begin{document}

m\si{\micro}\textmu $\mu$

\textbeta $\beta$

$\upmu \upbeta$

µμβ % U+00B5 (micro symbol) U+03BC (greek lower case mu) U+03B2 (greek lower case beta)

\end{document}


Result:

• I was just messing around to see if it was possible and managed to "unslant" the actual cm greek letters. I copied cmmi10.tfm to cmmu10.tfm and then added the line cmmu10 CMMI10 " -0.25 SlantFont " <cmmi10.pfb to the map file. To do this properly, one would have to do that for all sizes, plus edit the tfm files to reduce the italic corrections (to 0.0 for most characters), plus prepare the appropriate LaTeX incantations. Thus, it seems possible, although tedious. It gets a little less tedious if one first prepares a tfm with only greek letters. – Dan Nov 21 '13 at 4:11
• Sounds interesting... In case one needs only a couple of symbols (in my case only the β so far, since a nicely fitting micro-µ is part of the text companion font), it might be worthwhile. Is there a way to do that entirely via LaTeX macros without adding a new "font"? Could you give an example for the β symbol? – Novgorod Nov 21 '13 at 17:30
• It might be possible with pstricks to apply the appropriate slant transformation to an occasional character. Unfortunately, I have never used pstricks and don't know what it is capable of, except in very general terms. – Dan Nov 21 '13 at 21:53
• I've looked at this a fair bit, and your best bet is to move fonts; here is a question on the same topic I asked a while back. – Canageek Dec 18 '13 at 2:35

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.

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}


• This is a great answer. I've marked this posting as a "favorite" to make it easier to find it again in the future, should I have a need for this method. – Mico Feb 26 '15 at 14:44
• @StevenB.Segletes I posted a follow-up question to your great answer here. Maybe you have a simple solution. – thewaywewalk Apr 5 '15 at 11:22

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.