0

I am using the quotchap package and for all the Appendices, I want to add the word "Appendix" before the appendix number e.g. Appendix A instead of A. My problem is shown in the picture below
My problem
I need assistance on how to obtain the following output:
My desired output
Below is my MWE:

\documentclass[11pt,openany,twoside]{book}
\raggedbottom
\let\cleardoublepage=\clearpage
\usepackage[left=2.5cm, right=2.5cm, top=3cm, bottom=3cm,a4paper]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\newcommand\HRule{\noindent\rule{\linewidth}{1.5pt}}
\usepackage[dotinlabels]{titletoc}
\usepackage{background}
\backgroundsetup{contents={}}
\usepackage{fancyhdr}
\usepackage{hhline}
\pagestyle{fancy} 
\usepackage[noindentafter,calcwidth]{titlesec}
\usepackage[courier]{quotchap}
\usepackage{helvet}
\renewcommand\sectfont{\bfseries}
\usepackage{calc,pifont} 
\usepackage{multirow}
\newcommand*\myheaderfooterfont{\normalfont\bfseries}
\usepackage[nottoc]{tocbibind}
\usepackage[ragged]{sidecap}
\usepackage[marginal]{footmisc}
\renewcommand\footnoterule{\vspace*{-3pt}%
    \hrule width 2in height 1.4pt \vspace*{2.6pt}}
\setlength\footnotemargin{10pt}
\usepackage{etoolbox}
\usepackage{regexpatch}
\usepackage{listings}
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
}
\usepackage[toc,header]{appendix}
\usepackage{apptools}
\begin{document} 
        \frontmatter
\chapter*{Ac}
\addcontentsline{toc}{chapter}{Ac}

\mainmatter \setcounter{tocdepth}{1} \chapter{Backrre}

\begin{appendices} \renewcommand{\chaptername}{Appendix} \chapter{Derivation of X} The contents... \chapter{Derivation of Y} Another content... \end{appendices}

\backmatter

\bibliography{}

\end{document}

itc
  • 657
  • The quotechap package does not use the \chaptername in its definition of \chapter. You need to revise some of the quotechap chapter related macros in your preamble. – Peter Wilson Jul 08 '22 at 17:38
  • @Peter Wilson, can you please assist. I'm stuck. – itc Jul 08 '22 at 17:54

1 Answers1

1

This code modifies the \@makechapterhead macro of the quotchap package to add the word Appendix to appendices (A to D).

a

% !TeX TS-program = pdflatex

\documentclass[11pt,openany,twoside]{book}
\usepackage[T1]{fontenc}% added <<<<<< \raggedbottom \let\cleardoublepage=\clearpage \usepackage[left=2.5cm, right=2.5cm, top=3cm, bottom=3cm,a4paper]{geometry} \usepackage{amsmath} \usepackage{amssymb} \usepackage[table]{xcolor} \usepackage{graphicx} \newcommand\HRule{\noindent\rule{\linewidth}{1.5pt}} \usepackage[dotinlabels]{titletoc} \usepackage{background} \backgroundsetup{contents={}} \usepackage{fancyhdr} \usepackage{hhline} \pagestyle{fancy} \usepackage[noindentafter,calcwidth]{titlesec} \usepackage[courier]{quotchap} \usepackage{helvet} \renewcommand\sectfont{\bfseries} \usepackage{calc,pifont} \usepackage{multirow} \newcommand\myheaderfooterfont{\normalfont\bfseries} \usepackage[nottoc]{tocbibind} \usepackage[ragged]{sidecap} \usepackage[marginal]{footmisc} \renewcommand\footnoterule{\vspace{-3pt}% \hrule width 2in height 1.4pt \vspace*{2.6pt}} \setlength\footnotemargin{10pt} \usepackage{etoolbox} \usepackage{regexpatch} \usepackage{listings} \usepackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=blue, } \usepackage[toc,header]{appendix} \usepackage{apptools}

\usepackage{showframe}

%************************************************** added \usepackage{xstring} \newcommand{\appname}{{\fontfamily{phv}\fontsize{22pt}{26pt}\selectfont\raisebox{1em}{\textcolor{red}{Appendix}}}} % set the appendix name <<<<<<<<<<<
\makeatletter
\patchcmd{@makechapterhead}{\thechapter}{% \IfSubStr{ABCDEFGHIJKLMNOPQRSTUVWXYZ}{\thechapter}{\appname,\thechapter}{\thechapter} }
\makeatother
%**************************************************

\begin{document} \frontmatter \chapter*{Ac} \addcontentsline{toc}{chapter}{Ac}

\mainmatter
\setcounter{tocdepth}{1}
\chapter{Backrre}

\begin{appendices}
    \chapter{Derivation of X}
    The contents...
    \chapter{Derivation of Y}
    Another content...
    \setcounter{chapter}{15}
    \chapter{Derivation of P}
    \setcounter{chapter}{25}
    \chapter{Derivation of Z}
    Another content...      
\end{appendices}

\backmatter     

% \bibliography{}

\end{document

UPDATE after follow up question.

z

Simon Dispa
  • 39,141
  • What if I have I have Appendices from A-M? Is there a way of automating the code such that whenever the Chapters are in letters of the alphabet, i.e Appendix A, B, C,... then we automatically have Appendix G, H,... for example? – itc Jul 08 '22 at 20:52
  • @itc Of course. If all else meets your requirements, I'll add the full alphabet as an update. – Simon Dispa Jul 08 '22 at 20:56
  • you can edit the code so that it automatically deals with the issue I have mentioned in my comment above. – itc Jul 08 '22 at 21:00
  • @itc Done! Please check the new code. Thank you for your feedback! – Simon Dispa Jul 08 '22 at 21:23
  • Thank you very much @Simon Dispa, the code is now working perfectly. And just out of curiosity, lets say I want to do the same for the main chapters, what changes should I make to the solution you posted above? – itc Jul 08 '22 at 21:28
  • @itc I think it can be done, but please ask a new question (it will help other readers) and keep me posted. – Simon Dispa Jul 08 '22 at 21:31
  • Noted with thanks. – itc Jul 08 '22 at 21:33