[Tex/LaTex] Upright Lowercase $\pi$ as Default


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:

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:

\setmathfont{xits-math.otf}    %I use MinionMath-Regular.otf but should work the same

 \verb|\pi| = \pi $\pi$       
 %I put both \pi and $\pi$ here just to show that it can work in and out of math mode.


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):

upright vs italic pi

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.

\setmainfont{Minion Pro}
  \verb|\pi|:            & $\pi$                 \\
  \verb|π|:              & $π$                   \\
  \verb|π| in text mode: & π \emph{π} \textbf{π} \\

enter image description here