I am using Pandoc to convert a LaTeX document to .docx, but i have not been able to figure out how to change the font size. An MWE looks like this

Hello world
Hello world

Compiling the MWE with pdflatex produces an output where the two "Hello world" statements appear in different font sizes. Converting with pandoc, i get a document where both statements have the same font size. How do i get them to appear in different sizes in the word document?


1 Answer 1


Pandoc supports only a small subset of LaTeX commands and \scriptsize is not one of them. Why does it work anyway? Because unrecognized LaTeX (or ConTeXt or HTML) commands are passed unchanged to the LaTeX (or ConTeXt or HTML) writer. If you want to use pandoc to convert LaTeX to .docx, then you should stick to those commands that can be represented in pandoc's own markdown format.

Nevertheless: If you want to modify the produced .docx you can save the reference file using: pandoc --print-default-data-file reference.docx > custom-reference.docx

Update: The recent manual suggests using pandoc -o custom-reference.docx --print-default-data-file reference.docxto create custom-reference.docx

In custom-reference.docx you can change the following styles (be sure to actually change the style defined in the document, not just the sample text!):


  • Normal
  • Body Text
  • First Paragraph
  • Compact
  • Title
  • Subtitle
  • Author
  • Date
  • Abstract
  • Bibliography
  • Heading 1
  • Heading 2
  • Heading 3
  • Heading 4
  • Heading 5
  • Heading 6
  • Block Text
  • Footnote Text
  • Definition Term
  • Definition
  • Caption
  • Table Caption
  • Image Caption
  • Figure
  • Figure With Caption
  • TOC Heading


  • Default Paragraph Font
  • Body Text Char
  • Verbatim Char
  • Footnote Reference
  • Hyperlink


  • Normal Table

You can use the changed reference file by adding the option --reference-doc=custom-reference.docx.

  • 1
    Great hint to modify the reference.docx, I would not have thought to look for that option in the help/manpage. Commented Dec 17, 2018 at 12:49
  • How to apply the --reference-doc directive? It is not working on the pandoc command line: the fontsize remains the same Commented Apr 25, 2023 at 16:00
  • @WestCoastProjects -- Hard to tell without any more information. But I just tried, what I wrote back then and it still works. Although the manual specifies a slightly different command to use to produce custom-reference.docx, which I updated in the answer. So if anything does not work, please be more specific. Maybe you want to ask a new question, providing a minimal working example (MWE)
    – DG'
    Commented Apr 25, 2023 at 20:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .