aaronwolen / pandoc-letter

Pandoc template for writing letters in markdown
GNU General Public License v3.0
409 stars 124 forks source link

German-style dates ("1. Januar 2017") throw error in pdf generation #15

Closed lordminx closed 7 years ago

lordminx commented 7 years ago

When trying to generate a letter with a date like "1. Januar 2017", when invoking pandoc --template=template-letter.tex test.md -o test.pdf

it throws the following error:

! LaTeX Error: Something's wrong--perhaps a missing \item.

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

l.74 \opening{To whom it may concern,}

pandoc: Error producing PDF

It seems german-style dates (Which are written with a dot to donate the ordering, ie. "1. Januar 2017" meaning "first of january of the year 2017") are parsed as lists or something like that, resulting in compiled LaTeX like this:

\date{\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{5}
\tightlist
\item
  April 2017
\end{enumerate}}

instead of the correct

\date{6 April 2017}

Sadly, my LaTeX skills are nonexistant, so I wouldn't even know where to start fixing this.

aaronwolen commented 7 years ago

Try escaping the period:

opening: To whom it may concern,
closing: Sincerely,
date: 1\. January 2017

Does that help?

lordminx commented 7 years ago

Yes, escaped it works! Good to know, thanks!

Is there a way to autoescape this in the template?

aaronwolen commented 7 years ago

I'm not sure about that. Even if there is, I'd be hesitant to implement it here because I try to keep this template at parity with pandoc's latex template.