26

The isomath package makes it possible to typeset upright Greek letters via \mathrm and \mathbf. Is it it possible to force all Greek letters to be typeset upright unless specified otherwise, e.g. to make it so that \(\Phi \Psi\) delivers the same output as \(\mathrm{\Phi \Psi}\)? An ideal solution would be to load isomath with some option and if it optionally could make difference of upper and lower case Greek letters.

\documentclass{article}

\usepackage{isomath}

\begin{document}

\(\Phi \Psi\)% These are typeset in italic

\(\mathrm{\Phi \Psi}\)% These are typeset upright

\end{document}

Output of code producing Greek letters

3
  • 1
    Just for reference, if XeLaTeX is an option, the package unicode-math provides an easy solution to this problem through the "math-style" option, documented at section 5 of the manual. – pmav99 Oct 15 '11 at 22:00
  • 2
    add \usepackage{upgreek}, then you can write \upPsi for example – Andy Barbour Jun 2 '14 at 5:01
  • @AndyBarbour - I found your solution to be the least impactive for what I was trying to solve. (meaning the best solution without other side-effects) – Pete P Aug 10 '19 at 19:12
16

You don't need the isomath package:

\DeclareMathSymbol{\Gamma}{\mathalpha}{operators}{0}
\DeclareMathSymbol{\Delta}{\mathalpha}{operators}{1}
\DeclareMathSymbol{\Theta}{\mathalpha}{operators}{2}
\DeclareMathSymbol{\Lambda}{\mathalpha}{operators}{3}
\DeclareMathSymbol{\Xi}{\mathalpha}{operators}{4}
\DeclareMathSymbol{\Pi}{\mathalpha}{operators}{5}
\DeclareMathSymbol{\Sigma}{\mathalpha}{operators}{6}
\DeclareMathSymbol{\Upsilon}{\mathalpha}{operators}{7}
\DeclareMathSymbol{\Phi}{\mathalpha}{operators}{8}
\DeclareMathSymbol{\Psi}{\mathalpha}{operators}{9}
\DeclareMathSymbol{\Omega}{\mathalpha}{operators}{10}

To get an italic Gamma, use \mathnormal{\Gamma}. Try

$\Gamma\mathnormal{\Gamma}\mathbf{\Gamma}$

enter image description here

The command \DeclareMathSymbol is used for assigning a meaning to characters or commands in math mode. The second argument contains the "kind" of symbol; \mathalpha means a symbol that obeys to the alphabet selection commands. The third argument is the alphabet used by default; the fourth is the slot in the font. All the standard declarations are in fontmath.ltx loaded at format creation time.

Notice that these declarations won't work if the default font encoding of the document is T1 instead of OT1, as operators refers to the ordinary Roman document font. One should define a new math alphabet, in this case.

How to do this when the document encoding is T1? One has to define a new symbol font:

\DeclareSymbolFont{otone}{OT1}{cmr}{m}{n}
\SetSymbolFont{bold}{otone}{OT1}{cmr}{m}{n}
\DeclareMathSymbol{\Gamma}{\mathalpha}{otone}{0}
\DeclareMathSymbol{\Delta}{\mathalpha}{otone}{1}
\DeclareMathSymbol{\Theta}{\mathalpha}{otone}{2}
\DeclareMathSymbol{\Lambda}{\mathalpha}{otone}{3}
\DeclareMathSymbol{\Xi}{\mathalpha}{otone}{4}
\DeclareMathSymbol{\Pi}{\mathalpha}{otone}{5}
\DeclareMathSymbol{\Sigma}{\mathalpha}{otone}{6}
\DeclareMathSymbol{\Upsilon}{\mathalpha}{otone}{7}
\DeclareMathSymbol{\Phi}{\mathalpha}{otone}{8}
\DeclareMathSymbol{\Psi}{\mathalpha}{otone}{9}
\DeclareMathSymbol{\Omega}{\mathalpha}{otone}{10}

Of course cmr can be changed into the document's main font family name, provided it contains Greek uppercase letters in its OT1 version; but it's just a matter of giving the correct slot numbers for the chosen font.

5
  • I tried your solution but \Gamma produces italic output. – N.N. Oct 5 '11 at 12:45
  • @N.N. Please, show a minimal example, as mine works. The suggested code must go after loading isomath. – egreg Oct 5 '11 at 12:59
  • pastebin.com/pxXkGuce produces i.imgur.com/f92xj.png. I use Ubuntu's TeX Live 2009 if that matters. – N.N. Oct 5 '11 at 13:03
  • @N.N. Sorry! I copied the wrong code! – egreg Oct 5 '11 at 13:06
  • Cheers, it works now! Do you mind including an explanation of what the lines of \DeclareMathSymbol does, i.e. their meaning, in your answer? Also, if there is an isomath solution I'd be interested to learn about it. – N.N. Oct 5 '11 at 13:10
3

isomath was written to set the math style to an 'ISO math style', as the author of the package puts it. Essentially, this means that it will be possible to typeset Greek letters (and non-Greek ones, for that matter) as bold italics, to denote vectors and matrices according to the ISO standard. It is possible to have upright letters, too. isomath requires OML font encoding. The isomath documentation (2011-01-14) states:

Currently only the mathdesign package provides upright fonts in OML encoding.

So, this package also needs to be loaded in order to obtain the correct fonts. LaTeX may otherwise display entirely different characters.

An example based on code snippets from the package documentation could be:

\documentclass[12pt,a4paper]{article}
\usepackage[utopia]{mathdesign}
\usepackage[OMLmathrm,OMLmathbf]{isomath} % options define which alphabets will be loaded, i.e. if bold face font is not necessary, `OMLmathbf` can be ommitted.
\begin{document}
$\Gamma$ $\mathrm{\Gamma}$ $\mathbf{\Gamma}$ $\mathbfit{\Gamma}$

$\pi$ $\mathrm{\pi}$ $\mathbf{\pi}$ $\mathbfit{\pi}$
\end{document}

The output will be:

enter image description here

It seems that the definition of the new math alphabets by isomath can lead to an error. To circumvent this, load the package with the option reuseMathAlphabets.

Known incompatibilities: fourierpackage

3
  • Thanks for you answer. How does this answer my question for a way to force all Greek letters to be typeset upright unless specified otherwise, e.g. to make it so that \(\Phi \Psi\) delivers the same output as \(\mathrm{\Phi \Psi}\)? – N.N. Oct 17 '11 at 8:14
  • 1
    I'm sorry if I could not give a satisfactory answer. Maybe you can define a new command: \newcommand{\upGamma}{\mathrm{\Gamma}}. Otherwise you need to change the fonts, as @egreg did in his answer. I'm afraid I don't have the skills to propose anything more 'general' that could substitute e.g. \Gamma with \mathrm{\Gamma}. (\renewcommand obviously doesn't work here.) – Count Zero Oct 17 '11 at 11:13
  • Note that you can specify any of the three upright families from mathdesign without loading the package, with, e.g. \usepackage[OMLmathrm, rmdefault=mdput]{isomath} for Math Design Utopia. – Davislor Dec 26 '20 at 20:51
0

An older font with upright Greek letters is AMS Euler. Loading eulervm or eulerpx will also set your Latin letters upright, but some packages have an option like eulergreek to set only the Greek letters to Euler. The stix and stix2 packages support Greek letters in \mathrm. There is also an upright Greek font in fourier. None of these are compatible with isomath or listed in its manual because they use an encoding other than OML.

The lucidamatx package supports math-style=upright. The mathdesign package supports greeklowercase=upright.

The kpfonts and mathdesign packages support the commands \alphaup\Omegaup. The upgreek package supports \upalpha\upOmega. Both newtxmath and newpxmath support \upGamma as well as \Gammaup, etc. The fourier package supports \otheralpha\otherOmega.

If using isomath, you can either load mathdesign and then \usepackage[OMLmathrm]{isomath}, or get the math design fonts with, for example, \usepackage[OMLmathrm, rmdefault=mdput]{isomath} for Math Design Utopia, or load an upright OML math font with \SetMathAlphabet. See table 3 in the isomath manual for the upright families that come in OML. (If you load mathdesign, I would recommend you load erewhon, garamondx or XCharter afterward to fix some bugs with its text fonts.)

I would recommend you use unicode-math in LuaTeX when you can, and legacy math fonts when you have to. All OpenType math fonts contain upright Greek letters that you can use with, for example, \symup{\pi}, \muppi or \uppi. You can also give unicode-math the package option mathrm=sym to make \mathrm{\pi} an alias for \symup{\pi}. If you do so, you should \setoperatorfont and make sure to write \textnormal{iff}, not \mathrm{iff}, for words in math mode. Finally, you can give unicode-math the option math-style=upright.

0

In fact, the documentation of isomath, Section 2.2.1 (for the 2012-09-04 version), provides several alternatives for setting upright greek letters in math mode. The one I liked the most, because it did not require changing the fonts I was using, was option (e):

e) Use the text character with the alphabeta package from the lgrx bundle:

\usepackage{amsmath}
\usepackage{alphabeta} 

and in the body

$ u = 2 \text{\pi} r $

Edit: As noted by Davislor, it is safer to use \textnormal instead of \text to prevent italics in italicized environments, such as Theorems.

$ u = 2 \textnormal{\pi} r $
1
  • 1
    You want \textnormal here. \text{\pi} will set \pi as italic if the surrounding text is italic, such as inside a theorem statement. – Davislor Dec 26 '20 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.