I have a .tex file with text in Devanagari script. I am able to convert to pdf using XeLaTeX outside of Emacs without any problem. However, when I try it within Emacs, the resulting pdf does not have any Devanagari text.

I am new to emacs, and am using spacemacs 25.1.

Here are the solutions I have already tried, but I couldn't get them to work:

I have tried many combinations and variations of these to no success.

How do I generate a pdf from within Emacs that shows the Devanagari script?


Here is the minimal example which works in a .tex file if compiled with xelatex outside of emacs environment:


\setmainfont[Script=Devanagari]{Arial Unicode MS}
\newfontfamily\devanagarifontsf[Script=Devanagari]{Arial Unicode MS}


मया emacs बहु रोचते।


However, when I try to write the same in org mode, desired output is not generated. Here is the content of my org mode file:

#+Title: Generating Devanagarai text in LaTeX?
#+LATEX_CMD: xelatex
#+LATEX_HEADER: \usepackage{polyglossia}
#+LATEX_HEADER: \setmainlanguage{sanskrit}
#+LATEX_HEADER: \setotherlanguage{english}
#+LATEX_HEADER: \setmainfont[Script=Devanagari]{Arial Unicode MS}
#+LATEX_HEADER: \newfontfamily\devanagarifontsf[Script=Devanagari]{Arial Unicode MS}

मया emacs बहु रोचते।

If the org file is exported as html, the output has both Devanagari and English text as expected. However, no pdf output is generated when exporting as latex.

  • 1
    1. Please provide us with a minimal tex file to work with - I don't know what Devangari script is, but if you provide a short example, I can try to compile it. 2. What happened when you tried stackoverflow.com/questions/15926817/… ? That appears to be the simplest way to get XeLaTeX to work.
    – Tyler
    Oct 5, 2016 at 1:18
  • Thanks to @Dan for trimming the question, and to @Tyler for the inputs. I have included the minimal example in both .tex and .org formats now. I have also tried to follow the stackoverflow link which you had shared, but could not get it to work. An error message is generated saying no pdf was produced. I tried compiling with and without (setq TeX-engine 'xetex) command in my config.
    – Shambho
    Oct 5, 2016 at 18:56
  • Sorry, I can't figure out how to install Arial Unicode MS on Linux, so I can't even compile this from the command line :/
    – Tyler
    Oct 6, 2016 at 1:17
  • @Tyler: Really appreciate your quick response. It will be a big help. Here are two possibilities for installing the fonts (First one is most promising I think.): linuxquestions.org/questions/slackware-14/… and wiki.ubuntu.com/Fonts
    – Shambho
    Oct 6, 2016 at 1:45
  • I am using it on a Mac, so it might be similar.
    – Shambho
    Oct 6, 2016 at 1:52

1 Answer 1


Finally, figured it out:

  • Use M-x customize-group
    • org-export-pdf
    • org-latex-to-pdf-process (As explained here)
    • change this option:
      • %latex -interaction nonstopmode -output-directory %o %f
    • to this option:
      • xelatex -interaction nonstopmode -output-directory %o %f
    • in all places!

With this set, the latex headers in the question are redundant. Just type Devanagari text, and export will work fine in LaTeX!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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