7

I am trying to typeset a longer document with lots of packages. Now it seems that pre-compiling the header can speed up the edit-compile-revise cycle quite a bit. I tried to follow the guideline from How to speed up pdflatex for a very large document on MacOS X? but it does not work on my system and I am not sure what I am doing wrong.

My preamble.tex looks as follows:

\documentclass[a4paper]{scrbook}
\usepackage{scrpage2}
\def\preambleloaded{Precompiled preamble loaded.}

and the main.tex file:

\def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax} \ifundefined{preambleloaded}
\typeout{PRECOMILED PREAMBLE NOT LOADED}\input{preamble} \else
\typeout{\preambleloaded}
\fi

\begin{document}
test test test
\end{document}

Now after compiling the preamble with

lualatex -ini -job-name="main" "&lualatex preamble.tex\dump"

a main.fmt file is created and lualatex runs without errors. Compiling the main file with

lualatex -shell-escape main.tex

gives the message right at the beginning that the preamble was not included:

LaTeX2e <2011/06/27>
LuaTeX adaptation of babel <v3.8l-luatex-1.4> and hyphenation patterns for engl
ish, loaded.
PRECOMILED PREAMBLE NOT LOADED
(C:/Users/User/Documents/LaTeX/precompile/preamble.tex
(C:/Users/User/AppData/Roaming/MiKTeX/2.9/tex/latex/koma-script/scrbook.cls 
...

The only difference that I can think of at the moment is that I am using LuaLaTeX on Windows 7 instead of pdftex on Mac OS X as in the linked question. Any hint how to fix this is very appreciated.

  • 1
    Don't you need: lualatex -shell-escape "&main main.tex" ? – Taco Hoekwater May 10 '12 at 14:14
  • @TacoHoekwater: Thank you! That works nicely. Could you convert your comment into an answer and maybe add a sentence what the difference is so that I can accept it? – Alexander May 10 '12 at 15:04
7

You need:

lualatex -shell-escape "&main main.tex"

otherwise the newly generated main.fmt file is not used at all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.