首页 > 解决方案 > 无法编织 pdf,收到 tinytex 错误,tlmgr 搜索失败

问题描述

使用 - RStudio 版本 1.2.1335 - R 版本

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

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

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

这是我要运行的文件的标题:

--
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 文件:

输出文件: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\3.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:是的" tlmgr 搜索 --file --global "/Palatino。" !包 fontspec 错误:找不到字体“Palatino”。

!kpathsea:运行 mktextfm Palatino

!命令名称为 C:\Users\UYser\AppData\Roaming\TinyTeX\bin\win32\mktextfm

!kpathsea:将字体创建命令附加到missfont.log。

错误:无法编译 PBHLTH252-Assignment-1_post.tex。调试技巧见https://yihui.name/tinytex/r/#debugging。有关更多信息,请参阅 PBHLTH252-Assignment-1_post.log。另外:警告消息:在 parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) 中:找不到包含 Palatino 的包。执行停止

我尝试关注这个线程,https ://github.com/yihui/tinytex/issues/81 ,但没有成功:

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

结果是:

软件包存储库http://ctan.math.illinois.edu/systems/texlive/tlnet(未验证:gpg 不可用)

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

给我以下错误:

tlmgr 安装 Palatino。'afm' 不是内部或外部命令、可运行程序或批处理文件。tlmgr update --self tlmgr.pl:包存储库http://ctan.math.illinois.edu/systems/texlive/tlnet(未验证:gpg 不可用) tlmgr.pl:没有可用的 tlmgr 自我更新。tlmgr 安装 Palatino。'afm' 不是内部或外部命令、可运行程序或批处理文件。

任何帮助表示赞赏!

标签: rr-markdowntinytex

解决方案


看起来您在使用 Windows 时从 Mac 用户那里获得了模板。那里的字体名称不同。而不是Palatino你可以使用Palatino Linotype. 我不确定是否Helvetica并且Courier会起作用。如果没有,您可以使用Arialand Courier New

然而,这听起来像是一个相当丑陋的字体组合。Palatino 是一种非常好的字体,但 Helvertica/Arial 和 Courier (New) 都不太适合。此外,我不认为将普通的 Palatino 字体设置为用于数学。你可以改用Asana MathMikTeX/TinyTeX 自带的。


推荐阅读