# [texhax] Upright digits in theorems

Uwe Lück uwe.lueck at web.de
Thu Jun 8 22:15:41 CEST 2006

At 23:32 06.06.06, Uwe Lück wrote:
>At 16:11 06.06.06, Alex Scorpan wrote:
> >What is the most elegant and robust way to arrange that digits and
> >such always display upright inside a theorem-like environment, when
> >the surrounding text is italic?  This is for a rather large-scale
> >application.
>
>you can indeed replace 0 by \textup{0} etc. by TeX macros.

Attached is a demo .tex containing macros for these replacements.
A macro \UprightDigitsInEnv modifies an environment for them
after the environment has been defined.

This was more difficult than I expected. My first "multi-tasking"
package -- in a way. First, each of ten replacement processes
does its first move. During typesetting the environment, at
every digit the corresponding process does its next move.

This version doesn't "right" a digit within curly braces.
Some refinement could do this. And I would not bet that
I could find a refinement that also "rights" digits that appear
only after expansion. (The item labels in the demo exemplify
this.) Here your active characters approach would be superior
wrt this. Maybe for the latter approach it suffices to modify
\label and \ref such that the active digits just expand to their
"other" versions. I still think that the font approach is most
clean (see below for recalling).

Cheers,
Uwe.

>A /third/ approach: let \itshape etc. expand such that
>not standard italic/slanted fonts are used, rather your
>own variants where only letters are slanted (italic), not
>the digits. In this case I really rather guess, I only have
>a rough idea of METAFONT, I sometimes read .mf files,
>I would not be able to make .mf files that would be
>needed for this approach. -- Probably the most reliable
>approach -- e.g., the above second approach would have
>difficulties (hence at least not very elegant) with digits
>that only appear after expansion of some macros used
>by the author. -- I guess the most elegant solution for
>this third approach are the so-called "virtual fonts"
>-- someone else should advise on this.