I want to speed up the compilation process, so I splitted the main document in two files:
MWE
preamble.tex
\documentclass{article}
\csname endofdump\endcsname
main.tex
\begin{document}
\ifdefined\test
:)
\else
:/
\fi
\end{document}
This works:
#!/bin/bash
pdftex -ini -jobname="preamble" "&pdflatex" mylatexformat.ltx "preamble.tex"
pdflatex -fmt preamble "main.tex"
Problem
However, I want to pass data from command line to tex to get a happy smilie,
#!/bin/bash
pdftex -ini -jobname="preamble" "&pdflatex" mylatexformat.ltx "preamble.tex"
pdflatex -fmt preamble "\def\test{1}\input{main}"
and I stumble across an interactive mode where I don't know what to do. Using the -no-parse-first-line doesn't help either.
texput.log
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!