5

I want to write some Hindi text along with English using LaTeX for eg: k=क, bollywood or (बॉलीवुड). I have used the below in the preamble but I'm getting the error command:

\G already defined.

\documentclass{report}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{sanskrit}
\usepackage{xltxtra}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\newfontfamily\devanagarifont[Script=Devanagari]{mangal.ttf}
\newfontfamily\devtransl[Script=Roman,Mapping=DevRom]{Times New Roman}
qubyte
  • 17,299
  • 1
    Hi Amit, welcome to TeX.sx. I've put your quote in a quote block, and the code in a code block. Click on edit to see how to do these using the keyboard, but also note in the editor that there is a code tool marked with {}, and a similar quote tool. – qubyte Feb 20 '12 at 14:59

1 Answers1

3
\documentclass{report}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{sanskrit}

\usepackage{fontspec}
\setmainfont{Times New Roman}
\newfontfamily\devanagarifont[Scale=MatchUppercase]{Devanagari MT}
\newfontfamily\devtransl[Mapping=DevRom]{Times New Roman}

\begin{document}
bollywood or \foreignlanguage{sanskrit}{बॉलीवुड}
\end{document}

I've changed the Devanagari font to one that I have on my machine:

enter image description here

For longer parts in Sanskrit there's also the otherlanguage* environment. For entire paragraphs you can use the sanskrit environment, see the documentation of Polyglossia.

There's no need, in general, to load xltxtra.

egreg
  • 1,121,712
  • thanks.its working. i tried it with my main document but due to package conflicts of amssymb and amsmth, it was giving errors. the sequence mentioned below solved all the problem. {\documentclass{report} \usepackage{amssymb} \usepackage{polyglossia}

    \usepackage{amsmath} \setdefaultlanguage{english} \setotherlanguage{sanskrit} \usepackage{fontspec} \setmainfont{Times New Roman} \newfontfamily\devanagarifont[Scale=MatchUppercase]{Mangal} \newfontfamily\devtransl[Mapping=DevRom]{Times New Roman}}

    – Amit Bhatt Feb 20 '12 at 20:07
  • If you're using Hindi you should set the main language to hindi not sanskrit, since (at least) the hyphenation patterns are different. (I don't know about other things.) – Alan Munn Apr 03 '13 at 12:06