# Precompiled header with lualatex and unicode-math

Consider the following:

preamble.tex:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Cambria Math}


main.tex

\def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax} \ifundefined{preambleloaded}
\fi

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


Now I use lualatex -ini -job-name="main" "&lualatex preamble.tex\dump" via the command line with the result of, apparently, an unfinished run (the corresponding logfile ends with

Beginning to dump on file main.fmt
(format=main 2014.9.11)
24193 strings using 403578 bytes
919997 memory locations dumped; current usage is 243&455843
22307 multiletter control sequences
\font


).

Subsequently the use of lualatex -shell-escape "&main main.tex" results in an error of the form of

This is LuaTeX, Version beta-0.76.0-2013062821 (rev 4627)
\write18 enabled
Could not undump 1 4-byte item(s): <fd:3>: unexpected end of file


The use of, e.g., Asana Math leads to the same error.

I have an up-to-date MikTeX System and I use Cambria Math routinely with unicode-math, so I guess the font cannot be installed completely wrong.

Am I doing something wrong? To be honest, I'm completely clueless. Any help greatly appreciated! :-)

• I doubt that you can dump a font in the format. See e.g. the comments here tex.stackexchange.com/questions/46672/custom-luatex-format-file. – Ulrike Fischer Sep 11 '14 at 6:56
• @UlrikeFischer font dumping works at least in some cases. Commenting out the unicode-math related part above and replacing it with \usepackage{fontspec} \setmainfont[ItalicFont={MinionPro-It},BoldFont={MinionPro-Bold},BoldItalicFont={MinionPro-BoldIt},SmallCapsFeatures={Renderer=Basic},Ligatures={TeX,Common},Scale=MatchLowercase,Numbers={OldStyle,Proportional}]{MinionPro} results in a correctly working fmt file as well as a correct pdf output in the end. – John Sep 11 '14 at 9:24
• I have to partly correct myself -- only the standard Minion Pro font works, neither the bold nor the italic or the oldstyle figures work. Does this have to do with the loading of pdftex.map that seems to occur by loading the generated fmt somehow? – John Sep 11 '14 at 11:49
• @John try updating your Luatex binary. Élie’s fix was applied some time ago. If it still fails afterwards, there might be another bug that should be reported to the devs. – Philipp Gesang Sep 12 '14 at 6:02
• @phg The error persists with LuaTeX, Version 0.79.1 (TeXLive 2014/W32TeX) I still get Could not undump 1 4-byte item(s): <fd:3>: unexpected end of file. – John Sep 29 '14 at 12:50