[texhax] Large Project

Philip TAYLOR P.Taylor at Rhul.Ac.Uk
Wed Dec 23 22:31:42 CET 2009



Aditya Mahajan wrote:

> Another option with plain TeX is that, in addition to having a separate
> tex file for each chapter, also more all your macros to a separate file,
> say preamble.tex. Then, in preamble.tex define a macro
>
> \def\mypreambleloaded{\relax}
>
> and start the individual chapter files by
>
> \ifx\undefined\mypreambleloaded \input preamble \fi
>
> Then you can compile each file individually without making any changes
> in the sources.

Well, if you're going that route, you could put the intelligence
into the preamble itself :

% Preamble.TeX

\expandafter
\ifx \csname preamble already loaded\endcsname \relax
      \message {Preamble loading ...}
      \edef \next
          {\let \csname preamble already loaded\endcsname
              = \noexpand \empty
          }
\else
      \message {Preamble already loaded.}
      \let \next = \endinput
\fi
\next

<remainder of preamble>

and then each chapter file need simply \input Preamble

Philip TAYLOR





More information about the texhax mailing list