Pandoc Error producing PDF with markdown body text and YAML metadata file

Viewed 385

I'm running the following Pandoc 2.0.3 command on the Mac Terminal command line:

pandoc one.md "metadata.yaml" -o two.pdf

This should take the markdown file one.md and output two.pdf using the yaml file metadata.yaml, a minimal version of which is:

---
header-includes:
- \usepackage{fancyhdr}
...

This Pandoc run produces a PDF as expected for the following version of one.md:

# Report

However, it fails to produce a PDF for the following version of one.md, which contains body text:

# Report

Lorem.

The resulting error message is:

Error producing PDF.
! LaTeX Error: Can be used only in preamble.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.65 header-includes: - \usepackage

I don't understand why including that one word creates a failure.

1 Answers
Related