Add more variables to latex template.

These variables specifically allow one to use pandoc's code highlighting
instead of hand-coding it for LaTeX and HTML, and allow one to inject
extra packages/settings into the template from the command line.
Separate caption formatting out into its own section.

The 'Floats' section also contains a fix allowing footnotes to be used
in the caption.