6

I want to enter Sanskrit quotes in my thesis. I have downloaded the "skt" package from CTAN. Also I have texlive-full installed. But I am unable to follow subsequent steps of how to incorporate this packages. I am using Ubuntu and though there are so many solutions mentioned on the net and as well as this site, still I am not able to follow. Can any body give step by step procedure about how to go about it ? As an example I want to type the following as quotation

सर्वधर्मान् परित्यज्य मामेकं शरणं व्र्ज
अहं त्वां सर्वपापेभ्यो मोक्षयिष्यामि मा शुचः

Thanks for your help in advance !

  • Could you please specify where your problem lies? Do you struggle with creating a template to typeset a test sentece? Or does your tex program spit out errors you can't resolve? Please provide a Minimal Example that shows where problems lie, so we can help you. – HATEthePLOT Feb 23 '16 at 11:06
11

If I understand well what you are expecting, you want a document written in English, but with sanskrit quotes within. For this, you may use the package polyglossia and define your main language (English) and other sub languages for the document (for example sanskrit here). In your case, you will also need to declare the fonts for sanskrit, a possibility is devanagarifont.

This is a minimal working example that I expect to fit your needs:

\documentclass[12pt]{article}

\usepackage{fontspec}
\usepackage{polyglossia}

\setmainlanguage{english}
\setotherlanguages{sanskrit} %% or other languages

\newfontfamily\devanagarifont[Script=Devanagari]{Lohit Devanagari}

\begin{document}
The main text is in English, and you can add sanskrit quote...

\begin{sanskrit}
सर्वधर्मान् परित्यज्य मामेकं शरणं व्र्ज

अहं त्वां सर्वपापेभ्यो मोक्षयिष्यामि मा शुचः
\end{sanskrit}
\end{document}

The output is as below :

enter image description here

For information, this was compiled using Ubuntu 14.04 with a full install of Texlive-2015 (not the one in the official repos).

EDIT

Compiled with XeLaTeX (other not tested).

  • I tried Xelatex(from command line) and it worked. When I tried it from texmaker (xelatex option), it gave error asking me to But lualatex did not work it gave me a lot of errors. e.g ! Undefined control sequence. l.53 \newXeTeXintercharclass \sanskrit@punctthin % ! ? ; : danda double_danda. – AJN Feb 23 '16 at 11:55
  • 1
    See the edit, I compiled with XeLaTeX, but didn't try with LuaLaTeX...A quick search reveal this post : tex.stackexchange.com/questions/283567/…, is it the kinf of message you have? – Damien Dtx Feb 23 '16 at 11:58
  • 1
    As per the link, we are restircted to use xelatex. Also, when i tried out some latex commands inside the sanskrit environment, they do not work as expected (e.g., itemize gives square shaped character as the bullet, textbf results in font substituition warning etc). Are usual latex commands not allowed inside the sanskrit environment? – AJN Feb 23 '16 at 12:07
  • Here, we only defined a font for usual text. You need to specify explicitly a font for italic, bold,...if needed. You may use a command like \newfontfamily\devanagarifont[Script=Devanagari, ItalicFont=AnotherDevanagariFont Slanted]{Lohit Devanagari}. – Damien Dtx Feb 23 '16 at 12:14
  • thank you for your answer. This works. Can u suggest the possible variants of typing in sanskrit. For example is there a provision where I can type in english (with proper intonation) and after compiling, the output is in sanskrit ? – Hirak Feb 24 '16 at 5:20
6

For the sake of completeness, here's how this can be done using the skt package.

Note that I do not recommend this. The skt package is anachronistic. It comes from a time before XeTeX and LuaTeX, from a time where free and easy use of Unicode fonts was not available and where ASCII-only input was the norm. There is every danger that this package will not play nicely with other packages that you need, things might break and it is probably more trouble than it is worth, now.

However, it was once a good package and I quite like the output. I also am rather partial to ASCII-only input, but the problem is skt requires preprocessing.

Anyway, here's how you do it.

You create a .skt file, not a .tex file. The .tex file will be produced by the preprocessor. The .skt file, though, will look just like a normal .tex file. You must load the skt package:

\documentclass[12pt]{article}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{skt}

\begin{document}

\textit{Bhagavad-G\={\i}t\={a}} 18:66:

{\skt sarvadharmaan parityajya maameka.m "sara.na.m vraja | \\
  aha.m tvaa.m sarvapaapebhyo mok.sayi.syaami maa "suca.h || 66 ||}

\begin{enumerate}\itshape

  \setcounter{enumi}{65}

  \item
  Sarvadharm\={a}n parityajya m\={a}m eka\d{m} \'{s}ara\d{n}a\d{m} vraja; \\
  Aha\d{m} tv\={a}\d{m} sarvap\={a}pebhyo mok\d{s}ayi\d{s}y\={a}mi m\={a}     
  \'{s}uca\d{h}.

\end{enumerate}

\end{document}

This is my answer.skt file. You can see that it's just a normal .tex file in form and function.

So you would need to rename your document file to foo.skt and delete foo.tex.

Then I ran

skt answer.skt

You will probably need to run this command from a terminal, as I doubt any IDEs will support this and you should be aware that .skt files are unlikely to have appropriate syntax highlighting, etc.

This produces the answer.tex file, which looks like this:

\documentclass[12pt]{article}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{skt}

\begin{document}

\textit{Bhagavad-G\={\i}t\={a}} 18:66:

{\skt .sa;vRa;Da;ma;Ra;n,a :pa;i8a:=+tya:j1ya ma;a;mea;k\ZH{-12}{M} Za:=+NMa
v.ra:ja \ZS{12}@A \\
 A;h\ZH{-6}{M} tva;Ma .sa;vRa;pa;a;pea;Bya;ea ma;ea;[a;Y4a;ya;Sya;a;Y6a;ma
ma;a Zua;.caH\ZS{4} \ZS{12}@A\ZS{6}@A 66 \ZS{12}@A\ZS{6}@A}

\begin{enumerate}\itshape

  \setcounter{enumi}{65}

  \item
  Sarvadharm\={a}n parityajya m\={a}m eka\d{m} \'{s}ara\d{n}a\d{m} vraja; \\
  Aha\d{m} tv\={a}\d{m} sarvap\={a}pebhyo mok\d{s}ayi\d{s}y\={a}mi m\={a}     
  \'{s}uca\d{h}.

\end{enumerate}

\end{document}

So you can see the preprocessor has done nothing more or less but translate the user-friendly skt syntax that a human could read and write, into something that LaTeX can actually read (as long as the skt package is loaded, obviously).

Then and only then did I run

pdflatex ./answer.tex

Which produces:

enter image description here

P.S.: There's a mistake in your original Sanskrit. व्र्ज vrja should be व्रज vraja.

  • Em, when i type skt example.skt, my ubuntu terminal says skt command not found :( – crskhr Aug 14 '16 at 2:06
  • But then when I compile your pdflatex ./answer.tex the output is coming perfectly fine. – crskhr Aug 14 '16 at 2:07
  • 1
    @S.C. As you can imagine, when I wrote this answer, I tested it fully. I've just updated ubuntu to 16.04 and now I can't get the skt preprocessor to work either. It's now so old, and I don't think it's gonna be fixed any time soon. I'd Unicode it, I really would. – Au101 Aug 14 '16 at 2:39
  • What do you mean by saying "I would unicode it"?? – crskhr Aug 14 '16 at 3:48
  • @S.C. I'm saying I'd give up on the skt package. I'm disappointed, I used it for a while, but I certainly don't know how to get it working and it's so niche, I think it's a lost cause. I'm sorry I can't help. I'd delete this answer, but I don't want to be too rash, maybe I've just messed up and skt is alive and well, I just can't remember how to make it work. But still, I think you're better off using Unicode input with XeTeX, as shown in some of the answers above.Sanskrit 2003 and Chandas are both very good fonts you can use and the sanskrit keyboard layout that comes with ubuntu is great – Au101 Aug 14 '16 at 4:00
5
 \documentclass[12pt]{article}
 \usepackage{fontspec}
 \usepackage[english]{babel} 
 \newfontfamily\sanskrit[Script=Devanagari]{Lohit Devanagari}
 \begin{document}
 The main text is in English, and you can add sanskrit quote...

 \begin{quotation}\sanskrit
        सर्वधर्मान् परित्यज्य मामेकं शरणं व्र्ज

        अहं त्वां सर्वपापेभ्यो मोक्षयिष्यामि मा शुचः
 \end{quotation}
 \end{document}

enter image description here

3

Since you want just few Devanagari lines in thesis, following is a good way: write a separate .dn file using package 'devanagari' of Velthuis which contains your devanagari lines. Package devanagari comes with textlive-full, so no need to install it separately. Say this file is ABC.dn. Then process A.dn using "devnag" to get ABC.tex--- a texfile; it is a standard process. ABC.tex file contains the code which (La)TeX can process to produce devanagari output.

  1. Usepackage devanagari in your thesis preamble.
  2. Note that in ABC.tex the command \documentclass is precedes the command "\def\DevnagVersion{2.15}", that is, ABC.tex begins as "\def\DevnagVersion{2.15}\documentclass{your class}". Copy "\def\DevnagVersion{2.15}" command and paste in the the preamble of your thesis at similar place. Thus the thesis preamble now reads "\def\DevnagVersion{2.15}\documentclass{class for thesis}".
  3. Now copy the processed devanagari transliteration in ABC.tex and paste in your thesis where you want it. This processed transliteration is usually not readable. If you look carefully, then it might make some sense.

Now process your thesis file as usual.

This process has the following advantages: 1. Package devanagari is standard LaTeX package, so no need to install anything different. 2. Using XeLaTeX or adding extra font for devanagari in Preamble might be tricky. Since it is your thesis you don't want that these fonts or XeLaTeX change anything. The above process is very safe and uses (La)TeX only. The devanagari output comes with default font in package devanagari, which is decent one. The font suits Sanskrit, Hindi and Marathi as well. All the best!

1

The skt package produces extraordinarily beautiful Devanagari including Vedic accents which can easily be rendered in a different color as was the practice in carfully written manuscripts. I use it all the time and it still works with texlive 2018. I am now supervising a Bachelor's in Technology project at IIIT Hyderabad in which Aditya is working to revise the skt package to be more user friendly (take longer sequences of text, and receive input directly from the Sanskrit Library Phonetic basic (ascii) encoding). We intend to submit the results for integration into texlive. Any hints are welcome.

  • 3
    I am not sure this is a direct answer to the question but it does highlight one reason for using the old skt package instead of modern alternatives. See also this answer, which is related to your project: receives input directly in Devanagari, but uses the skt package. (But I agree with the comment above; if there's a question here please ask as a separate one, to fit the format of this site.) – ShreevatsaR Jan 23 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.