# upright italics (math mode)?

Knuth's beautiful CMU font has many variants which are accessible from LaTeX:

• \textrm,\mathrm - roman (default)
• \textit,\mathit - italics
• \textbf,\mathbf - bold
• \textsc - small caps
• \textsl - slanted (roman)

However, some additional variants like "upright italics" seem to have no invoking command. Is this true? Are there packages which make them accessible?

Thanks.

• Where is the sense of having an italic font in upright shape? – user2478 May 15 '18 at 18:08
• you put {math mode) in the title but all your examples are text fonts? – David Carlisle May 15 '18 at 19:05
• @Herbert: for "related" variables, like indices which appear in different contexts (e.g. a function of three N-dimensional distributions). @DavidCarlisle: not all the above are defined for \math**. I've updated the question - but it only makes my case stronger! – Jesse Knight May 16 '18 at 0:43
• @Herbert I'm not sure what you mean. Typically, when compared to the roman variant, an italic face is slanted and has a different shape. You can have slanted letters in the roman-style shape, so why not unslanted letters in the italic-style shape? – David Richerby May 16 '18 at 13:36
• @Herbert Yes, I know all that. Why do you think it makes sense to take the "i" of a roman font, make it lean to the right and call it "slanted" but not make sense to take the "i" of an italic font, make it not lean to the right and clal it "upright italic"? – David Richerby May 16 '18 at 16:15

CMU isn't Knuth's original Computer Modern font but a newer extended Unicode set using OpenType font format.

LaTeX only provides the simple named macros for the combinations that are most likely used but all of the original Computer Modern collection can be accessed by specifying appropriate font family or shapes, for example:

\documentclass{article}

\begin{document}

{\fontshape{ui}\selectfont abcdefg  upright italic}

{\bfseries  abcdefg bold extended}

{\fontseries{b}\selectfont  abcdefg bold non-extended}

{\fontfamily{cmfib}\selectfont  abcdefg fibonacci}

{\fontfamily{cmdh}\selectfont  abcdefg dunhill}

{\ttfamily  abcdefg non-variable typewriter}

{\fontfamily{cmvtt}\selectfont  abcdefg variable typewriter}

{\fontfamily{cmvtt}\itshape  abcdefg variable typewriter italic}

\end{document}

• Wow so there is a boldface that is not absurdly large in CM. :O Awesome! – Andrea Lazzarotto May 15 '18 at 22:16
• @AndreaLazzarotto \renewcommand\bfdefault{b} then \textbf etc use b not bx if that's what you prefer. – David Carlisle May 15 '18 at 22:37

Are there packages which make [upright italics] accessible?

You could load the cfr-lm package, which provides the \uishape switch and the \textui macro. (ui is short of 'upright italic'.)

\documentclass{article}
\usepackage{cfr-lm}
\begin{document}
$aaa,\ \mathit{aaa},\ \textit{aaa},\ \textui{aaa}$

$fff,\ \mathit{f{}f{}f},\ \textit{f{}f{}f},\ \textui{f{}f{}f}$
\end{document}

• In case someone's wondering why I inserted {} between pairs of f letters: I did so to break up any ff-ligatures. – Mico May 15 '18 at 18:55

The CTAN/TeX Live/MiKTeX package cm-unicode also contains OpenType fonts that can be used with LuaLaTeX or XeLaTeX, e.g.:

\documentclass{article}
\usepackage{lipsum}
\usepackage{fontspec}

\newfontface\cmunui{CMU Serif Upright Italic}

\begin{document}
\cmunui
\lipsum[1]
\end{document}


No reason my approach for Greeks at Upright Greek font fitting to Computer Modern can't be applied directly to italic.

I use the (default) unslant value of -.25, which seems good for the CM font. Different fonts will require customized values.

\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

\textit{slanted CM italic}

\unslant{\textit{unslanted CM italic}}
\end{document}


• @Mico Yes, on my small screen of yesterday evening (after a long day of work), the .21 seemed good enough. This morning, I see that some improvement is possible. I will edit. – Steven B. Segletes May 16 '18 at 9:46

Since you asked specifically about using them in math mode, one way to do that in unicode-math is:

\documentclass[varwidth, preview]{standalone}

\usepackage{amsmath}
\usepackage[math-style=ISO]{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont[range=up/{Latin,latin,Greek,greek}]{CMU Serif Upright Italic}

\begin{document}
\begin{align*}
\symup{e}^{\symup{i} x} &= \cos{x} + \symup{i} \sin{x} \\
\symup{e}^{\symup{i \pi}} + 1 &= 0
\end{align*}
\end{document}


The above is set in ISO style, with the constants e, i and π set upright, the variable x in italic, the digits 1 and 0 left unchanged (therefore still matching the default text font, so 10 looks the same as $10$) and the operator names cos and sin set in the text font. The unicode-math package is smart enough to tell the difference between upright math symbols, \symup, and snippets of text such as \operatorname, \text or \mathrm.

If you instead want to use upright italic letters by default, but still have the usual slanted italic available with \symit{x}, pass the [math-style=upright] option to \usepackage{unicode-math}. If you want to replace the italic rather than the upright math latters, change range=up to range=it.

There is no corresponding bold upright italic font, but should you wish to use one (such as for vectors), you might reload the regular-weight font with the range=bfup/{latin,Latin,greek,Greek} option from unicode-math and the FakeBold= option from fontspec.

The most famous upright italic math font Donald Knuth was involved with was AMS Euler, by Hermann Zapf. This is available in OpenType as the font Neo Euler.

To use a TrueType or OpenType upright italic font as your text font, use fontspec (see Heiko Oberdiek’s answer). You can also use options on commands such as \setmainfont to replace only the italic style of a font family. You should only use a legacy NFSS toolchain if you’re forced to, for compatibility with an old document or old software.