1

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
output:
  pdf_document:
    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.

5
  • 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… Commented Oct 2, 2017 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
    Commented Oct 3, 2017 at 21:04
  • 1
    Nakula doesn't have a bold font. Commented Oct 3, 2017 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
    Commented Oct 3, 2017 at 21:29
  • @badaboum You can take a look at Shobhika. ctan.org/tex-archive/fonts/shobhika Commented Dec 24, 2017 at 2:28

2 Answers 2

3

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
header-includes:
  - \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.

2

Pandoc versions 2.15 and newer use babel instead of polyglossia with xelatex. Adapting the accepted answer:

---
fontsize: 12pt
lang: de
mainfont: Arial
header-includes:
  - \babelfont[hindi]{rm}{Shobhika}
---

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

You must log in to answer this question.

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