This question has helped me in creating a command for my own package (more a list of commands I defined) to force upright lowercase \pi
, and so in my package I have the following code:
\renewcommand{\pi}{\text{$\mathup{π}$}}
I don't want to include my entire package here because it's huge. So, as a simpler example, when I run the following code (in LuaLaTeX) it works fine and the pi becomes upright:
\documentclass{article}
\usepackage{unicode-math}
\usepackage{amsmath}
\setmathfont{xits-math.otf} %I use MinionMath-Regular.otf but should work the same
\begin{document}
\renewcommand{\pi}{\text{$\mathup{π}$}}
\verb|\pi| = \pi $\pi$
%I put both \pi and $\pi$ here just to show that it can work in and out of math mode.
\end{document}
But, it only shows pi as uppercase this for that particular line! If I go to another place in the document and try $\pi$
, it reverts to italicised! Since I'd rather not have to type in $\mathup{\pi}$
or $\mathrm{\pi}$
each time, is there any way to force this command as a default instead?
Below is a screenshot of what I would like as default (left) and what I wish to avoid (right):
Best Answer
I would follow egreg's comment, all italic, or all upright. In case it's a special occasion, then don't redefine
\pi
but define another command.