Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

While reading "TeX for the impatient" on the topics of iftrue and iffalse, I encountered this example,

\def\test#1#2{\ifnum #1>#2 \isbigger \else \isnotbigger \fi}

\test{3}{6} \bigger$3>6$\else$3\le6$\fi \par

thinking I can do better than that, as shown below

\def\test#1#2{\ifnum #1>#2 \true#1#2 \else \false#1#2 \fi}

\test{3}{6} \par
\test{6}{3} \par.

But wait, the book example, I wonder, may have an unsound signal(s) burried in it which I did not notice. So I explored and located this (What is iffalse for What is \iffalse for?), addressed in to find a direction leading to newif command, thus continuing my try of what follows

\def\test#1#2{\ifnum #1>#2 \biggertrue \else \biggerfalse \fi
\test{3}{6} \par
\test{6}{3} \par.

Satisfied with the exercies tried, I still have some concerns. Is this the burried signal I am looking for? Are there other directions that the shown programming techniques in the book are useful/crucial?

share|improve this question
I don't understand. What does "unsound" or "buried signals" mean? –  Werner Aug 19 '13 at 7:02
What I tried to say is that my code, in my view, can achieve the same results as those in the book. Is there an untold story on when to use \iftrue or \iffalse notion for that example on page 239? What are the focus/situation of using \iftrue or \iffalse? –  Jesse Aug 19 '13 at 8:32
After \newif\ifbigger, \biggertrue and \biggerfalse are just \let\ifbigger=\iftrue and \let\ifbigger=\iffalse, so the third code is exactly the same as the first one. –  egreg Aug 19 '13 at 8:46
@egreg -- Is it fair to say that one should avoid using \iftrue or \iffalse because \newif technique is sufficient? –  Jesse Aug 19 '13 at 10:37
@Jesse \iftrue and \iffalse can sometimes get handy, but in general the \newif abstraction is better. –  egreg Aug 19 '13 at 10:45

1 Answer 1

up vote 8 down vote accepted

Your original example is somewhat odd. The idea behind it is to define a new command \bigger which you can use in subsequent tests. The whole point is that \bigger is separate from \test, so your second example doesn't replicate its functionality. The reason I call it ‘odd’ is that the code

  % true code
  % false code

doesn't quite ring true to me — but I'm long accustomed to seeing such conditionals begin with \if….

The \bigger definition code is how \newif works internally, which you've now discovered. For what you're interested in, it's a reasonable approach to take. You may, however, be interested in alternative approaches (http://tex.stackexchange.com/a/5896/179). In terms of traps to be aware of, it can be better to avoid using \iftrue and \iffalse in general (http://tex.stackexchange.com/a/2951/179).

share|improve this answer
thanks for the speedy response and directions. Oh, just to clarify, the odd code is from the book which indeed puzzles me too, but it works. –  Jesse Aug 19 '13 at 17:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.