1

When elegantbook class (3.11) uses polyglossia package it does not show chapter number at header?

MWE:

\documentclass[11pt,fancy,authoryear,twoside]{elegantbook}
\usepackage{lipsum}
    
%--------------------------------------------------
%Bengali Font in Document
%--------------------------------------------------
\tracinglostchars=2
% For a bilingual document
\RequirePackage{fontspec}
\RequirePackage{polyglossia}

\defaultfontfeatures{Ligatures=TeX, Scale=MatchUppercase}
% Times New Roman used for English
%\setmainfont{Times New Roman}
%\setmainfont{Times New Roman}[NFSSFamily=ntxtlf]
\setmainlanguage{bengali}
\setotherlanguage{english}

% Bengali
\newfontfamily\bengalifont{Kalpurush}[
  Script=Bengali,
  Language=Bengali,
  AutoFakeBold = 0.2,
  AutoFakeSlant = 0.15  ]

%End--------------------------------------------
    
\title{An Elegant \LaTeX{} Template for Books}
\subtitle{Classic Elegant\LaTeX{} Template}

\author{Ethan Deng \& Liam Huang}
\institute{Elegant\LaTeX{} Program}
\date{April 12, 2020}
\version{3.11}
\bioinfo{Bio}{Information}

\extrainfo{Victory won\rq t come to us unless we go to it. }

\logo{logo-blue.png}
\cover{cover.jpg}


\begin{document}

\maketitle

\frontmatter
\tableofcontents

\mainmatter

\chapter{স্যাম্পল  চ্যাপ্টার}
\lipsum[1]
\section{স্যাম্পল সেকশন}
\lipsum[1-30]
\end{document}

Output:
enter image description here

enter image description here

I need following output:

enter image description here enter image description here

Actually I am new in Latex, that's why I have not much knowledge about it. How can I fix this problem?

1
  • 2
    It would be helpful if you would provide for a file that we can run. You use inserted images we do not have, and I would not like to download letter types I do not use. You could try whether the same problem appears when you use a Latin letter type instead of the Bengali letter. Might be your problem is the "fancy" in your documentclass, because afterwords you do not define how to present the chapter heads nor the headers. – C. Peters Apr 15 at 6:43
4

The class defines the chapter title and the header in the wrong way. It misuses \chaptername to include the number. But as \chaptername is redefined by the language support packages the number is lost again

But you should be aware that the class is not a generic class for all languages. It explicitly supports only english, chinese and italian.

You can add the following before \begin{document}:

\renewcommand{\chaptermark}[1]{\markboth{\chaptername~\thechapter \, #1\,}{}}
\titleformat{\chapter}[\style]{\bfseries}
     {\filcenter\LARGE\enspace\bfseries{\color{structurecolor}%
       \IfAppendix{\appendixname}{\chaptername~\thechapter}\enspace}}
     {1pt}{\bfseries\color{structurecolor}\LARGE\filcenter}[]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.