6

I am a Linguist and I need to use Bengali script inside an English article which is predominantly English. I have found many answers but they only seem to be useful when the whole document is in Bengali. I should mention that I use the following:

Tex-editor: Texmaker

Library: MikTex

Package: Tipa

Compiler: LuaLatex

Let me describe the problem: for example when I start my document as:

\documentclass[10pt,a4paper]{article}

\usepackage{tipa}

\begin{document}

x, y, z whatever.... 

আমি

\end{document}

It doesn't show any error and the pdf looks fine except the Bengali letters just disappear.

Please help.

Arun Debray
  • 7,126
  • 2
  • 30
  • 54

2 Answers2

7

Using the polyglossia package, it works quite well in XeLaTeX:

\documentclass[preview, margin=0.5cm]{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{bengali}
% Replace this with whatever font you're using
\newfontfamily\bengalifont[Script=Bengali]{Akaash}
\title{\textbengali{ইংরেজি} and Bengali}
\begin{document}
\maketitle

First English, \textbengali{তারপর বাংলা}

\end{document}

The output looks like this.

enter image description here

(As per this answer, I installed the Akaash font from this website. You can substitute in another font if you prefer.)

Note, however, that if I compile with LuaLaTeX, vowels are not handled correctly: the first word of the title should be ইংরেজি, but instead we have this, which is wrong:

enter image description here

Unfortunately, I don't (yet) know of a workaround in LuaLaTeX.

Arun Debray
  • 7,126
  • 2
  • 30
  • 54
  • Do you know how to use Bengali v.2 with fontspec? The font I used offers 2 scripts and I'm curious what the second one would look like. (I know nothing whatsoever about Bengali.) – cfr Jan 02 '16 at 02:15
  • @cfr sure, I'll take a look at Noto Sans Bengali and see if I can make that work. – Arun Debray Jan 02 '16 at 02:36
  • http://tex.stackexchange.com/questions/89118/context-xetex-texlive-2012-does-not-work-for-indic-scripts-like-malayalam?lq=1 is interesting. Could something similar apply with LuaTeX? – cfr Jan 02 '16 at 02:48
  • @cfr: after some searching, I'm stuck. According to this mail thread, it's possible to switch from beng to bng2 in XeTeX, but the referenced pastebin link is long gone, and I have no idea how one would do this. It seems like it would be worth asking as a followup question, in fact. – Arun Debray Jan 02 '16 at 03:48
  • http://tex.stackexchange.com/q/285527/ Feel free to edit if I've got anything wrong. – cfr Jan 02 '16 at 04:14
  • @cfr: it turns out that you can put \newfontscript{Bengali2}{bng2} and \newfontfamily\bengalifont[Script=Bengali2]{Noto Sans Bengali} in your preamble to switch the two. However, when I tried this on a paragraph of Bengali text (with plenty of conjuncts!) I could see no difference between the two. – Arun Debray Jan 02 '16 at 04:19
  • Excellent! Too bad it didn't help, though.... – cfr Jan 02 '16 at 20:24
1

I don't know anything about Bengali so it took me a while to figure out a font I could use for this. However, I get similar output to Arun Debray when compiling with LuaLaTeX

wrong

which I gather is wrong, whereas XeLaTeX produces

possibly less wrong

which I gather is less wrong.

Since this uses an entirely different font, I guess that LuaLaTeX cannot cope properly with this script at the moment. (Or it needs some additional something which XeLaTeX can do without.)

\documentclass[a4paper]{article}
\usepackage{geometry,fontspec,polyglossia}
\setmainlanguage[variant=british]{english}
\setotherlanguage{bengali}
\newfontfamily\bengalifont{Noto Sans Bengali}[Script=Bengali]
\begin{document}
x, y, z whatever\dots

\begin{bengali}
  আমি
\end{bengali}
\end{document}

The font I used offers two versions of Bengali script

beng            Bengali
bng2            Bengali v.2

However, I am not sure how to enable the second one to compare. I guess this could be done as a raw font feature, but perhaps there is a better option for this, which would still have it correctly recognised as a script?

cfr
  • 198,882
  • To confirm, your first example is wrong, and the second example is correct. One of the quirks of the Bengali script is that some vowels are written before consonants they come after, so ম is ma but মি is mi. You can use ি or ে (i and e, respectively) to test for this. – Arun Debray Jan 02 '16 at 02:30
  • I also found this post mentioning similar issues in a related script; it works in XeLaTeX, but not LuaLaTeX. – Arun Debray Jan 02 '16 at 02:40
  • Thanks for confirmation. I said "gathered" just because I am entirely following you on this. But I thought it would be useful to know the correct/incorrect results applied to another font, since I'd just spent a while figuring out a font I could use for this. I assume the second version of the script will follow the same pattern, but it would be interesting to have that confirmed. I just couldn't figure out a way to get fontspec to recognise it. – cfr Jan 02 '16 at 02:40
  • This kind of issue is why I said in my original comment that XeLaTeX might prove better here than LuaLaTeX. XeLaTeX is generally better with multilingual stuff, especially when it comes to scripts which are less commonly used in LaTeX documents and which differ most from Latin scripts. (RTL typesetting works better, for example, and I've seen other cases where the results are wrong for LuaTeX but right with XeTeX although I don't know I can track all the questions down now.) – cfr Jan 02 '16 at 02:43
  • Thanks a lot, it works although I should mention that \usepackage{tipa} now shows the following error:error:_____________________________ ! LaTeX Error: Command \sups already defined. Or name \end... illegal, see p.192 of the manual., ____________________________ but when I comment that out everything works fine and I have the features of Tipa package too... don't know how ! Maybe polyglossia includes Tipa ? Does it ? – LinguaDas Jan 04 '16 at 23:33
  • @LinguaDas I think tipa uses traditional font encodings and fonts so it won't play nicely with unicode fonts, engines and packages. If you look in tipa.sty you can see that it is loading fontenc with encoding T3 for example. Although traditional encodings can be used alongside unicode, usually it is unnecessary and just causes problems. Unless you know exactly why you need it and why you are doing it, don't load fontenc with XeTeX or LuaTeX. – cfr Jan 04 '16 at 23:59