O cabeçalho sofisticado com \thechapter ainda mostra "Capítulo" depois de \apêndice. Deve mostrar "Apêndice"

O cabeçalho sofisticado com \thechapter ainda mostra "Capítulo" depois de \apêndice. Deve mostrar "Apêndice"

Tenho capítulos e apêndices. Eu não estou usando \part. Meu cabeçalho é definido como

\fancyhead[RO,LE]{\textsf{\footnotesize \thechapter--\thepage}}

Depois de passar dos capítulos para os apêndices (depois \appendix), os títulos dos apêndices estão ok, mas o cabeçalho diz "Capítulo A: blá" em vez de "Apêndice A: blá".

Responder1

Aqui está uma solução.

o comando \@chapappexpande para o capítulo primeiro e para o apêndice após o uso, \appendixpodemos usá-lo aqui \renewcommand{\chaptermark}[1]{\markboth{\@chapapp{} \thechapter:\ #1}{}}

\documentclass{book}
\usepackage{blindtext}


\usepackage{fancyhdr}
\renewcommand{\chaptermark}[1]{% 
\markboth{\@chapapp{} \thechapter:\ #1}{}} 
\fancyhead{} 
\makeatletter
\fancyhead[RO,LE]{\textsf{\footnotesize \thechapter--\thepage}} 
\fancyhead[LO,RE]{\textsf{\footnotesize \leftmark}}
\makeatother
\pagestyle{fancy}

\begin{document}
\blinddocument
\appendix 
\blinddocument 
\end{document}

informação relacionada