![使用 quotchap 包为所有附录章节添加“附录”一词](https://linux22.com/image/452236/%E4%BD%BF%E7%94%A8%20quotchap%20%E5%8C%85%E4%B8%BA%E6%89%80%E6%9C%89%E9%99%84%E5%BD%95%E7%AB%A0%E8%8A%82%E6%B7%BB%E5%8A%A0%E2%80%9C%E9%99%84%E5%BD%95%E2%80%9D%E4%B8%80%E8%AF%8D.png)
我正在使用 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)。
% !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
更新在后续问题之后。