Generalifthenelse help

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
ivanwest
Posts: 10
Joined: Fri Jul 11, 2008 1:04 am

ifthenelse help

Post by ivanwest »

Hi all,

another beginner question if I may?

Doing my thesis I have several files F1, F2, F3,....
and then a file Final.tex which inputs the above files for compiling my thesis.
I also have another seperate file called thesis_pre.tex (preamble)

Each of the files (including Final.tex) inputs thesis_pre.tex at the begining of the document.
The problem is, when I need to run Final.tex I have to go to each file (F1, F2,...) and manually comment out the input command for the preamble file.
I would like to be able to have a ifthenelse command that turns the inputs off in the files when I run the Final.tex. if this is possible.

Thank you in advance for any help given.

Cheers
Ivan :D

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
T3.
Posts: 208
Joined: Fri Mar 14, 2008 12:58 pm

ifthenelse help

Post by T3. »

The standard solution to this problem in LaTeX is to use \include commands instead of \input and then control which files are included for compilation with \includeonly command.

If you insist on using \input then this thread might be of interst to you. One solution to your problem is to put something like this in all your files:

Code: Select all

\ifx\PreambleLoaded\Undefined
\input{thesis_pre.tex}
\fi
Then in the preamble define \PreambleLoaded to prevent preamble loading in subsequent files:

Code: Select all

\def\PreambleLoaded{yes}
Cheers,

Tomek
Post Reply