28

This is not directly a LaTeX question since I use Markdown to format my text but this subpart of "stack" seems the most correct place to ask my question.

I generate my PDF with Pandoc from markdown using the command:

pandoc myDoc.md --chapters -o result.pdf

Where it generates chapters from my markdown. This is nice, however it calls the chapters "Chapter 1", "Chapter 2" and so on and so forth (See http://cl.ly/PfRJ ). For English documents this would be okay. However my documents are in Dutch.

Is there any way I can change this? I think there is a template somewhere where it stores these things? But I can't seem to find it.

1

4 Answers 4

34

You can pass the lang option to the template using -V which passes it further to the babel package.

pandoc -V lang=nl somefile.markdown

This is translated to the following LaTeX code which should result in dutch chapter headings.

\usepackage[dutch]{babel}
4
  • 1
    Awesome, I don't even need to change any templates which I thought was needed. Thanks for the solution.
    – Matthijn
    Commented Jun 14, 2013 at 11:33
  • This is right, however for some purposes i.e. bibliographies with pandoc-citeproc you will need to set the language as metadata (use -M rather than -V). This will also set the variable. This is explained here: pandoc.org/README.html#reader-options
    – twsh
    Commented Mar 2, 2016 at 21:16
  • 5
    Can you write 'dutch'? I thought you needed to use a code like 'nl'.
    – twsh
    Commented Mar 2, 2016 at 21:19
  • It seems this doesn't work anymore Commented Jun 10 at 13:43
5

It's quite simple. You have to pass the following parameter to the pandoc call.

-V lang=de

You'll have to use language parameters according to BCP 47 (like en-GB, fr, de...)

The exact behavior is described here: http://pandoc.org/README.html#language-variables

1
  • Actually, I was searching for how to specify German, so thanks, but for the original question, de is a somewhat week approximation to dutch ;) -- nl would work better here.
    – Wolf
    Commented Dec 5, 2019 at 12:28
4

You can also use YAML metadata to store the language settings.

---
lang: nl
---

Add this at the top of your markdown file. You don't need to modify your pandoc command.

1
  • uhm I did that but it didn't work. Section headings are still in English Commented May 30 at 14:38
1

@Marco already answered your main question. However, this one is still open:

" I think there is somewhere a template where it stores these things? But I can't seem to find it."

If you do not refer a specific template on the Pandoc command line with --template=my-latex-template.tex, then Pandoc will use an internally available template.

Pandoc has such templates for (almost) all output formats it can generate.

You can print that template for LaTeX with the following command:

pandoc -D latex | tee pandoc-default-template.latex

If you open that template in a text editor, you'll see where it uses variables:

  1. These variables look like $varname$ -- that is, they are enclosed in $ characters.
  2. You can see what the variable names are.
  3. You can see how you can influence the outcome of the generated document by using the command line switch:
    -V varname="some value" or
    --variable=varname:"some value".

You must log in to answer this question.

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