从R Markdown到LaTeX的错误转换 [英] Incorrect conversion from R Markdown to LaTeX
问题描述
为什么以下R Markdown最小(非)工作示例无法编译为PDF?
Why does the following R Markdown minimal (non)-working example not compile to PDF?
---
header-includes:
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \lhead{}
- \chead{}
- \rhead{The performance of new graduates}
- \lfoot{From: K. Grant}
- \cfoot{To: Dean A. Smith}
output:
pdf_document:
keep_tex: yes
latex_engine: xelatex
---
# Test
特别是,有问题的转换发生在-\lfoot{From: K. Grant}
和-\cfoot{To: Dean A. Smith}
上,如在输出.tex
文件中所见:
In particular, the problematic conversion happens to -\lfoot{From: K. Grant}
and -\cfoot{To: Dean A. Smith}
, as seen in the output .tex
file:
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{}
\chead{}
\rhead{The performance of new graduates}
true
true
由于某些原因,这两行都转换为true
导致
For some reason, both of these lines are converted to true
causing
LaTeX错误:缺少
\begin{document}
从而防止文档编译为PDF.
thereby preventing the document from compiling to PDF.
将\lfoot
和\cfoot
更改为几乎所有其他内容似乎会导致它们正确转换.那么这是怎么回事?我认为转换过程中knitr
或pandoc
肯定有问题.
Changing \lfoot
and \cfoot
to just about anything else seems to lead to them being converted correctly. So what's going on here? I take it that there must be a problem with either knitr
or pandoc
in the conversion process.