# upright italics (math mode)?

Jesse Knight 05/15/2018. 5 answers, 277 views

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.

David Carlisle 05/15/2018.

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}

Mico 05/15/2018.

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}

Heiko Oberdiek 05/15/2018.

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}

Davislor 05/16/2018 at 00:28.

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.

Also beware that there is no matching CMU bold upright italic font, should you want to use bold upright math letters (e.g. for constant vectors) or bold italic math letters (e.g. for vector variables).

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.

Steven B. Segletes 05/16/2018 at 00:46.

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

\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[-.21]{\textit{unslanted CM italic}}
\end{document}