[texhax] Query : why can \ifnum comparison operators not be \let, yet \def is OK ?
Philip Taylor
P.Taylor at Rhul.Ac.Uk
Wed Feb 3 10:45:12 CET 2016
I am puzzled by the following behaviour. All of my TeX work these days
is XML based, which means that as soon as I am ready to \input the first
XML file, "<" must be active.
Wishing to compile only a subset of chapters, I added a test to inhibit
XML files being \input if they were not required. I was then very
puzzled by the diagnostic :
> This is XeTeX, Version 3.14159265-2.6-0.99991 (TeX Live 2014/W32TeX)
(preloaded format=xetex)
> restricted \write18 enabled.
> entering extended mode
> (./untitled-4.tex
> ! Missing = inserted for \ifnum.
> <to be read again>
> \lessthan
> \Chapter ...{{Chapter #1}{#2}} \ifnum #1\lessthan
> \maxchapter \def
\next {\i...
> l.22 \Chapter 1 {Introduction}
>
> ?
The code in question reads as follows, and all is well if the \def is
not commented out; however, with the \def commented out and falling back
on the preceding \let, \ifnum fails as above. Could someone explain
this, please ?
\newcount \maxchapter
\maxchapter = 1
\catcode `\< = \catcode `\@
\let \lessthan = <
% \def \lessthan {<}
\catcode `\< = \active
\def \Chapter #1 #2%
{
\vfill \eject
\mark {{Chapter #1}{#2}}
\ifnum #1\lessthan \maxchapter
\def \next {\input #1.xml}
\else
\let \next = \relax
\fi
\next
}
\Chapter 1 {Introduction}
\end
More information about the texhax
mailing list