我想要一个脚本编织一个Rmd文件到PDF文档并面临一些错误。Rmarkdown针织YAML LaTeX错误
我必须说,文档针织很好,如果我点击在Rstudio针织按钮,但它未能编织如果我用命令:
rmarkdown::render('diagnostic.Rmd',output_format = "pdf_document",
output_file = "diag.pdf")
的第一个错误,我得到来自我的这部分代码:
---
author: Zigo_datateam
date: "`r format(Sys.time(), '%d %B, %Y')`"
geometry: margin=1.6in
header-includes: "\\usepackage{fancyhdr} \\fancyfoot[CO,CE]{My footer}"
output:
pdf_document:
toc: false
title: "Graphic Layout(Report)"
---
是:
Error in yaml::yaml.load(string, ...) :
Scanner error: while scanning a simple key at line 4, column 1could
not find expected ':' at line 5, column 1
所以,如果我删除孔header-includes
Ë上的表达似乎开始编织,但后来我得到这个部分的第二错误(其中来自第二“---”后):
\addtolength{\headheight}{1.0cm}
\pagestyle{fancyplain}
\rhead{\includegraphics[height=1.2cm]{logo.png}}
\renewcommand{\headrulewidth}{0pt}
错误:
! Undefined control sequence.
<argument> \undefinedpagestyle
l.130 ...headheight}{1.0cm} \pagestyle{fancyplain}
我怎样才能摆脱第一个错误没有得到第二个?
更新:我决定把所有的页脚/标题样式移动到一个单独的文件,我的代码如下所示:
---
author: Zigo_datateam
date: "`r format(Sys.time(), '%d %B, %Y')`"
geometry: margin=1.6in
output:
pdf_document:
includes:
in_header: mystyles.sty
title: "Graphic Layout(Report)"
---
我前面谈到的采空出,但我仍然得到这个的错误:
pandoc: Error producing PDF
Error: pandoc document conversion failed with error 43
我会包括乳胶包使用从这里回答:https://tex.stackexchange.com/questions/171711/how-to-include-latex-package-in-r-markdown – user20650
你还有'缩进'toc:false'行之后yaml :: yaml.load()中出错? – Anthon
是的,错误仍然存在 –