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'
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}