0
我正在編寫爲我編寫LaTeX文件的C代碼。然後,我嘗試在非交互模式下使用pdflatex編譯文件(如我自動執行某個過程,並且不希望等待用戶輸入致命錯誤)。該乳膠文件是./data/output_date.tex
輸出,我試圖編譯它使用命令使用pdflatex編譯C代碼中的LaTeX文件
system("./pdflatex --interaction=nonstopmode --output-directory=data ./data/output_date.tex");
不過,我得到錯誤信息:
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(./data/output_date.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
(/usr/share/texmf-texlive/tex/latex/pbox/pbox.sty
(/usr/share/texmf-texlive/tex/latex/tools/calc.sty)
(/usr/share/texmf-texlive/tex/latex/base/ifthen.sty))
(data/output_2013_date.aux))
! Emergency stop.
<*> ./data/output_date.tex
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on data/output_date.log.
我似乎無法破譯到底爲什麼我緊急停止,特別是因爲當我從終端(與C可執行文件相同的文件夾)運行相同的確切命令時,LaTeX可以很好地編譯爲pdf。
有什麼特殊的我必須做的,因爲我打電話編譯器作爲從C代碼的命令?
編輯:這是相應的.log文件的文本。它似乎只說「沒有合法的\ end found」,這讓我感到困惑,因爲我檢查了源文件以確保我的\ begin和\ end匹配。
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) (format=pdflatex 2013.5.23) 15 JUL 2013 09:50
entering extended mode
%&-line parsing enabled.
**./data/output_date.tex
(./data/output_date.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\[email protected]=\count79
\[email protected]=\count80
\[email protected]=\count81
\[email protected]=\count82
\[email protected]=\count83
\[email protected]=\count84
\[email protected]=\count85
\[email protected]=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texmf-texlive/tex/latex/pbox/pbox.sty
Package: pbox 2003/04/06 v1.0 Dynamic parboxes
(/usr/share/texmf-texlive/tex/latex/tools/calc.sty
Package: calc 2007/08/22 v4.3 Infix arithmetic (KKT,FJ)
\[email protected]=\count87
\[email protected]=\count88
\[email protected]=\dimen103
\[email protected]=\dimen104
\[email protected]=\skip43
\[email protected]=\skip44
LaTeX Info: Redefining \setlength on input line 76.
LaTeX Info: Redefining \addtolength on input line 77.
\[email protected]=\count89
\[email protected]=\skip45
)
(/usr/share/texmf-texlive/tex/latex/base/ifthen.sty
Package: ifthen 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
)
\[email protected]=\skip46
)
(data/output_date.aux)
\openout1 = `output_date.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8.
LaTeX Font Info: ... okay on input line 8.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8.
LaTeX Font Info: ... okay on input line 8.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8.
LaTeX Font Info: ... okay on input line 8.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8.
LaTeX Font Info: ... okay on input line 8.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8.
LaTeX Font Info: ... okay on input line 8.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8.
LaTeX Font Info: ... okay on input line 8.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <12> on input line 9.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 9.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 9.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line 15.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 15.
)
! Emergency stop.
<*> ./data/output_date.tex
*** (job aborted, no legal \end found)
Here is how much of TeX's memory you used:
375 strings out of 495061
4422 string characters out of 1182621
56939 words of memory out of 3000000
3619 multiletter control sequences out of 15000+50000
6675 words of font info for 24 fonts, out of 3000000 for 9000
28 hyphenation exceptions out of 8191
23i,14n,19p,304b,189s stack positions out of 5000i,500n,10000p,200000b,50000s
! ==> Fatal error occurred, no output PDF file produced!
不是專家,但你有沒有試過檢查'data/output_date.log'?它顯然表示它確實在那裏投入了一些東西。也許有些提示出了什麼問題。 – luk32
我做過了,但我無法確切知道錯誤是什麼。我編輯過上面發佈了.log文件的文本,但就像我在那裏說的那樣,我能找到的最好的結果是\ end,這很奇怪,因爲我的\ begin和\ end在源代碼中匹配。 – cjubb39
因爲,你說完全相同的命令在命令行上工作,也許你可以剝離tex文件到一個最小的攻擊性的例子,其中shell命令仍然工作,而嵌入式計數器部分中斷。也許可以(或者更容易)分析tex文檔或環境的問題。 – luk32