How to type Devanagari using LaTeX (Overleaf)?

5.4k Views Asked by At

I am trying type Devanagari Script in LaTeX using Overleaf. But I am getting some formatting error. The "matras" are not reflecting in the output Devanagari text.

\usepackage{devanagari}
{\dn karma}

Output is as follows:

Word Karma

but it should be

Should be

3

There are 3 best solutions below

0
On BEST ANSWER

You need to pre-process your input data. If you have a file karma.dn

\documentclass{article}

\usepackage{devanagari}

\begin{document}
{\dn karma}

\end{document}

and call

devnag karma.dn

you get karma.tex like this:

\def\DevnagVersion{2.16}\documentclass{article}

\usepackage{devanagari}

\begin{document}
{\dn km\0}

\end{document}

Result:

enter image description here

The devnag program comes with the LaTeX package. It might be easier to use a Unicode capable LaTeX engine like XeLaTeX or LuaLaTeX together with suitable fonts.

0
On

If you want to write Devanagari (Hindi) in pdflatex then go through this GitHub link.

Input: मै तुमसे बहुत प्यार करता हूँ।

Output: {\dn m\4 \7{t}ms? b\7{h}t =yAr krtA \8{h}\1. }

0
On

You have to make your own .dn file and then input the file in LaTeX. This should solve the matra problem as in making the .dn file, it will add matras phonetically.