latexmk -pdf
我正在GitLab-CI 环境中运行以将*.tex
文件呈现为 PDF。
当我检查输出时,我发现,这latexmk
是在调用pdftex
而不是pdflatex
:
Checking out d4c1eceb as testing-latexmk...
Skipping Git submodules setup
$ latexmk -pdf $DOCUMENT.tex
Latexmk: This is Latexmk, John Collins, 21 September 2018, version: 4.60.
Rule 'pdflatex': Rules & subrules not known to be previously run:
pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex -recorder "Concept-of-Realization.tex"'
------------
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./Concept-of-Realization.tex
LaTeX2e <2018-04-01> patch level 5
现在我检查一下pdflatex
在切换到之前发生了什么latexmk
:
Checking out ffb7336b as v0.1...
Skipping Git submodules setup
$ pdflatex $DOCUMENT.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./Concept-of-Realization.tex
LaTeX2e <2018-04-01> patch level 5
令我惊讶的是,这两次运行都调用了 themselfespdftex
而不是pdflatex
。
问题:
- 为何
pdflatex
打电话给自己pdftex
? - 区别在哪里?
答案1
在 Linux 终端上的/usr/local/texlive/2018/bin/x86_64-linux
目录中:
$ file pdflatex
pdflatex: symbolic link to pdftex
但有pdftex
:
$ file pdftex
pdftex: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32,
BuildID[sha1]=f304a4bff8b70b6e1693666cfe3a966599c1f918, stripped
也就是说,pdftex
始终是引擎,pdflatex
只是链接到pdftex
但不加载相同的选项。这些是pdflatex
和的输出pdftext
:
$ pdflatex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018)
(preloaded format=pdflatex)
restricted \write18 enabled.
**
$ pdftex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018)
(preloaded format=pdftex)
restricted \write18 enabled.
**
如你所见,有不同的 预加载格式,与明显的命令名称匹配。如果您尝试使用 ,也会发生同样的情况latex
。为什么 latex 和 pdflatex 都是指向同一个可执行文件(pdftex)的符号链接,但行为却不一样?嗯,简而言之,因为 pdftex 将把符号链接的名称作为格式选项,无论它是什么,所以对于链接“foo”:
~ $ ln -s /usr/local/texlive/2018/bin/x86_64-linux/pdftex foo
~ $ ./foo
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018)
(preloaded format=foo)
restricted \write18 enabled.
**
但是如果使用带有该-ini
选项的两个命令,则不会加载任何格式,然后是完全相同的内容:
$ pdflatex -ini ## (or pdftex -ini)
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (INITEX)
restricted \write18 enabled.
**
当然,您可以使用pdftex
(或pdflatex
)命令,但加载pdflatex
(或pdftex
)格式:
$ pdftex -fmt pdflatex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018)
(preloaded format=pdflatex)
restricted \write18 enabled.
**
总结:pdflatex
仅调用pdftex -fmt pdflatex