[Tex/LaTex] Adding chapter prefix for Appendix

appendiceschaptersnamingtitlesec

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}

Best Answer

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.

Related Question