问题描述
这两天在测试湘云在统计之都上投的一篇稿子《 R Markdown 制作 beamer 幻灯片》的代码,文中提到了 binb 包内置的 Presento 主题,这个主题比较简洁、清爽,但是需要安装的字体比较多,我已提前使用如下代码下载所涉及的字体:
tinytex::tlmgr_install(c("montserrat", "lato", "noto", "alegreya", "inconsolata"))
下载后的字体放在paste(tinytex::tinytex_root(), "texmf-dist/fonts", c("opentype", "truetype"), sep = "/")
路径下,我已把该路径下所有相关字体手动安装了一遍,包括paste(tinytex::tinytex_root(), "texmf-dist/fonts/opentype/public/inconsolata", sep = "/")
目录下的 4 个字体文件。但是无论是 Ubuntu 20.04 LTS 还是 Windows 10 下编译文档都会报错,报错信息如下:
tlmgr update --all --self
tlmgr.pl: package repository https://mirror.bjtu.edu.cn/CTAN/systems/texlive/tlnet (not verified: pubkey missing)
tlmgr.pl install: package already present: texlive-scripts
! Package fontspec Error: The font "Inconsolata" cannot be found.
! 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 C:\Users\cxy\AppData\Roaming\TinyTeX\bin\win32\mktexmf
! Cannot find Inconsolata.mf.
! Cannot find Inconsolata.mf.
! kpathsea: Running mktextfm Inconsolata
! The command name is C:\Users\cxy\AppData\Roaming\TinyTeX\bin\win32\mktextfm
! kpathsea: Appending font creation commands to missfont.log.
Error: LaTeX failed to compile Untitled.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Untitled.log for more info.
Execution halted
在 Ubuntu 20.04 LTS 下我是通过运行sudo apt-get install fonts-inconsolata
后解决了 inconsolata 字体缺失问题,但是 Windows 10 下不知道如何解决 inconsolata 字体缺失问题。
我的代码
---
author: Ratul Saha
address: www.ratulsaha.com
title: PRESENTO
subtitle: clean, simple and extensible
date: \today
output: binb::presento
---
## Presento
- \begin{center}\largetext{The design is \underline{clean}}\end{center} \bigskip
- \begin{center}\largetext{The rules are \underline{simple}}\end{center} \bigskip
- \item \begin{center}\largetext{The code is \underline{extensible}}\end{center}
## Open Source Fonts
- \montserratfont This is \textsc{Montserrat} \bigskip
- \notosansfont This is \textsc{Noto Sans} \bigskip
- \latolightfont This is Lato (light) \bigskip
- \inconsolatafont This is inconsolata \bigskip
- \textsc{This is Alegreya Sans small caps} \bigskip
## Color Palette
\begin{center}
\crule[colordgray] \crule[colorhgray] \crule[colorblue] \crule[colorgreen] \crule[colororange]
\end{center}
____
\begin{center}
\hugetext{BIG BOLD TEXT}
\medskip
\small but background color does not work
\end{center}
____
\tikz[overlay,remember picture] \node[opacity=0.8, at=(current page.center)]{%
\includegraphics[width=\paperwidth]{images/skeleton}};
\begin{textblock}{7}(7,2.5)
{\color{colorblue}\hugetext{\textbf{RUN!}}}
\end{textblock}
我的系统环境
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044), RStudio 2022.7.1.554
Locale:
LC_COLLATE=Chinese (Simplified)_China.utf8 LC_CTYPE=Chinese (Simplified)_China.utf8
LC_MONETARY=Chinese (Simplified)_China.utf8 LC_NUMERIC=C
LC_TIME=Chinese (Simplified)_China.utf8
Package version:
base64enc_0.1.3 bslib_0.2.5.1 cli_3.3.0 compiler_4.2.1 digest_0.6.27
evaluate_0.15 fs_1.5.0 glue_1.6.2 graphics_4.2.1 grDevices_4.2.1
highr_0.9 htmltools_0.5.1.1 jquerylib_0.1.4 jsonlite_1.8.0 knitr_1.39
magrittr_2.0.3 methods_4.2.1 R6_2.5.0 rappdirs_0.3.3 rlang_1.0.2
rmarkdown_2.14 sass_0.4.0 stats_4.2.1 stringi_1.7.8 stringr_1.4.0
tinytex_0.40 tools_4.2.1 utils_4.2.1 xfun_0.31 yaml_2.2.1