0

Summary of issue

I followed the guide linked in this answer, and it works perfectly for me. However, I find that if I use a precompiled preamble, and then specify \includeonly{}, the full document is still compiled.

Is there something obvious I'm missing?

MWE

File: main.tex

%&preamble
\includeonly{part1}
\begin{document}
\include{part1}
\include{part2}
\end{document}

File: preamble.tex

\documentclass{article}
\usepackage{amsmath}
\csname endofdump\endcsname

File: part1.tex

Part 1.

File: part2.tex

Part 2.

Precompilation

I precompiled the preamble using pdftex -ini -jobname="preamble" "&pdflatex" mylatexformat.ltx "preamble.tex"

If you change %&preamble in main.tex to \input{preamble}, it works as expected.

System info

Compiled under the LaTeX Workshop extension for Visual Studio Code on Windows 10, using latexmk.

6
  • I think a mylatexfomat will skip the preamble as for as \endofdump or \begin{document} so as you don't have that the preamle will be skipped (on the assumption it has been preloaded), the design is that you don't need a separate preamble.,tex you can use your main file. Aug 14 at 15:48
  • @DavidCarlisle As far as I understand yes using mylatexformat will skip anything before \endofdump, but anything after (so between \endofdump and \begin{document} will still be ran at compile-time. In the guide this is referred to as the 'dynamic' part of the preamble (as opposed to the 'static' part, which what we've precompiled.
    – Joe.S
    Aug 14 at 16:06
  • and you don't have that in main.tex so nothing before begin document will be used, put csname ... before includeonly Aug 14 at 16:08
  • Or do you just mean that I didn't need to separate the preamble into a separate file for pre-compilation? I'm aware of that, but my preamble is rather large so I decided to for cleanliness' sake. I was previously just using a separate preamble file and then using \input{preamble] in my main.tex document. I can't imagine merging the preamble would fix the \includeonly{} issue though.
    – Joe.S
    Aug 14 at 16:09
  • you don't need to merge you just need to put the end of dump marker in the main file as I wrote above Aug 14 at 16:09

1 Answer 1

0

Once a document using the precompiled format starts being processed TeX skips over the preamble as far as \endofdump or \begin{document}. This allows a document to be used for both pre-compiling the format, and as the actual document, even though you used separate files here.

So you need to add \csname endofdump\endcsname to your main document at the point you want processing to start, before \includeonly otherwise no commands in the preamble will be executed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .