此问题与this question密切相关,但是存在以下差异:
centos
)中的Unix CentOS。我已经使用模板Hugo-Xmin创建了一个项目。在RStudio中,在Blogdown中创建项目后,它创建了一些预定义的帖子,我正在编辑此帖子:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myapp.settings')
application = get_wsgi_application()
我通过在文件末尾添加以下代码段来修改了该文件:
/content/post/2015-07-23-r-rmarkdown.Rmd
我的工作目录是项目文件夹,我从那里运行,在R控制台中,命令:
This is a tikz picture:
```{r, echo=FALSE, engine='tikz', out.width='90%', fig.ext=if (knitr:::is_latex_output()) 'pdf' else 'png', fig.cap='Some caption.'}
\begin{tikzpicture}[scale=.7]
\draw [fill=gray!30,very thick] (0,-1) rectangle (5,1);
\draw [very thick] (5, 0) -- (13,0);
\node [below] at (2,-1) {\large Hello};
\node [below, align=center] at (0,-1) {\large Two\\ lines};
\end{tikzpicture}
```
并得到这个:
blogdown::build_site()
重要:请注意,我已遵循帮助链接,并在文件开头添加了以下代码段:
> blogdown::build_site()
Rendering content/_index.Rmarkdown
running: bash -c "cd ../..;
find . -not -path '*/exampleSite/*' \\( -name '*.html' -o -name '*.css' \\) | xargs wc -l"
Rendering content/post/2015-07-23-r-rmarkdown.Rmd
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013)
restricted \write18 enabled.
entering extended mode
! LaTeX Error: File `preview.sty' not found.
! Emergency stop.
<read *>
Quitting from lines 49-55 (2015-07-23-r-rmarkdown.Rmd)
Error: Failed to compile tikz2b145b766cfa.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See tikz2b145b766cfa.log for more info.
Execution halted
Error in render_page(f) :
Failed to render 'content/post/2015-07-23-r-rmarkdown.Rmd'
我在上面报告的输出是在此代码段到位后得到的输出。
通过检查文件```{r, include=FALSE}
options(tinytex.verbose = TRUE)
```
(如错误消息中所述),我可以看到以下错误:
tikz2b145b766cfa.log
重要的是要知道我已经在CentOS系统上安装了许多软件包和软件:
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013) (format=pdflatex 2019.3.18) 18 MAR 2019 21:12
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**tikz2b145b766cfa.tex
(./tikz2b145b766cfa.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ru
ssian, ukrainian, bulgarian, loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
\@input{preview.aux}
\openout2 = `preview.aux'.
No file preview.tex.
! LaTeX Error: File `preview.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
! Emergency stop.
<read *>
l.4 \usepackage
{amsmath}^^M
Here is how much of TeX's memory you used:
200 strings out of 494820
2171 string characters out of 3178049
47774 words of memory out of 3000000
3480 multiletter control sequences out of 15000+200000
3640 words of font info for 14 fonts, out of 3000000 for 9000
198 hyphenation exceptions out of 8191
23i,0n,17p,164b,36s stack positions out of 5000i,500n,10000p,200000b,50000s
! ==> Fatal error occurred, no output PDF file produced!
并且:
yum install texlive*
在R。
根据建议,我安装了:install.packages("devtools")
remotes::install_github('yihui/knitr')
install.packages(c('magick', 'pdftools'))
。成功了。之后,在运行tinytex
之后,总是提示我缺少必须安装的库。 30分钟后,我收到此消息:
build_site()
很遗憾,我已经为此问题苦苦挣扎,因为已经安装了> blogdown::build_site()
Rendering content/_index.Rmarkdown
running: bash -c "cd ../..;
find . -not -path '*/exampleSite/*' \\( -name '*.html' -o -name '*.css' \\) | xargs wc -l"
Rendering content/post/2015-07-23-r-rmarkdown.Rmd
hugo: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by hugo)
hugo: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by hugo)
,并且不确定如何修复libstdc++-4.8.5-36.el7.x86_64
和GLIBCXX_3.4.20
。对它们尝试GLIBCXX_3.4.21
无效。
答案 0 :(得分:1)
我不知道为什么您的TeX Live无法找到preview.sty
,但是我很确定TinyTeX会自动运行:
# first make sure all your R packages are up-to-date, then
tinytex::install_tinytex()