Word Templates

Using Templates

If you want to customize the appearance of MS Word output, Pandoc supports a special type of template called a reference document. Here’s an example of specifying a custom reference document for docx:

    reference-doc: custom-reference-doc.docx

Reference documents include sample text that uses all of the output styles used by Pandoc.

To use a reference doc template, just copy it to your document’s directory and reference it as shown above.

Creating Templates

To create a new reference doc based on the Pandoc default, execute the following command:

$ quarto pandoc -o custom-reference-doc.docx \
   --print-default-data-file reference.docx

Then, open custom-reference-doc.docx in MS Word and modify styles as you wish:

When you move the cursor to a specific element in the document, an item in the styles list will be highlighted. If you want to modify the style of any type of element, you can click the drop-down menu on the highlighted item, and you will see a dialog box like this:

After you finish modifying the styles, you can save the document and use it as the template for future Word documents.