3

I switched to lualatex for coloring part of Arabic words easily with arabluatex and xcolor. With xelatex I'd no problem with Bangla.

Here's the latex script:

\documentclass[12pt]{report}
\usepackage{arabluatex, fontspec, xcolor}
\setmainfont{[Kalpurush]}
\newfontfamily\arabicfont[Script = Arabic]{Al Qalam Quran Majeed Web} 

\newcommand{\textarabic}[1]{\bgroup\textdir TRT\arabicfont #1\egroup}     % Arabic inside LTR
\newcommand{\n}[1]{\bgroup\textdir TLT #1\egroup}     % for digits inside Arabic text
\newcommand{\afootnote}[1]{\footnote{\textarabic{#1}}}     % Arabic footnotes
\newenvironment{Arabic}{\textdir TRT\pardir TRT\arabicfont}{}     % Arabic paragraph

\def\r{\color{red}}
\setlength\parindent{0pt}

\begin{document}    

    কণ্যা এখন কি করিবে? \\
    \textarabic{وَ{\r لَ}دٌ}\\
    \textarabic{{\r ٱل}كَلَمُ}\\
    \textarabic{أَبَ{\r كُم}}

\end{document}

and here's the output:

enter image description here

Bangla output in the first line should have been: কণ্যা এখন কি করিবে?

How to fix Bangla in lualatex?

  • Thanks. @UlrikeFischer The glyphs look kind of familiar, I think we had some similar problem in luaotfload before. Do you remember anything about it? – Marcel Krüger May 28 '19 at 15:24
  • @MarcelKrüger, not all Arabic fonts work with arabluatex for coloring parts! Traditional Arabic doesn't work at all, with Simplified Arabic it works to some extent but alphabets actually get disunified, with Arabic Typesetting it doesn't work well! I found Al Qalam Quran Majeed Web in an article and so far it's working nicely. –  May 28 '19 at 15:43
  • 2
    @MarcelKrüger The script is also mentioned here https://tex.stackexchange.com/questions/454031/examples-for-broken-rendering-of-scripts-in-lualatex. Imho (as it fails in context too) it is one of the cases why we want harfbuzz in luatex (with mode=harf it works fine). – Ulrike Fischer May 28 '19 at 18:11
  • @UlrikeFischer, harfbuzz is for Arabic, right? I don't have any issue with Arabic, it's working nicely. My problem is with Bangla. –  May 28 '19 at 18:43
  • 1
    no, harfbuzz is a library for all scripts (and harfbuzz is used in xetex where your script works fine). – Ulrike Fischer May 28 '19 at 18:48
  • @UlrikeFischer, in xelatex Arabic broke apart, I'd tried this code. –  May 28 '19 at 19:05
  • 2
    well if you are feeling adventurous you could try harftex (which is luatex + harfbuzz). – Ulrike Fischer May 28 '19 at 20:17
  • @UlrikeFischer, I'm using Latex Workshop in Visual Studio Code. I just changed pdf to xe or lua in settings to make it work for me and it did perfectly, but harf isn't working in VS Code! I've MikTex 2.9 installed in my System. –  May 28 '19 at 20:41
  • 1
    harftex isn't in miktex. You would need a texlive and then get the binaries from http://w32tex.org/ (and you would need to make a latex format for it, and get https://github.com/khaledhosny/harf). – Ulrike Fischer May 28 '19 at 20:56
  • @UlrikeFischer, thanks for your info. Installing harftex seems very complicated! –  May 28 '19 at 21:16
  • @UlrikeFischer, I've removed MikTex and installed TexLive 2019 and everything seems to be working fine, without downloading and installing binaries from w32tex.org, in VS Code with Latex Workshop except that I've to copy some of arabic fonts in my working directory, eg. Al Qalam Quran Majeed Web. If I use Simplified Arabic, Traditional Arabic, etc. I don't have to put a copy of these in working directory. Now I've this question! –  May 29 '19 at 10:47
  • November 2019 update on how to run the luaharfbuzz engine: https://tex.stackexchange.com/questions/493180/how-to-install-harftex-on-texlive – Cicada Dec 26 '19 at 11:29

1 Answers1

2

Compile with the luahbtex engine.

bengali conjuncts

The example uses fonts I have available.

The Harfbuzz font shaping engine (now in luatex) knows how to form conjuncts.

MWE

\documentclass[12pt]{report}
\usepackage{arabluatex, fontspec, xcolor}
\setmainfont{Noto Sans Bengali}[Renderer=Harfbuzz,Script=Bengali]%[Kalpurush]}
\newfontfamily\arabicfont{Noto Sans Arabic}[Renderer=Harfbuzz,Script=Arabic]%[Script = Arabic]{Al Qalam Quran Majeed Web} 

\newcommand{\textarabic}[1]{\bgroup\textdir TRT\arabicfont #1\egroup}     % Arabic inside LTR
\newcommand{\n}[1]{\bgroup\textdir TLT #1\egroup}     % for digits inside Arabic text
\newcommand{\afootnote}[1]{\footnote{\textarabic{#1}}}     % Arabic footnotes
\newenvironment{Arabic}{\textdir TRT\pardir TRT\arabicfont}{}     % Arabic paragraph

\def\r{\color{red}}
\setlength\parindent{0pt}

\begin{document}    

    কণ্যা এখন কি করিবে? \\
    \textarabic{وَ{\r لَ}دٌ}\\
    \textarabic{{\r ٱل}كَلَمُ}\\
    \textarabic{أَبَ{\r كُم}}

\end{document}

Because I have MiKTeX on Windows, and I like to run latex, I set up a compiler option using miktex-luahblatex.exe.

Refer to the instructions in: How to install HarfTeX on TeXLive?, "Update November 2019" section. (You don't need to install HarfTex anymore.)

Cicada
  • 10,129