[texhax] Organizing A Big LaTeX File
David C. Walden
dave at walden-family.com
Sat Mar 18 14:50:12 CET 2006
At 12:37 AM 3/18/2006, you wrote:
>I'm writing a report for a project, which is about 30 pages or so. It
>would be good if I could split up things into several different folders.
>I'm thinking of one folder for my TeX files, another for my EPS files.
>When I compile with LaTeX, I run through every single file. Is it
>possible to arrange things in such a way that I only compile those files
>which have changed? That I can glue the files together in some way at the
>end?
Read about \include and \includeonly, e.g.,
\documentclass...
%\includeonly{file-1}
%\includeonly{file-2}
%\includeonly{file-1,file-3}
\begin{document}
\include{file-1}
\include{file-2}
...
\include{file-n}
\end{document}
If all of the \includeonly statements are commented out, you compile
everything. By un-commenting an \includeonly line you compile only
the files listed in the command. I put my .eps files in a subfolder
called figures in the folder where my LaTeX files are. Then, I can
say \includegraphics{figures/figure-i} in any of my LaTeX files. There is
no need to ever put all the LaTeX files together in one file; you just
comment out all \includeonly commands.
The above doesn't take care of automatically deciding whether to compile
files that have changed; I have to comment and uncomment the \includeonly
command for the file I am currently editing and recompiling. If you compile
that whole first draft first, LaTeX remembers about cross-references
to files you are not currently compiling.
[I don't keep up on what is denigrated practices, so I don't know
about the propriety of the above, but that is what I do.]
More information about the texhax
mailing list