I have a document with Bangla as its main language (using babel
package) and English as the secondary language. Bangla is used for regular text. However, whenever I am using Bangla in the equation in math mode, text in Bangla is not showing at all. For example,
$৩৪^২$ %34^2
\begin{align*}
৩৪২ &= (৩৪+৪)(৩৪-৪) + ৪২\\
&= ৩৮৩০ + ৪২
\end{align*}
This code shows only symbols = ( + )( − ) +
. I have a solution to show the Bangla text using \text{}
command. But its a hazard. I need a generous solution for it without using \text{}
. Can anyone help?
Complete example:
\documentclass{article}
\usepackage[english]{babel}
\babelprovide[import, onchar = fonts ids]{bengali}
% \babelfont[bengali]{rm}[Renderer=Harfbuzz]{FreeSerif}
\babelfont[bengali]{rm}[Renderer=Harfbuzz,AutoFakeBold,AutoFakeSlant=0.3]{Kalpurush}
\babelcharproperty{`।}{locale}{bengali}
% bangla numerals
\babelprovide[maparabic,alph=alphabetic]{bengali}
% fix `matra` in bangla text
\makeatletter
\AtBeginDocument{%
\def\bbl@mapdir#1{%
{\def\languagename{#1}%
\let\bbl@ifrestoring\@firstoftwo % To avoid font warning
\bbl@switchfont
\ifnum\fontid\font>\z@
\directlua{
Babel.locale_props[\the\csname bbl@id@@#1\endcsname]%
['/\bbl@prefontid'] = \fontid\font\space}%
\fi}}}%
\makeatother
\usepackage{amsmath}
\begin{document}
$৩৪^২$ %34^2
\begin{align*}
৩৪২ &= (৩৪+৪)(৩৪-৪) + ৪২\\
&= ৩৮৩০ + ৪২
\end{align*}
\end{document}
! LaTeX Error: Environment align* undefined.
unicode-math
I thought\usepackage{unicode-math} \setmathfont{latinmodern-math.otf} \setmathfont[range={"0980-"09FF}]{fontkalpurush.ttf}
should be enough be enough but that is still using a latin font for the Begali range for some reason.