10

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.
C.S.
  • 1,379

3 Answers3

2

For the question of typing: The Vedic accents are not available on the standard keyboard layouts, it seems.

Which leaves: (a) direct input individual selection of characters from a character map (e.g., BabelMap); (b) almost-direct input via text editors where the unicode value can be keyed in and pressing Alt-X converts it to the glyph (e.g., LibreOffice Writer; BabelPad); (c) writing custom keyboards (OS dependent); (d) mapping a font in xelatex (here, using a made-up word, which GoogleTrans currently reports as meaning black powder):

accent marks

Fine detail adjustments in the typesetting might be needed, depending on the actual words used.

(This mapping also implies that direct manipulation via lua code in lualatex should also be possible.)

Experiment shows that Latex macros of the sort \newcommand\myaccenta{\symbol{^^^^0951}} are seen as extraneous boxes at the type-setting stage and interrupt the letter-shaping mechanism.

Also, interesting news: a revision and update of the skt package seems to be in the pipeline. (Typing Sanskrit in TeX)


Code for the mapping example:

\documentclass[12pt]{article}
\usepackage{xcolor}
\usepackage{fontspec}
\setmainfont[Script=Devanagari,Mapping=vedic,Scale=1.5]{Noto Serif Devanagari}

\newfontface\translitd[Mapping=devanagari-to-iastb,Scale=1.1,Colour=red]{Noto Sans}% This is for the IAST-based transliteration only.

\newfontfamily\englishfont{Noto Serif}
\usepackage{polyglossia}
\setdefaultlanguage{hindi}
\setotherlanguages{english}

\begin{document}
\section{\textenglish{Mapping}}
\textenglish{Test text:} कालेमूनि {\translitd कालेमूनि}

\vspace{12pt}
\begin{tabular}{ccccc}
,, & कालेमूनि,,  & कालेमू,,नि & काले,,मूनि & का,,लेमूनि \\
\end{tabular}

\vspace{12pt}
\begin{tabular}{ccccc}
.. & कालेमूनि..  & कालेमू..नि & काले..मूनि & का..लेमूनि \\
\end{tabular}

\vspace{12pt}
\begin{tabular}{ccccc}
(( & कालेमूनि((  & कालेमू((नि & काले((मूनि & का((लेमूनि \\
\end{tabular}

\vspace{12pt}
\begin{tabular}{ccccc}
)) & कालेमूनि))  & कालेमू))नि & काले))मूनि & का))लेमूनि \\
\end{tabular}

का,,ले..मू((नि))  
\end{document}

The .map file (to be converted to .tec format with teckit_compile):

; TECkit mapping for TeX input conventions <-> Unicode characters

LHSName "vedic" ;
RHSName "UNICODE"

pass(Unicode)

; ligatures from Knuth's original CMR fonts
U+002D U+002D           <>  U+2013  ; -- -> en dash
U+002D U+002D U+002D    <>  U+2014  ; --- -> em dash

U+0027          <>  U+2019  ; ' -> right single quote
U+0027 U+0027   <>  U+201D  ; '' -> right double quote
U+0022           >  U+201D  ; " -> right double quote

U+0060          <>  U+2018  ; ` -> left single quote
U+0060 U+0060   <>  U+201C  ; `` -> left double quote

U+0021 U+0060   <>  U+00A1  ; !` -> inverted exclam
U+003F U+0060   <>  U+00BF  ; ?` -> inverted question

; additions supported in T1 encoding
;;U+002C U+002C   <>  U+201E  ; ,, -> DOUBLE LOW-9 QUOTATION MARK
U+003C U+003C   <>  U+00AB  ; << -> LEFT POINTING GUILLEMET
U+003E U+003E   <>  U+00BB  ; >> -> RIGHT POINTING GUILLEMET


; Here are the Vedic accents
 U+002C U+002C <>  U+0951; ॑ ,,
 U+002E U+002E <>  U+0952; ॒ ..
 U+0028 U+0028 <>  U+0953; ॓ ((
 U+0029 U+0029 <>  U+0954; ॔ ))

The key to the mapping is to choose combinations of characters that are easy to type and unlikely to be used elsewhere in the text. In this case, double comma ,, double dot .. double left bracket (( and double right bracket )). But other characters can be used, if desired.

As an aside, the font designer designs the font, including the marks. Here's a random sample:

font sample

Cicada
  • 10,129
2

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.

egreg
  • 1,121,712
  • I told u this is working. type the vedic accents and see. – C.S. May 23 '12 at 16:20
  • just see if this commands are working. {\dn\dnveda tat |{sa}_{vi}tur-vare.nya.m |}. For me these dont work – C.S. May 23 '12 at 16:21
  • @Chandrasekhar This kind of input is not for use with XeLaTeX. As I said, I don't know anything about vedic accents. – egreg May 23 '12 at 16:26
  • egreg - I am attaching an image to explain the Vedic accents I hope this would help to address the issue. http://i.stack.imgur.com/jqZKm.jpg – Aku May 24 '12 at 15:03
  • @Aku If I input this स॒व॑ितुर (using the Devanagari MT font) I get the two accents. I don't know if this means anything (I hope nothing bad, at least). – egreg May 24 '12 at 15:14
  • @egreg - no it does not mean anything bad, how did u get two accents like that? – Aku May 24 '12 at 15:17
  • @Aku Just inputting that text when the font is Devanagari MT. I got the word from a previous question by Chandrasekhar and added the accents I got from a repository of Unicode glyphs. – egreg May 24 '12 at 15:21
2

Note: I don’t know Hindi nor can I read this.

If I input the text as plain Unicode, I always get the vedic accent marks. The following code gives me something which has the accents, as far as I can see.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[12pt]{article}

\usepackage{fontspec,xltxtra,xunicode}
\setmainfont[Script=Devanagari,Mapping=velthuis-sanskrit]{Nakula}

\begin{document}

दि॒पदे॑ । शं चतु॑षपदे

\end{document}

Vedic intonation marks with Unicode input

If you want to change the Devanagari font, just exchange the Nakula option. Arial Unicode MS and Code2000 had seemnigly correct outputs (although with Code2000 the accents overlapped the vowel marks). Devanagari MT, however, did not work correctly for me.

You can find the vedic accents under:

  • U+0951 DEVANAGARI STRESS SIGN UDATTA = Vedic tone svarita
  • U+0952 DEVANAGARI STRESS SIGN ANUDATTA = Vedic tone anudatta

Although I don’t know what you meant by “Deergha Swarita” in your posted image, I suspect it might be U+1CDA (VEDIC TONE DOUBLE SVARITA), which I did not have available in any of my fonts.

Also confer the Unicode blocks Devanagari, Vedic Extensions and Devanagari Extended.

brian-ammon
  • 2,425
  • 1
  • 21
  • 35
  • This you are giving input itself in unicode right. What about input in Roman and output in unicode – C.S. May 25 '12 at 12:07
  • OK, now I understand your question, sorry. You want to typeset the Vedic intonation marks with ASCII macros (\_, \=, \|, etc.) as in Chapter 10 “Vedic Macros” of the velthuis manual. I will see to it as soon as I get back to my TeX system. – brian-ammon Jun 03 '12 at 14:32
  • Yes. Thanks brain. Please reply as soon as possible. I am desperate :( – C.S. Jun 03 '12 at 15:16
  • Actually, I think that the question has already been answered by egreg: „This kind of input is not for use with XeLaTeX. […]“ Accordingly, I have only found that the examples in section 10.2 work with LaTeX only and not with XeLaTeX. Why would you like to have the ASCII input in XeLaTeX when you can have the normal Unicode input? It seems to me that you have to use the normal LaTeX typesetting program if you want to input the Vedic intonation marks in ASCII. If there are any specific reasons why you need to use the ASCII input in XeLaTeX, you may need to post a follow-up question. – brian-ammon Jun 05 '12 at 10:50
  • Then how can I input vedic accents? – C.S. Feb 13 '13 at 09:02
  • @brian-ammon - I am using XeLaTeX and use direct unicode input, I am a Mac user , can you please tell me how do you enter Vedic tone Anudatta and Swarita. Dirgha swarita is one just like swarita but instead of one line there will be two. I would appreciate your help – Raama Sep 20 '13 at 09:55
  • If you use direct unicode input, you can just use the Mac Character Palette http://fsymbols.com/character-maps/mac/ In the search bar just look up Anudatta or Swarita and select the correct symbol. You can double-click it or drag and drop it to insert it into your source code document. – brian-ammon Sep 20 '13 at 19:24