Je cherche à changer le style des chapitres d'un document écrit avec Quand je teste sur l'ECM suivant : \documentclass[ mainlanguage=english, french, localtocs, localbibs*, secnumdepth=subsubsection, titlesec={pagestyles}]{yathesis} \usepackage{lipsum} \usepackage{geometry} \makeatletter \def\@makechapterhead#1{% \vspace*{0\p@}% (no extra top margin) {\parindent \z@ \centering \normalfont\sffamily % --- Chapter number line with colored text and rule --- \ifnum \c@secnumdepth >\m@ne \if@mainmatter \Huge\bfseries\color{gray}\@chapapp~\thechapter\par\nobreak \vskip -7\p@ % tighten spacing above the rule {\color{black}\rule{0.9\linewidth}{0.2pt}}\par % horizontal rule \vskip 7\p@ % space between rule and title \fi \fi % --- Chapter title line --- \LARGE\bfseries\color{blue} #1\par}% \vskip 30\p@ % space below chapter title % --- Insert leadchapter text, if provided --- \@ifundefined{YAD@leadchapter}{}{% \noindent\YAD@leadchapter\par \let\YAD@leadchapter\relax }% % --- Insert local chapter TOC, if enabled --- \ifbool{YAD@localtocs}{% \YAD@localtoc \renewcommand{\YAD@localtoc}{\YAD@default@localtoc}% \ifbool{YAD@nextwithlocaltoc}{% \boolfalse{YAD@localtocs}\boolfalse{YAD@nextwithlocaltoc}}{}% % (no extra gap here; adjust with \vskip if desired) }{}% \@afterheading \clearpage } \def\@makeschapterhead#1{% \vspace*{0\p@}% (no extra top margin) {\parindent \z@ \centering \normalfont\sffamily \LARGE\bfseries\color{red} #1\par}% \vskip 30\p@ % space below chapter title % --- Insert leadchapter text, if provided --- \@ifundefined{YAD@leadchapter}{}{% \noindent\YAD@leadchapter\par \let\YAD@leadchapter\relax }% % --- Insert local chapter TOC, if enabled --- \ifbool{YAD@localtocs}{% \YAD@localtoc \renewcommand{\YAD@localtoc}{\YAD@default@localtoc}% \ifbool{YAD@nextwithlocaltoc}{% \boolfalse{YAD@localtocs}\boolfalse{YAD@nextwithlocaltoc}}{}% % (no extra gap here; adjust with \vskip if desired) }{}% \@afterheading } % \makeatother \geometry{ paper=a4paper } % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Début du document %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Caractéristiques du document %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Préparation des pages de couverture et de titre %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Les caractéristiques de la thèse sont saisies dans le fichier % « characteristics.tex » (situé dans le dossier « configuration »). % % Production des pages de couverture et de titre %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\maketitle[frametitle=ovalbox] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Début de la partie liminaire de la thèse %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % (Facultatif) Production de la page de clause de non-responsabilité %\makedisclaimer % % (Facultatif) Production de la page de mots clés %\makekeywords % % (Facultatif) Production de la page affichant les logo, nom et coordonnées du % ou des laboratoires (ou unités de recherche) où la thèse a été préparée %\makelaboratory % % (Facultatif) Dédicace(s) % \input{liminaires/dedicaces} % % (Facultatif) Épigraphe(s) % \input{liminaires/epigraphes} % % Résumés succincts % \input{liminaires/resumes} % % (Facultatif) Chapitre de remerciements % \include{liminaires/remerciements} % % (Facultatif) Chapitre d'avertissement % \include{liminaires/avertissement} % % (Facultatif) Liste des acronymes % \printacronyms % % (Facultatif) Liste des symboles % \printsymbols % % (Facultatif) Chapitre d'avant-propos % \include{liminaires/avant-propos} % % Sommaire \tableofcontents[depth=section] % % (Facultatif) Liste des tableaux % \listoftables % % (Facultatif) Table des figures % \listoffigures % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Début de la partie principale (du « corps ») de la thèse %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \mainmatter \chapter{Le premier} \lipsum{4} \chapter{Le deuxième} \lipsum{8} \chapter*{Un test non num} \lipsum{6} \end{document} Les chapitres numérotés sont bien modifiés (avec le titre en bleu, ne me jugez pas c'est pour le test), mais les non numérotés utilisent aussi Je ne trouve pas grand chose sur internet qui m'aide dans cette situation. J'ai essayé d'utiliser ces commandes à différents endroits sans succès et clairement, même sans package externe ça me fait le coup. À noter que ça agit aussi logiquement sur la bibliographie et la table des matières, mais je ne comprends pas pourquoi la commande dédiée n'est pas utilisée... EDIT (au cas où): je compile chez moi avec |
Voici une autre solution (plus simple), qui répond à la question posée en commentaires. \documentclass[ mainlanguage=english, french, localtocs, localbibs*, secnumdepth=subsubsection, titlesec={pagestyles}]{yathesis} \usepackage{lipsum} \usepackage{geometry} \makeatletter \def\@makechapterhead#1{% \vspace*{0\p@}% (no extra top margin) {\parindent \z@ \centering \normalfont\sffamily % --- Chapter number line with colored text and rule --- \ifnum \c@secnumdepth >\m@ne \if@mainmatter \Huge\bfseries\color{gray}\@chapapp~\thechapter\par\nobreak \vskip -7\p@ % tighten spacing above the rule {\color{black}\rule{0.9\linewidth}{0.2pt}}\par % horizontal rule \vskip 7\p@ % space between rule and title \fi \fi % --- Chapter title line --- \LARGE\bfseries\color{blue} #1\par}% \vskip 30\p@ % space below chapter title % --- Insert leadchapter text, if provided --- \@ifundefined{YAD@leadchapter}{}{% \noindent\YAD@leadchapter\par \let\YAD@leadchapter\relax }% % --- Insert local chapter TOC, if enabled --- \ifbool{YAD@localtocs}{% \YAD@localtoc \renewcommand{\YAD@localtoc}{\YAD@default@localtoc}% \ifbool{YAD@nextwithlocaltoc}{% \boolfalse{YAD@localtocs}\boolfalse{YAD@nextwithlocaltoc}}{}% % (no extra gap here; adjust with \vskip if desired) }{}% \@afterheading \clearpage } \def\@makeschapterhead#1{% \vspace*{0\p@}% (no extra top margin) {\parindent \z@ \centering \normalfont\sffamily \LARGE\bfseries\color{red} #1\par}% \vskip 30\p@ % space below chapter title % --- Insert leadchapter text, if provided --- \@ifundefined{YAD@leadchapter}{}{% \noindent\YAD@leadchapter\par \let\YAD@leadchapter\relax }% % --- Insert local chapter TOC, if enabled --- \ifbool{YAD@localtocs}{% \YAD@localtoc \renewcommand{\YAD@localtoc}{\YAD@default@localtoc}% \ifbool{YAD@nextwithlocaltoc}{% \boolfalse{YAD@localtocs}\boolfalse{YAD@nextwithlocaltoc}}{}% % (no extra gap here; adjust with \vskip if desired) }{}% \@afterheading }\let\old@makechapterhead\@makechapterhead \AfterPreamble{% \patchcmd{\chapter}{{\YAD@starred@chapter}{\YAD@unstarred@chapter}}{{\let\@makechapterhead\@makeschapterhead\YAD@starred@chapter}{\let\@makechapterhead\old@makechapterhead\YAD@unstarred@chapter}}{}{\err} } \makeatother \geometry{ paper=a4paper } % \begin{document} \tableofcontents[depth=section] \mainmatter \chapter{Le premier} \lipsum{4} \chapter{Le deuxième} \lipsum{8} \chapter*{Un test non num} \lipsum{6} \end{document} Voici une solution. \documentclass[ mainlanguage=english, french, localtocs, localbibs*, secnumdepth=subsubsection, titlesec={pagestyles}]{yathesis} \usepackage{lipsum} \usepackage{geometry} \makeatletter \patchcmd{\YAD@globalstyle}{\chapter*}{\chapter*[]}{}{\err} \AfterPreamble{% \RenewDocumentCommand{\YAD@tmp@chapter}{sO{}O{}m}{% \ifthenelse{\isempty{#2}}{% \ifthenelse{\isempty{#3}}{% \IfBooleanTF{#1}{\YAD@ORI@chapter*{#4}}{\YAD@ORI@chapter{#4}}% }{% \IfBooleanTF{#1}{\YAD@ORI@chapter*{#4}}{\YAD@ORI@chapter{#4}}% \chaptermark{#3}% }% }{% \ifthenelse{\isempty{#3}}{% \IfBooleanTF{#1}{\YAD@ORI@chapter*[#2]{#4}}{\YAD@ORI@chapter[#2]{#4}}% }{% \IfBooleanTF{#1}{\YAD@ORI@chapter*[#2]{#4}}{\YAD@ORI@chapter[#2]{#4}}% \chaptermark{#3}% }% }% } \RenewDocumentCommand{\YAD@starred@chapter}{O{}O{}m}{% \booltrue{YAD@nonnumbered@chapter}% \booltrue{YAD@nonnumbered@section}% \booltrue{YAD@nonnumbered@subsection}% \booltrue{YAD@nonnumbered@subsubsection}% \booltrue{YAD@nonnumbered@paragraph}% \booltrue{YAD@nonnumbered@subparagraph}% \YAD@setsecnumdepth{none}% \YAD@tmp@chapter*[#1][#2]{#3}% }} \def\@makechapterhead#1{% \vspace*{0\p@}% (no extra top margin) {\parindent \z@ \centering \normalfont\sffamily % --- Chapter number line with colored text and rule --- \ifnum \c@secnumdepth >\m@ne \if@mainmatter \Huge\bfseries\color{gray}\@chapapp~\thechapter\par\nobreak \vskip -7\p@ % tighten spacing above the rule {\color{black}\rule{0.9\linewidth}{0.2pt}}\par % horizontal rule \vskip 7\p@ % space between rule and title \fi \fi % --- Chapter title line --- \LARGE\bfseries\color{blue} #1\par}% \vskip 30\p@ % space below chapter title % --- Insert leadchapter text, if provided --- \@ifundefined{YAD@leadchapter}{}{% \noindent\YAD@leadchapter\par \let\YAD@leadchapter\relax }% % --- Insert local chapter TOC, if enabled --- \ifbool{YAD@localtocs}{% \YAD@localtoc \renewcommand{\YAD@localtoc}{\YAD@default@localtoc}% \ifbool{YAD@nextwithlocaltoc}{% \boolfalse{YAD@localtocs}\boolfalse{YAD@nextwithlocaltoc}}{}% % (no extra gap here; adjust with \vskip if desired) }{}% \@afterheading \clearpage } \def\@makeschapterhead#1{% \vspace*{0\p@}% (no extra top margin) {\parindent \z@ \centering \normalfont\sffamily \LARGE\bfseries\color{red} #1\par}% \vskip 30\p@ % space below chapter title % --- Insert leadchapter text, if provided --- \@ifundefined{YAD@leadchapter}{}{% \noindent\YAD@leadchapter\par \let\YAD@leadchapter\relax }% % --- Insert local chapter TOC, if enabled --- \ifbool{YAD@localtocs}{% \YAD@localtoc \renewcommand{\YAD@localtoc}{\YAD@default@localtoc}% \ifbool{YAD@nextwithlocaltoc}{% \boolfalse{YAD@localtocs}\boolfalse{YAD@nextwithlocaltoc}}{}% % (no extra gap here; adjust with \vskip if desired) }{}% \@afterheading } \makeatother \geometry{ paper=a4paper } % \begin{document} \tableofcontents[depth=section] \mainmatter \chapter{Le premier} \lipsum{4} \chapter{Le deuxième} \lipsum{8} \chapter*{Un test non num} \lipsum{6} \end{document} Je vais voir ce qui ce passe avec la bibliographie plus tard. Hello, merci pour la réponse !
J'ai deux questions quand je vois ça :
1. est-ce que du coup c'est Pour la question 1) oui. Pour 2) voir la nouvelle solution proposée. Solution modifiée. |