我在 Linux 系统 LuaTex 1.0.4 上运行。由于编译时间需要相当长的时间 - 尤其是创建 ToC,我认为我可以预编译标头。使用预编译的标头,我尝试运行(作为文件Main_2.tex
)
\begin{document}
Hello World
\end{document}
luatex -shell-escape "&preamble Main_2.tex"
总是失败
*geometry* detected driver: pdftex
(/usr/share/texmf/tex/latex/hyperref/nameref.sty
(/usr/share/texmf/tex/generic/oberdiek/gettitlestring.sty)) (./Main_2.out)
(./Main_2.out) (/usr/share/texmf/tex/latex/oberdiek/pdflscape.sty
(/usr/share/texmf/tex/latex/graphics/lscape.sty))
! Unknown color stack number 1.
<to be read again>
序言是
\RequirePackage{luatex85} % for the watermark to be transparent (with the package)
\documentclass[a4paper,11pt]{article}
\usepackage{tikzpagenodes}
\usepackage[a4paper,includeheadfoot,margin=2.54cm]{geometry} % for margins on a A4paper
\usepackage{fontspec}
\usepackage[english, ngerman]{babel}
\usepackage{enumerate} % for enumeration to change
\usepackage{xcolor} % for highlighting AND background images-color!!!
\usepackage[pdfencoding=auto]{hyperref} % for links and PDF-specifica (and Umlaute in PDF meta-data)
\usepackage[raggedright]{titlesec} % to have the section NOT justify, i.e. the lines can be shorter (for linebreak)
\def\UrlBreaks{\do\/\do-\do\_} % for breaking long URLS additonally
\usepackage[all]{nowidow} % prevents orphans and widows
\usepackage{hyphenat} % allows hyphenation of compound words like 'Test- und Produktivszenarien' (see source code)
\defaultfontfeatures{Ligatures=TeX} % to have the automatics ligatures of TeX
\setmainfont{Liberation Sans} % use different font (#xxy) [ size 11pt - already in the preamble]
%%% START adjust spacing in ToC number %%%
\makeatletter
\renewcommand\@pnumwidth{2em} %more place for page number
\makeatother %%% END adjust spacing in ToC number %%%
\usepackage{setspace} % use for line spacing
\onehalfspacing % line spacing = 1.5
\usepackage{booktabs} % for rules within a table
\usepackage{parskip}
\usepackage{ltablex} % for tables with long lines & long tables (over >1 page)
\usepackage{arabluatex} % for support of arabic fonts
\newfontfamily\arabicfont{Amiri}[Script=Arabic, RawFeature={+anum}]
\usepackage{tikz} % for invalid images
\usetikzlibrary{shapes}
\usepackage{fancyvrb}
\usepackage{fvextra}
\usepackage{csquotes} % for quotes
\usepackage{eso-pic, transparent, pdfpages} % for the watermark
\AddToShipoutPictureFG{\AtPageCenter{\put(-40,-25){\rotatebox{55}{\makebox[0pt]{\transparent{0.5}\fontsize{3cm}{3cm}\bfseries\textcolor{red}{Draft}}}}}}
%%% START fix for longtables incorrect page wrapping %%%
\makeatletter
% copied from longtable.sty:
\def\LT@output{%
\ifnum\outputpenalty <-\@Mi
\ifnum\outputpenalty > -\LT@end@pen
\LT@err{floats and marginpars not allowed in a longtable}\@ehc
\else
\setbox\z@\vbox{\unvbox\@cclv}%
\ifdim \ht\LT@lastfoot>\ht\LT@foot
\dimen@\pagegoal
\advance\dimen@-\ht\LT@lastfoot
\ifdim\dimen@<\ht\z@
\setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot\vss}%
\@makecol
\@outputpage
\setbox\z@\vbox{\box\LT@head}%
\fi
\fi
\global\@colroom\@colht
\global\vsize\@colht
% \vbox %<--- removing this box avoids the error
{\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}%
\fi
\else
\setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot\vss}%
\@makecol
\@outputpage
\global\vsize\@colroom
\copy\LT@head\nobreak
\fi}
\makeatother %%% END fix for longtables incorrect page wrapping %%%
% START: #xxx: Different colors
\usepackage{titlesec}
\definecolor{coi_gray}{RGB}{136,155,169}
% Set formats for each heading level
\titleformat*{\section}{\normalsize\bfseries\color{coi_gray}}
\titleformat*{\subsection}{\normalsize\bfseries\color{coi_gray}}
\usepackage[font=small, format=hang]{caption} % small font, an additional line as space after figure
\titleformat*{\subsubsection}{\normalsize\bfseries\color{coi_gray}}
% END #xxx
\hypersetup{
pdfauthor={},
pdftitle={Test, DRAFT},
pdfsubject={DRAFT},
urlcolor={blue},
colorlinks={true},
pdfcreator={my\hyp{}tex},
pdfproducer={lualatex},
linkcolor={black},
pdfkeywords={afg},
}
\dump
然后我fmt
用 生成文件lualatex -ini "&lualatex preamble.tex"
。
有什么提示说明定义有什么问题吗?是顺序问题吗?还是包冲突?
答案1
只是为了完整性:
我发现以下软件包不兼容
\usepackage{tikzpagenodes}
\usepackage{arabluatex} % for support of arabic fonts
\usepackage{tikz} % for invalid images
所提及的字体不会对编译造成任何问题。但最终版本可能会出现问题。
另外,我想指出的是,该软件包microtype
似乎在拆分时无法正常工作。这一点尤其值得注意,因为该软件包也需要一些时间来编译。我花了一段时间才意识到我想比较苹果和橘子。