I'm currently using the following approach to conditionally display/hide parts of my document:
% PREAMBLE
\def\MyVersion{1}
% BODY
\ifnum\MyVersion=1
This is version one.
% possibly other paragraphs, math blocks, tables, figures, etc
\fi
\ifnum\MyVersion=2
This is version two.
% possibly other paragraphs, math blocks, tables, figures, etc
\fi
To tidy up a bit, I tried to define macros for the \ifnum and \fi statements in the preamble:
\def\StartVersionOne{\ifnum\MyVersion=1}
\def\StopVersionOne{\fi}
\def\StartVersionTwo{\ifnum\MyVersion=2}
\def\StopVersionTwo{\fi}
However, this produces the following error:
! Incomplete \ifnum; all text was ignored after line ...
Strangely, everything works if I only use the \StartXXX macros and not the \StopXXX macros.
Can anyone explain what is going on? Am I defining the macros wrongly for \fi?
commentpackage. For ConTeXt, you can use Modes. Perhaps you can look at the implementation of these solution to see how to implement the same in plain TeX. – Aditya Feb 16 '11 at 22:33