Document ClassesError: can't print the title of the toc, the list of table, the acronyms well

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
dchevalier
Posts: 1
Joined: Thu Jun 30, 2022 9:27 am

Error: can't print the title of the toc, the list of table, the acronyms well

Post by dchevalier »

Hi,

I created a cls file because I wanted to change some points and more precisely the title of the toc, the acronyms, etc.
I made it (see cls file) and it was working well. However, when, I have some code in order to write in different languages, it doesn't work anymore.

Here a simple example:

Code: Select all

\documentclass{Internship_Report}

\usepackage{multirow}
\usepackage{longtable}
\usepackage{lscape}
\usepackage{makecell}
\usepackage{tabularx}
\usepackage{color}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage[breaklinks,hidelinks]{hyperref}


\begin{document}


\begin{center}
    \huge{\bfseries{Acknowledgements}}
    \vspace{0.3cm}
\end{center}

\chineseLanguage{非常感谢您} M; \<شكرًا لك أيها>  ; \greekLanguage{Σας ευχαριστώ πoulos} and V

\tableofcontents

\listoffigures

\newpage
\listoftables

\newpage
\chapter{Chap 1}

\chapter{Chap 2}


\end{document}
Here my cls file:

Code: Select all

\NeedsTeXFormat{LaTeX2e}

\ProvidesClass{Internship_Report}[2022/06/02 - Internship Report]

\LoadClass[11pt,twoside]{report}

\RequirePackage{appendix}
\RequirePackage{fancyhdr}
\RequirePackage[toc,acronym]{glossaries}
\RequirePackage{caption}
\RequirePackage{graphicx}
\RequirePackage[titles]{tocloft}

\RequirePackage{biblatex}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Geometry 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{calc}
\RequirePackage[a4paper,top=3.5cm,bottom=2.5cm,outer=1in,inner=1.5in]{geometry}
%\RequirePackage{showframe}

\setlength{\headheight}{13.59999pt}
\setlength{\parindent}{0em}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Chapter / Section / Appendix 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RequirePackage{fmtcount}

\makeatletter
\def\@makechapterhead#1{%
  \vspace*{-23\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \thispagestyle{fancy} \huge\bfseries \thechapter.\space  % Change the size of the chapter title
        %\huge\bfseries \@chapapp\space \thechapter
    \fi
    \interlinepenalty\@M
    \huge \bfseries #1\par\nobreak %\Huge \bfseries #1\par\nobreak
    \vskip 40\p@
}}

  
\newcommand\appendix@chapter[1]{%
    \addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
    \refstepcounter{chapter}%
    \def\app@ct{Appendix \@Alph\c@chapter: #1}
    \orig@chapter*{\thispagestyle{fancy}\vspace*{-70\p@} \huge\bfseries \app@ct}      % Change the size of the chapter title
    \markboth{\MakeUppercase{\app@ct}}{\MakeUppercase{\app@ct}}
    \addcontentsline{toc}{chapter}{\normalsize\bfseries\app@ct}%
}
\let\orig@chapter\chapter
\g@addto@macro\appendix{\let\chapter\appendix@chapter}

\newcommand\unappendix{\par
  \setcounter{apdxsection}{\value{section}}%
  \setcounter{section}{\value{savesection}}%
  \setcounter{subsection}{0}%
  \gdef\thesection{\@arabic\c@section}}

\patchcmd{\@makechapterhead} {\vskip 40}{\vskip 20}{}{}
\patchcmd{\@makeschapterhead}{\vskip 40}{\vskip 20}{}{}

\DeclareRobustCommand{\csr}{\textsc{\acrfull{ac:csr}}}
\DeclareRobustCommand{\rlc}{\acrshort{ac:rlc}}
\DeclareRobustCommand{\sdu}{\acrshort{ac:sdu}}

        
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{3.25ex \@plus1ex \@minus.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}

\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
{3.25ex \@plus1ex \@minus .2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Table of Contents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{secnumdepth}{5}
\setlength{\cftbeforechapskip}{6pt}

\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Hearder / Footer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand{\chaptermark}[1]{\markboth{\uppercase{\thechapter.~ #1}}{}}

\pagestyle{fancy}

\fancypagestyle{main}{
    \fancyhf{}
    \fancyhead[LE]{\thepage}
    \fancyhead[RE]{\leftmark}
    \fancyhead[LO]{\leftmark}
    \fancyhead[RO]{\thepage}
    \fancyfoot[LE]{}
    \fancyfoot[RO]{}
    \fancyfoot[LO]{}
    \fancyheadoffset{0cm}
    \renewcommand{\headrulewidth}{1pt}
}


\fancypagestyle{PageNum}{%
    \fancyfoot{}
    \fancyhf{}
    \fancyhead[LE]{\thepage}
    \fancyhead[RE]{}
    \fancyhead[LO]{}
    \fancyhead[RO]{\thepage}
    \fancyfoot[LE]{}
    \fancyfoot[RO]{}
    \fancyfoot[LO]{}
    \fancyheadoffset{0cm}
    \renewcommand{\headrulewidth}{0pt}
}

\newcommand{\BlankPageNum}{
    \newpage
    \thispagestyle{PageNum}
    \mbox{}
    \newpage
}

\newcommand{\BlankPage}{
    \newpage
    \thispagestyle{empty}
    \mbox{}
    \newpage
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Foreign Languages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RequirePackage[LAE,LFE,T1]{fontenc}
\RequirePackage[greek,main=english]{babel}
\RequirePackage{CJKutf8}
\RequirePackage{arabtex}
\RequirePackage{utf8}

\newcommand{\greekLanguage}[1]{\selectlanguage{greek}#1\selectlanguage{english}}
\newcommand{\chineseLanguage}[1]{\begin{CJK*}{UTF8}{gbsn}#1\end{CJK*}}
\newcommand{\arabicLanguage}[1]{\setarab \fullvocalize \transtrue \arabtrue 
    \begin{RLtext}#1\end{RLtext}}
\setcode{utf8}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Contents / Figures / Tables / Bibliography Acronyms names
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand\contentsname{\vspace{-2.55cm} \centering \huge\bfseries Table of Contents}
\renewcommand\listfigurename{\vspace{-2.55cm} \centering \huge\bfseries List of Figures}
\renewcommand\listtablename{\vspace{-2.55cm} \centering \huge\bfseries List of Tables}
\renewcommand*{\acronymname}{List of Abbreviations}
Thanks for your answers.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply