使用latexmk编译XeLaTeX tex文件

发布于 2024-09-07 07:33:37 字数 1246 浏览 6 评论 0原文

如何在 Mac OS X 上使用 latexmk 编译 XeLaTeX tex 文档?

目前我正在运行 latexmk job.tex 并收到错误:

! 
 ********************************************
 * XeTeX is required to compile this document.
 * Sorry!
 ********************************************.
\RequireXeTeX ...********************************}
                                                  \endgroup \fi 
l.18 \RequireXeTeX

? ^D
! Emergency stop.
\RequireXeTeX ...********************************}
                                                  \endgroup \fi 
l.18 \RequireXeTeX

我的 tex 文件的第一行是(如 这篇文章):

% !TEX TS-program = xelatexmk

我尝试过其他的(例如program=xelatex),但无济于事。

Latexmk 对其命令的描述如下:

$ latexmk -commands xelatex job
Commands used by latexmk:
   To run latex, I use "latex %O %S"
   To run pdflatex, I use "pdflatex %O %S"
   ...

似乎没有任何从命令行选择 tex 程序的逻辑机制,并且从源代码中也不清楚如何做到这一点。

我还查看了橡胶,但它似乎也不起作用。

我很感激您能够提供的任何见解。

布莱恩

How can one compile a XeLaTeX tex document using latexmk on Mac OS X?

At present I am running latexmk job.tex and getting an error:

! 
 ********************************************
 * XeTeX is required to compile this document.
 * Sorry!
 ********************************************.
\RequireXeTeX ...********************************}
                                                  \endgroup \fi 
l.18 \RequireXeTeX

? ^D
! Emergency stop.
\RequireXeTeX ...********************************}
                                                  \endgroup \fi 
l.18 \RequireXeTeX

The first line of my tex file is (as suggested by this post):

% !TEX TS-program = xelatexmk

and I've tried others (e.g. program=xelatex), but to no avail.

latexmk describes its commands as follows:

$ latexmk -commands xelatex job
Commands used by latexmk:
   To run latex, I use "latex %O %S"
   To run pdflatex, I use "pdflatex %O %S"
   ...

There doesn't appear bo be any logical mechanism for selecting a tex program from the command line, and it's not clear from the source how one would do this, either.

I've also looked atrubber, but it doesn't seem to work either.

I appreciate any insight you may be able to provide.

Brian

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

埖埖迣鎅 2024-09-14 07:33:37
latexmk -v
Latexmk, John Collins, 16 January 2010. Version 4.13a

我放入

$pdflatex = 'xelatex --shell-escape %O %S';

我的 .latexmkrc 文件。当然,这是一种解决方法。但当我打电话时它对我有用

latexmk -pvc -pdf MyXetexFile
latexmk -v
Latexmk, John Collins, 16 January 2010. Version 4.13a

I put

$pdflatex = 'xelatex --shell-escape %O %S';

in my .latexmkrc file. This is a workaround, of course. But it works for me when I call

latexmk -pvc -pdf MyXetexFile
淡忘如思 2024-09-14 07:33:37

这是我的快速修复,以便 latexmk 与 XeLaTeX 一起使用:
添加到

`elsif (/^-xelatex$/) { $pdf_mode = 1; $pdflatex = 'xelatex %O %S'; $pdf_previewer =
'start evince %O %S';}`

该行上方(或附近)

`elsif (/^-pdf$/) { $pdf_mode = 1; }`

然后你可以调用latexmk -xelatex file.tex。有效,但我没有对其进行广泛的测试。应该与 lualatex 类似地工作。

That's my quick fix, so that latexmk works with XeLaTeX:
Add

`elsif (/^-xelatex$/) { $pdf_mode = 1; $pdflatex = 'xelatex %O %S'; $pdf_previewer =
'start evince %O %S';}`

above (or near) the line

`elsif (/^-pdf$/) { $pdf_mode = 1; }`

.

Then you can call latexmk -xelatex file.tex. Works, but I didn't test it extensively. Should work similarly with lualatex.

岁月染过的梦 2024-09-14 07:33:37
$ latexmk -v
Latexmk, John Collins, 27 July 2010. Version 4.18

我使用命令运行:

latexmk -pdf -e '$pdflatex=q/xelatex %O %S/' foo.tex

这与 andre-r 和 Kay 的答案基本相同,但仅来自命令行。

$ latexmk -v
Latexmk, John Collins, 27 July 2010. Version 4.18

I run with the command:

latexmk -pdf -e '$pdflatex=q/xelatex %O %S/' foo.tex

which is basically the same as the answers from andre-r and Kay, but only from the command-line.

凉城已无爱 2024-09-14 07:33:37

在版本:4.65(2019 年 6 月 18 日)中,使用 -xelatex 选项和按照评论之一的建议设置 -pdflatex 之间存在差异。

选项 1:-xelatex

$ latexmk -xelatex file.tex

使用 -xelatex 选项或 -pdfxe 选项,tex 文件首先被排版为 xdv (扩展 DVI)文件。然后,调用xdvipdfmxxdv文件转换为pdf文件。

latexmk 中,$xelatex_default_switches 设置为 -no-pdf(第 395 行)以使 xelatex 生成 < code>xdv 文件而不是默认的 PDF 文件。

因此,-xelatex 选项相当于:

$ xelatex -no-pdf file.tex  # called one or more times to produce file.xdv
$ xdvipdfmx file.xdv        # called only once in the end

选项 2:-pdflatex=xelatex

第二个选项是按如下方式设置 pdflatex,同时打开 -pdf< /code> 选项:

# %O is a substitution for options and %S is for source file
$ latexmk -pdflatex='xelatex %O %S' -pdf file.tex

在此方法中,使用 xelatex 直接生成 PDF 文件,而不生成中间输出文件。请注意,今天,xelatex 首先生成一个 xdv 流,并在内部将其传送到 xdvipdfmx 以生成 PDF 文件。

因此,这种方法相当于:

$ xelatex file.tex     # called one or more times to produce file.pdf

根据 user36296 的评论更新了 2019.08.31。

In version: 4.65 (18 June 2019), there is a difference between using the -xelatex option and setting -pdflatex as suggested by one of the comments.

Option 1: -xelatex

$ latexmk -xelatex file.tex

With the -xelatex option, or the -pdfxe option, the tex file is first typeset to an xdv (extended DVI) file. Then, xdvipdfmx is called to convert the xdv file to a pdf file.

In latexmk, $xelatex_default_switches is set to -no-pdf (line 395) to have xelatex produce an xdv file instead of the default PDF file.

Hence the -xelatex option is equivalent to:

$ xelatex -no-pdf file.tex  # called one or more times to produce file.xdv
$ xdvipdfmx file.xdv        # called only once in the end

Option 2: -pdflatex=xelatex

A second option is to set pdflatex as follows along with turning on the -pdf option:

# %O is a substitution for options and %S is for source file
$ latexmk -pdflatex='xelatex %O %S' -pdf file.tex

In this approach, xelatex is used to generate the PDF file directly, without generating an intermediate output file. Note that, today, xelatex first generates an xdv stream and internally pipes it to xdvipdfmx to produce a PDF file.

Hence this approach is equivalent to:

$ xelatex file.tex     # called one or more times to produce file.pdf

Updated 2019.08.31 from user36296's comment.

终陌 2024-09-14 07:33:37

latexmk --xelatex job.tex
现在,这个论证以这种简单的形式是可以通过的。

latexmk --xelatex job.tex
Now the argument is passable in this simple form.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文