TransWikia.com

How do I localize enumeration in Bengali?

TeX - LaTeX Asked on December 7, 2020

In English, enumeration happens automatically, but it does not work in Bengali. How do I localize the enumeration for Bengali?

documentclass[11pt]{article}
usepackage{enumerate}
usepackage[banglamainfont=Kalpurush, banglattfont=Siyam Rupali, feature=0, changecounternumbering=0]{latexbangla}

begin{document}

section*{বাংলায়  enumeration }
begin{enumerate}[(১।)]
 item  1st item
 item 2nd item
begin{enumerate}[(ক)]
item 1st sub item
item 2nd sub item 
end{enumerate}
end{enumerate}

end{document}

But it does output:

enter image description here

I want to get output as:

enter image description here

One Answer

The babel package supports a Bengali version of arabic and (as an undocumented bonus feature) alph. This enables you to format your example with enumitem, and also localizes the numbers of pages, chapters, sections, table of contents entries, etc.

tracinglostchars=2 % Warn if a glyph is not in the current font
documentclass[11pt]{article}
usepackage{iftex}
usepackage{enumitem}

ifLuaTeX
  usepackage[english, bidi=basic, layout=sectioning.counters]{babel}
  usepackage{fontspec}
  defaultfontfeatures{Renderer=HarfBuzz, Scale=MatchLowercase, Ligatures = TeX}
else % XeLaTeX?
  usepackage[english, bidi=default, layout=sectioning.counters]{babel}
  usepackage{fontspec}
  defaultfontfeatures{Scale=MatchLowercase, Ligatures = TeX}
fi

babelprovide[import, main, maparabic, alph=alphabetic]{bengali}

%% From: https://github.com/potasiyam/Kalpurush
%% A matching font family might be Gentium.
babelfont{rm}
          [Scale = 1.0,
           BoldFont = *,
           BoldFeatures = {FakeBold = 1.1}
          ]{Kalpurush}

begin{document}

section*{বাংলায়  enumeration }
begin{enumerate}[label=arabic*।]
   item  1st item
   item 2nd item
     begin{enumerate}[label=(alph*)]
       item 1st sub item
       item 2nd sub item 
     end{enumerate}
end{enumerate}

end{document}

Kalpurush font sample

This requires LuaLaTeX 1.12.0 or greater, and as of June 2020, a bug in fontspec prevents this MWE from working properly in XeLaTeX. Until this is fixed, LuaLaTeX from TeX Live 2020 works, and XeLaTeX from TeX Live 2019 might too.

If these don’t meet your needs, you will need to define your own enumeration counter.

Answered by Davislor on December 7, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP