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.