When the -s/--standalone
option is used, pandoc uses a
template to add header and footer material that is needed for a
self-standing document. To see the default template that is used, just
type
pandoc -D *FORMAT*
where FORMAT is the name of the output format. A custom
template can be specified using the --template
option. You
can also override the system default templates for a given output format
FORMAT by putting a file
templates/default.*FORMAT*
in the user data directory (see
--data-dir
, above). Exceptions:
odt
output, customize the
default.opendocument
template.docx
output, customize the
default.openxml
template.pdf
output, customize the
default.latex
template (or the default.context
template, if you use -t context
, or the
default.ms
template, if you use -t ms
, or the
default.html
template, if you use
-t html
).pptx
has no template.Note that docx
, odt
, and pptx
output can also be customized using --reference-doc
. Use a
reference doc to adjust the styles in your document; use a template to
handle variable interpolation and customize the presentation of
metadata, the position of the table of contents, boilerplate text,
etc.
Templates contain variables, which allow for the inclusion
of arbitrary information at any point in the file. They may be set at
the command line using the -V/--variable
option. If a
variable is not set, pandoc will look for the key in the document’s
metadata, which can be set using either YAML
metadata blocks or with the -M/--metadata
option. In
addition, some variables are given default values by pandoc. See Variables below for a list of
variables used in pandoc’s default templates.
If you use custom templates, you may need to revise them as pandoc changes. We recommend tracking the changes in the default templates, and modifying your custom templates accordingly. An easy way to do this is to fork the pandoc-templates repository and merge in changes after each pandoc release.