4

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}
  • My answer here, tex.stackexchange.com/questions/145926/…, may be of some use, depending on your implementation requirements.. – Steven B. Segletes Nov 9 '15 at 15:09
  • @StevenB.Segletes I was using your answer before, but it also comes with compatibility issues if one uses different classes, compilers and fonts. – thewaywewalk Nov 9 '15 at 17:50
  • 1
    I hadn't realized that we had already corresponded over that answer until I just went back and looked. Sorry for the redundant pointer. – Steven B. Segletes Nov 9 '15 at 19:03
3

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

  • I was using fontspec and unicode-math before with Minion Pro like in your answer, but as pxfonts looks the same I don't see the point of using it, as it is so damn slow. As it works with unicode-math my code is written like in your answer, but now I would like to change back to non-unicode fonts. Are you aware of a pxfonts-specific solution? Apart from that, the first Phi should be italic. – thewaywewalk Nov 9 '15 at 14:57
  • I don't know a pxfonts specific solution, Imho it would be rather difficult and time consuming to set it up. In legacy tex the greek symbols are spread around: some uppercase upright in OT1, some italic upper + lowercase in OML, the rest must probably be pulled from LGR. I changed the math-style to get an italic Phi. – Ulrike Fischer Nov 9 '15 at 15:09
  • Alright, it appears to me that the my best option is to use \deltaup etc. and in case I switch back to unicode math someday, redefine all greek letters by something like \let\deltaup\delta. I don't really know what to do with your answer now, I appreciate your help, but completely changing the font engine is not really a solution in my eyes. – thewaywewalk Nov 9 '15 at 15:29
  • Well you wrote "I accept "no" as an answer.", and that's what I'm saying in the first sentence. I expanded a bit regarding the "no" for the pxfonts. – Ulrike Fischer Nov 9 '15 at 16:04
  • That was the workaround I was looking for! thank you! And yes, now also the "no" is clearer ;) – thewaywewalk Nov 9 '15 at 17:45
2

You mentioned working with pxfonts and having tried pxgreeks. The only missing thing is that pxgreeks leaves the lowercase Greek letters of type mathord as done by package pxfonts. The uppercase Greek letters are already of variable type and you only need to use alphabet \mathfrak (sic) to get the upright variants.

Thus it is only a matter of modifying the mathcodes of the lowercase Greek letters to be of variable family. Here is how to do it for legacy engine pdftex:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{pxfonts}
\usepackage[ISO]{pxgreeks}
\usepackage{siunitx}

% make all lowercase Greek of "variable family"
% pdftex engine only.
% uppercase Greek are already of "variable family"
% from pxgreeks package.
\makeatletter
\@tfor\@tempa:=
\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \kappa \lambda \mu
\nu \xi \pi \rho \sigma \tau \upsilon \phi \chi \psi \omega \varepsilon
\vartheta \varpi \varrho \varsigma \varphi  
\do {% for some reason, must proceed in two steps
      \count255 \numexpr\@tempa+"7000\relax
      \expandafter\mathchardef\@tempa \count255 }
\makeatother


\begin{document}\thispagestyle{empty}
% slanted lowercase and uppercase Greek
\begin{equation}
    \Phi_{\delta} = \SI{42}{\micro\ohm} \cdot \delta_{\Phi} 
\end{equation}  

% use \mathfrak (sic) to get uppercase Greek...

\begin{equation}
    \Phi_{\mathfrak{\delta}} = \SI{42}{\micro\Omega} \cdot \delta_{\mathfrak{\Phi}} 
\end{equation}  

\begin{equation}
P_{\mathrm{d}} = \SI{42}{\nano\ampere} \cdot d_{\mathrm{P}} 
\end{equation}  

Use \string\mathfrak\space to get uppercase Greek !


$\Gamma \Delta
  \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega \alpha \beta \gamma
  \delta \epsilon \zeta \eta \theta \iota \kappa \lambda \mu \nu \xi \pi \rho
  \sigma \tau \upsilon \phi \chi \psi \omega \varepsilon \vartheta \varpi
  \varrho \varsigma \varphi $

$\mathfrak {\Gamma \Delta
  \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega \alpha \beta \gamma
  \delta \epsilon \zeta \eta \theta \iota \kappa \lambda \mu \nu \xi \pi \rho
  \sigma \tau \upsilon \phi \chi \psi \omega \varepsilon \vartheta \varpi
  \varrho \varsigma \varphi }$

\end{document}

Result:

italic and upright greek letters

  • works with lualatex as well, but is however not really a solution as it requires X_{\mathrm{\delta d}} to be splitted up in X_{\mathfrak{\delta}\mathrm{d}} because greek and latin behave not the same. – thewaywewalk Nov 10 '15 at 8:15
  • yes. And also \mathfrak {\foo} is not that much better than \fooup... as an aside with pxgreeks one can use \otheralpha, \otherGamma... to get the italic if the default is upright and vice versa. Last comment: except if you want a macro with \mathrm {#1} I think the ...up mark-up is clearer. With legacy fonts, \mathrm switches to a font, it is not a command to get "upright". Thus, one should rather define a command \upright which would do all the preliminary works, like switch to the "operator" family, and treat all math symbols which do not obey the switch. – user4686 Nov 10 '15 at 8:42
  • Sounds like a good idea, unfortunately I'm not familiar enough with core latex to get work, I wouldn't know where to start. I'm about to post a follow up question, where your comment maybe could be an answer, I post a link her ein some minutes. – thewaywewalk Nov 10 '15 at 8:47
  • Here we go... – thewaywewalk Nov 10 '15 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.