28.03.2013 Views

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

D.2. L AT E X programming comm<strong>and</strong>s 447<br />

<strong>and</strong> the processing continues. Warnings may be split in<strong>to</strong> several lines<br />

with the \MessageBreak comm<strong>and</strong>, just like error texts.<br />

Two last comm<strong>and</strong>s of this type are<br />

\ClassInfo{class name}{info text}<br />

\PackageInfo{package name}{info text}<br />

which write their texts only <strong>to</strong> the transcript file, <strong>and</strong> not <strong>to</strong> the moni<strong>to</strong>r.<br />

They are otherwise just like the corresponding NoLine warnings.<br />

D.2.8 Inputting files<br />

Files other than classes <strong>and</strong> packages may also be input, in which case it<br />

is often desirable <strong>to</strong> make sure that they exist beforeh<strong>and</strong>. Or, alternative<br />

actions might be taken depending on the existence of a certain file. These<br />

goals are met with<br />

\IfFileExists{file name}{true}{false}<br />

\InputIfFileExists{file name}{true}{false}<br />

Both these comm<strong>and</strong>s test for the presence of the specified file name in<br />

the area that L AT E X is looking for files, <strong>and</strong> execute true if it is found,<br />

otherwise false. In addition, \InputIfFileExists reads in that file after<br />

executing true.<br />

These comm<strong>and</strong>s are not restricted <strong>to</strong> the preamble, nor <strong>to</strong> class or<br />

package files. In fact, the regular \input comm<strong>and</strong> is defined in terms of<br />

them.<br />

Many special classes make use of these comm<strong>and</strong>s <strong>to</strong> read in a local<br />

configuration file. For example, the class ltxdoc contains<br />

\InputIfFileExists{ltxdoc.cfg}<br />

{\typeout{Local config file ltxdoc.cfg used}}<br />

{}<br />

just before \ProcessOptions is called. This allows one <strong>to</strong> have a local<br />

configuration that might specify<br />

\PassOptionsToClass{a4paper}{article}<br />

for a European installation, without altering the files that are processed<br />

with the ltxdoc class.<br />

D.2.9 Checking files<br />

Although not really part of programming, two L AT E X features <strong>to</strong> keep track<br />

of input files are described here. The first of these, already mentioned in<br />

Section 9.1.1, is the comm<strong>and</strong><br />

\listfiles

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!