0

I want to create a book that will help Asian people learn English. The requirements are - the book should contain text from 2 different languages, say, Hindi and English.

I tried this multi-lingual example from here

\documentclass{article}
%Always start xelatex files with these in preamble. This helps in defining the script and fonts
\usepackage{fontspec}
%Set the main languge next as main font.
\setmainfont[Script=Devanagari]{Lohit Hindi}

%Set rest of the languages l;ike this. Experiment a bit. script=punjabi did not work. Replaced with gurmukhi and it works.


%English does not need any script specifiction! Just define the font.
\newfontfamily{\eng}{Arial}
\begin{document}
%No need to define script as this is the manin font set. Like defalut.
नमो नारायणाय! \\

{\eng namo bhagavate naraayanaaya}\\
%the next line does not begin liekt he ones above. so it defaults to mainfont which is devanagari.
शुभम।
\end{document}

I used the following command $ xelatex multilang.tex

but I got the error -

This is XeTeX, Version 3.1415926-2.4-0.9998 (TeX Live 2012/Debian)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, et
hiopic, farsi, arabic, pinyin, croatian, bulgarian, ukrainian, russian, slovak,
 czech, danish, dutch, usenglishmax, ukenglish, finnish, french, basque, ngerma
n, german, swissgerman, ngerman-x-2012-05-30, german-x-2012-05-30, monogreek, g
reek, ibycus, ancientgreek, hungarian, bengali, tamil, hindi, telugu, gujarati,
 sanskrit, malayalam, kannada, assamese, marathi, oriya, panjabi, italian, lati
n, latvian, lithuanian, mongolian, mongolianlmc, nynorsk, bokmal, indonesian, e
speranto, coptic, welsh, irish, interlingua, serbian, serbianc, slovenian, friu
lan, romansh, estonian, romanian, armenian, uppersorbian, turkish, afrikaans, i
celandic, kurmanji, polish, portuguese, galician, catalan, spanish, swedish, th
ai, loaded.

some more output and then this error -

(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg)))kpathsea: Invalid fontname `Lohit Hindi/ICU', contains ' '
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "Lohit Hindi" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

l.5 \setmainfont[Script=Devanagari]{Lohit Hindi}

The questions are -

  1. what is the exact problem here? It looks like the font "Lohit Hindi" is missing, but I am confused
  2. how to install fonts in LaTex (or XeTex) or how to make the fonts installed on Linux available to XeTex?
1
  • 2
    XeLaTeX uses system fonts, so you have to install this font in the normal way for your operating system. Apr 15, 2015 at 14:48

1 Answer 1

2

If this is what you expect to see in your LaTeX / XeTeX output …

enter image description here

then you may just have to change the name of the font, which may be outdated in the example you got.

I modified your example like this (with comments removed):

\documentclass{article}
\usepackage{fontspec}

\setmainfont[Script=Devanagari]{Lohit-Devanagari} % Hindi -> Devanagari

\newfontfamily{\eng}{Arial}
\begin{document}
नमो नारायणाय! \\

{\eng namo bhagavate naraayanaaya}\\
शुभम।
\end{document}

And if the Lohit fonts are missing on your system, you may find your luck here for Fedora and Debian, but also more crudely from git, svn and the like for any other system (see instructions there).

Worked for me on a RHEL6 derived system (Scientific Linux). Good luck!

2
  • Please note the difference in LaTeX betwenn a linebreak, a proper paragraph break and empty lines in the output. Right now, this is not the same as above.
    – Johannes_B
    Apr 15, 2015 at 17:18
  • 1
    @Johannes_B, you are right, although I believe that the empty line was not deliberately positioned like that in the original question. (There might be the same empty line missing after the part in latin characters.) However I corrected it in my answer. Thank you!
    – Dirk
    Apr 16, 2015 at 17:59

You must log in to answer this question.

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