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}
Stefan Kottwitz
  • 231,401
  • 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 Jan 12 '12 at 10:43

2 Answers2

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} 
David Carlisle
  • 757,742
Aku
  • 11,026
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

Stefan Kottwitz
  • 231,401
  • Ok, perhaps I copied the upper half and pasted here. But i have added the \end{flushleft} command. – chandrasekhar Jan 12 '12 at 10:54
  • right i got it now. – chandrasekhar Jan 12 '12 at 12:26
  • There seems to be a problem with your example code (the order of devanagari and fontspec); see this question: http://tex.stackexchange.com/q/74141/3954 . – Gonzalo Medina Sep 26 '12 at 03: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}. – ShreevatsaR Mar 05 '17 at 08:30