5

I'd like to use unicode-math to use ISO-style fonts for my formulae. However, I'd like to use \pi instead of \uppi to create an upright pi. Unfortunately, my redefinition with \renewcommand doesn't work.

How can I redefine the meaning of \pi to give an upright pi, while sticking with math-style=ISO and bold-style=ISO for the remaining letters?

At the moment I have the following MWE:

\documentclass{article}

\usepackage[T1]{fontenc}

% Mathematics
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

% Font
\usepackage{fontspec}
\usepackage[math-style=ISO,bold-style=ISO]{unicode-math}
\setmathfont{Latin Modern Math}
\renewcommand{\pi}{\uppi} % doesn't work

\begin{document}
  \begin{align}
    \alpha \beta \Alpha \Beta\\
    \pi \uppi % these commands should show the same glyph
  \end{align}
\end{document}
Stefan
  • 865

1 Answers1

8

Until the range feature is fixed, you can use an indirect redefinition:

\documentclass{article}
% Mathematics
\usepackage{amsmath}

% Font
\usepackage{fontspec}
\usepackage[math-style=ISO,bold-style=ISO]{unicode-math}
\setmathfont{Latin Modern Math}

\AtBeginDocument{%
  \let\umathpi\pi
  \renewcommand\pi{\symup\umathpi}%
}

\begin{document}

\begin{gather}
\alpha \beta \Alpha \Beta
\\
\pi \uppi \mitpi
\end{gather}

\end{document}

enter image description here

Notes

  1. I don't recommend doing this; better define \cpi for “constant pi”, say \newcommand{\cpi}{\symup{\pi}}

  2. Loading amssymb and amsfonts is useless, as all symbols and fonts are already provided by unicode-math

  3. Don't load fontenc along with fontspec/unicode-math unless you have a very good reason to

  4. Never use the minimal class (see Why should the minimal class be avoided?)

egreg
  • 1,121,712