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.

448 Appendix D. L AT E X Programming<br />

which may be given in the preamble, even before \documentclass. It<br />

causes a list of all input files <strong>to</strong> be printed at the end of the processing,<br />

along with their version <strong>and</strong> release data. In this way, one has a record<br />

of just which files were included, something that may be of use when<br />

deciding <strong>to</strong> send a document file <strong>to</strong> another installation for processing<br />

there. Since any non-st<strong>and</strong>ard files may also have <strong>to</strong> be included, these<br />

may be more readily identified from such a listing.<br />

For example, the simple document file<br />

\documentclass{article}<br />

\usepackage{ifthen}<br />

\listfiles<br />

\begin{document}<br />

\input{mymacros}<br />

This is \te.<br />

\end{document}<br />

produces the listing<br />

*File List*<br />

article.cls 2001/04/21 v1.4e St<strong>and</strong>ard <strong>LaTeX</strong> document class<br />

size10.clo 2001/04/21 v1.4e St<strong>and</strong>ard <strong>LaTeX</strong> file (size option)<br />

ifthen.sty 2001/05/26 v1.1c St<strong>and</strong>ard <strong>LaTeX</strong> ifthen package<br />

mymacros.tex<br />

***********<br />

In this case, the local file mymacros.tex contains no version information<br />

because it is missing a \ProvidesFile comm<strong>and</strong>.<br />

What should one do if a local file, such as mymacros.tex above, is<br />

needed for the processing of a document file that is <strong>to</strong> be sent elsewhere?<br />

One could send it along with the main file, but that requires giving the<br />

recipient more instructions on what <strong>to</strong> do. Or, its contents could simply<br />

be included in the main file, for shipping purposes. For a package file,<br />

this is not so easy, since internal comm<strong>and</strong>s containing the @ sign would<br />

cause trouble, <strong>and</strong> the options would not be h<strong>and</strong>led properly. For this<br />

purpose, we have the environment<br />

\begin{filecontents}{file name}<br />

file contents<br />

\end{filecontents}<br />

which may only appear at the very beginning of the document, before the<br />

\documentclass comm<strong>and</strong>. It tests <strong>to</strong> see if there is a file on the system<br />

with the name file name, <strong>and</strong> if not, it writes its contents literally <strong>to</strong> a file<br />

of that name. This may be a package file that is subsequently input with<br />

\usepackage. In this way, the missing non-st<strong>and</strong>ard files can be ported<br />

<strong>to</strong>gether with the main document file.<br />

If we extend the above simple example by including at the very start

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

Saved successfully!

Ooh no, something went wrong!