5

I am working on a larger report and need help with chapter naming for the appendices. I want to add "Appendix" as a prefix to the chapter numbering for the appendices in my document in the actual text, not just in the ToC.

The ToC is working as it should:

Table of Content

The Appendix chapter numbering is not:

Appendix

Instead of:

A Some Stuff

I wish to have it as:

Appendix A: Some Stuff

While keeping the individual sections of the appendices as they are in the screenshots.

I have attached a MWE:

\documentclass[11pt,twoside]{report}
\usepackage[a4paper]{geometry}
\raggedbottom

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}

\usepackage{titlesec}
\titleformat{\chapter}{\bfseries\LARGE}{\thechapter~}{0em}{}

\usepackage[titletoc]{appendix}

\begin{document}
\pagenumbering{roman}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}

\tableofcontents

\chapter{Some Chapter}
\pagenumbering{arabic}
\setcounter{page}{1}
\chapter{Another Chapter}

\begin{appendices}
\chapter{Some Stuff}
\section{List of stuff}
\section{List of more stuff}
\section{List of even more stuff}
\chapter{More Stuff}
\section{Some equations}
\section{Some more equations}
\end{appendices}
\end{document}
3

You can insert a conditional in the \titleformat setup for \chapters:

enter image description here

\documentclass[11pt,twoside]{report}
\usepackage[a4paper]{geometry}
\raggedbottom

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}

\usepackage{titlesec}

\makeatletter
\newcommand{\setappendix}{Appendix~\thechapter:~}
\newcommand{\setchapter}{\thechapter~}
\titleformat{\chapter}{\bfseries\LARGE}{%
  \ifnum\pdfstrcmp{\@currenvir}{appendices}=0
    \setappendix
  \else
    \setchapter
  \fi}{0em}{}
\makeatother
\usepackage[titletoc]{appendix}

\begin{document}
\pagenumbering{roman}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}

\tableofcontents

\chapter{Some Chapter}
\pagenumbering{arabic}
\setcounter{page}{1}
\chapter{Another Chapter}

\begin{appendices}
\chapter{Some Stuff}
\section{List of stuff}
\section{List of more stuff}
\section{List of even more stuff}
\chapter{More Stuff}
\section{Some equations}
\section{Some more equations}
\end{appendices}
\end{document}

The conditional checks whether you're in the appendices environment and sets the \chapter header using \setappendix. Otherwise it sets it using \setchapter.

  • I just noticed that the change is not reflected in the header. I am currently using the following in my preamble for the headers: \usepackage{fancyhdr} \pagestyle{fancy} \fancyhead{} \fancyhead[LE,RO]{\slshape \leftmark} \fancyfoot{} \fancyfoot[CE,CO]{\thepage} \renewcommand{\headrulewidth}{0.4pt} \renewcommand{\chaptermark}[1]{% \markboth{\MakeUppercase{% \ \thechapter.% \ #1}}{}} – mendokusai May 31 '15 at 19:48

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.