0

I'm trying to have the same chapter title styles for the normal chapters and the appendix chapters but add the word "Appendix" before the appendix titles, as only the letters are shown before the appendix title. Right now the chapter title style is defined using this piece of code:

% Chapter title settings
\usepackage{titlesec}       
\titleformat{\chapter}[display]
  {\Huge\bfseries\filcenter}
  {{\fontsize{50pt}{1em}\vspace{-4.2ex}\selectfont \textnormal{\thechapter}}}{1ex}{}[]

I have managed to get it to work in the table of contents but not in the appendix titles.

The appendix code looks like this:

\usepackage[titletoc]{appendix}

% APPENDICES
\cleardoublepage
\appendix
\setcounter{page}{1}
\pagenumbering{Roman}           % Capitalized roman numbering starting from I (one)

\begin{appendices}
\input{include/backmatter/Appendix_1}
\end{appendices}

Example:

\documentclass[12pt,a4paper,twoside,openright]{report}
\usepackage[utf8]{inputenc}
\usepackage[titletoc]{appendix}
\usepackage{moreverb}                               % List settings
\usepackage{textcomp}                               % Fonts, symbols etc.
\usepackage{lmodern}                                % Latin modern font
\usepackage{helvet}                                 % Enables font switching
\usepackage[T1]{fontenc}                            % Output settings
\usepackage[english]{babel}                         % Language settings

\usepackage{titlesec}       
\titleformat{\chapter}[display]
  {\Huge\bfseries\filcenter}
  {{\fontsize{50pt}{1em}\vspace{-4.2ex}\selectfont \textnormal{\thechapter}}}{1ex}{}[]

\usepackage{fancyhdr}                               
\pagestyle{fancy}  
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\space#1}{}} 

% Select one-sided (1) or two-sided (2) page numbering
\def\layout{2}  % Choose 1 for one-sided or 2 for two-sided layout
% Conditional expression based on the layout choice
\ifnum\layout=2 % Two-sided
    \fancyhf{}                                  
    \fancyhead[LE,RO]{\nouppercase{ \leftmark}}
    \fancyfoot[LE,RO]{\thepage}
    \fancypagestyle{plain}{         % Redefine the plain page style
    \fancyhf{}
    \fancyfoot[LE,RO]{\thepage}     % Added for the extra even pages
    \renewcommand{\headrulewidth}{0pt}} 
    \fancyfoot[LE,RO]{\thepage}
\else           % One-sided     
    \fancyhf{}                  
    \fancyhead[C]{\nouppercase{ \leftmark}}
    \fancyfoot[C]{\thepage}
\fi

\makeatletter
\setlength{\@fptop}{0pt}
\makeatother

\title{Test}
\author{Mr Need Help}
\date{\today}

\begin{document}

\maketitle
\pagenumbering{roman}
\cleardoublepage

\tableofcontents

\setcounter{page}{1}
\pagenumbering{arabic}          % Arabic numbering starting from 1 (one)
\setlength{\parskip}{0pt plus 1pt}

\chapter{Introduction}
\chapter{Method}

% APPENDICES
\cleardoublepage
\appendix
\setcounter{page}{1}
\pagenumbering{Roman}           % Capitalized roman numbering starting from I (one)

\begin{appendices}
\chapter{Test 1}
\chapter{Test 2}
\end{appendices}

\end{document}
1
  • 2
    As always on this site: please post a full minimal example that others can just copy and test as is without having to guess half the document. Help us help you.
    – daleif
    Commented Mar 22, 2018 at 15:00

1 Answer 1

2

The command \titleformat can be used in the document environment and not only in the preamble. So you can insert before your appendices the command:

\titleformat{\chapter}[display]
  {\Huge\bfseries\filcenter}
  {{\fontsize{50pt}{1em}\vspace{-4.2ex}\selectfont
     \textnormal{\appendixname\thechapter}}}{1ex}{}[]

By the way:

  1. In report or book class, appendices are \chapters and the packet appendix is, TTBOMK, not usefull, the \appendix declaration should be sufficient.
  2. As you use the class options twoside,openright and define your own headers, you would more comfortably swich to book class, where you also can benefit from the declarations \frontmatter, \mainmatter, eliminating the manual change of page numbering (except for appendices, of course).
1
  • Your answer also applies for \titlecontents. Indeed, it seems the only way to obtain Appendix as a prefix after the \appendix command is issued is to redefine \titlecontents to use \appendixname instead of \chaptertitlename. Thank you for the insight even after this long time since your answer. Commented Aug 8 at 20:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .