I've seen this mentioned often, for example, in several answers here. But I have my doubts. Do LaTeX engines (latex/pdflatex/xelatex/lualatex) do incremental compilation at all? Besides, even if they do, any file included in the main tex file with \input{} could redefine macros used in later included files, so how would the engines know when to recompile a partial file?
Asked
Active
Viewed 558 times
0
Ethan Bolker
- 9,333
- 3
- 42
- 69
Siyuan Ren
- 1,519
1 Answers
1
Real life example: Here's the main document of my Phd thesis, I will not explain the details, I just want to show the idea.
%% Kommandozeilenaufruf in texmaker
% pdflatex -synctex=1 -interaction=nonstopmode --extra-mem-top=60000000 %.tex|"C:/Program Files/Adobe/Reader 9.0/Reader/AcroRd32.exe" %.pdf
% Vorspann
% ----------------------------------------------
\input{01_Vorspann/Dokumentenklasse.tex}
\input{01_Vorspann/Seitenlayout.tex}
\input{01_Vorspann/WeitereLayoutAnpassungen.tex}
\input{01_Vorspann/Standardpakete.tex}
\input{01_Vorspann/Mathezeugs.tex}
\input{01_Vorspann/GleitumgebungenUndVerzeichnisseAnpassen.tex}
\input{01_Vorspann/KopfUndFusszeile.tex}
\input{01_Vorspann/Schriften_und_Symbole_Typografie.tex}
\input{01_Vorspann/Bibliografie-Zeugs.tex}
\input{01_Vorspann/WeiterePakete.tex}
% % Neu
% % http://tex.stackexchange.com/questions/64188/what-are-good-ways-to-make-pdflatex-output-copy-and-pasteable
% \usepackage{cmap}
% Zum Schluss laden!
\input{01_Vorspann/PDF-Zeugs.tex}
% ----------------------------------------------
% Eigene Einstellungen
% ----------------------------------------------
\input{01_Vorspann/BezeichnungenAnpassen.tex}
\input{01_Vorspann/Styleguide_EigeneBefehle_und_Farbdefinitionen.tex}
\input{01_Vorspann/Trennmuster.tex}
% ----------------------------------------------
\myVersionMitAnmerkungen{off}
% Eigentliches Dokument
% ----------------------------------------------
\begin{document}
% Bookmark-Formatierung initialisieren
\bookmarksetup{style=myBookmarkNormal}
\pagenumbering{Roman}
\input{02_Inhalt/Titelseite.tex}
\cleardoublepage
% Kopf- und Fußzeile einschalten
\pagestyle{scrheadings}
% Römische (xii) Nummerierung
\pagenumbering{roman}
% Zählung beginnt hier ab 1
\setcounter{page}{1}
\input{02_Inhalt/Vorwort.tex}
\input{02_Inhalt/Danksagung.tex}
\input{02_Inhalt/Kurzfassung.tex}
\input{02_Inhalt/Verzeichnisse.tex}
\cleardoublepage
% Arabische (12) Nummerierung
\pagenumbering{arabic}
% Zählung beginnt hier wieder ab 1
\setcounter{page}{1}
\startcontents[chapters]
\input{02_Inhalt/Einleitung.tex}
\startcontents[chapters]
\input{02_Inhalt/StandDerForschung.tex}
\startcontents[chapters]
\input{02_Inhalt/Haptik.tex}
\startcontents[chapters]
\input{02_Inhalt/Statistik.tex}
\startcontents[chapters]
\input{02_Inhalt/Psychophysik.tex}
\startcontents[chapters]
\input{02_Inhalt/Versuchsaufbau.tex}
\startcontents[chapters]
\input{02_Inhalt/Experimente.tex}
% Letzes 'richtiges' Kapitel
% Stopp der Zwischen-TOCs
\stopcontents[chapters]
\input{02_Inhalt/Zusammenfassung.tex}
\input{02_Inhalt/Literaturverzeichnis.tex}
\input{02_Inhalt/Anhang.tex}
\end{document}
% ----------------------------------------------
If I am working on a chapter, let's say statistics (\input{02_Inhalt/Statistik.tex}), then it would look like this:
% \startcontents[chapters]
% \input{02_Inhalt/StandDerForschung.tex}
%
% \startcontents[chapters]
% \input{02_Inhalt/Haptik.tex}
\startcontents[chapters]
\input{02_Inhalt/Statistik.tex}
% \startcontents[chapters]
% \input{02_Inhalt/Psychophysik.tex}
%
% \startcontents[chapters]
% \input{02_Inhalt/Versuchsaufbau.tex}
There are other solutions as well, for example, to put \end{document} in a different position (higher).
Dr. Manuel Kuehner
- 22,451
-
I'm not sure if this (or any) answer will help OP. But you should look into the
\includecommand (see the link further up on this page). If you use\inputin your preamble and\includein your document, you'd be able to add\includeonlyto the preamble to automatically comment out chapters you aren't working on. As a bonus, the numbering would still work properly. – Teepeemm Jun 14 '18 at 18:51 -
Include adds a page break which I personally dislike. But I see your point. Anyway, the OP seems to be not interested anymore. – Dr. Manuel Kuehner Jun 14 '18 at 21:32
\inputwill change any definitions. It's up to you to keep track of what does what. I would strongly suggest that you separate your definitions from your text. Always\inputyour definitions, and\includeyour text as appropriate. – Teepeemm Jun 14 '18 at 18:49