bookdown Error 'CTeX fontset `mac' is unavailable in current mode.' when using output format pdf_book & pdf_document2

纵然是瞬间 提交于 2019-12-11 02:44:24

问题


I'm using bookdown with Rstudio + tinyTex + pandoc to write a report in Chinese. Because I need to use cross reference, I have to set the output format to pdf_document2, but I got an issue about CTeX fontest.

First, here is the YAML part:

---
title: "title"
author:
  - author
documentclass: ctexart
site: bookdown::bookdown_site
output:
  bookdown::pdf_document2
bibliography: bib_v1.bib
csl: chinese-author-date.csl
link-citations: yes
colorlinks: yes
classoption: "hyperref,"
---

And there's some wrong when build the book, which says 'CTeX fontset `mac' is unavailable in current mode.', and here's the whole error info:

tlmgr search --file --global '/mac'
TeX Live 2017 is frozen forever and will no
longer be updated.  This happens in preparation for a new release.

If you are interested in helping to pretest the new release (when
pretests are available), please read     http://tug.org/texlive/pretest.html.
Otherwise, just wait, and the new release will be ready in due time.
! Critical ctex error: "fontset-unavailable"
! 
! CTeX fontset 'mac' is unavailable in current mode.
! 
! See the ctex documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

! 
! CTeX fontset 'mac' is unavailable in current mode.
! 
! See the ctex documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

! CTeX fontset 'mac' is unavailable in current mode.
! 
! See the ctex documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

! 
! See the ctex documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

! See the ctex documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

! 
! For immediate help type H <return>.
!...............................................  

! For immediate help type H <return>.
!...............................................  

Error: Failed to compile _main.tex. See _main.log for more info.
In addition: Warning message:
In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains mac
Please delete _main.Rmd after you finish debugging the error.
Execution halted

Exited with status 1.

I'm not familiar with LaTeX, and don't know how to fix the issue. I've tried to build the bookdown-Chinese demo here, and it succeed. I also tried to use the template of this demo in my own file, or use the output format pdf_book, but I still got the same problem.

So is there something I can do to fix it?

Thanks very much for your help!


回答1:


The bookdown-chinese demo uses XeLaTeX: https://github.com/yihui/bookdown-chinese/blob/master/_output.yml#L22 You could do the same like this:

output: 
  bookdown::pdf_document2:
    latex_engine: xelatex


来源:https://stackoverflow.com/questions/49684617/bookdown-error-ctex-fontset-mac-is-unavailable-in-current-mode-when-using-o

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!