首页 > 解决方案 > 我可以将 Pandoc 排版引擎更改为 XeTeX 或 LuaTex 吗?

问题描述

我正在尝试在我的文档中使用 Arial 字体并将其从 Markdown 转换为 Latex。我在我的乳胶模板中包含以下内容:

\usepackage{fontspec}
\setmainfont{Arial}

当我正常使用它时,这可以工作并将字体更改为 Arial,但是当我使用 Pandoc 转换为 PDF 时,我收到错误:

Error producing PDF.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Fatal fontspec error: "cannot-use-pdftex"
! 
! The fontspec package requires either XeTeX or LuaTeX.
! 
! You must change your typesetting engine to, e.g., "xelatex" or
! "lualatex"instead of plain "latex" or "pdflatex".
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

l.28 \msg_fatal:nn {fontspec} {cannot-use-pdftex}

它说该软件包需要 XeTeX 或 LuaTex。我已经尝试了很多方法来将字体更改为 Arial,但到目前为止没有任何效果。

我使用 OS X。

标签: latexpandoc

解决方案


在使用 Pandoc 创建 pdf 时使用 LuaTex:

pandoc test.txt --pdf-engine=lualatex -o test.pdf

相应地申请 XeTex:

pandoc test.txt --pdf-engine=xelatex -o test.pdf

来自 Pandoc手册

--pdf-engine=pdflatex|lualatex|xelatex|wkhtmltopdf|weasyprint|prince|context|pdfroff

生成 PDF 输出时使用指定的引擎。默认为 pdflatex。如果引擎不在您的 PATH 中,则可以在此处指定引擎的完整路径。

查看手册的演示部分- 大多数用例都包含在其中。


推荐阅读