2

I am trying to compile a latex document with xelatex in Visual Studio using latex workshop. But I am getting the error:

main.tex:19: You can't use `macro parameter character #' after \the.
\bengalinumeral ...alinumber \expandafter {\the ##
                                                  1}
l.19 \end{document}

] (./main.aux)

Here is my tex document:

% !TEX program = xelatex

\documentclass[a4paper,12pt]{book}

\usepackage[banglamainfont=Kalpurush,
banglattfont=Siyam Rupali]{latexbangla}

\begin{document}

    \title{Test}
    \author{Test}
    \date{Test}
    \maketitle

    \tableofcontents

    \chapter{asdf}

\end{document}

I think latexbangla is causing the problem. Disabling changecounternumbering by \usepackage[banglamainfont=Kalpurush, banglattfont=Siyam Rupali, changecounternumbering=0]{latexbangla} compiles into pdf. But automatic numberings are broken.

Tex:

% !TEX program = xelatex

\documentclass[a4paper,12pt]{book}

\usepackage[banglamainfont=Kalpurush,
banglattfont=Siyam Rupali,
changecounternumbering=0]{latexbangla}

\begin{document}

    \title{টেস্ট}
    \author{\today ১ ২ ৩ ৪ 1 2 3 4}
    \maketitle

\end{document}

Output:

broken number

  • 1
    It looks like the problem might be upstream in the polyglossia package, but I'm not sure. I don't have time to look deeper into this but I'm leaving this note in case someone else cares to do so. – Don Hosek May 15 '20 at 04:21
  • Runs OK for me (xelatex on windows), both Latin script and bangla. Although it takes about a minute with Latin-only script. About 10 seconds with bangla only. Loading ucharclasses is where it takes it time. – Cicada May 15 '20 at 13:52
  • Make sure you have an up-to-date installation. There are 60+ packages being loaded up. – Cicada May 15 '20 at 13:55
  • @Cicada Currently I am running Manjaro Linux 20.0. and I have installed texlive-core, texlive-bin, texlive-langextra, texlive-latexextra, texlive-pictures and updated. – Sharif Minhazul Islam May 15 '20 at 15:02
  • @Cicada How can I know which package I need if it doesn't give any error about package? – Sharif Minhazul Islam May 15 '20 at 15:38
  • @DonaldHosek Yes. There was a bug in polyglossia. Which was later fixed. And I have to slightly update latexbangla.sty – Sharif Minhazul Islam May 16 '20 at 00:24

2 Answers2

2

ah! Fix answer already posted as I was typing this one.


If I set the polyglossia language (using \setdefaultlanguage), polyglossia changes the date display as required.

bangla

I use \bengalidigits{} to convert arabic numerals to bangla; otherwise direct input is OK (because of the font).

MWE

\documentclass[a4paper,12pt]{book}

\usepackage[banglamainfont=Kalpurush,
banglattfont=Siyam Rupali,
%changecounternumbering=0
]{latexbangla}
\setdefaultlanguage[numerals=Bengali,
changecounternumbering=true]{bengali}

\begin{document}

    \title{টেস্ট}
    \author{\today ১ ২ ৩ ৪ 1 2 3 4\\০১২৩৪৫৬৭৮৯ \bengalidigits{123 456 789}}
    \maketitle

\today

০১২৩৪৫৬৭৮৯ \bengalidigits{123 456 789}

\end{document}

chapter

Cicada
  • 10,129
0

There was a bug in polyglossia, which was fixed later on. But LaTeXbangla was not updated using the newer version of polyglossia. If you are seeing error that means your polyglossia package is not updated. Update your package then fix LaTeXbangla. LaTeXbangla is causing number breaking.

Fixing latexbangla.sty

Find latexbangla.sty. You will find latexbangla.sty here /usr/share/texmf-dist/tex/latex/latexbangla/ in Linux. I don't know about windows or mac.

Change line 139 from this

\setmainlanguage[changecounternumbering=true]{bengali}

to this

\setmainlanguage[numerals=Bengali, changecounternumbering=true]{bengali}

This should fix the number breaking problem.


How to update polyglossia in Arch Linux

Now if you use Arch Linux like me, texlive in repository is not updated. You can either choose to install from tug or just replace the polyglossia with new one from GitHub. But latest version from GitHub, is also showing some different error. My friend gave a working version of polyglossia(download link).

Step 1. Download and unzip.

Step 2. Find tex folder in that and replace you system polyglossia files with the new one. In Manjaro Linux, you can do this by (I don't know about where other OS store their files)

sudo cp -r -v path_to_tex_folder /usr/share/texmf-dist/tex/latex/polyglossia/

Step 3. Now run sudo texhash to update tex.

Now, It works fine.


I am going to raise an issue on polyglossia and LaTeXbangla in github about the new error.