2

I use the following pandoc command to compile a PDF from a mardown file:

pandoc infile.md metadata.yaml -o outfile.pdf

my yaml file has the following content:

---
documentclass: extarticle
fontsize: 11pt
header-includes:
- \usepackage{fancyhdr}
- \usepackage{graphicx}
- \usepackage{hyperref}
- \pagestyle{fancy}
- \fancyfoot[CO,CE]{\href{https://creativecommons.org/licenses/by-nc-nd/4.0/deed.de}{\includegraphics[scale=0.7]{CC.png}}}
- \fancyfoot[LE,RO]{\thepage}
output: pdf_document
---

How can I add PDF metadata to the PDF file?

I found a tex solution here:

\usepackage[pdftex,
            pdfauthor={Your Name},
            pdftitle={The Title},
            pdfsubject={The Subject},
            pdfkeywords={Some Keywords},
            pdfproducer={Latex with hyperref, or other system},
            pdfcreator={pdflatex, or other tool}]{hyperref}

but however I add this to my yaml file, I get an error:

[WARNING] Could not parse YAML metadata at line 59 column 1: :4:0: Unexpected '\'
Error producing PDF.
! Undefined control sequence.
l.60 \includegraphics

2 Answers 2

4

I found an answer in the pandoc-manual:

adding this to the yaml file works almost perfect:

---
title-meta:
- 'META Title'
author-meta:
- 'The Author'
date-meta:
- '1. Juni, 2020'
keywords:
- 'keyword1;keyword2;keyword3'
---

only subject: is not working.

2

Pandoc (+ TeX) Solution

The package hyperref is loaded by default in the Pandoc (v 2.9.2.1) LaTeX template. Your code is calling it again. Instead, you should just set it up. MWE:

---
documentclass: extarticle
fontsize: 11pt
header-includes: |
    \hypersetup{pdftex,
            pdfauthor={Your Name},
            pdftitle={The Title},
            pdfsubject={The Subject},
            pdfkeywords={Some Keywords},
            pdfproducer={Latex with hyperref, or other system},
            pdfcreator={pdflatex, or other tool}}
---

# Introduction

...

Pure Pandoc Solution

Are you using the latest Pandoc? The following MWE works fine:

---
documentclass: extarticle
fontsize: 11pt
title-meta: 'META Title'
author-meta: 'The Author'
date-meta: '1. Juni, 2020'
keywords:
- 'keyword1'
- 'keyword2'
- 'keyword3'
subject: My Favorite Subject
---

# Introduction

...

PDF file description

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .