我正在使用 bookdown 和 RStudio 创建 pdf 书。使用 更新 latex 包后tinytex::tlmgr_update()
,图像突然不再渲染,无论是使用knitr::include_graphics()
还是\includegraphics{}
,但图形标题仍在渲染。
请注意,在我更新所有 latex 包(和 tlmgr)之前,一切都运行正常,因此路径或代码文本没有任何变化。我尝试卸载tinytex
所有包,然后重新安装,但似乎仍然遇到同样的问题。
bookdown 创建的文件.tex
包含以下内容:
\begin{figure}
\includegraphics[width=0.9\linewidth]{images/test} \caption{\label{fig:test}Test figure}\label{fig:unnamed-chunk-1}
\end{figure}
最小工作示例:
---
title: "Test book"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
documentclass: book
output:
bookdown::pdf_book:
latex_engine: xelatex
fig_caption: yes
citation_package: natbib
includes:
in_header: preamble.tex
link-citations: yes
keep_md: true
keep_tex: true
---
# Test book
Test figure:
```{r, fig.cap="\\label{fig:test}Test figure", echo=FALSE, message=FALSE, out.width="90%"}
knitr::include_graphics("images/test.png")```
前言:
\usepackage{booktabs}
这些是我安装的乳胶包:
[1] "amscls" "amsfonts" "amsmath" "babel" "bibtex" "blindtext" "booktabs"
[8] "caption" "cm" "colortbl" "dehyph" "dvipdfmx" "dvips" "ec"
[15] "environ" "epigraph" "eso-pic" "etex" "etoolbox" "euenc" "fancyhdr"
[22] "fancyvrb" "float" "fontspec" "framed" "geometry" "glyphlist" "graphics"
[29] "graphics-cfg" "graphics-def" "gsftopk" "helvetic" "hyperref" "hyphen-base" "hyphenat"
[36] "iftex" "inconsolata" "knuth-lib" "kpathsea" "l3backend" "l3kernel" "l3packages"
[43] "latex" "latex-base-dev" "latex-bin" "latex-fonts" "latexconfig" "latexmk" "lm"
[50] "lualibs" "luaotfload" "luatex" "makecell" "makeindex" "mathspec" "metafont"
[57] "mfware" "multirow" "natbib" "oberdiek" "pdfpages" "pdftex" "plain"
[64] "scheme-infraonly" "setspace" "tabu" "tetex" "tex" "tex-ini-files" "texlive.infra"
[71] "threeparttable" "threeparttablex" "times" "tipa" "titlesec" "titling" "tlgs"
[78] "tlperl" "tlpsv" "tocbibind" "tools" "trimspaces" "ulem" "unicode-data"
[85] "upquote" "url" "varwidth" "wrapfig" "xcolor" "xetex" "xetexconfig"
[92] "xkeyval" "xunicode" "zapfding"