在用rmarkdown编译为pdf时出错,我的yaml为:
bookdown::pdf_book:
includes:
in_header: latex/preamble.tex
before_body: latex/before_body.tex
after_body: latex/after_body.tex
keep_tex: true
dev: "cairo_pdf"
latex_engine: xelatex
citation_package: natbib
pandoc_args: ["--top-level-division=chapter", "--lua-filter=latex/sidebar.lua"]
template: null
quote_footer: ["\\hspace*{\\fill} ", ""]
toc_unnumbered: false
number_sections: true
编译错误的内容为:
"D:/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS _main.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output _main.tex --lua-filter "D:\R\R-4.3.1\library\bookdown\rmarkdown\lua\custom-environment.lua" --lua-filter "D:\R\R-4.3.1\library\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "D:\R\R-4.3.1\library\rmarkdown\rmarkdown\lua\latex-div.lua" --metadata-file "C:\Users\ADMINI~1\AppData\Local\Temp\RtmpSoHUNH\file4af443714d65" --embed-resources --standalone --table-of-contents --toc-depth 2 --number-sections --highlight-style tango --pdf-engine xelatex --natbib --include-in-header "latex\preamble.tex" --include-before-body "latex\before_body.tex" --include-after-body "latex\after_body.tex" --wrap preserve --top-level-division=chapter --lua-filter=latex/sidebar.lua --variable tables=yes --standalone -Mhas-frontmatter=false
! Package fontspec Error: The font "Inconsolata" cannot be found.
! kpathsea: Running mktextfm Inconsolata
! The command name is F:\texlive\texlive\2023\bin\windows\mktextfm
! name = Inconsolata, rootname = Inconsolata, pointsize =
! mktexmf: empty or non-existent rootfile!
! name = Inconsolata, rootname = Inconsolata, pointsize =
! mktexmf: empty or non-existent rootfile!
! mktexmf: empty or non-existent rootfile!
! kpathsea: Running mktexmf Inconsolata.mf
! The command name is F:\texlive\texlive\2023\bin\windows\mktexmf
! Cannot find Inconsolata.mf.
! kpathsea: Appending font creation commands to missfont.log.
Error: LaTeX failed to compile _main.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See _main.log for more info.
Execution halted
本人使用的是Texlive 2023,错误提示显示缺少相应字体,但我不知道该如何安装对于字体。请教一下各位坛友,谢谢。