[texhax] Upright digits in theorems
Uwe Lück
uwe.lueck at web.de
Tue Jun 6 23:32:37 CEST 2006
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.
... maybe you it is for something like a journal where the
authors don't reliably use $...$ as you urge them. Then
here is a /second/ approach:
you can indeed replace 0 by \textup{0} etc. by TeX macros.
First store the content of the environment in a macro;
then let a loop (or a number of loops) go through the
tokens to which the storing macro expands in one step
...
I just have started to try this, but it needs some time,
and it's late now (here). I may provide you with a set
of macros doing this later if you can't do it on your
own but are interested. Just to convince you that I
am not boasting or so: I have made such macros in
some projects. E.g., currently I have a German text
over which single Latin words are scattered; they have
been marked as \lat{...} in an earlier conversion stage.
One task was to get `ae'-ligatures, i.e., \ae. I have
made \lat simply replace each `ae' in the argument of
\lat by `\ae' -- and it works. Roughly, there is some
\def\aelig#1ae{...\ae...} according to the tricks described
in the TeXbook. For your case, some \@tfor together
with several \@ifnextchar from the LaTeX kernel may be
easier.
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.
HTH -- Uwe.
More information about the texhax
mailing list