我正在使用RMarkdown脚本在Windows 7 PC上的Rstudio中制作一些beamer幻灯片。这些幻灯片位于目录中。
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中(用正斜杠引用): 我得到一个致命错误,其中包括日志输出:
! 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中时: 我在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!未定义的控制序列。<write> \string \bibdata {C:\me\bib\masterbib.bib } l.569 \end{frame} 错误:无法编译Slides.tex。有关更多信息,请参见Slides.log。
另外:警告消息: 运行命令'"pdflatex" -halt-on-error -interaction=batchmode "slides.tex"'的状态为1 Execution halted
- BarkleyBGSlides.log
的内容。 - mb21