1

I am using titlesec to apply formatting to my chapter and section headings. When I add an appendix to the document, the chapter name reads 'Chapter A', where as it should read 'Appendix A'

enter image description here

Running a \renewcommand after \begin{appendices} seems to have no effect. I believe there is a clash between titlesec and appendix, but I am not sure how to resolve it.

How can I redefine the appendix chapter name?

\documentclass[11pt,a4paper]{report}
\setlength{\headheight}{13.6pt}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{appendix}

%Pagestyle setup
\pagestyle{fancyplain}
\fancyhf{}
\fancyfoot[R]{\thepage}
\fancyhead[R]{\fancyplain{}{\nouppercase\leftmark}}
\renewcommand{\headrulewidth}{0pt}

\usepackage{xpatch}
\xpatchcmd\chaptermark{. }{\ --}{}{\PatchFailed}

%Title formatting
\titleformat
{\chapter}[display]
    {\bfseries\LARGE}{Chapter \thechapter}{2ex}
    {
        \vspace{-0.5ex}
        \rule{\textwidth}{0.4pt}
        \centering
    }
    [
        \vspace{-1.5ex}
        \rule{\textwidth}{0.4pt}
        \vspace{-4ex} 
    ]

\begin{document}
\cleardoublepage
\pagenumbering{roman}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
\pagestyle{plain}
\lipsum

\appendixtitleon
\appendixtitletocon
\tableofcontents

\cleardoublepage
\pagenumbering{arabic}
\pagestyle{fancy}
\chapter{Introduction}
\lipsum

\clearpage
\pagestyle{plain}
\begin{appendices}
\renewcommand\chaptername{Appendix} %Has no effect
\renewcommand\appendixname{Appendix} %Also has no effect
\renewcommand\chaptertitlename{Appendix} %From titlesec documentation. Again, no effect
\chapter{The first appendix} 
\lipsum{}
\end{appendices}
\end{document}
2

If you want \renewcommand\chaptertitlename{...} to have an effect, you may want to build it in the definition of your custom chapter format.

\documentclass[11pt,a4paper]{report}
\setlength{\headheight}{13.6pt}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{appendix}

%Pagestyle setup
\pagestyle{fancyplain}
\fancyhf{}
\fancyfoot[R]{\thepage}
\fancyhead[R]{\fancyplain{}{\nouppercase\leftmark}}
\renewcommand{\headrulewidth}{0pt}

\usepackage{xpatch}
\xpatchcmd\chaptermark{. }{\ --}{}{\PatchFailed}
\renewcommand\chaptertitlename{Chapter}
%Title formatting
\titleformat
{\chapter}[display]
    {\bfseries\LARGE}{\chaptertitlename\ \thechapter}{2ex}
    {
        \vspace{-0.5ex}
        \rule{\textwidth}{0.4pt}
        \centering
    }
    [
        \vspace{-1.5ex}
        \rule{\textwidth}{0.4pt}
        \vspace{-4ex} 
    ]

\begin{document}
\cleardoublepage
\pagenumbering{roman}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
\pagestyle{plain}
\lipsum

\appendixtitleon
\appendixtitletocon
\tableofcontents

\cleardoublepage
\pagenumbering{arabic}
\pagestyle{fancy}
\chapter{Introduction}
\lipsum

\clearpage
\pagestyle{plain}
\begin{appendices}
\renewcommand\chaptertitlename{Appendix} %From titlesec documentation. Again, no effect
\chapter{The first appendix} 
\lipsum{}
\end{appendices}
\end{document}

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.