【问题标题】:bookdown is taking pdflatex even though I explicitly stated xelatex即使我明确指出 xelatex,bookdown 仍在使用 pdflatex
【发布时间】:2021-06-26 22:15:15
【问题描述】:

我正在尝试使用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

我做错了什么,我该怎么做才能让它发挥作用?

【问题讨论】:

    标签: r latex pandoc bookdown


    【解决方案1】:

    您需要以能够看到您的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"))
    

    (单独指定)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-03-25
      • 1970-01-01
      • 1970-01-01
      • 2018-11-25
      • 2017-06-29
      • 2010-11-06
      • 1970-01-01
      相关资源
      最近更新 更多