[Tex/LaTex] vedic symbols in XeTeX

symbolsxetex

How do I produce the vedic, anudatta and udatta via XeTeX. The one in this links gives

http://mirrors.ctan.org/language/devanagari/velthuis/doc/generic/velthuis/xetex-examples.tex

The normal Sanskrit compilation works but the vedic accents if compiled with similar commands doesn't work.

  • Does anyone how we can work with XeTeX for typesetting Vedic Mantras or Texts.
\documentclass[12pt]{article}
\usepackage{ifxetex}
\RequireXeTeX
\usepackage{fontspec}
\newcommand\dn{\catcode`\~=12
           \fontspec[Script=Devanagari,Mapping=velthuis-sanskrit]{Nakula}}

\let\origlabelitemi\labelitemi
\renewcommand\labelitemi{{\normalfont\origlabelitemi}}

\parindent=0pt

\begin{document}

\section{Examples}

{\dn
\begin{center}
\setlength{\fboxrule}{2pt}
\framebox[3.2cm][s]{.o ga.ne"saaya nama.h}
\end{center}
}
\end{document}

The above command works perfectly for non-vedic sanskrit, but once I start using udatta and anudatta it doesn't work at all.

Commands like this:

  • \dn\dnveda _{a} which work well in devanagari doesn't seem to work here.

Best Answer

I don't know anything of Devanagari and Sanskrit; but here's an example that I obtained first by compiling without the second line, then copying from the PDF and pasting.

% Requires font Nakula by John Smith,
% see http://bombay.indology.info/software/fonts/devanagari/index.html
\documentclass[12pt]{article}
\usepackage{ifxetex}
\RequireXeTeX
\usepackage{fontspec}
\newfontfamily{\sanskritfont}[Script=Devanagari,Mapping=velthuis-sanskrit]{Nakula}
\newcommand\dn{\catcode`\~=12 \sanskritfont}

\newfontfamily{\directsanskrit}[Script=Devanagari]{Nakula}

\begin{document}

{\dn .o ga.ne"saaya nama.h}

{\directsanskrit ॐ गणेशाय नमः}

\end{document}

enter image description here

As far as I can see, the two lines are identical.

The lines

\newfontfamily{\sanskritfont}[Script=Devanagari,Mapping=velthuis-sanskrit]{Nakula}
\newcommand\dn{\catcode`\~=12 \sanskritfont}

have the same effect as your

\newcommand\dn{\catcode`\~=12
           \fontspec[Script=Devanagari,Mapping=velthuis-sanskrit]{Nakula}}

but use XeTeX more efficiently.

Related Question