fletcher/peg-multimarkdown — Issue #108: Problem with 'Date:' metadata --> LaTeX
Author: hugochisholm
Created: 2012-02-22 06:06:35+00:00
State: open

I've been having this problem where I'll define the date in the metadata header and it doesn't get passed to my LaTeX file. For example, this MMD file:

latex input:	mmd-article-header
Title:	An analysis of ...
Base Header Level:	2
latex mode:	memoir
Author:	Hugo V. Lachapelle-Chisholm
Date:	11 February, 2012
Comment:
latex input:	mmd-natbib-plain
latex input:	mmd-article-begin-doc
latex footer:	mmd-memoir-footer

# Testing

Some boring text

...and convert it to *.tex* then process it in *TeXShop 2011*, the date on my output *.PDF* shows today's date, not '11 February, 2012'. It also shows today's date if there is no date, which is the proper function.

Once I realized that I couldn't process *any* TeX file and have the proper date I started looking into the MMD latex input files. As far as I understand (and I am a new user at this, so I could be wrong), nothing calls '\date' in the input files. I experimented with adding it to the 'mmd-article-begin-doc' and made this change after '\author':

...
\begin{document}

\title{\mytitle}
\author{\myauthor}
\date{\mydate}

\mainmatter
\maketitle
...

This fixes the problem if a date is defined in the metadata. But if none is defined, it causes the *exact* problem that user [Gnossos](https://github.com/Gnossos) mention in [Issue #106](https://github.com/fletcher/peg-multimarkdown/issues/106). To fix this problem I added some code from 'mmd-letterhead-begin-doc' that was probably added to fix this exact problem in letters.

...
\ifx\event\undefined
\else
\date[\mydate]{\today}
\fi

\ifx\mydate\undefined
\def\mydate{\today}
\fi

The added code is just the last three lines. This, I've found, solves the problem of LaTeX stumbling if no date is defined in the metadata. If nothing is defined, today's date is used, if something *is* defined it uses that first.

So I guess I fixed my own problem but I wanted to share it in case it isn't isolated to just me. If this issue with dates isn't a problem for others, it could very well be an issue with my LaTeX installation, but when I saw Gnossos' earlier issue, it was the exact error message I was encountering before I implemented the changes to the mmd lated input files.