latexmk 执行了哪些命令

latexmk 执行了哪些命令

最近我发现,latexmk如果我理解正确的话,它可以用一个命令替换编译 latex 所需的几个命令。是否可以显示我发出例如时执行了哪些命令latexmk -pdf thesis.tex?或者更好的是,是否可以在某种“无操作模式”下运行,latexmk只打印应该发出哪些命令来手动编译 latex?我不认为最新的是可能的,因为在编译过程中会生成'.aux', '.bbl 文件等,按照描述反复读取这里这里。所以我猜想在我们知道下一步是否需要编译之前必须进行一些编译,但我宁愿问。谢谢

PS:我想知道执行的命令的确切顺序,例如:

pdflatex thesis.tex
pdflatex thesis.tex
pdflatex thesis.tex

或者

pdflatex thesis.tex
bibtex thesis.tex
pdflatex thesis.tex
pdflatex thesis.tex

答案1

latexmk已经在终端输出期间提供了当前运行哪些规则的信息。但如果您不想深入了解终端输出,请运行latexmk -time -pdf thesis.tex。这原本是为了获取时间信息,但作为副作用,它会在输出末尾总结所有步骤。

'pdflatex  -recorder  "Thesis.tex"': time = 10.21
'biber  "Thesis"': time = 11.21
'pdflatex  -recorder  "Thesis.tex"': time = 11.52
'pdflatex  -recorder  "Thesis.tex"': time = 11.45
'pdflatex  -recorder  "Thesis.tex"': time = 11.48
Accumulated processing time = 57.02

答案2

latexmk --commands提供以下列表:

   To run latex, I use "latex %O %S"
   To run pdflatex, I use "pdflatex %O %S"
   To run biber, I use "biber %O %B"
   To run bibtex, I use "bibtex %O %B"
   To run makeindex, I use "makeindex %O -o %D %S"
   To make a ps file from a dvi file, I use "dvips %O -o %D %S"
   To make a ps file from a dvi file with landscape format, I use "dvips -tlandscape %O -o %D %S"
   To make a pdf file from a dvi file, I use "dvipdf %O %S %D"
   To make a pdf file from a ps file, I use "ps2pdf  %O %S %D"
   To view a pdf file, I use "open %S"
   To view a ps file, I use "NONE"
   To view a ps file in landscape format, I use "NONE"
   To view a dvi file, I use "NONE"
   To view a dvi file in landscape format, I use "NONE"
   To print a ps file, I use "lpr %O %S"
   To print a dvi file, I use "NONE $lpr_dvi variable is not configured to allow printing of dvi files"
   To print a pdf file, I use "lpr %O %S"
   To find running processes, I use "ps -ww -u scmbradley", 
      and the process number is at position 1
Notes:
  Command starting with "start" is run detached
  Command that is just "start" without any other command, is
     used under MS-Windows to run the command the operating system
     has associated with the relevant file.
  Command starting with "NONE" is not used at all

答案3

由于某种原因,在我的发行版中,-time输出被缩写了:

'lualatex': time = 0.99
'makeindex a.idx': time = 0.02
'lualatex': time = 1.11
'lualatex': time = 1.07

因此,一种更简单的方法是简单地在latexmk输出中 grep 字符串“Running”(上面提到,命令是已经打印出来,只是埋在输出中):

$ latexmk    -lualatex  a 2> /dev/null |grep Running
Running 'lualatex  -recorder  "a.tex"'
Running 'makeindex -s gind.ist  -o "a.ind" "a.idx"'
Running 'lualatex  -recorder  "a.tex"'
Running 'lualatex  -recorder  "a.tex"'

(但是在 Windows 上则不会有grep。)

当然,构造某种方法来解决此错误(例如使用\messageTeX 文件中的命令)很简单,但在正常使用中这并不是什么大问题。

(附注:如果您想找出“完整运行”的命令,请latexmk -C a事先删除所有辅助文件;否则它可能只执行一次运行或类似操作。)

相关内容