# non-italic font for equation when we use “Subscript”?

I read this answer about non-italic font for equation, however, it does not work when we use Subscript in our equation:

$$\mbox{ abc_{d} }$$


Is there a solution to show such an equation without italic font?

• I think you want to use \mathrm here: abc_{\mathrm d}. – Alan Munn Aug 5 '18 at 23:35

Assuming you want just the subscript to be upright, then you should use \mathrm here instead of the \mbox technique, since the \mbox will not preserve the fontsize decrease that you expect in the subscript. Note also, you don't need the $ inside the equation environment. \documentclass{article} \begin{document} $$abc_{\mathrm{d}}$$ \end{document}  If you want the whole expression to be upright, simply wrapping it in \mathrm will work, but it's likely that there are better ways to achieve what you want, e.g. using the amsmath command \DeclareMathOperator to create custom operators that should be rendered upright. See the following question for more detail on this: • Gets my upvote :) – Au101 Aug 5 '18 at 23:47 • Please brace the argument. $abc_{\mathrm def}\$ might yield unexpected results for a newbie. – Henri Menke Aug 6 '18 at 6:48

## In Modern Toolchains

With unicode-math, a better solution is abc_{\symup d}, or else set \mathrm to work as symup by default. The \mathrm command sets d in the main text font.

Here’s an example of why you might want upright math letters to be different from the main font, and some of the examples are superscripts.

\documentclass[varwidth, preview]{standalone}

\usepackage{mathtools}
\usepackage[math-style=ISO]{unicode-math}

\setmainfont{TeX Gyre Pagella}
\defaultfontfeatures{Scale=MatchLowercase}

\setmathfont{Asana Math}
\setmathfont[range={up/{Latin,latin,Greek,greek},
bfup/{Latin,latin,Greek,greek}},
script-features={}, sscript-features={}
]{Neo Euler}

\newcommand\upe{\symup{e}}
\newcommand\upi{\symup{i}}

\begin{document}
\begin{align*}
\upe^{\upi x} &= \cos{x} + \upi \sin{x} \\
\upe^{\upi \uppi} + 1 &= 0
\end{align*}
\end{document}


This sets Euler’s equations in ISO style, in which the constants e, i and π are set upright. It additionally sets the upright math letters to Neo Euler, an OTF conversion of the AMS Euler math font by Hermann Zapf. It’s a good match for his famous font, Palatino, and I use clones of Palatino as both the text and the math font. The digits, italic x symbol and the upright operator names sin and cos are from Palatino (by way of Adobe, URW Palladio, pxfonts and Asana Math).

Without changing the \symup alphabet and using it, the symbol for the imaginary unit would look like the letter i in sin and dx would look like you were integrating the variable x.

If you use the default Latin Modern Math font, you might try CMU Serif Upright Italic (cmunui.otf) as an alternative for upright math letters. This is an OpenType conversion of Donald Knuth’s unslanted Computer Modern Italic font.

## Using Legacy Encodings

It’s also possible to achieve very similar output in PDFLaTeX by loading newpxmath, either newpxtext or tgpagella, and then loading AMS Euler as a symbol font. Since many mathematical texts want to set a small number of constants as upright letters, this is another viable approach.

\documentclass[varwidth, preview]{standalone}

\usepackage{mathtools}
\usepackage{newpxtext}
\usepackage{newpxmath}

\DeclareSymbolFont{eulerup}{U}{zeur}{m}{n}
\DeclareMathSymbol{\uppi}{\mathalpha}{eulerup}{"19}
\DeclareMathSymbol{\upi}{\mathalpha}{eulerup}{"69}
\DeclareMathSymbol{\upe}{\mathalpha}{eulerup}{"65}

\begin{document}
\begin{align*}
\upe^{\upi x} &= \cos{x} + \upi \sin{x} \\
\upe^{\upi \uppi} + 1 &= 0
\end{align*}
\end{document}


AMS Euler is part of amsfonts, so I took the character codes from the manual. The standard legacy codings are all in the LaTeX Font Encoding guide. Other legacy fonts with U encodings should include font tables in their documentation.

If you use the default Computer Modern font, you might try the upright italic shape of Computer Modern (cmr{m}{ui}) to get upright Latin letters and the upgreek package to get upright Greek.