3

I generally type sanskrit using the "devnag" preprocessor. But when making a sanskrit title it is showing an error. Can you please help me in rectifying this.

My input vivekachoodamani.dn file is given below:

\documentclass[10pt]{article}
\usepackage[ansinew]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{devanagari}
\usepackage{fontspec,bera}
\usepackage[width=4.5in, height=7.0in, top=1.0in, papersize={5.5in,8.5in}]{geometry}

\begin{document}
\title{{\dn vivekachoodama.ni}}
\author{Sri Sankaracharya}

\maketitle

\begin{flushleft}


{\dn sarvavedaantasiddhaantagocara.m tamagocara.m | \\ govinda.m paramaananda.m {sad}guru.m pra.nato.asmyaham ||  1}

{\small I prostrate myself before Govinda, the perfect teacher, who is absorbed always in the highest state of bliss. His true nature cannot be known by the senses or the mind. It is revealed only through knowledge of the scriptures.}

\end{document}
1
  • I don't have any experience with Sanskrit or the devnag perprocessor, but it is probably advantageous to give the error message you're receiving.
    – Psirus
    Commented Jan 12, 2012 at 10:43

2 Answers 2

1

The end of the flushleft environment is missing. I changed the input encoding from ansinew to utf8, since my editor uses it and it better matches XeLaTeX. Further I got a geometry error, so I removed the package. After I fixed those things, this example could be compiled with XeLaTeX:

\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{devanagari}
\usepackage{fontspec,bera}
\begin{document}
\title{{\dn vivekachoodama.ni}}
\author{Sri Sankaracharya}
\maketitle
\begin{flushleft}
{\dn sarvavedaantasiddhaantagocara.m tamagocara.m | \\ govinda.m paramaananda.m {sad}guru.m pra.nato.asmyaham ||  1}

{\small I prostrate myself before Govinda, the perfect teacher, who is absorbed always in the highest state of bliss. His true nature cannot be known by the senses or the mind. It is revealed only through knowledge of the scriptures.}

\end{flushleft}
\end{document}

enter image description here

4
  • Ok, perhaps I copied the upper half and pasted here. But i have added the \end{flushleft} command. Commented Jan 12, 2012 at 10:54
  • right i got it now. Commented Jan 12, 2012 at 12:26
  • There seems to be a problem with your example code (the order of devanagari and fontspec); see this question: tex.stackexchange.com/q/74141/3954 . Commented Sep 26, 2012 at 3:52
  • The example output is completely wrong (e.g. the first word of the body, corresponding to input sarvavedaantasiddhaantagocara.m, must look like “सर्ववेदान्तसिद्धान्तगोचरं” rather than the gibberish that starts like “सअरवअवएदअअनत…”). I think what this shows is that \dn from \usepackage{devanagari} is not compatible with XeLaTeX, or at least not with \usepackage[utf8]{inputenc}. Commented Mar 5, 2017 at 8:30
2

Here is one way of doing it, there could be many way but I find this, the easiest.

\documentclass[a4paper,12pt]{article}
\usepackage[left=0.15in,right=0.15in,top=0.75in,bottom=0.75in]{geometry}
\usepackage{fontspec}
\usepackage{fancyhdr}
\usepackage{verse}
\usepackage{varwidth}
\pagestyle{fancy}
\newenvironment{Verse}
  {\center\varwidth{\linewidth}}
  {\endvarwidth\endcenter}

%\setmainfont[Script=Devanagari]{Nakula}
\setmainfont[Script=Devanagari]{Sanskrit 2003}

\begin{document} 
\title{रामायणम्}
\author{वाल्मीकि}

\maketitle

\lhead{रामायणम्}
\chead{बाल काण्ड}
%\rhead{\bfseries प्रथमः सर्ग}
\lfoot{ by आकु}
\cfoot{\thepage}
%\cfoot{संस्कृत प्रेमियो के लिये }
\rfoot{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\begin{verse}
प्रजापति समः श्रीमान् धता रिपु निषूदनः | \\
रक्षिता जीवलोकस्य धर्मस्य परि रक्षिता||
\end{verse}
\end{document} 
1
  • can you post some template for numbered sanskrit verses template. Please refer to your another question for similar, could you have one. Commented Aug 10, 2015 at 14:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .