Writing a long document, compilation with Texmaker becomes too slow, so when I want to see how it looks, I loose time (not too much, but it is getting worse because of document's size).
Is there any way to compile faster?
Writing a long document, compilation with Texmaker becomes too slow, so when I want to see how it looks, I loose time (not too much, but it is getting worse because of document's size).
Is there any way to compile faster?
In a similar situation I decided, that when writing on a text passage I seldom need to see the whole document, but that compiling the current chapter/section/whatever is enough. For this task I use the subfiles
package. With this package I can both compile the main file to get the complete output and the individual chapters alone to save time. Compiling the individual will still have the packages from the main file available and the look and feel of the document will be the same.
My file look like this:
main.tex
:
\documentclass{book}
\usepackage{subfiles}
\usepackage{xcolor}% Just an example for all packages you want to use
\begin{document}
text
\subfile{chapter1}
\end{document}
and chapter1.tex
% !TeX root = chapter1.tex % not necessary, but some editors think they are smart
\documentclass[main]{subfiles}
\begin{document}
the content of chapter 1, \textcolor{blue}{using packages from the main file}
\end{document}
Most of the time I use this together with
\usepackage{xr-hyper}% or \usepackage{xr} if you don't use hyperref
\externaldocument{Chapter2}
which can be used to access labels etc. from for example other subfiles
or with
\usepackage{zref-xr}
\zxrsetup{toltxlabel}
\zexternaldocument*[main-]{main}
to access things like pagenumbers or chapter numbers from the main file.
main.tex
? Your answer works only if i put my chapters in same file that main.tex
is..
– santimirandarp
Jun 12 '17 at 17:39
\documentclass[../main]{subfiles}
and \subfile{./foldername/chapter1}
[untested]
– user36296
Jun 12 '17 at 19:00
I highly recommend recompiling often. Here are some thoughts which were too long for a comment:
You might want to compare What are good learning resources for a LaTeX beginner?.
In the end you can choose your workflow freely, so just see this as my opinion. The problem is of course the runtime. You cannot always get what you want. These might "speed up" the runtime:
\input
or \include
and comment the temporarily uninteresting sections/chapters out or use \includeonly
or the subfile
-package (as mentioned by TeXnician and samcarter). draft
modes.gnuplot
. inkscape
as an alternative. savebox
es might be appropriate. LuaTeX
might speed up the compile time. This also might depend on your use of the Lua language, e.g. I once gained several minutes by writing a script in Lua instead of using \foreach
directly. pdflatex
.
– TeXnician
Jun 5 '17 at 11:15
draft
? It should speed up compilation dramatically (at the loss of not getting graphs included insidefigure
environments and not getting hyperlinks formed. Math material will still be compiled, though. Depending on what you need to achieve, setting thedraft
option may be worth it. – Mico Jun 5 '17 at 11:55\include{file-nn.tex}
directives in the body of the document, and an\includeonly{list of files to be compiled}
directive in the preamble. – Bernard Jun 5 '17 at 12:11