我想加快编译过程,因此我将主文档分成两个文件:
平均能量损失
序言.tex
\documentclass{article}
\csname endofdump\endcsname
主文本
\begin{document}
\ifdefined\test
:)
\else
:/
\fi
\end{document}
这有效:
#!/bin/bash
pdftex -ini -jobname="preamble" "&pdflatex" mylatexformat.ltx "preamble.tex"
pdflatex -fmt preamble "main.tex"
问题
但是,我想将数据从命令行传递给 tex 以获得快乐的笑脸,
#!/bin/bash
pdftex -ini -jobname="preamble" "&pdflatex" mylatexformat.ltx "preamble.tex"
pdflatex -fmt preamble "\def\test{1}\input{main}"
我偶然发现了一个交互模式,我不知道该怎么做。使用-不解析第一行也没什么帮助。
文本输出日志
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=preamble 2014.12.16) 16 DEC 2014 14:17
entering extended mode
restricted \write18 enabled.
**\def\test{1}\input{main}
==============================================================================
JOB NAME : "texput"
CUSTOMISED FORMAT: "preamble"
PRELOADED FILES:
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
==============================================================================
*
! Emergency stop.
<*> \def\test{1}\input{main}
End of file on the terminal!
Here is how much of TeX's memory you used:
3 strings out of 494701
113 string characters out of 6174765
48268 words of memory out of 5000000
3561 multiletter control sequences out of 15000+600000
7639 words of font info for 26 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
8i,0n,22p,42b,30s stack positions out of 5000i,500n,10000p,200000b,80000s
! ==> Fatal error occurred, no output PDF file produced!
答案1
我不是这方面的专家,但我猜mylatexformat
不会递归扫描输入文件,因此永远不会遇到\begin{document}
文字main.tex
文字,而根据其格式,这是标记格式结束所必需的文档. 至少对于您的 MWE 来说,如果您在命令行上发出\endofdump
(标记格式结束的替代方法,以避免两个),它就会起作用:\begin{document}
pdflatex -fmt preamble "\endofdump\def\test{1}\input{main}"