This question is very closely related to this question, however the following differences apply:
- OS: Unix CentOS in Docker container (image is
centos
) with Windows host. - Error: Conceptually the same error, but the fix that worked on Windows does not work here and the error message is also different.
I have created a project by using template Hugo-Xmin. In RStudio, after creating the project in blogdown, it created some predefined posts, I am editing this one:
/content/post/2015-07-23-r-rmarkdown.Rmd
I modified that file by adding this snippet at the end of the file:
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}
```
Failed to process the post
My working directory is the project folder, I run from there, in the R console, the command:
blogdown::build_site()
And get this:
> 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'
Important Please notice that I have followed the help link and added, at the beginning of the file, this snippet:
```{r, include=FALSE}
options(tinytex.verbose = TRUE)
```
The output I reported above, is the output I get when this snippet is in place.
Troubleshooting 1
By inspecting file tikz2b145b766cfa.log
(as reported in the error message), I can see the following error:
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!
It is important to know I have installed on the CentOS system a lot of packages and software:
yum install texlive*
And:
install.packages("devtools")
remotes::install_github('yihui/knitr')
install.packages(c('magick', 'pdftools'))
In R.
Troubleshooting 2
As advised, I installed: tinytex
. It succeeded. After that, after running build_site()
, I always got prompted for a missing library I had to install. After 30 minutes, I got this message:
> 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)
This one I am struggling with unfortunately as libstdc++-4.8.5-36.el7.x86_64
is already installed and I am not sure how to fix GLIBCXX_3.4.20
and GLIBCXX_3.4.21
. Trying yum install
on them does not work.