1

I can't group my list of figures by chapters. I've tried solutions proposed in subjects Include chapters in List of Figures with titletoc? and Include Chapters have figures with caption In List of Figures but the first solution doesn't work without any compiling error, and the second one makes an error :

! Undefined control sequence. argument> \thechapitre

This is a MWE :

Main :

\documentclass{Maclasse}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref} % hyperliens PDF
\usepackage{bookmark} % signets PDF
\usepackage{tocloft}

%% List of Equations
\newcommand{\listequationsname}{List of Equations}
\newlistof{listofequations}{equ}{\listequationsname}
\newcommand{\myequation}[2]{%
    \addcontentsline{equ}{equation}{\protect\numberline{\ref{#2}}#1}\par}

\makeatletter
\let\l@equation\l@figure
\makeatother

% List of figures
\makeatletter % Spaces between number and title of figures
 \renewcommand*\l@figure{\@dottedtocline{1}{1em}{3.2em}}
\makeatother

\makeatletter % Separations between chapters in list of figures
\def\thischapitretitle{}
\apptocmd{\@chapitre}{\gdef\thischapitretitle{#1}}{}{}

\newcommand{\DeclareDividedList}[1]%
  {\newcounter{#1@chapitre}\setcounter{#1@chapitre}{0}}

\pretocmd{\addcontentsline}%
  {\ifltxcounter{#1@chapitre}%
   {%
 \ifnumgreater{\thechapitre}{\value{#1@chapitre}}{%
   \setcounter{#1@chapitre}{\thechapitre}%
   \addtocontents{#1}{\protect\contentsline{chapitre}%
     {\protect\numberline {\thechapitre} {\thischapitretitle}}{}{} }
     }{}%
   }{}%
  }{}{}
\makeatother

\DeclareDividedList{lof}
\DeclareDividedList{lot}

\listfiles

\begin{document}

\frontmatter
\listoffigures % Table des figures

\chapitre{Ch 1}

\begin{figure}
\caption{Figure 1}
\end{figure}

\chapitre{Ch 2}

\begin{figure}
\caption{Figure 2}
\end{figure}

\end{document}

Class :

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{Maclasse}[2014/01/30 v0.4 classe pour ma thèse]
\LoadClassWithOptions{memoir} % classe de référence: memoir

%%% OPTIONS %%%

\RequirePackage{kvoptions} % support des options de type clé=valeur
\SetupKeyvalOptions{family=drfr,prefix=drfr@}

\DeclareBoolOption[true]{footnotereset}
\DeclareBoolOption[true]{versetitle}
\ProcessKeyvalOptions{drfr}

\ifdrfr@footnotereset
% reset des notes de bas de page à chaque nouvelle page
\PassOptionsToPackage{perpage}{footmisc}
\else
% numérotation continue des notes de bas de pages du début à la fin
\counterwithout{footnote}{chapter}
\fi

%%% PACKAGES REQUIS %%%
\RequirePackage[utf8]{inputenc} % pour bonne interprétation des caractère     spéciaux dans la classe
\RequirePackage{ifdraft} % comportements spécifiques quand l'option de     classe draft est présente
\RequirePackage{xifthen} % code conditionnel
\RequirePackage{xstring} % code conditionnel
\RequirePackage{footmisc} % gestion des notes de bas de page
\RequirePackage{engrec} % compteur à symbole grecs
\RequirePackage{filecontents} % génération des fichers de style makeindex
\usepackage{babel} % support des langues
\usepackage[babel]{csquotes} % support des guillemets babel

%%% PAGE DE TITRE %%%

% Numéro d'ordre
\newcommand{\numerodordre}[1]{\def\theordrnumber{#1}}

% université
\newcommand{\university}[1]{\def\theuniversity{#1}}

% école doctorante
\newcommand{\school}[1]{\def\theschool{#1}}

% Numéro d'école doctorale
\newcommand{\numeroEDSF}[1]{\def\thedoctschoolnumber{#1}}

% spécialité de la thèse
\newcommand{\speciality}[1]{\def\thespeciality{#1}}

% date de soutenance
\newcommand{\approvaldate}[1]{\def\theapprovaldate{#1}}

% titre
\renewcommand{\title}[1]{\def\thetitle{#1}}

% auteur
\renewcommand{\author}[2]{\def\theauthor{#1 \textsc{#2}}}

% Président du jury
% {civilité}{prénom}{nom}{poste}
\newcommand{\president}[4]{%
\def\thepresident{\textbf{#1 #2 \textsc{#3}}}
\def\thepresidentjob{#4}}

% directeur de thèse
% {civilité}{prénom}{nom}{poste}
\newcommand{\director}[4]{%
\def\thedirector{\textbf{#1 #2 \textsc{#3}}}
\def\thedirectorjob{#4}}

% rapporteurs
% {civilité}{prénom}{nom}{poste}
\newcommand{\reportera}[4]{%
\def\thereportera{\textbf{#1 #2 \textsc{#3}}}
\def\thereporterajob{#4}}

\newcommand{\reporterb}[4]{%
\def\thereporterb{\textbf{#1 #2 \textsc{#3}}}
\def\thereporterbjob{#4}}

% autres membres du jury
% {civilité}{prénom}{nom}{poste}
\newcommand{\membera}[4]{%
\def\themembera{\textbf{#1 #2 \textsc{#3}}}
\def\thememberajob{#4}}

\newcommand{\memberb}[4]{%
\def\thememberb{\textbf{#1 #2 \textsc{#3}}}
\def\thememberbjob{#4}}

% page de titre pour la soutenance
\newcommand{\maketitlepage}{{%
\thispagestyle{empty}

\begin{flushleft}
{\Large \No d'Ordre : D.U. \theordrnumber}\\[1\onelineskip]
\end{flushleft}
\begin{center}
{\LARGE \textbf{UNIVERSIT\'E \theuniversity} \\}
{\Large U.F.R. Sciences et Technologies \\[1\onelineskip]}
{\LARGE \textbf{\'ECOLE DOCTORALE DES \theschool \\
\No \thedoctschoolnumber} \\[1\onelineskip]}

{ {\LARGE THESE \\[1\onelineskip]}
 pr\'esent\'ee pour obtenir le grade de \\
 \textbf{DOCTEUR D'UNIVERSIT\'E} \\
 \textit{\textbf{Sp\'ecialit\'e : \thespeciality}}  \\[1\onelineskip]
 Par : {\Large \textbf{\theauthor}}\\
 Titulaire du Master Recherche sp\'ecialit\'e Physico-Chimie de l'Atmosph\`ere et du Climat}\\
\rule{0.9\linewidth}{.5pt} \\
{\LARGE\bfseries \thetitle \\ \rule{0.9\linewidth}{.5pt}}
 \\ soutenue publiquement le \theapprovaldate , devant la commission d'examen : \\[1\onelineskip]
\begin{tabular}{lll}
Pr\'esident : & \thepresident & \thepresidentjob \\
Rapporteurs: & \thereportera & \thereporterajob \\
  & \thereporterb & \thereporterbjob \\
Examinateurs : & \themembera & \thememberajob \\
  & \thememberb & \thememberbjob \\
Directeur de th\`ese : & \thedirector & \thedirectorjob \\
\end{tabular}
\end{center}

\cleardoublepage
}}

%%% TEXTE %%%

\OnehalfSpacing % espacement de ligne
\frenchbsetup{PartNameFull=false} % "partie I" préféré à "première partie"

%%% EN-TETES / PIEDS DE PAGE %%%

% date de compilation indiquée en mode draft uniquement
\newcommand{\addversion}{\ifdraft{Brouillon datant du \today}{}}

% définition du style des headers et footers
\makepagestyle{corpus}
\makeheadrule{corpus}{\textwidth}{\normalrulethickness}
%\makefootrule{corpus}{\textwidth}{\normalrulethickness}{\footruleskip}
\makeevenhead{corpus}{\small\thetitle}{}{\small\addversion}
\makeoddhead{corpus}{}{}{\small\rightmark}
\makeevenfoot{corpus}{}{\small\thepage}{}
\makeoddfoot{corpus}{}{\small\thepage}{}
\makepsmarks{corpus}{%
\nouppercaseheads
\createmark{part}{right}{shownumber}{Titre }{. \ }
\createmark{chapter}{right}{shownumber}{\@chapapp\ }{. \ }
\createmark{section}{right}{shownumber}{}{. \ }
\createmark{subsection}{right}{shownumber}{}{ \ }
\createplainmark{toc}{right}{\contentsname}
\createplainmark{lof}{right}{\listfigurename}
\createplainmark{lot}{right}{\listtablename}
\createplainmark{bib}{right}{\bibname}
\createplainmark{index}{right}{\indexname}
\createplainmark{glossary}{right}{\glossaryname}
}

% hack de la classe memoir: équivalent à \createmark{book}, non disponible
\def\bookpagemark#1{%
  \markright{%
  \ifnum\c@secnumdepth > -2
    \if@mainmatter
      Partie \thebook. \ %
    \fi
  \fi
#1}}

\pagestyle{corpus}


%%% SECTIONS %%%

%% [-2] parties ("Première partie")
%
%% macro de conversion compteur => chaine de caractères de genre féminin
%\newcommand{\counterToFrenchF}[1]{\ifcase\value{#1}\or Première\or
%     Deuxième\or Troisième\or Quatrième\or Cinquième\or
%     Sixième\or Septième\or Huitième\or Neuvième\or Dixième\or
%     Onzième\or Douzième\or Treizième\or Quatorzième\or Quinzième\or
%     Seizième\or Dix-septième\or Dix-huitième\or Dix-neuvième\or     Vingtième\fi}
%\renewcommand*{\bookname}{\protect\counterToFrenchF{book}~partie}
%\renewcommand{\booknamenum}{} % espace entre intitulé et numéro
%\renewcommand{\printbooknum}{} % numéro
%\newcommand{\partie}{\book}
%
%% [-1] titres (I)
%
%\AtBeginDocument{%
%    \renewcommand*{\partname}{Titre}
%}
%\counterwithin*{part}{book}% RAZ du compteur \part dans un nouveau book
%\newcommand{\titre}{\part}

% [0] chapitres (1)

\renewcommand*{\thechapter}{\Roman{chapter}}
\counterwithin*{chapter}{part}% RAZ du compteur \chapter dans une nouvelle     part
\newcommand{\chapitre}{\chapter}

% [1] sections (I)

\renewcommand*{\thesection}{\thechapter.\arabic{section}}
%\setbeforesecskip{}
%\setsecindent{}
\setaftersecskip{2em}
\setsecheadstyle{\Large\bfseries\raggedright}
\setsechook{\needspace{4\baselineskip}}

% [2] paragraphes (§1)

\renewcommand*{\thesubsection}{\thesection.\arabic{subsection}.}%\S~
%\setbeforesubsecskip{}
%\setsubsecindent{}
\setaftersubsecskip{1.5em}
\setsubsecheadstyle{\Large\bfseries\raggedright}
\setsubsechook{\needspace{4\baselineskip}}
\newcommand{\paragraphe}{\subsection}

% [3] sous-paragraphes (A.)

\renewcommand*{\thesubsubsection}{\thesubsection \alph{subsubsection}.}
%\setbeforesubsubsecskip{}
%\setsubsubsecindent{}
%\setaftersubsubsecskip{}
\setsubsubsecheadstyle{\large\bfseries\raggedright}
\setsubsubsechook{\needspace{4\baselineskip}}
\newcommand{\souspara}{\subsubsection}

% [4] alinéas (1.)

\renewcommand*{\theparagraph}{\thesubsubsection \arabic{paragraph}.}
%\setbeforeparaskip{}
%\setparaindent{}
\setafterparaskip{1em}
\setparaheadstyle{\bfseries\raggedright}
\setparahook{\needspace{4\baselineskip}}
\newcommand{\alinea}{\paragraph}

% [5] sous-alinéas (a.)

\renewcommand*{\thesubparagraph}{\alph{subparagraph}.}
%\setsubparaindent{0pt}
\setaftersubparaskip{0.5em} % 
\setsubparaheadstyle{\bfseries\raggedright}
\setsubparahook{\needspace{4\baselineskip}}
\newcommand{\sousalinea}{\subparagraph}

% [6] points (i.)

\newcommand{\subsubparagraph}{\@startsection{subsubparagraph}
  {6}{\parindent}{1\baselineskip plus 0.25\baselineskip}
  {.5em}{\normalsize\bfseries\raggedright}}
\newlistentry[subparagraph]{subsubparagraph}{toc}{5}
\newcommand*{\subsubparagraphmark}[1]{} % gobble heading mark
\renewcommand{\thesubsubparagraph}{\roman{subsubparagraph}.}
\newcommand{\point}{\subsubparagraph}

% [7] souspoints (alpha.)

\newcommand{\subsubsubparagraph}{\@startsection{subsubsubparagraph}
  {7}{\parindent}{1\baselineskip plus 0.25\baselineskip}
  {.5em}{\normalsize\bfseries\raggedright}}
\newlistentry[subsubparagraph]{subsubsubparagraph}{toc}{6}
\newcommand*{\subsubsubparagraphmark}[1]{} % gobble heading mark
\renewcommand{\thesubsubsubparagraph}{\engrec{subsubsubparagraph}.}
\newcommand{\souspoint}{\subsubsubparagraph}

% [8] versets (paragraphes numérotés)

\newcommand{\versetsec}[1]{\@startsection{versetsec}
  {8}{\parindent}{0.5\baselineskip}
  {#1}{\small\textbf}}
\newlistentry{versetsec}{toc}{7}
\newcommand*{\versetsecmark}[1]{} % gobble heading mark
\renewcommand{\theversetsec}{\arabic{versetsec}.}

\newcommand{\versetsecfilled}{\versetsec{-1em}}
\newcommand{\versetsecblank}{\versetsec{-0em}}

% référencement des versets dans l'index
\newcounter{indexv}

% style des versets: caractères séparateur avec le texte
\newcommand{\versetsep}{}
\newcommand{\versetsepifempty}{}
\newcommand{\versetsepspace}{1em}
\newcommand{\versetsepstyle}{\normalfont}

% ajout de point final si nécessaire.
% aucun point n'est ajouté si le verset est déjà fini par "!", "?", "." ou     "/ldots".
\newcommand{\versetdot}[1]{%
  \IfEndWith{#1}{.}{}{%
    \IfEndWith{#1}{?}{}{%
      \IfEndWith{#1}{!}{}{%
        \IfEndWith{#1}{\ldots}{}{.}%
      }%
    }%
  }%
}

\newcommand{\versetcontent}[1]{%
  \ifthenelse{\equal{#1}{}}%
    {\versetsecblank{#1}}%
    {\versetsecfilled{#1\protect\versetdot{#1}}}%
    }
}

\newcommand{\verset}[1]{%
  \ifdrfr@versetitle%
    \ifthenelse{\equal{#1}{}}%
      {\ifthenelse{\equal{\versetsepifempty}{}}%
        {\versetcontent{#1}}%
        {\versetcontent{{\versetsepstyle\versetsepifempty}}}}%
      {\ifthenelse{\equal{\versetsep}{}}%
        {\versetcontent{#1}}%
        {\versetcontent{#1\hspace{\versetsepspace}    {\versetsepstyle\versetsep}}}}%
  \else%
    \versetcontent{{\versetsepstyle\versetsepifempty}}%
  \fi%
  \addtocounter{indexv}{1}% 
}

% numérotation visible
\setsecnumdepth{all}
\maxsecnumdepth{all}
\setcounter{secnumdepth}{7} % pour points (6) et sous-points (7)

% option pour éviter les pbs d'hyperliens ambigus (de \part et \chapter)
\PassOptionsToPackage{hypertexnames=false}{hyperref}

%%% REFERENCES CROISEES

\AtBeginDocument{%
% autoref est disponible via le package hyperref
\renewcommand*{\bookautorefname}{Partie}
\renewcommand*{\partautorefname}{Titre}
\renewcommand*{\chapterautorefname}{Chapitre}
}


%%% GLOSSAIRE

\renewcommand{\memgloterm}[1]{\textbf{#1}}
\renewcommand{\memglodesc}[1]{\hspace{1ex}#1}
\renewcommand{\memglonum}[1]{}

%%% INDEX %%%

\renewcommand*{\seename}{\textit{voir}}
\renewcommand*{\alsoname}{\textit{v. aussi}}

\ifdraft{\showindexmarks}{}

% index de base par versets
\newcommand{\indexvfilename}{\jobname}
\newcommand{\makeindexv}{\makeindex[\indexvfilename]}
\newcommand{\indexv}[1]{\specialindex{\indexvfilename}{indexv}{#1}}
\newcommand{\printindexv}{\printindex[\indexvfilename]}

% index d'auteur par versets
\newcommand{\indexafilename}{auteurs}
\newcommand{\makeindexa}{\makeindex[\indexafilename]}
\newcommand{\indexa}[1]{\specialindex{\indexafilename}{indexv}{#1}}
\newcommand{\printindexa}{\printindex[\indexafilename]}

% entête de l'index
\newcommand{\idxmark}[1]{#1\markboth{#1}{#1}}

% raccourcis de style pour entrées indexées
\newcommand{\hyperbf}[1]{\textbf{\hyperpage{#1}}}
\newcommand{\hyperit}[1]{\textit{\hyperpage{#1}}}


%%% SOMMAIRE & TABLE DES MATIERES %%%

% paramètres communs
\renewcommand{\cftbookname}{Partie\space}%
\renewcommand{\cftpartname}{Titre\space}%
%
\cftsetindents{subsubparagraph}{4em}{2em}
\cftsetindents{subsubsubparagraph}{5em}{2em}
\cftsetindents{versetsec}{6em}{2em}

% sommaire
\newcommand*{\setupshorttoc}{%
\renewcommand*{\contentsname}{Sommaire}
\let\oldchangetocdepth\changetocdepth
\renewcommand*{\changetocdepth}[1]{}
\let\oldcftchapterfillnum\cftchapterfillnum
\setcounter{tocdepth}{7}% Parties / Titres / Chapitres / Sections / Paragraphes / Sous-paragraphes seulement
% A modifier dans sommaire.tex
%
%\cftpagenumbersoff{book}
%\cftpagenumbersoff{part}
%\cftpagenumbersoff{chapter}
%
\renewcommand{\tocheadstart}{}
%
\renewcommand{\cftbeforebookskip}{1em}%
%\renewcommand{\cftbookfont}{}%
\renewcommand{\cftbookindent}{0em}%
\renewcommand{\cftbookpagefont}{\normalfont\bfseries\large}%
%\renewcommand{\cftafterbookskip}{}%
%\renewcommand{\cftbookleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftbeforepartskip}{0.5em}%
\renewcommand{\cftpartfont}{\normalfont\scshape}%
\renewcommand{\cftpartindent}{0.5em}%
%\renewcommand{\cftpartnumwidth}{}%
\renewcommand{\cftpartpagefont}{\normalfont\scshape}%
    %\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftbeforechapterskip}{0em}%
\renewcommand{\cftchapterfont}{\normalfont}%
\renewcommand{\cftchaptername}{Chapitre\space}%
\renewcommand{\cftchapterindent}{1em}%
%\renewcommand{\cftchapternumwidth}{}%
\renewcommand{\cftchapterpagefont}{\normalfont}%
%\renewcommand{\cftchapterleader}{\cftdotfill{\cftdotsep}}%
}%

\newcommand{\shorttableofcontents}{%
\clearpage
\setupshorttoc
\tableofcontents
}%

% table des matières
\newcommand*{\setuplongtoc}{%
\renewcommand*{\contentsname}{Table des matières}%
\let\changetocdepth\oldchangetocdepth
\setcounter{tocdepth}{7}%
%
% \cftpagenumberson{book}
% \cftpagenumberson{part}
% \cftpagenumberson{chapter}
%
\renewcommand{\tocheadstart}{\chapterheadstart}
%
\renewcommand{\cftbookbreak}{\addpenalty{-\@highpenalty}\clearpage}
\renewcommand{\cftbeforebookskip}{0em}%
\renewcommand{\cftbookfont}{\normalfont\bfseries\Large}%
\renewcommand{\cftbookindent}{1em}%
%\renewcommand{\cftbooknumwidth}{}%
%\renewcommand{\cftafterbookskip}{}%
\renewcommand{\cftbookleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftbeforepartskip}{1.5em}%
\renewcommand{\cftpartfont}{\normalfont\bfseries\large}%
\renewcommand{\cftpartindent}{0em}%
%\renewcommand{\cftpartnumwidth}{}%
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftbeforechapterskip}{0em}%
\renewcommand{\cftchapterfont}{\normalfont\bfseries\large}%
\renewcommand{\cftchapterindent}{0em}%
\renewcommand{\cftchaptername}{Chapitre\space}%
%\renewcommand{\cftchapternumwidth}{}%
\renewcommand{\cftchapterleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftbeforesectionskip}{0.5em}%
\renewcommand{\cftsectionfont}{\normalfont\large}%
%\renewcommand{\cftsectionname}{Section\space}%
\renewcommand{\cftsectionindent}{0em}%
\renewcommand{\cftsectionnumwidth}{5.5em}%
%\renewcommand{\cftsectionleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftbeforesubsectionskip}{0.5em}%
\renewcommand{\cftsubsectionfont}{\normalfont\scshape}%
%\renewcommand{\cftsubsectionname}{}%
\renewcommand{\cftsubsectionindent}{0em}%
\renewcommand{\cftsubsectionnumwidth}{2em}%
%\renewcommand{\cftsubsectionleader}{\cftdotfill{\cftdotsep}}%
%
%\renewcommand{\cftbeforesubsubsectionskip}{}%
\renewcommand{\cftsubsubsectionfont}{\normalfont\itshape}%
%\renewcommand{\cftsubsubsectionname}{}%
\renewcommand{\cftsubsubsectionindent}{1em}%
\renewcommand{\cftsubsubsectionnumwidth}{2em}%
%\renewcommand{\cftsubsubsectionleader}{\cftdotfill{\cftdotsep}}%
%
%\renewcommand{\cftbeforeparagraphskip}{}%
\renewcommand{\cftparagraphfont}{\normalfont}%
%\renewcommand{\cftparagraphname}{}%
\renewcommand{\cftparagraphindent}{2em}%
\renewcommand{\cftparagraphnumwidth}{2em}%
%\renewcommand{\cftparagraphleader}{\cftdotfill{\cftdotsep}}%
%
%\renewcommand{\cftbeforesubparagraphskip}{}%
\renewcommand{\cftsubparagraphfont}{\normalfont}%
%\renewcommand{\cftsubparagraphname}{}%
\renewcommand{\cftsubparagraphindent}{3em}%
\renewcommand{\cftsubparagraphnumwidth}{2em}%
%\renewcommand{\cftsubparagraphleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftsubsubparagraphfont}{\normalfont\small}%
%
\renewcommand{\cftsubsubsubparagraphfont}{\normalfont\small}%
%
}%

\newcommand{\longtableofcontents}{%
\clearpage
\setuplongtoc
\tableofcontents
}%

% génération du fichier de style .ist
\begin{filecontents}{\jobname.ist}
% output main entry <entry> as: \item \idxmark{<entry>}, 
item_0 "\n\\item \\idxmark{"
delim_0 "}, "
% not forgetting the subitem case%    added 2008
item_x1 "} \n \\subitem "
% Wrap and uppercase head letters
heading_prefix "{\\bfseries\\hfil "
heading_suffix "\\hfil}\\nopagebreak\n"
headings_flag 1
\end{filecontents}

% génération du fichier de style .gst
\begin{filecontents}{\jobname.gst}
% Output style parameters
preamble "\\begin{theglossary}"
postamble "\n\\end{theglossary}\n"
item_0 "\n\\glossitem"
delim_0 "{\\memglonum{"
encap_suffix "}}}"
heading_prefix "{\\bfseries\\hfil "
heading_suffix "\\hfil}\\nopagebreak\n"
headings_flag 1
% Input style parameters
keyword "\\glossaryentry"
\end{filecontents}

\endinput

Thank you for your help

  • You state that chapitre is the only difference to the original memoir class, but this is exactly the breaking point seen in the error message. Why change a running system? You quite likely broke something, and we cannot see it, because it is in your own class. – Johannes_B Jun 15 '16 at 7:13
  • memoir provides the functionality of tocloft, you don't have to use the package, but rather read the memoirdocumentation for details. – Johannes_B Jun 15 '16 at 7:14
  • Thank your for your fast answer. It's not the only difference but the others are not for this point (bibliography, etc.). The class is modified for a french scientific version of phd. I had to add tocloft because List of Equations didn't work without this package – Alex Jun 15 '16 at 7:18
  • 1
    @Alex: I am the author of the second answer you linked. I want to help,but not without seeing the real class. Apparently, there is no chapitre counter defined! – user31729 Jun 15 '16 at 7:49
2

To start with: I cite Boromir in 'The Fellowship of the Ring': There's evil in that class that does not sleep ;-)

Correcting many errors....

  • \usepackage\RequirePackage
  • unpaired } at line 306

  • \newcommand{\chapitre}{\chapter} does not make \chapitre behave like \chapter, especially, there's no \l@chapitre command, nor is there a counter named chapitre then, nor is \@chapitre ever defined -- the patching with \addtocmd works, because it does not check if \@chapitre is ever defined.

The whole issue is actually shooting oneself into the foot. Why not keeping \chapter as it is defined -- all causes more trouble than necessary.

The \thechapitre counter formater is also not defined and must be \let\thechapitre\thechapter to be effective. Since chapitre is never stepped, it must be made an alias counter of chapter, i.e.

\let\c@chapitre\c@chapter

Also don't use \setcounter{foo}{\theotherfoo}, since \theotherfoo is very likely no number!!! Use \setcounter{foo}{\value{otherfoo} for this.


\documentclass[french]{MaclasseNouveau}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref} % hyperliens PDF
\usepackage{bookmark} % signets PDF
\usepackage{tocloft}

%% List of Equations
\newcommand{\listequationsname}{List of Equations}
\newlistof{listofequations}{equ}{\listequationsname}
\newcommand{\myequation}[2]{%
    \addcontentsline{equ}{equation}{\protect\numberline{\ref{#2}}#1}\par}

\makeatletter
\let\l@equation\l@figure
\makeatother

% List of figures
\makeatletter % Spaces between number and title of figures
 \renewcommand*\l@figure{\@dottedtocline{1}{1em}{3.2em}}
\makeatother

\makeatletter % Separations between chapters in list of figures
\def\thischapitretitle{}

%\apptocmd{\@chapter}{\protect\gdef\thischapitretitle{#1}}{\typeout{Foo}}{}
\LetLtxMacro\memoir@@chapter\@chapter
\def\@chapter[#1]#2{%
  \ifblank{#1}{%
    \gdef\thischapitretitle{#2}%
   }{%
     \gdef\thischapitretitle{#1}%
   }%
   \memoir@@chapter[#1]{#2}%
}

\newcommand{\DeclareDividedList}[1]{%
  \newcounter{#1@chapitre}
  %\setcounter{#1@chapitre}{0}% Not necessary
}

\pretocmd{\addcontentsline}%
{\ifltxcounter{#1@chapitre}%
  {%
    \ifnumgreater{\value{chapitre}}{\value{#1@chapitre}}{%
      \setcounter{#1@chapitre}{\value{chapitre}}%
      \addtocontents{#1}{\protect\contentsline{chapitre}%
        {\protect\numberline {\thechapitre} {\thischapitretitle}}{}{} }
    }{}%
  }{}%
}{}{}
\makeatother

\DeclareDividedList{lof}
\DeclareDividedList{lot}

%\listfiles

\begin{document}

\frontmatter
\listoffigures % Table des figures
\mainmatter
\chapitre{Ch 1}

\begin{figure}
\caption{Figure 1}
\end{figure}

\chapitre{Ch 2}

\begin{figure}
\caption{Figure 2}
\end{figure}

\end{document}

MaclasseNouveau.cls

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{MaclasseNouveau}[2014/01/30 v0.4 classe pour ma thèse]
\LoadClassWithOptions{memoir} % classe de référence: memoir

%%% OPTIONS %%%

\RequirePackage{kvoptions} % support des options de type clé=valeur
\SetupKeyvalOptions{family=drfr,prefix=drfr@}

\DeclareBoolOption[true]{footnotereset}
\DeclareBoolOption[true]{versetitle}
\ProcessKeyvalOptions{drfr}

\ifdrfr@footnotereset
% reset des notes de bas de page à chaque nouvelle page
\PassOptionsToPackage{perpage}{footmisc}
\else
% numérotation continue des notes de bas de pages du début à la fin
\counterwithout{footnote}{chapter}
\fi

%%% PACKAGES REQUIS %%%
\RequirePackage[utf8]{inputenc} % pour bonne interprétation des caractère     spéciaux dans la classe
\RequirePackage{ifdraft} % comportements spécifiques quand l'option de     classe draft est présente
\RequirePackage{xifthen} % code conditionnel
\RequirePackage{xstring} % code conditionnel
\RequirePackage{footmisc} % gestion des notes de bas de page
\RequirePackage{engrec} % compteur à symbole grecs
\RequirePackage{filecontents} % génération des fichers de style makeindex
\RequirePackage{babel} % support des langues
\RequirePackage[babel]{csquotes} % support des guillemets babel
\RequirePackage{letltxmacro}

%%% PAGE DE TITRE %%%

% Numéro d'ordre
\newcommand{\numerodordre}[1]{\def\theordrnumber{#1}}

% université
\newcommand{\university}[1]{\def\theuniversity{#1}}

% école doctorante
\newcommand{\school}[1]{\def\theschool{#1}}

% Numéro d'école doctorale
\newcommand{\numeroEDSF}[1]{\def\thedoctschoolnumber{#1}}

% spécialité de la thèse
\newcommand{\speciality}[1]{\def\thespeciality{#1}}

% date de soutenance
\newcommand{\approvaldate}[1]{\def\theapprovaldate{#1}}

% titre
\renewcommand{\title}[1]{\def\thetitle{#1}}

% auteur
\renewcommand{\author}[2]{\def\theauthor{#1 \textsc{#2}}}

% Président du jury
% {civilité}{prénom}{nom}{poste}
\newcommand{\president}[4]{%
\def\thepresident{\textbf{#1 #2 \textsc{#3}}}
\def\thepresidentjob{#4}}

% directeur de thèse
% {civilité}{prénom}{nom}{poste}
\newcommand{\director}[4]{%
\def\thedirector{\textbf{#1 #2 \textsc{#3}}}
\def\thedirectorjob{#4}}

% rapporteurs
% {civilité}{prénom}{nom}{poste}
\newcommand{\reportera}[4]{%
\def\thereportera{\textbf{#1 #2 \textsc{#3}}}
\def\thereporterajob{#4}}

\newcommand{\reporterb}[4]{%
\def\thereporterb{\textbf{#1 #2 \textsc{#3}}}
\def\thereporterbjob{#4}}

% autres membres du jury
% {civilité}{prénom}{nom}{poste}
\newcommand{\membera}[4]{%
\def\themembera{\textbf{#1 #2 \textsc{#3}}}
\def\thememberajob{#4}}

\newcommand{\memberb}[4]{%
\def\thememberb{\textbf{#1 #2 \textsc{#3}}}
\def\thememberbjob{#4}}

% page de titre pour la soutenance
\newcommand{\maketitlepage}{{%
\thispagestyle{empty}


\begin{flushleft}
{\Large \No d'Ordre : D.U. \theordrnumber}\\[1\onelineskip]
\end{flushleft}
\begin{center}
{\LARGE \textbf{UNIVERSIT\'E \theuniversity} \\}
{\Large U.F.R. Sciences et Technologies \\[1\onelineskip]}
{\LARGE \textbf{\'ECOLE DOCTORALE DES \theschool \\
\No \thedoctschoolnumber} \\[1\onelineskip]}

{ {\LARGE THESE \\[1\onelineskip]}
 pr\'esent\'ee pour obtenir le grade de \\
 \textbf{DOCTEUR D'UNIVERSIT\'E} \\
 \textit{\textbf{Sp\'ecialit\'e : \thespeciality}}  \\[1\onelineskip]
 Par : {\Large \textbf{\theauthor}}\\
 Titulaire du Master Recherche sp\'ecialit\'e Physico-Chimie de l'Atmosph\`ere et du Climat}\\
\rule{0.9\linewidth}{.5pt} \\
{\LARGE\bfseries \thetitle \\ \rule{0.9\linewidth}{.5pt}}
 \\ soutenue publiquement le \theapprovaldate , devant la commission d'examen : \\[1\onelineskip]
\begin{tabular}{lll}
Pr\'esident : & \thepresident & \thepresidentjob \\
Rapporteurs: & \thereportera & \thereporterajob \\
  & \thereporterb & \thereporterbjob \\
Examinateurs : & \themembera & \thememberajob \\
  & \thememberb & \thememberbjob \\
Directeur de th\`ese : & \thedirector & \thedirectorjob \\
\end{tabular}
\end{center}

\cleardoublepage
}}
%%% TEXTE %%%

\OnehalfSpacing % espacement de ligne
\frenchbsetup{PartNameFull=false} % "partie I" préféré à "première partie"

%%% EN-TETES / PIEDS DE PAGE %%%

% date de compilation indiquée en mode draft uniquement
\newcommand{\addversion}{\ifdraft{Brouillon datant du \today}{}}

% définition du style des headers et footers
\makepagestyle{corpus}
\makeheadrule{corpus}{\textwidth}{\normalrulethickness}
%\makefootrule{corpus}{\textwidth}{\normalrulethickness}{\footruleskip}
\makeevenhead{corpus}{\small\thetitle}{}{\small\addversion}
\makeoddhead{corpus}{}{}{\small\rightmark}
\makeevenfoot{corpus}{}{\small\thepage}{}
\makeoddfoot{corpus}{}{\small\thepage}{}
\makepsmarks{corpus}{%
\nouppercaseheads
\createmark{part}{right}{shownumber}{Titre }{. \ }
\createmark{chapter}{right}{shownumber}{\@chapapp\ }{. \ }
\createmark{section}{right}{shownumber}{}{. \ }
\createmark{subsection}{right}{shownumber}{}{ \ }
\createplainmark{toc}{right}{\contentsname}
\createplainmark{lof}{right}{\listfigurename}
\createplainmark{lot}{right}{\listtablename}
\createplainmark{bib}{right}{\bibname}
\createplainmark{index}{right}{\indexname}
\createplainmark{glossary}{right}{\glossaryname}
}

% hack de la classe memoir: équivalent à \createmark{book}, non disponible
\def\bookpagemark#1{%
  \markright{%
  \ifnum\c@secnumdepth > -2
    \if@mainmatter
      Partie \thebook. \ %
    \fi
  \fi
#1}}

\pagestyle{corpus}

%%% SECTIONS %%%

%% [-2] parties ("Première partie")
%
%% macro de conversion compteur => chaine de caractères de genre féminin
%\newcommand{\counterToFrenchF}[1]{\ifcase\value{#1}\or Première\or
%     Deuxième\or Troisième\or Quatrième\or Cinquième\or
%     Sixième\or Septième\or Huitième\or Neuvième\or Dixième\or
%     Onzième\or Douzième\or Treizième\or Quatorzième\or Quinzième\or
%     Seizième\or Dix-septième\or Dix-huitième\or Dix-neuvième\or     Vingtième\fi}
%\renewcommand*{\bookname}{\protect\counterToFrenchF{book}~partie}
%\renewcommand{\booknamenum}{} % espace entre intitulé et numéro
%\renewcommand{\printbooknum}{} % numéro
%\newcommand{\partie}{\book}
%
%% [-1] titres (I)
%
%\AtBeginDocument{%
%    \renewcommand*{\partname}{Titre}
%}
%\counterwithin*{part}{book}% RAZ du compteur \part dans un nouveau book
%\newcommand{\titre}{\part}

% [0] chapitres (1)

\renewcommand*{\thechapter}{\Roman{chapter}}
\counterwithin*{chapter}{part}% RAZ du compteur \chapter dans une nouvelle     part

%%%% This is no really good idea
\newcommand{\chapitre}{\chapter}  
\newcounter{chapitre}
\let\c@chapitre\c@chapter% Alias counter 
\let\l@chapitre\l@chapter
\let\@chapitre\@chapter
\let\thechapitre\thechapter

% [1] sections (I)

\renewcommand*{\thesection}{\thechapter.\arabic{section}}
%\setbeforesecskip{}
%\setsecindent{}
\setaftersecskip{2em}
\setsecheadstyle{\Large\bfseries\raggedright}
\setsechook{\needspace{4\baselineskip}}

% [2] paragraphes (§1)

\renewcommand*{\thesubsection}{\thesection.\arabic{subsection}.}%\S~
%\setbeforesubsecskip{}
%\setsubsecindent{}
\setaftersubsecskip{1.5em}
\setsubsecheadstyle{\Large\bfseries\raggedright}
\setsubsechook{\needspace{4\baselineskip}}
\newcommand{\paragraphe}{\subsection}

% [3] sous-paragraphes (A.)

\renewcommand*{\thesubsubsection}{\thesubsection \alph{subsubsection}.}
%\setbeforesubsubsecskip{}
%\setsubsubsecindent{}
%\setaftersubsubsecskip{}
\setsubsubsecheadstyle{\large\bfseries\raggedright}
\setsubsubsechook{\needspace{4\baselineskip}}
\newcommand{\souspara}{\subsubsection}

% [4] alinéas (1.)

\renewcommand*{\theparagraph}{\thesubsubsection \arabic{paragraph}.}
%\setbeforeparaskip{}
%\setparaindent{}
\setafterparaskip{1em}
\setparaheadstyle{\bfseries\raggedright}
\setparahook{\needspace{4\baselineskip}}
\newcommand{\alinea}{\paragraph}

% [5] sous-alinéas (a.)

\renewcommand*{\thesubparagraph}{\alph{subparagraph}.}
%\setsubparaindent{0pt}
\setaftersubparaskip{0.5em} % 
\setsubparaheadstyle{\bfseries\raggedright}
\setsubparahook{\needspace{4\baselineskip}}
\newcommand{\sousalinea}{\subparagraph}

% [6] points (i.)

\newcommand{\subsubparagraph}{\@startsection{subsubparagraph}
  {6}{\parindent}{1\baselineskip plus 0.25\baselineskip}
  {.5em}{\normalsize\bfseries\raggedright}}
\newlistentry[subparagraph]{subsubparagraph}{toc}{5}
\newcommand*{\subsubparagraphmark}[1]{} % gobble heading mark
\renewcommand{\thesubsubparagraph}{\roman{subsubparagraph}.}
\newcommand{\point}{\subsubparagraph}

% [7] souspoints (alpha.)

\newcommand{\subsubsubparagraph}{\@startsection{subsubsubparagraph}
  {7}{\parindent}{1\baselineskip plus 0.25\baselineskip}
  {.5em}{\normalsize\bfseries\raggedright}}
\newlistentry[subsubparagraph]{subsubsubparagraph}{toc}{6}
\newcommand*{\subsubsubparagraphmark}[1]{} % gobble heading mark
\renewcommand{\thesubsubsubparagraph}{\engrec{subsubsubparagraph}.}
\newcommand{\souspoint}{\subsubsubparagraph}

% [8] versets (paragraphes numérotés)

\newcommand{\versetsec}[1]{\@startsection{versetsec}
  {8}{\parindent}{0.5\baselineskip}
  {#1}{\small\textbf}}
\newlistentry{versetsec}{toc}{7}
\newcommand*{\versetsecmark}[1]{} % gobble heading mark
\renewcommand{\theversetsec}{\arabic{versetsec}.}

\newcommand{\versetsecfilled}{\versetsec{-1em}}
\newcommand{\versetsecblank}{\versetsec{-0em}}

% référencement des versets dans l'index
\newcounter{indexv}

% style des versets: caractères séparateur avec le texte
\newcommand{\versetsep}{}
\newcommand{\versetsepifempty}{}
\newcommand{\versetsepspace}{1em}
\newcommand{\versetsepstyle}{\normalfont}

% ajout de point final si nécessaire.
% aucun point n'est ajouté si le verset est déjà fini par "!", "?", "." ou     "/ldots".
\newcommand{\versetdot}[1]{%
  \IfEndWith{#1}{.}{}{%
    \IfEndWith{#1}{?}{}{%
      \IfEndWith{#1}{!}{}{%
        \IfEndWith{#1}{\ldots}{}{.}%
      }%
    }%
  }%
}

\newcommand{\versetcontent}[1]{%
  \ifthenelse{\equal{#1}{}}%
  {\versetsecblank{#1}}%
  {\versetsecfilled{#1\protect\versetdot{#1}}}%
}
%}  WRONG!!!!

\newcommand{\verset}[1]{%
  \ifdrfr@versetitle%
    \ifthenelse{\equal{#1}{}}%
      {\ifthenelse{\equal{\versetsepifempty}{}}%
        {\versetcontent{#1}}%
        {\versetcontent{{\versetsepstyle\versetsepifempty}}}}%
      {\ifthenelse{\equal{\versetsep}{}}%
        {\versetcontent{#1}}%
        {\versetcontent{#1\hspace{\versetsepspace}    {\versetsepstyle\versetsep}}}}%
  \else%
    \versetcontent{{\versetsepstyle\versetsepifempty}}%
  \fi%
  \addtocounter{indexv}{1}% 
}

% numérotation visible
\setsecnumdepth{all}
\maxsecnumdepth{all}
\setcounter{secnumdepth}{7} % pour points (6) et sous-points (7)

% option pour éviter les pbs d'hyperliens ambigus (de \part et \chapter)
\PassOptionsToPackage{hypertexnames=false}{hyperref}

%%% REFERENCES CROISEES


\AtBeginDocument{%
% autoref est disponible via le package hyperref
\renewcommand*{\bookautorefname}{Partie}
\renewcommand*{\partautorefname}{Titre}
\renewcommand*{\chapterautorefname}{Chapitre}
}




%%% GLOSSAIRE

\renewcommand{\memgloterm}[1]{\textbf{#1}}
\renewcommand{\memglodesc}[1]{\hspace{1ex}#1}
\renewcommand{\memglonum}[1]{}

%%% INDEX %%%

\renewcommand*{\seename}{\textit{voir}}
\renewcommand*{\alsoname}{\textit{v. aussi}}

\ifdraft{\showindexmarks}{}

% index de base par versets
\newcommand{\indexvfilename}{\jobname}
\newcommand{\makeindexv}{\makeindex[\indexvfilename]}
\newcommand{\indexv}[1]{\specialindex{\indexvfilename}{indexv}{#1}}
\newcommand{\printindexv}{\printindex[\indexvfilename]}

% index d'auteur par versets
\newcommand{\indexafilename}{auteurs}
\newcommand{\makeindexa}{\makeindex[\indexafilename]}
\newcommand{\indexa}[1]{\specialindex{\indexafilename}{indexv}{#1}}
\newcommand{\printindexa}{\printindex[\indexafilename]}

% entête de l'index
\newcommand{\idxmark}[1]{#1\markboth{#1}{#1}}

% raccourcis de style pour entrées indexées
\newcommand{\hyperbf}[1]{\textbf{\hyperpage{#1}}}
\newcommand{\hyperit}[1]{\textit{\hyperpage{#1}}}


%%% SOMMAIRE & TABLE DES MATIERES %%%

% paramètres communs
\renewcommand{\cftbookname}{Partie\space}%
\renewcommand{\cftpartname}{Titre\space}%
%
\cftsetindents{subsubparagraph}{4em}{2em}
\cftsetindents{subsubsubparagraph}{5em}{2em}
\cftsetindents{versetsec}{6em}{2em}

% sommaire
\newcommand*{\setupshorttoc}{%
\renewcommand*{\contentsname}{Sommaire}
\let\oldchangetocdepth\changetocdepth
\renewcommand*{\changetocdepth}[1]{}
\let\oldcftchapterfillnum\cftchapterfillnum
\setcounter{tocdepth}{7}% Parties / Titres / Chapitres / Sections / Paragraphes / Sous-paragraphes seulement
% A modifier dans sommaire.tex
%
%\cftpagenumbersoff{book}
%\cftpagenumbersoff{part}
%\cftpagenumbersoff{chapter}
%
\renewcommand{\tocheadstart}{}
%
\renewcommand{\cftbeforebookskip}{1em}%
%\renewcommand{\cftbookfont}{}%
\renewcommand{\cftbookindent}{0em}%
\renewcommand{\cftbookpagefont}{\normalfont\bfseries\large}%
%\renewcommand{\cftafterbookskip}{}%
%\renewcommand{\cftbookleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftbeforepartskip}{0.5em}%
\renewcommand{\cftpartfont}{\normalfont\scshape}%
\renewcommand{\cftpartindent}{0.5em}%
%\renewcommand{\cftpartnumwidth}{}%
\renewcommand{\cftpartpagefont}{\normalfont\scshape}%
    %\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftbeforechapterskip}{0em}%
\renewcommand{\cftchapterfont}{\normalfont}%
\renewcommand{\cftchaptername}{Chapitre\space}%
\renewcommand{\cftchapterindent}{1em}%
%\renewcommand{\cftchapternumwidth}{}%
\renewcommand{\cftchapterpagefont}{\normalfont}%
%\renewcommand{\cftchapterleader}{\cftdotfill{\cftdotsep}}%
}%

\newcommand{\shorttableofcontents}{%
\clearpage
\setupshorttoc
\tableofcontents
}%

% table des matières
\newcommand*{\setuplongtoc}{%
\renewcommand*{\contentsname}{Table des matières}%
\let\changetocdepth\oldchangetocdepth
\setcounter{tocdepth}{7}%
%
% \cftpagenumberson{book}
% \cftpagenumberson{part}
% \cftpagenumberson{chapter}
%
\renewcommand{\tocheadstart}{\chapterheadstart}
%
\renewcommand{\cftbookbreak}{\addpenalty{-\@highpenalty}\clearpage}
\renewcommand{\cftbeforebookskip}{0em}%
\renewcommand{\cftbookfont}{\normalfont\bfseries\Large}%
\renewcommand{\cftbookindent}{1em}%
%\renewcommand{\cftbooknumwidth}{}%
%\renewcommand{\cftafterbookskip}{}%
\renewcommand{\cftbookleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftbeforepartskip}{1.5em}%
\renewcommand{\cftpartfont}{\normalfont\bfseries\large}%
\renewcommand{\cftpartindent}{0em}%
%\renewcommand{\cftpartnumwidth}{}%
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftbeforechapterskip}{0em}%
\renewcommand{\cftchapterfont}{\normalfont\bfseries\large}%
\renewcommand{\cftchapterindent}{0em}%
\renewcommand{\cftchaptername}{Chapitre\space}%
%\renewcommand{\cftchapternumwidth}{}%
\renewcommand{\cftchapterleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftbeforesectionskip}{0.5em}%
\renewcommand{\cftsectionfont}{\normalfont\large}%
%\renewcommand{\cftsectionname}{Section\space}%
\renewcommand{\cftsectionindent}{0em}%
\renewcommand{\cftsectionnumwidth}{5.5em}%
%\renewcommand{\cftsectionleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftbeforesubsectionskip}{0.5em}%
\renewcommand{\cftsubsectionfont}{\normalfont\scshape}%
%\renewcommand{\cftsubsectionname}{}%
\renewcommand{\cftsubsectionindent}{0em}%
\renewcommand{\cftsubsectionnumwidth}{2em}%
%\renewcommand{\cftsubsectionleader}{\cftdotfill{\cftdotsep}}%
%
%\renewcommand{\cftbeforesubsubsectionskip}{}%
\renewcommand{\cftsubsubsectionfont}{\normalfont\itshape}%
%\renewcommand{\cftsubsubsectionname}{}%
\renewcommand{\cftsubsubsectionindent}{1em}%
\renewcommand{\cftsubsubsectionnumwidth}{2em}%
%\renewcommand{\cftsubsubsectionleader}{\cftdotfill{\cftdotsep}}%
%
%\renewcommand{\cftbeforeparagraphskip}{}%
\renewcommand{\cftparagraphfont}{\normalfont}%
%\renewcommand{\cftparagraphname}{}%
\renewcommand{\cftparagraphindent}{2em}%
\renewcommand{\cftparagraphnumwidth}{2em}%
%\renewcommand{\cftparagraphleader}{\cftdotfill{\cftdotsep}}%
%
%\renewcommand{\cftbeforesubparagraphskip}{}%
\renewcommand{\cftsubparagraphfont}{\normalfont}%
%\renewcommand{\cftsubparagraphname}{}%
\renewcommand{\cftsubparagraphindent}{3em}%
\renewcommand{\cftsubparagraphnumwidth}{2em}%
%\renewcommand{\cftsubparagraphleader}{\cftdotfill{\cftdotsep}}%
%
\renewcommand{\cftsubsubparagraphfont}{\normalfont\small}%
%
\renewcommand{\cftsubsubsubparagraphfont}{\normalfont\small}%
%
}%

\newcommand{\longtableofcontents}{%
\clearpage
\setuplongtoc
\tableofcontents
}%

% génération du fichier de style .ist
\begin{filecontents}{\jobname.ist}
% output main entry <entry> as: \item \idxmark{<entry>}, 
item_0 "\n\\item \\idxmark{"
delim_0 "}, "
% not forgetting the subitem case%    added 2008
item_x1 "} \n \\subitem "
% Wrap and uppercase head letters
heading_prefix "{\\bfseries\\hfil "
heading_suffix "\\hfil}\\nopagebreak\n"
headings_flag 1
\end{filecontents}

% génération du fichier de style .gst
\begin{filecontents}{\jobname.gst}
% Output style parameters
preamble "\\begin{theglossary}"
postamble "\n\\end{theglossary}\n"
item_0 "\n\\glossitem"
delim_0 "{\\memglonum{"
encap_suffix "}}}"
heading_prefix "{\\bfseries\\hfil "
heading_suffix "\\hfil}\\nopagebreak\n"
headings_flag 1
% Input style parameters
keyword "\\glossaryentry"
\end{filecontents}

\endinput
  • Wiouldn't it be better to put all the other formatting stuff from the preamble to the class file? – Johannes_B Jun 15 '16 at 16:02
  • @Johannes_B: Of course, but even better: Don't use such acrobatics at all ;-) – user31729 Jun 15 '16 at 16:23
  • Every good class should have a \chapitre command. MDT template currectly defines chapter in 17 different languages. – Johannes_B Jun 15 '16 at 16:33
  • @Johannes_B: MDT is a good class? ;-) – user31729 Jun 15 '16 at 18:00
  • Of course not. lalala – Johannes_B Jun 15 '16 at 18:01

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.