[Tex/LaTex] Make greek letters behave like normal letters in math mode – default italic and responsive to mathrm

fontsgreekmath-mode

This topic has been discussed several times, but amongst all the answers, I couldn't find any suiting my needs.

I'm looking for a way to use greek letters the same way I'd use normal letters, means uppercase as well as lowercase letters should should be italic by default and responsive to the command \mathrm.

For uppercase greek letters the issue is easy to fix, on the one hand I can use the package isomath which, however completely breaks something like \mathrm{delta} (ffi is printed) and on the other hand there is pxgreeks which is exclusive to pxfonts-font package which is a requirement I'd like to avoid. \mathrm{delta} still prints an italic delta in this case

In both cases everything works fine for uppercase greek letters, but it does not work for lowercase greek letters.

So is there any way to make the first line in my MWE to behave exactly like the second line?

enter image description here

(I accept "no" as an answer.)


I was using unicode-math before, where it works out of the box, but as the fonts I'm using are avaiable as non-unicode fonts, I don't want to bother with the slow unicode-math/fontspec anymore.


I try to avoid the use of packages like upgreek which provides macros like updelta or pxfonts's deltaup as I'm cross-using my code in different document classes (article, scrbook, beamer, IEEEtran) with different fonts and I'm always facing incompatibility issues.

A pxfont-specific solution would help me also, though something generic is desirable.

Thank you.


MWE

\documentclass{article}

\usepackage[utf8x]{luainputenc}
\usepackage[T1]{fontenc}
\usepackage{pxfonts}
\usepackage{siunitx}
%\usepackage{isomath}
%\usepackage[ISO]{pxgreeks}

\begin{document}
\begin{equation}
    \Phi_{\mathrm{\delta}} = \SI{42}{\micro\Omega} \cdot \delta_{\mathrm{\Phi}} 
\end{equation}  
\begin{equation}
P_{\mathrm{d}} = \SI{42}{\nano\ampere} \cdot d_{\mathrm{P}} 
\end{equation}  
\end{document}

Best Answer

Imho there is no chance for a generic solution in legacy tex. There are always some small differences between the math font packages.

Regarding a pxfonts specific solution: Imho it is not impossible but it would be time consuming to set it up. In legacy tex the greek symbols are spread around: Some uppercase upright greek chars in OT1, some italic upper + lowercase in OML, the rest must probably be pulled from LGR, in the case of the pxfonts from the special font provided by the package. If you really cared only about \mathrm you could probably do something like this:

\documentclass{article}
\usepackage{amsmath}
\usepackage{pxfonts}
\let\deltait\delta

\makeatletter
\renewcommand\delta
 {%
   \ifnum\fam=0 \deltaup\else \deltait\fi
 }

\begin{document}

\begin{equation}
\delta \mathrm{\delta} 
\end{equation}

\end{document}

But it wouldn't expand to \mathbf and so I don't consider it a real solution.

But with xelatex/lualatex and unicode-math your example works fine (I changed the \Omega to \ohm in the \SI-argument):

\documentclass{article}

\usepackage[math-style=ISO]{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}
\usepackage{siunitx}

\begin{document}
\begin{equation}
    \Phi_{\symrm{\delta}} = \SI{42}{\micro\ohm} \cdot \delta_{\symrm{\Phi}} 
\end{equation}
\begin{equation}
P_{\symrm{d}} = \SI{42}{\nano\ampere} \cdot d_{\symrm{P}}
\end{equation}
\end{document}

enter image description here