7

I have been trying to get super-fast compiles with LuaLaTeX by using a pre-built preamble for my documents. However, every time I try to compile, I get this error:

No file main.aux.
[\directlua]:1: attempt to index global 'microtype' (a nil value)
stack traceback:
        [\directlua]:1: in main chunk.
MT@ifstreq ...{microtype.if_str_eq([[#1]],[[#2]])}
                                                  endcsname
l.3 \begin{document}

?

This is with the following MWE:

% in pream.tex
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Arno Pro}
\usepackage{microtype}
\usepackage{blindtext}
\endofdump

% in main.tex
\title{Test Document}
\author{Me}
\begin{document}
  \blindmathpaper
\end{document}

To generate the format I used

lualatex -ini -jobname="pream" "&lualatex" mylatexformat.ltx """pream.tex"""

and to compile main.tex I used

lualatex -fmt pream """main"""

Now, I have seen on the luatex-dev mailing list (linked to from Google) that the issue is that microtype is attempting to use some Lua code, but it can't because Lua code cannot go into a format – it must be run ‘live’ in the normal way.

Robert from the mailing list suggests putting \directlua{require("microtype")} into the document, but does not specify which one to put it in. Besides, wouldn't putting it into main.tex negate the whole (well, some of it) purpose of doing this – pre-loading all packages so compiles are faster?

Anyways, I digress.

Thanks for all the help you guys always offer here on TeX.sx!

Bernard
  • 271,350

0 Answers0