无法编织 pdf,接收到 tlmgr 搜索失败的 tinytex 错误

Unable to knit pdf, receiving tinytex error with failed tlmgr search

正在使用 - RStudio 版本 1.2.1335 -R 版本

我能够将 R markdown 文件编织成 HTML 和 Word,但无法生成 PDF。我不断收到相同的错误消息,告诉我无法找到 "Palatino" 字体。

文件处理成功(所有块运行)。

我已经尝试 re-installing 并重置 Miktex 和 Tinytex,以及 R 本身。我对此很陌生,所以我不确定如何进行。我应该安装 TexLive 吗?

这是我正在尝试 运行:

的文件的 header
--
title: "Assignment 1"
fontsize: 11pt
header-includes: \usepackage{fancyhdr}
geometry: "left=.5in,right=.5in,top=1in,bottom=1in"
output:
  pdf_document:
    latex_engine: xelatex
    md_extensions: +inline_notes
    number_sections: no
  word_document: default
mathfont: Palatino
monofont: Courier
mainfont: Palatino
sansfont: Helvetica
subtitle: \textbf{Due Wednesday, 11 September 2019 (beginning of class)}
fontfamily: mathpazo
---

这是我继续收到的错误,没有呈现 PDF 文件:

output file: PBHLTH252-Assignment-1_post.knit.md

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS PBHLTH252-Assignment-1_post.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+inline_notes --output PBHLTH252-Assignment-1_post.tex --template "C:\Users\UYser\Documents\R\win-library.6\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --pdf-engine xelatex --variable graphics=yes --lua-filter "C:/Users/UYser/Documents/R/win-library/3.6/rmarkdown/rmd/lua/pagebreak.lua" --variable "compact-title:yes" tlmgr search --file --global "/Palatino." ! Package fontspec Error: The font "Palatino" cannot be found.

! kpathsea: Running mktextfm Palatino

! The command name is C:\Users\UYser\AppData\Roaming\TinyTeX\bin\win32\mktextfm

! kpathsea: Appending font creation commands to missfont.log.

Error: Failed to compile PBHLTH252-Assignment-1_post.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See PBHLTH252-Assignment-1_post.log for more info. In addition: Warning message: In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) : Failed to find a package that contains Palatino. Execution halted

我尝试关注此话题,https://github.com/yihui/tinytex/issues/81,但没有成功:

  1. 运行这个建议的代码
tinytex::tlmgr_search("/Palatino[.](tfm|afm|mf|otf)")

结果:

package repository http://ctan.math.illinois.edu/systems/texlive/tlnet (not verified: gpg unavailable)

  1. 运行这个
tinytex::tlmgr_install("multirow") 

给我以下错误:

tlmgr install Palatino. 'afm' is not recognized as an internal or external command, operable program or batch file. tlmgr update --self tlmgr.pl: package repository http://ctan.math.illinois.edu/systems/texlive/tlnet (not verified: gpg unavailable) tlmgr.pl: no self-updates for tlmgr available. tlmgr install Palatino. 'afm' is not recognized as an internal or external command, operable program or batch file.

感谢任何帮助!

我以前也遇到过类似的问题。我的解决方案听起来很天真(或愚蠢),但对我来说非常有效。而不是调试,在 RStudio:

  1. 安装rticles
  2. 开始一个新的R Markdown文件
  3. 选择一种期刊文章模板,例如 PNAS Journal ArticleSpringer Journal ArticleElsevier Journal Article...
  4. knit 模板。

然后,它将尝试自动安装缺少的 LaTeX 包...

您可能想尝试一些日记模板。它对我有用,我希望这也能解决您的问题。好好享受!

看起来您在 Windows 上时从 Mac 用户那里获得了模板。那里的字体名称不同。您可以使用 Palatino Linotype 而不是 Palatino。我不确定 HelveticaCourier 是否有效。如果没有,您可以使用 ArialCourier New.

但是,这听起来像是一种相当难看的字体组合。 Palatino 是一种非常好的字体,但 Helvertica/Arial 和 Courier (New) 都不适合。此外,我不认为普通的 Palatino 字体被设置为用于数学。您可以改用 Asana Math,它随 MikTeX/TinyTeX.

一起提供