Question Details

No question body available.

Tags

pdf pandoc yaml-front-matter

Answers (2)

June 15, 2026 Score: 3 Rep: 114 Quality: Low Completeness: 50%

Pandoc's date field means that body text isn't automatically generated. The default LaTeX template displays it using \maketitle, but the generated title is only used when the document contains a title. This method should not be confused with any other prerequisites.

It's likely that your limited sample size included a title.

Add one:

--- title: "Document Title" date: "June 14, 2026" linestretch: 1.5 ---

Then compile:

pandoc j.md -o jtest.pdf

For command-line metadata, prefer --metadata/-M rather than --variable/-V:

pandoc j.md -M title="Document Title" -M date="June 14, 2026" -o jdate.pdf

To confirm what Pandoc sees:

pandoc j.md -t json | jq '.meta' pandoc j.md -s -t latex -o debug.tex grep -E '\\date|\\maketitle' debug.tex
June 15, 2026 Score: 1 Rep: 11 Quality: Low Completeness: 60%

Run the following command to see which template Pandoc is using and verify it has the $date$ variable:

pandoc -D latex | grep date

You should see a line like: \date{$date$}

If it's missing, the date won't appear. If you see something like \date{} with nothing inside, your template has been customized and stripped the variable.

The most likely fix: use --metadata instead of --variable

Pandoc draws a distinction between metadata (parsed from YAML) and variables (for template substitution). The date field in your YAML front matter is metadata. If you're overriding it on the command line, you need to set it as metadata, not a variable:

pandoc j.md -s --metadata date="June 14, 2026" -o jdate.pdf

The --variable flag you used bypasses the metadata parser and may not be picked up correctly depending on how the template accesses it.