考虑文件
\documentclass[12pt]{article}
\usepackage{filecontents}
\begin{filecontents}{stuff.txt}
Some stuff
\end{filecontents}
\begin{document}
\end{document}
latexmk
对此文件不满意。有什么方法可以安抚它吗?错误消息如下。
LaTeX Warning: Writing file `./stuff.txt'.
(./filecontents.aux) (./filecontents.aux) )
No pages of output.
Transcript written on filecontents.log.
=== TeX engine is 'pdfTeX'
Latexmk: Log file says no output from latex
Latexmk: For rule 'pdflatex', no output was made
Failure to make 'filecontents.pdf'
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
pdflatex: failed to create output file
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs, or warnings treated as errors.
答案1
问题不在于 latexmk,而在于 pdflatex。由于文档没有正文(\begin{document} 和 \end{document} 之间没有任何内容),因此 pdflatex 无法创建 pdf。只需在正文中添加一些文本,一切就都好了。