Add at the end of each chapter file
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "THEMAINFILE"
%%% End:
to point AUCTeX to the main file. Furthermore, (quoting the AUCTeX manual)
if you often use \include
or \input
, you should make AUCTeX aware of the multi-file document structure. You can do this by inserting (setq-default TeX-master nil)
into your init file. Each time you open a new file, AUCTeX will then
ask you for a master file.
Or, if you usually use the same master filename
You should always set this variable to the name of the top level document. If you always use the same name for your top level documents, you can set TeX-master in your .emacs
file.
(setq-default TeX-master "master") ; All master files called "master".
There has not been any answer per se to the question so far. But we got some
very helpful comments (and links). The following is an accumulated
version of responses received so far (with further link traversals
where necessary).
The following are not mutually exclusive and definitely not
categorizations. Once you get the hang of them (all or some), you are free
exercise your own styles and tricks to get your work done,
a little faster.
Divide the document into individual files: Rather than preparing single
large file, the document should be divided into separate .tex files
There are number of ways to choose from.
- If you are using
\input
to include your files, you can simply comment out
the relevant command for the file which you do not want to \input
.
- If you are using
\include
, the scenario is almost similar to the
above. But the added benefit will be that this allow you to include
specific files using \includeonly{filename,filename2,...}
to save
times.
An excellent discussion on LaTeX modular documents can be found
here. Relative
benefits of \input
versus \include
have been further elaborated
in this
question.
Effectively Build only a Part of the Presentation File: This is more
applicable when you are making minor changes to your presentations.
Your friend here is the \includeonlyframes
command, which allows you
to selectively include some frames. The following
is an excerpt from the The beamer Class
User Guide,
\includeonlyframes{⟨frame label list⟩}
This command behaves a little bit like the \includeonly
command:
Only the frames mentioned in the list are included. All other frames
are suppressed. Nevertheless, the section and subsection commands are
still executed, so that you still have the correct navigation bars. By
labeling the current frame as, say, current and then saying
\includeonlyframes{current}
, you can work on a single frame quickly.
The ⟨frame label list⟩ is a comma-separated list (without spaces) of
the names of frames that have been labeled. To label a frame, you must
pass the option label=⟨name⟩
to the \frame
command or frame
environment.
Example:
\includeonlyframes{example1,example3}
\frame[label=example1]
{This frame will be included. }
\frame[label=example2]
{This frame will not be included. }
\frame{This frame will not be included.}
\againframe{example1} % Will be included
See this answer to get
some very helpful examples. Also do not miss this interesting
idea
of modifying \includeonlyframes
to take a wild card. Do you see the prospect here? You can label your similar (group of) slides with names
which can be represented as <string>*
. Someone even
suggested that this feature should be added to the next beamer
release.
Use a Temporary/Work File: This method is mostly applicable when you
are working (most likely building for the first time) on a presentation or
something like a chess puzzle.
For presentations, prepare a main file, copy it to another build
file. Delete everything between \begin{document}
and \end{document}
in
the build file. Prepare a slide (or a group of slides) in the build
file. Cut and paste the contents between \begin{document}
and
\end{document}
in the build file to relevant location in the main file
only when satisfied with the output (image locations, overfull boxes
etc.)
For chess puzzles, use a work file (with templates for cut and paste),
then copy each slide to a file until it fills to a number of puzzles,
then start another file.
standalone
package: This package allows TeX pictures or other TeX
code in sub-files to be compiled standalone or as part of a main
document. It also provides support for pictures with beamer overlays.
A detailed description of this package will make the answer very
lengthy. You will get more help reading the documentation. I found
this answer facilitating
a quick learning. Also, see this interesting discussion on floats in
standalone
.
Best Answer
Any document that requires information to be written to and read from an ancillary file will need compiling more than once. These include documents that contain
\ref
, orvref
fromvarioref
, orcref
fromcleveref
\tableofcontents
,\listoffigures
,\listoftables
\thumbsoverview
(thumbs package)In particular, one would need to compile more than once if any of the above has cause to change- for example, you add a new section to your document, which would necessarily change the
\tableofcontents
.Of course, in the case of
bibliographies
andindexes
one would need to runbiblatex
(orbiber
) ormakeidx
between multiple compilations to ensure that these are kept up to date.Following Gonzalo's comment, there are also cases in which no ancillary files are involved as is the case with some table-building packages which require several passes to calculate the proper elements of the table (
longtable
, for example); or code usingPGF/TikZ
specially when using theremember picture/overlay
options.