# Format chapters except appendix

For the thesis I am writing it is demanded that the appendix chapters come in the form of "Appendix A", "Appendix B", etc..

I wanted different formatting for the chapters than the standard one so I used the titlesec package. The formatting of the chapters became what I wanted, but it also removed the "Appendix" word in the appendix's chapters. I am not proficient with the titlesec formatting package, so below I post an example of what I mean in hopes someone can help.

\documentclass[10pt, twoside, openright, dvipsnames]{report}

\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage[table,xcdraw]{xcolor}

\titleformat{\chapter}[hang]{\normalfont\scshape\LARGE\color{MidnightBlue}}{\thechapter\hspace{0pt}\color{MidnightBlue}\hspace{10pt}}{0pt}{\LARGE}

\titleformat*{\section}{\normalfont\scshape\Large\color{MidnightBlue}}
\titleformat*{\subsection}{\normalfont\scshape\large\color{MidnightBlue}}
\titleformat*{\subsubsection}{\normalfont\scshape\normalsize\color{MidnightBlue}}

\usepackage[titletoc]{appendix}

\begin{document}

\chapter{Introduction}
\section{Intro}
\chapter{Development}
\section{Intro}

\appendix
\chapter{One}

\end{document}


Is it possible to keep that exact formatting and include the "Appendix" word before ?

You can use the fact that in the main part of the document, \@chapapp expands to \chaptername, but after \appendix it expands to \appendixname.

Also note the simplifications I made in the rest of the code.

\documentclass[10pt, twoside, openright]{report}

\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage[table,xcdraw,dvipsnames]{xcolor}

\makeatletter
\titleformat{\chapter}[hang]
{\normalfont\scshape\LARGE\color{MidnightBlue}}
{\expandafter\ifx\@chapapp\appendixname\appendixname\ \fi\thechapter}
{10pt}
{\LARGE}
\makeatother

\titleformat*{\section}{\normalfont\scshape\Large\color{MidnightBlue}}
\titleformat*{\subsection}{\normalfont\scshape\large\color{MidnightBlue}}
\titleformat*{\subsubsection}{\normalfont\scshape\normalsize\color{MidnightBlue}}

\usepackage[titletoc]{appendix}

\begin{document}

\chapter{Introduction}
\section{Intro}
\chapter{Development}
\section{Intro}

\appendix
\chapter{One}

\end{document}


• Perfect! Thanks for the additional simplification. – Ludgero Himself Mar 15 at 15:11

The command \chaptername stores, what to display in a chapter head (e.g. in English it is Chapter, in German it's Kapitel). Same goes for \appendixname for appendices (Appendix or Anhang).

The command \chaptertitlename chooses, depending on whether you are in the \appendix or not, which of these two is called.

You could add \chaptertitlename to your titlesec definition and adjust the two commands above like this:

\renewcommand{\chaptername}{}
\renewcommand{\appendixname}{Appendix }
\titleformat{\chapter}[hang]{\normalfont\scshape\LARGE\color{MidnightBlue}}{\chaptertitlename\thechapter\hspace{0pt}\color{MidnightBlue}\hspace{10pt}}{0pt}{\LARGE}

• Great explanation, it solved the problem too ! – Ludgero Himself Mar 15 at 15:11