9

I was trying to type in upright greek letters in LaTex, and I've been recommended to use LuaLaTex with Unicode-math package to accomplish that.

However I ran into a weird issue. If I want to type in upright letter $\upmu$, it will be displayed as italicized. I can only get it by typing \mathrm{\mu}. Below is an example and its output. Am I missing something obvious here?

Thanks for your help.

enter image description here

\documentclass{article}
\usepackage{upgreek}
\usepackage{amsmath}
\usepackage{unicode-math}

\begin{document}
This will not work: $\upmu$ $\mitAlpha$

But this will work: $\mathrm{\mu}$ $\mathit{\Alpha}$
\end{document}
5
  • Do you want all Greek letters upright as standard or is the focus here only the single case of pi?
    – Joseph Wright
    Nov 26, 2014 at 9:49
  • Hi Joseph, only the single case. I looked up the table in unicode-math manual (ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/…) and it shows that the upright greeks should be produced by "\up*" commands. Just curious why this does not work here.
    – yuntaoc
    Nov 26, 2014 at 9:54
  • I agree the doc does seem to be confusing: I'll report this to Will. [An aside: You can get that file on your system using texdoc -l unicode-math or using the generic CTAN linke mirror.ctan.org/tex-archive/macros/latex/contrib/unicode-math/…
    – Joseph Wright
    Nov 26, 2014 at 10:12
  • 3
    @JosephWright: Imho it is not only a documentation problem. Like Manuel I do find it illogical that an \up.. command ends up italic. There should be a clear distinction between the layer of "fix" commands names that allows one to access a specific symbol (and which should be complete) and the layer of generic commands which are affected by math styles and other options. Nov 26, 2014 at 10:18
  • @UlrikeFischer Yes I agree, but at the least the docs should make this clear. I've sent Will an e-mail to say it needs addressing.
    – Joseph Wright
    Nov 26, 2014 at 10:22

3 Answers 3

7

How greek letter are typeset depends on the option math-style. With e.g. french both \upmu and \mu will be upright, with ISO both are italic. (I do find this confusing too, that \upXXX ends up italic ...). If you want to force upright mode for a single instance use a markup command like \mathup.

\documentclass{article}
\usepackage{amsmath}
\usepackage[math-style=ISO]{unicode-math} %or french, TeX, literal, upright

\begin{document}
$\upmu \mu x  $ 
$\mathup{\mu}$ 
$\mathit{\Alpha}$
\end{document}
16
  • 3
    If that's the expected behaviour, I think it's wrong. \itmu (or similar) should be italic and \upmu should be upright. Now the math-style should determine wether \mu equals \upmu or \itmu.
    – Manuel
    Nov 26, 2014 at 10:03
  • Thanks Ulrike, this reminds me a paragraph in the unicode-math manual that I did not quite understand (5.1 Math ‘style’). I am wondering if math-style controls the typeset, then what is the difference between \mu and \upmu in terms of unicode mapping?
    – yuntaoc
    Nov 26, 2014 at 10:07
  • @Manuel The name of italic variant is \mitmu (and like \upmu it changes with the math-style). And yes I would have found more logical too if both would not be affected by math-style.. Nov 26, 2014 at 10:08
  • 2
    Might be worth reporting this to Will: it's entirely non-obvious from unimath-symbols that \upmu only works 'as described` if math-styl is set to something other than TeX!
    – Joseph Wright
    Nov 26, 2014 at 10:11
  • @yuntaoc: \mu is defined as \mitmu. Nov 26, 2014 at 10:11
3
\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{XITS Math}
\setmathfont[math-style=literal,range={"00F0-"03D6}]{XITS Math}

\begin{document}
This will work: $\upmu\upalpha x$ $\mitAlpha$

But this will work: $\mathrm{\mu}$ $\mathit{\Alpha}$
\end{document}
5
  • Yes, but literal will affect also normal variables like x, and you would have to type them as \mitx etc if you want italic variables. Nov 26, 2014 at 10:09
  • 2
    Very true but I think entirely non-obvious from reading the docs!
    – Joseph Wright
    Nov 26, 2014 at 10:09
  • Sure, but it is no problem to define the literal style only for the greek letters. See edited answer.
    – user2478
    Nov 26, 2014 at 10:28
  • Well that's a good idea. Nov 26, 2014 at 10:30
  • @Herbert thanks for the alternative approach.
    – yuntaoc
    Nov 26, 2014 at 10:37
1

I’m going to assume the earlier answers were correct when posted, but in 2021, you really want \symup{\alpha}, etc. Using \mathrm will get you the font set by \setmathrm, which by default does not contain Greek letters. You can, however, pass unicode-math the mathup=sym package option to make \mathup an alias for \symup, and similarly mathrm=sym.

As of 2021, \upmu should work, and \mupmu has the old behavior of being equivalent to typing μ.

2
  • yes the whole set of \sym... commands were added in 2015 so Ulrike can be forgiven (although that is optional:-) github.com/wspr/unicode-math/blob/master/… Feb 13, 2021 at 14:17
  • @DavidCarlisle Thanks! I thought it was something like that. Since people are referring to this answer in 2021 and getting confused, it could use an update.
    – Davislor
    Feb 13, 2021 at 14:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .