无法在 Arch Linux 上编译 Rmarkdown 文件
Unable to compile a Rmarkdown file on Arch Linux
我在编译一个简单的 Rmarkdown 文件时遇到问题,而且我对解决方案一无所知。问题是:
我要编译的文件
这是一个没有 R 代码的简单文档,只有文本。在 header 中:标题、作者、日期和 output: pdf_document
.
包是如何安装的
我用 install.packages("tidyverse")
安装了包 rmarkdown
和 tinytex
。 TinyTex(发行版)是这样安装的:tinytex::install_tinytex()
.
错误
> rmarkdown::render("~/document.Rmd", "pdf_document")
processing file: document.Rmd
|........................................................................| 100%
ordinary text without R code
output file: document.knit.md
/usr/lib/rstudio/bin/pandoc/pandoc +RTS -K512m -RTS document.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output document.tex --lua-filter /home/rik/R/x86_64-pc-linux-gnu-library/4.0/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/rik/R/x86_64-pc-linux-gnu-library/4.0/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable 'geometry:margin=1in'
tlmgr: package repository https://ctan.dcc.uchile.cl/systems/texlive/tlnet (verified)
tlmgr install: package already present: latex
tlmgr install: package already present: latex-base-dev
! LaTeX Error: File `article.cls' not found.
! Emergency stop.
<read *>
Erro: LaTeX failed to compile document.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See document.log for more info.
Além disso: Warning message:
In has_crop_tools() :
Tool(s) not installed or not in PATH: pdfcrop, ghostcript
-> As a result, figure cropping will be disabled.
document.log
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex 2021.3.6) 6 MAR 2021 13:05
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**document.tex
(./document.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-18>
! LaTeX Error: File `article.cls' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: cls)
Enter file name:
! Emergency stop.
<read *>
l.7 \usepackage
{lmodern}^^M
Here is how much of TeX's memory you used:
22 strings out of 480971
456 string characters out of 5907552
278620 words of memory out of 5000000
17342 multiletter control sequences out of 15000+600000
403430 words of font info for 27 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
32i,0n,39p,87b,13s stack positions out of 5000i,500n,10000p,200000b,80000s
! ==> Fatal error occurred, no output PDF file produced!
#1 次尝试:重新安装 tinytex
我尝试卸载(tinytex::uninstall_tinytex()
)、重新安装(tinytex::install_tinytex()
)和重新安装(tinytex::reinstall_tinytex()
),但错误仍然存在。
#2 尝试:安装 lmodern
虽然 tinytex::check_installed("lm") == TRUE
,但我尝试用 tinytex::tlmgr_install("lmodern")
安装 lmoden
。
安装
> tinytex::tlmgr_install("lmodern")
tlmgr install lmodern
tlmgr: package repository https://ctan.dcc.uchile.cl/systems/texlive/tlnet (verified)
tlmgr install: package lmodern not present in repository.
tlmgr: action install returned an error; continuing.
tlmgr: An error has occurred. See above messages. Exiting.
tlmgr update --self
fmtutil [WARNING]: You seem to have no formats defined in your fmtutil.cnf files!
tlmgr install lmodern
tlmgr: package repository https://ctan.dcc.uchile.cl/systems/texlive/tlnet (verified)
tlmgr install: package lmodern not present in repository.
tlmgr: action install returned an error; continuing.
tlmgr: An error has occurred. See above messages. Exiting.
搜索
rik@arch ~ : sudo find / -regex ".*lmodern.sty"
/home/rik/.TinyTex/texmf-dist/tex/latex/lm/lmodern.sty
环境
sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux
Matrix products: default
BLAS: /usr/lib/libblas.so.3.9.0
LAPACK: /usr/lib/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=pt_BR.UTF-8 LC_NUMERIC=C
[3] LC_TIME=pt_BR.UTF-8 LC_COLLATE=pt_BR.UTF-8
[5] LC_MONETARY=pt_BR.UTF-8 LC_MESSAGES=pt_BR.UTF-8
[7] LC_PAPER=pt_BR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.4 tools_4.0.4
定义的环境变化不 .bash_profile
export PATH=$PATH:$HOME/.local/appimages:$HOME/bin:$HOME/.local/bin
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export TEXMFDIST=/usr/share/texmf-dist
一些观察
- 我在全新安装 Arch 时遇到了这个问题 Linux(wget 已安装)
- 我总是这样安装
rmarkdown
和 tinytex
,即使是在 Arch 上,每次都运行良好。
- 我在 Windows 机器和 Ubuntu 机器上试过,它按预期工作。
- RStudio 上的编织按钮也不起作用
尝试两件事:
- 如果从 arch repos 安装
texlive-latexextra
会怎样?我猜你正在尝试避免这种情况,因为你正在使用 tinytex
;我问的原因是因为乳胶似乎正在查找系统目录。
- 如果可行,请尝试在
.bashrc
. 中注释掉 TEXMFDIST
环境变量
我在编译一个简单的 Rmarkdown 文件时遇到问题,而且我对解决方案一无所知。问题是:
我要编译的文件
这是一个没有 R 代码的简单文档,只有文本。在 header 中:标题、作者、日期和 output: pdf_document
.
包是如何安装的
我用 install.packages("tidyverse")
安装了包 rmarkdown
和 tinytex
。 TinyTex(发行版)是这样安装的:tinytex::install_tinytex()
.
错误
> rmarkdown::render("~/document.Rmd", "pdf_document")
processing file: document.Rmd
|........................................................................| 100%
ordinary text without R code
output file: document.knit.md
/usr/lib/rstudio/bin/pandoc/pandoc +RTS -K512m -RTS document.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output document.tex --lua-filter /home/rik/R/x86_64-pc-linux-gnu-library/4.0/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/rik/R/x86_64-pc-linux-gnu-library/4.0/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable 'geometry:margin=1in'
tlmgr: package repository https://ctan.dcc.uchile.cl/systems/texlive/tlnet (verified)
tlmgr install: package already present: latex
tlmgr install: package already present: latex-base-dev
! LaTeX Error: File `article.cls' not found.
! Emergency stop.
<read *>
Erro: LaTeX failed to compile document.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See document.log for more info.
Além disso: Warning message:
In has_crop_tools() :
Tool(s) not installed or not in PATH: pdfcrop, ghostcript
-> As a result, figure cropping will be disabled.
document.log
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex 2021.3.6) 6 MAR 2021 13:05
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**document.tex
(./document.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-18>
! LaTeX Error: File `article.cls' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: cls)
Enter file name:
! Emergency stop.
<read *>
l.7 \usepackage
{lmodern}^^M
Here is how much of TeX's memory you used:
22 strings out of 480971
456 string characters out of 5907552
278620 words of memory out of 5000000
17342 multiletter control sequences out of 15000+600000
403430 words of font info for 27 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
32i,0n,39p,87b,13s stack positions out of 5000i,500n,10000p,200000b,80000s
! ==> Fatal error occurred, no output PDF file produced!
#1 次尝试:重新安装 tinytex
我尝试卸载(tinytex::uninstall_tinytex()
)、重新安装(tinytex::install_tinytex()
)和重新安装(tinytex::reinstall_tinytex()
),但错误仍然存在。
#2 尝试:安装 lmodern
虽然 tinytex::check_installed("lm") == TRUE
,但我尝试用 tinytex::tlmgr_install("lmodern")
安装 lmoden
。
安装
> tinytex::tlmgr_install("lmodern")
tlmgr install lmodern
tlmgr: package repository https://ctan.dcc.uchile.cl/systems/texlive/tlnet (verified)
tlmgr install: package lmodern not present in repository.
tlmgr: action install returned an error; continuing.
tlmgr: An error has occurred. See above messages. Exiting.
tlmgr update --self
fmtutil [WARNING]: You seem to have no formats defined in your fmtutil.cnf files!
tlmgr install lmodern
tlmgr: package repository https://ctan.dcc.uchile.cl/systems/texlive/tlnet (verified)
tlmgr install: package lmodern not present in repository.
tlmgr: action install returned an error; continuing.
tlmgr: An error has occurred. See above messages. Exiting.
搜索
rik@arch ~ : sudo find / -regex ".*lmodern.sty"
/home/rik/.TinyTex/texmf-dist/tex/latex/lm/lmodern.sty
环境
sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux
Matrix products: default
BLAS: /usr/lib/libblas.so.3.9.0
LAPACK: /usr/lib/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=pt_BR.UTF-8 LC_NUMERIC=C
[3] LC_TIME=pt_BR.UTF-8 LC_COLLATE=pt_BR.UTF-8
[5] LC_MONETARY=pt_BR.UTF-8 LC_MESSAGES=pt_BR.UTF-8
[7] LC_PAPER=pt_BR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.4 tools_4.0.4
定义的环境变化不 .bash_profile
export PATH=$PATH:$HOME/.local/appimages:$HOME/bin:$HOME/.local/bin
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export TEXMFDIST=/usr/share/texmf-dist
一些观察
- 我在全新安装 Arch 时遇到了这个问题 Linux(wget 已安装)
- 我总是这样安装
rmarkdown
和tinytex
,即使是在 Arch 上,每次都运行良好。 - 我在 Windows 机器和 Ubuntu 机器上试过,它按预期工作。
- RStudio 上的编织按钮也不起作用
尝试两件事:
- 如果从 arch repos 安装
texlive-latexextra
会怎样?我猜你正在尝试避免这种情况,因为你正在使用tinytex
;我问的原因是因为乳胶似乎正在查找系统目录。 - 如果可行,请尝试在
.bashrc
. 中注释掉
TEXMFDIST
环境变量