17

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.

23

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

pandoc -V lang=dutch somefile.markdown

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

\usepackage[dutch]{babel}
  • Awesome, I don't even need to change any templates which I thought was needed. Thanks for the solution. – Matthijn Jun 14 '13 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 Mar 2 '16 at 21:16
  • 3
    Can you write 'dutch'? I thought you needed to use a code like 'nl'. – twsh Mar 2 '16 at 21:19
4

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

@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".
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.