TeX - LaTeX Asked on May 26, 2021
So let’s say that I have a document:
% Preamble
usepackage{subfiles}
% Preamble
begin{document}
maketitle
subfile{FileA}
subfile{FileB}
subfile{FileC}
end{document}
Some questions:
input
or just having the entire TeX code from the subfiles in there. Is there a way to compile some subfiles simultaneously while leaving the other subfiles untouched (as in, the results from the subfiles do not change instead of not appearing in the pdf)?I use TeXStudio by the way.
Too long for the comments.
Re question 1: The title appears in the document that contains the maketitle
command. If it is in the main file and you compile some subfile, then the title will not appear, because the subfile takes only the preamble from the main file and ignores the rest.
Re question 2: This question is not specific to subfiles
, and the answer is basically 'no'. As far as I know, none of the TeX processors performs caching and typesets only those parts that have changed. Some packages provide the possibility to cache the result of intensive computations for the next run (like externalization in pgfplots
). On a larger scale, you can use tools for building a project, like make
, ant
and many more, to compile only parts of a project that have changed. But for TeX files, it will still call a tex processor that typesets the whole file.
Re question 3: I think this is a misconception of what TeX and the subfiles package does. When typesetting the main document, it will load the tex
sources of the subfiles, ignoring any pdf
. So typesetting any of the subfiles will generate new pdf
s for the subfiles, but leave the pdf of the main file untouched. TeXStudio may disguise the fact that you are editing actually tex
files which are typeset on the fly to pdf
to be viewed.
Re question 4: When typesetting a subfile the processing time is definitely shorter than when typesetting the main file. However, in most situations you will not notice it, because starting the program and opening the files takes much more time than typesetting some text. You will see real time savings only when the main file is huge and/or some parts contain computing-intensive graphcis.
Re question 5: This is probably a TeXStudio and/or usage issue. TeXStudio probably always typesets the file set as the 'current' one, and it probably was not aware that you wanted it to typeset only the subfile.
General recommendation: Start out with a single tex file. If it becomes too large, structure it using input
or include
. Only if you really need to be able to typeset part of the document independently, start experimenting with packages like subfiles
.
Correct answer by gernot on May 26, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP