[texhax] Fwd: Re: Upright digits in theorems

Uwe Lück uwe.lueck at web.de
Tue Jun 20 00:31:36 CEST 2006

... all of a sudden, I've found a modification of my earlier
replaing package that stands eqnarray and align.
I hope I can transfer this sample file before my dream
fades away and I wake up.

Still there are problems I addressed before (cf. below)
wherefore I suppose this approach is not appropriate for
a professional/"large-scale" application.
Concerning optional number or glue arguments,
I would have an idea (default vs. individual modifications
of certain commands), but still again ...

I am forwarding a CTAN announcement on Perl
that may be helpful here (in case you know about Perl).

Wishing you that you won't have 20 TeX catastrophes
this day,


[I'm trying to indicate why I usually wish `Lucky TeXing'
  instead of `Happy TeXing'.]

>Date: Mon, 12 Jun 2006 23:54:34 +0200
>From: Uwe Lück <uwe.lueck at web.de>
>At 00:04 09.06.06, Alex Scorpan wrote:
> >Your package seems to collide with {align}, screaming
> >         ! Argument of \@replace has an extra }.
>In fact this happens with Standard eqnarray already.
>And I guess there are many (essentially) other ways
>to get this error.
>The present version of "righting" is kind of "anarchistic"
>in allowing some typesetting before all numbers have
>been replaced. These errors can be avoided by doing
>all replacements before typesetting the environment.
>I must go to bed before I demonstrate this.
>Anyway, this "raw replacing" approach has a
>weakness which I consider even more serious:
>\\[1ex] will produce another error. Well, one could
>devise a routine that doesn't replace within brackets
>-- but (i) some authors may intend that brackets
>are typeset, e.g.: `X is 1-[2-]symmetric if ...'
>(ii) digits in \item[...] *should* be "righted".
>So I am even more convinced than before that
>you better use special (virtual) fonts. My replacing
>macros rather are a toy or an exercise for
>baby TeX gurus.
-------------- next part --------------
% UprDigs.tex -- upright digits in theorem environments 
% Uwe Lueck 2006/06/19 to texhax for Alex Scorpan. 

% \usepackage{trace}

% General macros: 
% Modifying some theorem environment #1, 
% adding \upright at digits on the left: 
      \expandafter\expandafter\expandafter {% 
        \expandafter\expandafter\expandafter \upright at digits 
% What the added macro \uright at digits does: 
\def\upright at digits{% 
  \let\env at considered\@currenvir
  \let\env at content\start at env@content
  \gather at env@content}
\def\start at env@content{% 
\long\def\gather at env@content#1\end#2{% 
  \add at env@content{#1}\def\env at found{#2}% 
  \ifx\env at found\env at considered
    \add at env@content{\end{#2}}% 
    \expandafter\gather at env@content
\long\def\add at env@content#1{% 
  \expandafter\def\expandafter\env at content\expandafter{% 
    \env at content#1}}
  \env at content 
  \expandafter\end\expandafter{\env at considered}}
  \let\env at content\@empty 
  \long\def\@repl at ce##1#1##2\@nil{% %     \def\passed at by{##1}% 
      \add at env@content{##1}% 
%      \typeout{** \meaning\env at content\space **}% 
      \expandafter\env at content %       \expandafter \passed at by
%       \def\return at modified{% 
%         \passed at by\textup{#1}\replace#1##2\@nil}%
%       \expandafter\return at modified 
      \add at env@content{##1\textup{#1}}% 
      \def\@tempe{\@repl at ce##2\@nil}% 
      \expandafter \@tempe 
%     \fi \typeout{** \string\env at content\space \meaning\env at content\space **}}% 
  \@repl at ce} 
%   \expandafter \do at replace \env at content #1\@nil} 
% \def\do at replace#1#2{\let\env at content\@empty \@repl at ce}

% Applying example: 

% \tracingmacros=1 \tracingonline=1 
\begin{eqnarray} %% Standard LaTeX 
\begin{align}      %% AMS LaTeX 
Two more claims: 
\item 7 by 6 equals 42. 
\item 9 by 6 equals 54. 
% \tracingmacros=0

More information about the texhax mailing list