简体   繁体   English

从 RStudio 编织 PDF 文件

[英]Knit PDf file from RStudio

I am trying to Knit PDf file from RStudio, and I am getting the following error:我正在尝试从 RStudio 编织 PDf 文件,但出现以下错误:

! LaTeX Error: File `framed.sty' not found.

  • R version: 3.2.2 (2015-08-14) R 版本:3.2.2 (2015-08-14)
  • Platform: x86_64-redhat-linux-gnu on AWS EC2平台:AWS EC2 上的 x86_64-redhat-linux-gnu

I know this is kind of old, but I tried all this answers in my ubuntu and it didn't work, finally I found that yihui developed the tinytex package , the only thing you have to do is run the following code:我知道这有点旧,但我在我的 ubuntu 中尝试了所有这些答案,但没有奏效,最后我发现yihui开发了tinytex 包,您唯一需要做的就是运行以下代码:

install.packages(c('tinytex', 'rmarkdown'))
tinytex::install_tinytex()

and you are set, this works cross platform你已经准备好了,这可以跨平台工作

Cheers干杯

While trying to knit PDF file from R Studio.在尝试从 R Studio 编织 PDF 文件时。

Error-1: !错误 1 :! LaTeX Error: File `framed.sty' not found. LaTeX 错误:找不到文件“framed.sty”。

Reference: https://github.com/rstudio/rmarkdown/issues/39参考: https : //github.com/rstudio/rmarkdown/issues/39

Solution:解决方案:

You need to install the framed LaTeX package.您需要安装带框架的 LaTeX 包。

yum -y install texlive-framed

Error-2: !错误 2 :! LaTeX Error: File `titling.sty' not found. LaTeX 错误:找不到文件“title.sty”。

Reference: https://github.com/rstudio/rmarkdown/issues/359参考: https : //github.com/rstudio/rmarkdown/issues/359

Solution:解决方案:

wget http://mirrors.ctan.org/macros/latex/contrib/titling.zip

unzip titling.zip     # (might need to sudo yum install unzip)

cd titling

latex titling.ins

sudo mkdir -p /usr/share/texlive/texmf-dist/tex/latex/titling

sudo cp titling.sty /usr/share/texlive/texmf-dist/tex/latex/titling/

sudo texhash

I had a similar problem with titling.sty .我有一个与titleing.sty类似的问题。 The solution was to install a package that contained the missing file.解决方案是安装一个包含丢失文件的包。

Ubuntu: Ubuntu:

On my ubuntu it was:在我的 ubuntu 上是:

sudo apt install texlive-latex-extra

Remember, that you can always find a package that contains a given file by using apt-file:请记住,您始终可以使用 apt-file 找到包含给定文件的包:

sudo apt-file search titling.sty

Of course, you'll have to install the apt-file package first (and refresh the file database) if you haven't done it before:当然,如果您之前没有安装过 apt-file 包,则必须先安装(并刷新文件数据库):

sudo apt install apt-file
sudo apt-file update

Based on your platform, I suspect the least disruptive solution is similar to that for Fedora.根据您的平台,我怀疑破坏性最小的解决方案类似于 Fedora 的解决方案。 I say "least disruptive," because I did not have to replace TexLive with a different package, I just added the missing components.我说“破坏性最小”,因为我不必用不同的包替换 TexLive,我只是添加了缺少的组件。 The process I followed came from a solution posted to https://askbot.fedoraproject.org/en/answers/94766/revisions/ [note that the page has moved so this is only read only], but nonetheless;我遵循的过程来自发布到https://askbot.fedoraproject.org/en/answers/94766/revisions/ [请注意页面已移动,因此这只是只读的] 的解决方案,但仍然如此; it explains why Fedora does not ship with all the TexLive components and more importantly - it explains how to load them separately.它解释了为什么 Fedora 不附带所有 TexLive 组件,更重要的是 - 它解释了如何单独加载它们。 For example, from your terminal, the following will install the missing "framed.sty" component: sudo dnf install "tex(framed.sty)"例如,从您的终端,以下将安装缺少的“framed.sty”组件:sudo dnf install“tex(framed.sty)”

After resolving the framed.sty issue, I was able to resolve the titling.sty error with:解决 framed.sty 问题后,我能够解决 title.sty 错误:

sudo yum -y install texlive-titling须藤 yum -y 安装 texlive-title

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM