1

The Devanagari font not displaying properly in xelatex I have tried with other devanagari fonts and same problem remains

\documentclass{article}

%!TEX program=xelatex

\usepackage[margin=.5in]{geometry}
\usepackage{fontspec}

% Devanagari
\newcommand{\Devanagari}[1]{\fontspec{Uttara}#1}

\begin{document}
    \Devanagari{मकडि का कान}
\end{document}

Ideal Output : [Libre Office]
https://i.sstatic.net/jdOGT.png
Actual Output :
https://i.sstatic.net/aqL3g.png

3
  • The Uttara font is not part of TeX. I downloaded it separately, and instead of compiling with xelatex, I compiled with lualatex. Same problem. I conclude that the font does not interact well with TeX, unless some additional code is provided. Does TeX have a suitable substitute font?
    – user287367
    Commented Oct 11, 2023 at 18:06
  • Thanks for mentioning. It also had problem with other fonts like Noto Sans Devanagari too. As mentioned in answer it worked just fine. Commented Oct 12, 2023 at 3:28
  • 1
    This article discuss about LaTeX/Internationalization. You can use tex fonts to write in other language. I generally prefer a font just for the looks, it doesn't matter Commented Oct 12, 2023 at 3:49

1 Answer 1

1

Use the Script option:

\newcommand\Devanagari[1]{\fontspec[Script=Devanagari]{Uttara}#1}
1
  • Interesting. I thought that the use of OpenType script was for language-specific character alternatives (such as Turkish i with/without dot). Did not realize that it also was used for other purposes.
    – user287367
    Commented Oct 12, 2023 at 16:48

You must log in to answer this question.

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