I really like how Steven is generating upright greek letters in his answer:

\documentclass[a4paper]{article}
\newsavebox{\foobox}
\newcommand{\slantbox}[2][0]{\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}
\newcommand\unslant[2][-.25]{\slantbox[#1]{$#2$}}

\newcommand\ualpha{\unslant\alpha}
\newcommand\ubeta{\unslant\beta}
\newcommand\ugamma{\unslant\gamma}

\begin{document}
$\alpha\beta\gamma$ \par
$\ualpha\ubeta\ugamma$ \par

$X_{\alpha\beta 123}$ \par
$X_{\ualpha\ubeta 123}$ \par
\end{document}


However, when it comes to subscripts, it just does not look right:

Especially the gap between the letters and the numbers looks bad and the come out way too big.

I experimented with

\newcommand\unslant[2][-.25]{\slantbox[#1]{$#2\!$}}


but now it comes out badly in normal text:

Is there any solution to get it work? Or do I need to define separate commands, for both cases subscripts and normal?

I'd like to avoid to return to packages like upgreek, which just doesn't fit a lot of fonts. But I didn't had these problems though.

Splitting up the definitions would work, not perfect but on could live with it:

\newcommand\ualpha{\unslant\alpha}
\newcommand\ubeta{\unslant\beta}
\newcommand\ugamma{\unslant\gamma}
\newcommand\sualpha{\scriptsize\unslant\alpha\kern-0.075em}
\newcommand\subeta{\scriptsize\unslant\beta\kern-0.07em}
\newcommand\sugamma{\scriptsize\unslant\gamma\kern-0.07em}

\begin{document}
$\alpha\beta\gamma$ \par
$\ualpha\ubeta\ugamma$ \par

$X_{\alpha\beta 123}$ \par
$X_{\sualpha\subeta 123}$ \par
\end{document}


But is that really necessary?

• aside from the fact that this question specifies bold, the solution offered should work as well in your case: Upright, boldface, lowercase, greek math symbols with cbgreek glyphs. the change needed should be to replace the bold and bx in the line \SetSymbolFont{upgreek}{bold}{LGR}{cmr}{bx}{n}] by U and m. (not tested.) – barbara beeton Apr 5 '15 at 12:46
• You could use \let\oldalpha=\alpha \def\alpha{\upslant{\oldalpha}} for every character. You can put it in a separate file and use \input to load it in the preamble. – John Kormylo Apr 5 '15 at 18:14
• @barbarabeeton I don't see how this should solve my problem. I don't want to use the upgreek package and subscripts are not mentioned in your linked answer neither. – thewaywewalk Apr 5 '15 at 18:44
• @JohnKormylo could you specify what you mean? My question contains a minimal working example. Also I don't see how it solves the problem with the subscripts – thewaywewalk Apr 5 '15 at 18:45

1. I did a small \mkern and minus \mkern around each character to better align them with the slanted counterparts; and

2. More importantly, I used the \ThisStyle{...\SavedStyle...} syntax of the scalerel package to preserve the math style of the argument.

Here is the MWE.

\documentclass[a4paper]{article}
\usepackage{scalerel}
\newsavebox{\foobox}
\newcommand{\slantbox}[2][0]{\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}
\newcommand\unslant[2][-.25]{%
\mkern1mu%
\ThisStyle{\slantbox[#1]{$\SavedStyle#2$}}%
\mkern-1mu%
}

\newcommand\ualpha{\unslant\alpha}
\newcommand\ubeta{\unslant\beta}
\newcommand\ugamma{\unslant\gamma}

\begin{document}
$\alpha\beta\gamma$ \par
$\ualpha\ubeta\ugamma$ \par

$X_{\alpha\beta 123}$ \par
$X_{\ualpha\ubeta 123}$ \par
\end{document}


The problem is that \unslant put the unslanted character on the right edge of the space originally needed for the slanted version. The following variation centers the unspanted character in the same space.

\documentclass{article}
\usepackage{mathtools}

\newsavebox{\foobox}
\newlength{\foodim}
\newcommand{\slantbox}[2][0]{\mbox{%
\sbox{\foobox}{#2}%
\foodim=#1\wd\foobox
\hskip \wd\foobox
\hskip -0.5\foodim
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
\hskip 0.5\foodim
}}
\newcommand\unslant[2][-.25]{\slantbox[#1]{$#2$}}

\let\oldalpha=\alpha
\def\alpha{\unslant{\oldalpha}}
\let\oldbeta=\beta
\def\beta{\unslant{\oldbeta}}
\let\oldgamma=\gamma
\def\gamma{\unslant{\oldgamma}}

\begin{document}
$\alpha\beta\gamma$ \par

$X_{\alpha\beta 123}$ \par
\end{document}


• In this answer the subscripts have the same size as the normal letters. Thats not the idea. Apart from that, the answer is practically identical to the accepted one? – thewaywewalk Apr 21 '15 at 16:26
• I just used and referenced your answer at tex.stackexchange.com/questions/239791/… – Steven B. Segletes Apr 21 '15 at 16:35
• @thewaywewalk John's answer adds value to my own answer in that he achieves the horizontal spacing correction directly inside the \slantbox, rather than relying on an externally applied \mkern as I do. I take his answer as a suggested improvement to my own, though you are correct in pointing out he does not preserve the math style. – Steven B. Segletes Apr 21 '15 at 16:37
• @StevenB.Segletes I see! But I could just combine both answer, right? – thewaywewalk Apr 21 '15 at 16:40
• It was originally posted April 5 to the wrong question. I was just moving it to the right question. – John Kormylo Apr 21 '15 at 16:41