Try writing in pure LaTeX.

Pandoc abstraction layer seem to get messy real fast when using more
advanced latex features.