使用 quotchap 包为所有附录章节添加“附录”一词

使用 quotchap 包为所有附录章节添加“附录”一词

我正在使用 quotchap 包,对于所有附录,我想在附录编号前添加单词“附录”,例如附录 A 而不是 A。我的问题如下图所示
我的问题
我需要帮助以获得以下输出:
我想要的输出
以下是我的 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}

答案1

此代码修改了包\@makechapterhead的宏quotchap,将单词“Appendix”添加到附录(A 到 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

更新在后续问题之后。

是

相关内容