Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
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
add comment

1 Answer

\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.

share|improve this answer
    
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 3 '13 at 12:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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