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

2

2

I'm using 'bookdown' with RStudio, tinyTex and 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 have an issue with 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 is something wrong when I build the book, which says

'CTeX fontset `mac' is unavailable in current mode.'

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 succeeded. I also tried to use the template of this demo in my own file, or use the output format pdf_book, but I still had the same problem.

So is there something I can do to fix it?

Thanks very much for your help!

Excurvature answered 6/4, 2018 at 3:3 Comment(0)
E
0

Although it's an old question, I want to supply the answer I found that may help others. For Chinese documents, we should install the package rticles, and do the following in the .rmd file header.

---
documentclass: ctexart
output: 
    rticles::ctex
---
Excurvature answered 13/1, 2023 at 5:23 Comment(0)
P
2

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
Psoriasis answered 6/4, 2018 at 9:26 Comment(0)
E
0

Although it's an old question, I want to supply the answer I found that may help others. For Chinese documents, we should install the package rticles, and do the following in the .rmd file header.

---
documentclass: ctexart
output: 
    rticles::ctex
---
Excurvature answered 13/1, 2023 at 5:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.