LaTeX lets you split a large document into several smaller ones. This can simplify editing or allow multiple authors to work on the document. It can also speed processing.
Regardless of how many separate files you use, there is always one root file, on which LaTeX compilation starts. This shows such a file with five included files.
\documentclass{book} \includeonly{ % comment out lines below to omit compiling pref, chap1, chap2, append, bib } \begin{document} \frontmatter \include{pref} \mainmatter \include{chap1} \include{chap2} \appendix \include{append} \backmatter \include{bib} \end{document}
This will bring in material from pref.tex, chap1.tex, chap2.tex, append.tex, and bib.tex. If you compile this file, and then comment out all of the lines inside \includeonly{...}
except for chap1
, and compile again, then LaTeX will only process the material in the first chapter. Thus, your output will appear more quickly and be shorter to print. However, the advantage of the \includeonly
command is that LaTeX will retain the page numbers and all of the cross reference information from the other parts of the document so these will appear in your output correctly.
See Larger book template, for another example of \includeonly
.
• \endinput | Stop including material from a file. | |
• \include & \includeonly | Conditionally include files. | |
• \input | Unconditionally include a file. |
© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/Splitting-the-input.html