Another bugs? \advance\prevdepth, \ifnum

Martin Bily BILY at cs.felk.cvut.cz
Mon Aug 14 12:28:49 CEST 2000


From: Bernd Raichle <raichle at Informatik.Uni-Stuttgart.DE>


On Saturday, 12 August 2000 11:19:04 +0200,
Hans Ginzel <Hans at kolej.mff.cuni.cz> writes:
[... \prevdepth ``mystery'' ...]
 >    I consider this as bug. If it is knowen, I am sorry.

...was answered by Pierre McKay.

 > But where to
 > search for knowen bugs?

Browse through the old bug reports and answers of Don Knuth.  Some of
the older ones can be found on CTAN ( in digests/tex-implementors/).
>From DEK's answers you can get a feeling what can be seen as a bug...



 >    Three years ago I submited to our local group yet another suspicious
 > matter. Nobody gave me a seriose answer.
 >
 > 	\edef\a{\ifnum1<2\else\fi}\show\a	% macro: \relax
 > 	\edef\b{\ifnum1<2 \else\fi}\show\b	% like \empty
 >
 >    But this is probably autors goal. Can you explain, please?

The reason is simple: \ifnum, its condition, \else and \fi are
evaluated in TeX's macro processor without going to the command
processor (i.e. expansion only).  If the macro processor is still
evaluating the if condition and finds an \else, \or, or \fi in the
input stream, TeX magically inserts a \relax token (which is a
non-expandable token) to stop further expansion.  Now the macro
processor can complete evaluating the if-condition and the appropriate
if-branch can be chosen.
  Without the ``trick'' inserting a non-expandable token, the internal
TeX functions would be more complex to communicate which of the
probably nested if-conditions are completed.  (Try to extend TeX.web
to avoid inserting a \relax for things like \ifnum\ifnum\ifnum1<2
0\else 1\fi 0<1\fi 1<2\fi !).


Best wishes,
  -bernd


To remember:
  13.-18.08.2000: TUG 2000 -- 21st annual meeting of the TeX User Group
                  Wadham College, Oxford, UK
    6.+7.10.2000: 23. Mitgliederversammlung von DANTE e.V.
                  Fern-Universitaet in Hagen
 >>>> Subscribe:  http://www.dante.de/dante/mv/mv23/ <<<<
_____________________________________________________________________
Bernd Raichle                                  "Le langage est source
Autor des `german.sty' (aktuell: v2.5e)         de malentendus"
					       (A. de Saint-Exupery)





More information about the csTeX mailing list