I have been looking for a good setup to create bilingual documents for a while, and have recently stumbled onto Markdown.

I am running Linux.

In Remarkable and Atom, I get Devanagari and German output, but the formatting is not to my pleasing.

I am now trying to use Pandoc to get a Pdf output of the Markdown file, but the Devanagari is not showing.

For example in the Markdown document, I type काम kām, but only kām shows up in the Pdf.

This is the Pandoc line I enter in the terminal:

pandoc --latex-engine=xelatex -f markdown h1b.md -t latex -o h1b.pdf

And this is my Yaml header in the Markdown document:

toc: true
fontsize: 12pt
documentclass: article
font: Noto Serif
    latex_engine: xelatex

I must be missing something, but am not sure what. I have tried not to change the default Pandoc Latex template, so if there is a solution where i need to add something to the Yaml code, that would be best.

Edit: if someone has a Devanagari supported Pandoc template, that would also be nice. I am currently trying to make one.

  • 2
    (See this question for an explanation of what you're seeing.) At minimum, you can try changing the font to a Devanagari font that also contains Latin characters (Arial Unicode, Mukta, Rajdhani, Chandas, etc). But the “proper” way involves more work… – ShreevatsaR Oct 2 '17 at 7:44
  • I was using the font Noto and have changed to Nakula, and all seems to be working now. Thanks for the tip. Only issue now, is that the markdown bold is not bold in the Latex/PDF (any ideas?). – badaboum Oct 3 '17 at 21:04
  • 1
    Nakula doesn't have a bold font. – ShreevatsaR Oct 3 '17 at 21:21
  • I thought that might be the issue, thanks for the speedy answer! Could you advise me for a good font for Hindi/Sanskrit? – badaboum Oct 3 '17 at 21:29
  • @badaboum You can take a look at Shobhika. ctan.org/tex-archive/fonts/shobhika – Ramaprakasha Dec 24 '17 at 2:28

Bilingual documents usually have a main language and the secondary language. Pandoc LaTeX templates use polyglossia for bilingual documents.

The following is a list of languages that polyglossia supports (p. 5, polyglossia manual).

List of supported languages in <code>polyglossia</code>

I've assumed the main language to be German and the secondary language to be Hindi. Please adapt accordingly.

Markdown source:

fontsize: 12pt
lang: de
mainfont: Arial
  - \newfontfamily\devanagarifont{Shobhika}

[काम]{lang=hi} kām

I've used Shobhika (as mentioned in the comments) for Hindi. This method is more flexible as you can use different fonts for different languages. In the above example, German uses Arial whereas Hindi uses Shobhika. If you want to use a font which has both character sets, just use mainfont, removing \newfontfamily\devanagarifont{Shobhika}.

Use the following command (pandoc 2.7.3) to compile:

pandoc -t latex -o output.pdf input.md --pdf-engine=xelatex

And finally, the output:

Sample output

For more information, see § Language variables of the Pandoc Manual.

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.