Incorrect conversion from R Markdown to LaTeX

Why doesn't the following minimal (un) working example of R Markdown 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

In particular, a problematic conversion occurs with -\lfoot{From: K. Grant}and -\cfoot{To: Dean A. Smith}, as shown in the output file .tex:

\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{}
\chead{}
\rhead{The performance of new graduates}
true
true

For some reason, both of these lines are converted to true, causing

LaTeX error: missing \begin{document}

thereby preventing the compilation of the document into PDF.

Changing \lfootand \cfootanything else seems to lead to the correct conversion. So what's going on here? I believe that there should be a problem with knitror in the conversion process pandoc.

NB: R Markdown, , Fancyhead, PDF TeX.SX .

+3
3

: . pandoc , header-includes, , : . , , ( , , )

---
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
+4

, , title YAML, :

---
output:
  pdf_document: 
    keep_tex: yes
    latex_engine: xelatex
header-includes: |
   \usepackage{fancyhdr}
   \pagestyle{fancy}
   \fancyhead{}
   \fancyfoot{}
   \lhead{My Title}
   \rhead{My Note}
   \lfoot{\today}\rfoot{Page \thepage}
---
0

pandoc raw_attribute ( ), LaTeX . .

header-includes: |
   '''{=latex}
   \usepackage{fancyhdr}
   \pagestyle{fancy}
   \fancyhead{}
   \fancyfoot{}
   \lhead{My Title}
   \rhead{My Note}
   \lfoot{\today}\rfoot{Page \thepage}
   '''
0

Source: https://habr.com/ru/post/1016064/


All Articles