如何解决尽管我明确说明了 xelatex,但 bookdown 正在使用 pdflatex
我正在尝试用 bookdown
作为 pdf 创建一本书。它适用于创建 EPUB 文件。
我的 YAML 是这样的:
---
title: "Title Here"
subtitle: "Subtitle here"
author: "me"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
documentclass: book
bibliography: [book.bib]
biblio-style: apalike
link-citations: yes
description: "description goes here."
cover-image: "cover.png"
lang: "es"
always_allow_html: true
output:
pdf_document:
latex_engine: xelatex
pdf_document2:
latex_engine: lualatex
---
在第 4 章的某个时刻,我收到一封日文信件,U+305B。
我尝试使用以下方法创建 pdf 书:
bookdown::render_book("index.Rmd",output_format = bookdown::pdf_document2())
和
bookdown::render_book("index.Rmd",output_format = bookdown::pdf_book())
他们都抱怨:
! Package inputenc Error: Unicode character せ (U+305B)
(inputenc) not set up for use with LaTeX.
并推荐我检查this part of the rmarkdown cookbook。从那里我拿走了 YAML 序言的最后 4 行。
我不禁注意到对 pandoc 的调用将 pdflatex
作为 pdf-engine
(参见倒数第三行):
/usr/lib/rstudio/bin/pandoc/pandoc +RTS -K512m -RTS myFileName.knit.md --to latex
--from markdown+autolink_bare_uris+tex_math_single_backslash
--output herramientasBasicasMejoramiento.tex
--lua-filter /usr/local/lib/R/site-library/bookdown/rmarkdown/lua/custom-environment.lua
--lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua
--lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua
--Metadata-file /tmp/RtmpAbwGga/file565f3d087e3c --self-contained
--table-of-contents --toc-depth 2 --number-sections
--highlight-style tango --pdf-engine pdflatex --variable graphics
--wrap preserve --variable tables=yes
--standalone -Mhas-frontmatter=false --citeproc
我在 Ubuntu 中工作并且已经安装了 texlive 和 tinytex。
whereis xelatex
xelatex: /home/gp/bin/xelatex /usr/local/texlive/2019/bin/x86_64-linux/xelatex
有一个 unanswered question with a problem that looks similar。
我做错了什么,我该怎么做才能让它发挥作用?
解决方法
您需要以可以看到您的 latex_engine
参数的方式指定输出格式,例如
bookdown::render_book("index.Rmd",output_format = "pdf_document2")
(从您的 YAML 中命名其中一种输出格式),或
bookdown::render_book("index.Rmd",output_format = bookdown::pdf_document2(latex_engine = "xelatex"))
(独立指定)。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。