1

I have a task of creating a number of documents with the content generated by some script. The content is substituted in a LaTeX template, and then I simply execute a LaTeX compiler (pdflatex in my case) on each of the resulting source files, getting my PDFs all nice and shiny.

The problem is it takes a very long time to finish (a few seconds per document times 7000 documents is quite a lot). Now it seems that most of the time is taken by LaTeX initializations (packages, fonts, etc.), while the compilation itself is very fast (each document is only two pages with nothing more complex the a couple of images and some text). As far as I understand, the automatisation tools such as latexmk will run LaTeX separately for each file, so this is not much better than me calling pdflatex directly from my script.

So is there a way to run LaTeX once and then feed TeX source files to it one after another?

Tina
  • 758
Andrei Smolensky
  • 681
  • 4
  • 11
  • 1
    Can you combine all 7000 documents in one and separate the pdf afterwards? If the package loading is the time consuming part, a precompiled preamble could help (search on this site for tutorials how to do this) – samcarter_is_at_topanswers.xyz Nov 09 '17 at 15:53
  • @samcarter That is an option, although since the data for the script might turn inconsistent, I would very much like to be able to look at the separate tex source to see what is the problem (and not have a complete new run on all the documents, of which many would otherwise be already succesfully compiled). – Andrei Smolensky Nov 09 '17 at 15:57
  • 1
    You can combine them without merging them. You could use \input or \import or the like. – TeXnician Nov 09 '17 at 15:58
  • 3
    If you have always the same preamble, you can make a new TeX format with preloaded class, packages and preamble code. Then you use this format instead of the latex format. See mylatexformat and: Ultrafast PDFLaTeX with precompiling – Schweinebacke Nov 09 '17 at 16:22

0 Answers0