Bonjour
Je voudrais pouvoir personnaliser la mise en page d'une tables des matières, d'un document de class book. J'utilise aussi le package fancyhdr
Pour l'instant j'ai défini :
1 2
|
\newcommand{\chapitre}{\addtocounter{chap}{1}\chapter*{Chapitre \Roman{chap}}\addcontentsline{toc}{chapter}{Chapitre \Roman{chap}}} |
Pour l'instant \tableofcontents imprime une table des matières comme il faut.
Maintenant, ce que j'aimerai faire, c'est ajouter un titre aux chapitres. La mise en forme dans le corps du texte n'est pas importante pour l'instant, mais le résultat produit par \chapter ne me convient pas.
Ce que j'aimerai faire c'est pouvoir redéfinir la mise en page des chapitres dans la table des matières avec un résultat comme
\textbf{Chapitre \Roman{\thechapter}}\\{\chaptername \hfill \chapterpage}
Le problème c'est que addcontentsline ne permet pas les retours à la ligne, ça génère l'erreur
! Incomplete \iffalse; all text was ignored after line 37.<inserted text>\fi<> livre.texThe file ended while I was skipping conditional text.This kind of error happens when you say `\if...' and forgetthe matching `\fi'. I've inserted a `\fi'; this might work.! Emergency stop.<> livre.tex (job aborted, no legal \end found)Here is how much of TeX's memory you used:14903 strings out of 493671281375 string characters out of 3143857392159 words of memory out of 300000017916 multiletter control sequences out of 15000+20000052038 words of font info for 39 fonts, out of 3000000 for 90001025 hyphenation exceptions out of 819169i,11n,66p,3069b,465s stack positions out of 5000i,500n,10000p,200000b,50000s! ==> Fatal error occurred, no output PDF file produced!
J'ai pensé à redéfinir \l@chapter[2] mais je n'ai pas accès au numéro du chapitre avec cela.
Du coup est-ce que vous sauriez soit comment implementer un équivalent à \l@chapter[2] qui prenne aussi un numero comme argument, ou comment forcer un saut de ligne dans la table des matières ? Je tiens à garder une numérotation romaine pour les chapitres.
Cordialement.
Partager