Question: By default the vertical spacing on sections is quite large with the pandoc default.latex template. Is there a way to pass an argument to reduce the size of the spacing?

I see that there is a titlesec package, however I'd like to keep using the default.latex template if possible without having to modify it.

IF I need to modify the template, is there a clever way to do it rather than copying the entire default.latex template?

Answer: 
You can also use the YAML header to put commands in the preamble:

```
---
header-includes:
    - \usepackage{titlesec}
    - \titleformat*{\section}{\itshape}
---

```
From the [User Guide](http://johnmacfarlane.net/pandoc/README.html#general-writer-options):

> 
> **-H FILE, --include-in-header=FILE**
> 
> 
> Include contents of FILE, verbatim, at the end of the header.
> [...] This option can be used repeatedly to include multiple files in the header. They will be included in the order specified. Implies --standalone.
> 
> 
> 

You can then put your customisation code in `FILE`.
The code inside `FILE` will be inserted at the end of the preamble **before** `\begin{document}` so you can import additional packages using `\usepackage`.

Additionally you can use

> 
> **-B FILE, --include-before-body=FILE**
> 
> 
> Include contents of FILE, verbatim, at the beginning of the document body (e.g. after [...] the
> \begin{document} command in LaTeX). [...] This option can be used
> repeatedly to include multiple files. They will be included in the
> order specified. Implies --standalone.
> 
> 
> **-A FILE, --include-after-body=FILE**
> 
> 
> Include contents of FILE, verbatim, at the end of the document body (before [...] the \end{document} command in
> LaTeX). This option can be be used repeatedly to include multiple
> files. They will be included in the order specified. Implies
> --standalone.
> 
> 
>