【问题标题】:How to use bibliography in different directory when knitting rmarkdown document to beamer presentation?将rmarkdown文档编织到投影仪演示文稿时如何在不同目录中使用参考书目?
【发布时间】:2016-12-20 20:21:06
【问题描述】:

我正在 Windows 7 PC 上的 Rstudio 中的 RMarkdown 脚本中编织一些投影仪幻灯片。幻灯片在目录中

C:/me/slides/myslides.Rmd

我有一个主参考书目,生活在

C:/me/bib/masterbib.bib

我不知道如何从 RMarkdown 文档链接到参考书目文件。这是我尝试的 YAML:

---
title: "Slides"
author: "me"
date: "2016-12-20"
bibliography: C:/me/bib/masterbib.bib
biblio-style: "apalike"
output: 
  beamer_presentation:
    citation_package: natbib
---

这是错误:

! Undefined control sequence.
<write> \string \bibdata {C:\me\bib\masterbib}
l.174 \end{frame}

Error: Failed to compile Slides.tex. See Slides.log for more info.
In addition: Warning message:
running command '"pdflatex" -halt-on-error -interaction=batchmode "Slides.tex"' had status 1 
Execution halted

我尝试了其他几种方法来指定masterbib.bib 的目录,但都没有奏效。我宁愿将masterbib.bib 文件保留在原处,而不是在C:/me/slides/ 目录中制作额外的副本。感谢您的帮助!


编辑

尝试将以下内容传递到 YAML 时(用正斜杠引用):

bibliography: "C:/LaTeXstuff/BibTexLibrary/BrianBib.bib"

我收到一个关于日志输出的致命错误:

! Undefined control sequence.
<write> \string \bibdata {C:\me
                                        \bib\masterbib}
l.174 \end{frame}

Here is how much of TeX's memory you used:
 18047 strings out of 494045
 334241 string characters out of 3145937
 424206 words of memory out of 3000000
 20891 multiletter control sequences out of 15000+200000
 31808 words of font info for 44 fonts, out of 3000000 for 9000
 715 hyphenation exceptions out of 8191
 56i,11n,55p,434b,376s stack positions out of 5000i,500n,10000p,200000b,50000s

!  ==> Fatal error occurred, no output PDF file produced!

将以下内容传递到 YAML 时(用反斜杠引用)

bibliography: "C:\me\bib\masterbib.bib"

我在 Rstudio 控制台中收到以下错误

Error in yaml::yaml.load(enc2utf8(string), ...) : 
  Scanner error: while parsing a quoted scalar at line 4, column 15found unknown escape character at line 4, column 29
Calls: <Anonymous> ... yaml_load_utf8 -> mark_utf8 -> <Anonymous> -> .Call
Execution halted

将以下内容传递到 YAML 时(不带反斜杠)

bibliography: C:\me\bib\masterbib.bib

我在 Rstudio 控制台中收到以下错误

! Undefined control sequence.
<write> \string \bibdata {C:\me
                                        \bib\masterbib}
l.174 \end{frame}

Error: Failed to compile BibTest.tex. See BibTest.log for more info.
In addition: Warning message:
running command '"pdflatex" -halt-on-error -interaction=batchmode "BibTest.tex"' had status 1 
Execution halted

【问题讨论】:

  • 你试过bibliography: "C:/me/bib/masterbib.bib"
  • @mb21 是的,这也会引发以下错误:! Undefined control sequence. &lt;write&gt; \string \bibdata {C:\me\bib\masterbib.bib } l.569 \end{frame} Error: Failed to compile Slides.tex. See Slides.log for more info.In addition: Warning message: running command '"pdflatex" -halt-on-error -interaction=batchmode "slides.tex"' had status 1 Execution halted
  • 您确定您使用了正斜杠(您在 Windows 上也需要这些...我不是...)也许您也应该查看并发布 Slides.log 的内容..
  • @mb21 我玩过斜线。我已经用我尝试过的其他一些方法对原始问题进行了编辑。

标签: knitr r-markdown pandoc beamer bibtex


【解决方案1】:

尝试用两个反斜杠不加引号:

...    
bibliography: C:\\me\\bib\\masterbib.bib
...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-07
    • 2015-09-22
    • 1970-01-01
    • 1970-01-01
    • 2020-12-31
    • 1970-01-01
    • 2016-01-01
    • 2011-03-02
    相关资源
    最近更新 更多