# How to create Vedic accents - anudatta, svarita and double-svarita - in devanagari script and IAST

What is the input to create anudatta, svarita and "double-svarita" in devanagari and IAST Script?

Anudatta and svarita for Devanagari I found out:

• "-" for anudatta

• "!" for svarita.

But following questions are left:

• what is the input for "double-svarita" in Devanagari?

• for Itrans this inputs are not working, which to choose there?

I use following script. I want to put the above mentioned accents (anudatta, swarita and double svarita) on Devanagari and IAST. If you have also suggestions for better layout, let me know.

\documentclass[a4paper,12pt]{article}

\usepackage{ifxetex}
\RequireXeTeX
\usepackage{xltxtra}

\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{fontspec}
\usepackage{polyglossia}

\setmainfont[Script=Devanagari,Mapping=../tec/iast]{Sanskrit2003}

\setlength{\parindent}{0mm}

\newcommand\devtext{\catcode\^=11
\catcode\~=11
\fontspec[Script=Devanagari,Mapping=itrans-dvn]{Sanskrit2003}}

\newcommand\iast{\catcode\^=11
\catcode\~=11
\fontspec[Script=Greek,Mapping=itrans-iast]{Linux Libertine O}}

\begin{document}

{\devtext
OM nama!ste rudra ma-nyava! u-tota- iSha!ve- namaH.
nama!ste astu- dhanva!ne bA-hubhyA!mu-ta te- nama!H..
}

{\iast
OM nama!ste rudra ma-nyava! u-tota- iSha!ve- namaH.
nama!ste astu- dhanva!ne bA-hubhyA!mu-ta te- nama!H..
}

\end{document}


The question is about the (TECkit) “Mapping”s like iast, itrans-dvn and itrans-iast that are included with TeX distributions. (E.g. inside /usr/local/texlive/2017/texmf-dist/fonts/misc/xetex/fontmapping/ if you're using MacTeX-2017.)

The short answer is that although some of these mappings contain ways to get U+0951 DEVANAGARI STRESS SIGN UDATTA and U+0952 DEVANAGARI STRESS SIGN ANUDATTA, none of these mappings contains anything for double-svarita (I presume you mean U+1CDA VEDIC TONE DOUBLE SVARITA). So if you strongly need to use the mappings you'll have to

• edit the .map files included there (or add a new one), and
• run teckit_compile on the .map file to generate a .tec file,

and then you can use it.

IMO much better than using these mappings is to directly enter Devanagari characters into the .tex file. There are various pieces of software and websites to make it easier to enter Devanagari characters, from input methods to transliterators from which you can copy the Devanagari. It would be preferable to use one of these and leave the input-transliteration problem out of TeX.

• Agreed, although it's not so easy to find input tools for any but the most bog standard Vedic accents, I personally ended up writing my own keyboard layout, which seems more of a pita than writing your own mapping :P – Au101 Jul 12 '17 at 18:11
• @Au101 Thanks, nice to see you here. Since I know nothing about Vedic accents, maybe you should post an answer? I think it would be more informative :-) – ShreevatsaR Jul 12 '17 at 18:17
• Oh thanks very much, I was pleased to see you had written another fine answer. Honestly I know a little about Vedic accents, but nothing about these mappings or anything :P This is a fine answer and deserves a tick – Au101 Jul 12 '17 at 19:16
• Thank you very much for that detailed answer. So I will stay with the solution you described in the end as I am not that skilled in writing my own mapping. – Denis Jul 12 '17 at 20:37
• After 2 year I again come to the same point. I am still not able to include U+1CDA double svarita. I tried to edit the .map file and generate a .tec file. But I was not successful. Are there any instructions which also a layman can understand? – Denis Dec 23 '19 at 5:58

The easiest\quickest way will be to create macros for the accents and tones, use the macros in the latex code, they will pass unchanged through the mapping process because the map files know nothing about tones. But note: the deva mapping file needs to be tweaked (I don't know how (yet)).

(A) To answer the question as asked, (1) change to a font that has double svarita, e.g. Shobhika Regular; (2) add the double svarita in directly: copy-pastethe ᳚ glyph from a character map, say; or insert the glyph directly via its codepoint number (^^^^1cda) like this, inside the transliteration scheme: nama!ste^^^^1cda.

(B) To answer the other question that will result:

The mapping file needs tweaking.

नम॑ः works OK outside the transliteration mapping environment

but not inside it:

The itrans-dvn mapping is folding overlapping-sets of classes of glyph strings into each other in a certain sequence, and presumably sealing them off from subsequent glyphs properly joining on. (It's regex-related. It'll take a while (for me!) to disentangle.) (Also, I notice my browser + this page does not shape them correctly either.)

For the transliterated text, itrans-iast mapping defines the input alias for svarita and anudatta, namely ! and -:

Define anudatta U+002D  ; -
Define svarita U+0021   ; !


but does nothing with them. So: Make a copy of itrans-iast.map in a place where TeX can find it (say, your current folder). Call the file itrans-iast2.map and add these two lines after the first pass(Unicode) line in the file:

pass(Unicode)

svarita > U+0951
anudatta > U+0952


Then compile with Teckit_compile itrans-iast2 to produce the itrans-iast2.tec binary file. Then go into your latex code and change Mapping=itrans-iast to Mapping=itrans-iast2.

(Alternatively, you could also type them directly, as well: nama^^^^0951ste^^^^1cda astu^^^^0952 dhanva^^^^0951ne bA^^^^0952hubhyA^^^^0951mu^^^^0952ta te^^^^0952nama^^^^0951^^^^0903. Or use macros as shortcuts.

Define them as:

\newcommand\svarita{^^^^0951}
\newcommand\anudatta{^^^^0952}
\newcommand\doublesvarita{^^^^1cda}


and use them like this, being careful with spaces:

\Paragraph{nama\svarita ste\doublesvarita\ rudra ma\anudatta nyava\svarita\ u\anudatta tota\anudatta\ iSha\svarita ve\anudatta\ namaH. \\
nama\svarita ste\doublesvarita\ astu\anudatta\ dhanva\svarita ne bA\anudatta hubhyA\svarita mu\anudatta ta te\anudatta\ nama\svarita H}


MWE

\documentclass[12pt,varwidth,border=6pt]{standalone}
\usepackage{fontspec}
\newcommand\mysktfont{Shobhika Regular}
\newfontface\fplain{\mysktfont}% no mapping
\newcommand\devtext{
\fontspec[Script=Devanagari,Mapping=itrans-dvn2]{\mysktfont}}%mapping transliteration to Devanagari
\newcommand\iast{
\fontspec[Mapping=itrans-iast2]{\mysktfont}} %mapping transliteration to IAST transliteration scheme

\newcommand{\Paragraph}[1]{\devtext{#1}
\par\medskip
{\iast{#1}}}

\begin{document}
\fplain
नम॑ः

\Paragraph{
nama!ste^^^^1cda rudra ma-nyava! u-tota- iSha!ve- namaH. \\
nama!ste^^^^1cda astu- dhanva!ne bA-hubhyA!mu-ta te- nama!H
}

\end{document}


Question Extending .map file with U+1CDA Vedic tone double svarita relates.

• Great, thank you a lot! Now the double svarita is beautifully with shobhika included. – Denis Jan 2 '20 at 21:42
• Hi @Cicada I followed all steps mentioned above but am unable to generate a pdf with devanagari text on my mac. After running xelatex swara.tex I see see this error in the log file Package fontspec Info: Could not resolve font "Shobhika Regular/I" (it (fontspec) probably doesn't exist). I verified that the font does exist. Also changed the font to Sanskrit 2003 but it results in a similar error. Can you help? Log file: dropbox.com/s/453ycx0bbwj9w4k/swara.log?dl=0 and dropbox.com/s/kbj80tv3yu51z5c/swara-sanskrit2003.log?dl=0 – linuxfan Feb 2 '20 at 3:56
• @linuxfan The best way is post a new question, with the minimum amount of compilable code that illustrates the issue. That way more eyes are on it. – Cicada Feb 2 '20 at 9:47
• @linuxfan Sanskrit2003 only has regular (no bold, italic or bold-italic): Shobika has regular and bold (no italic or bold-italic) on my system (windows). I imagine your code is trying to load such font files so ask a new question with the code so people can test out their answers without having to guess. You will get a faster response that way. – Cicada Feb 2 '20 at 9:58
• Good idea. Will post a new question – linuxfan Feb 2 '20 at 13:55