1

I am writing an Assamese book using XeTex. While using \subsection command, it starts numbering without the section number it belongs to. \subsubsection command does not print any number and also its indentation is wrong. I have tried with \renewcommand. But could not fix the error. Using ployglossia also results into same condition. Further, in order to get chapter numbers in Assamese numerals, I had to define \bengalinumeral as shown in the following.

    \documentclass[12pt,a4paper]{book}
    % For a bilingual document
    \usepackage{fontspec}
    \usepackage[banglamainfont=SolaimanLipi, banglattfont=SolaimanLipi ]{latexbangla}
    %\setmainlanguage[changecounternumbering=true]{bengali}
    \setotherlanguage{english}
    \usepackage{fancyhdr}
        \makeatletter
        \def\bengalidigits#1{\expandafter\@bengali@digits #1@}
        \def\@bengali@digits#1{%
          \ifx @#1
          \else
            \ifx0#1০\else\ifx1#1১\else\ifx2#1২\else\ifx3#1৩\else\ifx4#1৪\else\ifx5#1৫\else\ifx6#1৬\else\ifx7#1৭\else\ifx8#1৮\else\ifx9#1৯\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
            \expandafter\@bengali@digits
          \fi
        }
        \makeatother



    \def\bengalinumber#1{\bengalidigits{\number#1}}
    \def\bengalinumeral#1{\bengalinumber{\csname c@#1\endcsname}}
    \renewcommand\thechapter{\bengalinumeral{chapter}}
    \renewcommand\thesection{\bengalinumeral{section}}
    \renewcommand{\thesubsection}{\thesection.\bengalinumeral{subsection}}
    \renewcommand{\thesubsubsection}{\thesection.\thesubsection.\bengalinumeral{subsubsection}}
    \numberwithin{subsection}{section}
    \numberwithin{subsubsection}{subsection}
\begin{document}
\chapter{ওভটনি সোঁত}
%\begin{bengali}
\section{পাতনি}
    abcdefgh কখগঘঙচছজঝঞ টঠডঢণ তথদধন পফবভম যৰলৱ শ ষ স হ ক্ষ 
    আ অা ই ঈ উ ঊ ঋ এ ঐ ও ঔ
    \subsection{কককক}
    abcdefgh কখগঘঙচছজঝঞ টঠডঢণ তথদধন পফবভম যৰলৱ শ ষ স হ ক্ষ 
     আ 

    অ আ ই ঈ উ ঊ ঋ এ ঐ ও ঔ
    \subsubsection{খখখখ}
    \section{হহহহ}
    \subsection{এয়া চাবচেক্চন}

\end{document}

The result I got is Subsection without parent section number

Would anyone guide me please.

Thanks and regards.

Leucippus
  • 1,636
sb1966
  • 11

1 Answers1

2

Welcome to tex.se.

There might be the latexbangla-polyglossia interaction causing all this, with a recent polyglossia change to be put into latexbangla.

One question per question is the expected format, otherwise things can becoming confusing about what was answered or if it helped.

Perhaps this bugfix request is possibly related: You can't use `macro parameter character #' error in latexbangla and polyglossia

If I activate polyglossia manually (until the latexbangla bugfix goes in), and number all levels and comment out your code changes, the numbering format looks OK now.

numbering levels

You have an extra space because a % is missing after \ifx @#1. See bengalidigits.sty package under polyglossia. Also see same package for use of \ifcase statement (more compact).

Section-level numbering can be set with \setcounter{secnumdepth}{x}, where x = 3 by default.

Your digit/numeral/section redefinitions codeblock introduces spaces and switches items off, but I do not have time to debug it. In any case, if I understand correctly, all this seems to be being done by latexbangla using polyglossia (e.g., gloss-bengali.ldf file), so after the fix goes in, it should be alright.

MWE

 \documentclass[12pt,a4paper]{book}
    % For a bilingual document
    \usepackage{fontspec}
    \usepackage[banglamainfont=SolaimanLipi, banglattfont=SolaimanLipi ]{latexbangla}
    %\setmainlanguage[changecounternumbering=true]{bengali}

%activate polyglossia
\setdefaultlanguage[numerals=Bengali,
changecounternumbering=true]{bengali}
%number all levels
\setcounter{secnumdepth}{5}

    \setotherlanguage{english}
    \usepackage{fancyhdr}
%        \makeatletter
%        \def\bengalidigits#1{\expandafter\@bengali@digits #1@}
%        \def\@bengali@digits#1{%
%          \ifx @#1
%          \else
%            \ifx0#1০\else\ifx1#1১\else\ifx2#1২\else\ifx3#1৩\else\ifx4#1৪\else\ifx5#1৫\else\ifx6#1৬\else\ifx7#1৭\else\ifx8#1৮\else\ifx9#1৯\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
%%%%%%%    \ifcase#1০\or১\or২\or৩\or৪\or৫\or৬\or৭\or৮\or৯\fi
%%%%%%    \ifcase#1০\or১\or২\or৩\or৪\or৫\or৬\or৭\or৮\or৯\fi
%            \expandafter\@bengali@digits
%          \fi
%        }
%%%%%%%\def\bengalidigits#1{\expandafter\@bengali@digits #1@}
%%%%%%%\def\@bengali@digits#1{%
%%%%%%%  \ifx @#1% terminate
%%%%%%%  \else
%%%%%%%%    \ifcase#1০\or১\or২\or৩\or৪\or৫\or৬\or৭\or৮\or৯\fi
%%%%%%%    \expandafter\@bengali@digits
%%%%%%%  \fi
%%%%%%%}
%%%%%%
%%%%%%
%        \makeatother



%    \def\bengalinumber#1{\bengalidigits{\number#1}}
%    \def\bengalinumeral#1{\bengalinumber{\csname c@#1\endcsname}}
%    \renewcommand\thechapter{\bengalinumeral{chapter}}
%    \renewcommand\thesection{\bengalinumeral{section}}
%    \renewcommand{\thesubsection}{\thesection.\bengalinumeral{subsection}}
%    \renewcommand{\thesubsubsection}{\thesection.\thesubsection.\bengalinumeral{subsubsection}}
%    \numberwithin{subsection}{section}
%    \numberwithin{subsubsection}{subsection}
\begin{document}
\chapter{ওভটনি সোঁত}
\section{পাতনি x}
\subsection{কককক y}
\subsubsection{খখখখ z}
\paragraph{খখখখ z1}
\subparagraph{খখখখ z2}
    \section{হহহহ}
    \subsection{এয়া চাবচেক্চন}
\subsection{কককক}
\subsubsection{খখখখ}
\paragraph{খখখখ}
\subparagraph{খখখখ}
\end{document}
Cicada
  • 10,129
  • Thanks @Cicada. Used your MWE, but didn't get the desired result. Replacing the polyglossia folder in /usr/share/.../polyglossia in my Ubuntu 18.04 with the latest one from Github as described in link produced kernel error while compiling. Best regards. I apologise for asking more than one question at a time inadvertently. – sb1966 May 25 '20 at 21:49
  • @sb1966 Ask a question about the kernel error. I do not have unix. It may be that others modules also need updating, or perhaps both admin and user folders (if unix has such a thing) need to be updated. – Cicada May 26 '20 at 10:13
  • I have installed texlive 2019 from ISO, which was last updated in April 2019. This also is giving me the same output. I don't know which version of polyglossia it uses. Thanks and Regards. – sb1966 May 26 '20 at 18:37
  • Happy that I got the desired results after I updated to TexLive 2020. So the problem is SOLVED. Best regards and thanks a lot. – sb1966 May 26 '20 at 21:31