使用quotchap宏包时如何让附录标题显示Appendix前缀
问题描述
在LaTeX book 文档类中使用quotchap宏包排版文档时,需要在附录章节的字母编号前添加「Appendix」字样,期望排版效果如下:
Appendix A
定理1的证明
常规写法编译后,附录标题仅显示字母编号,实际效果为:
A
定理1的证明
最小可复现示例
\documentclass{book} \usepackage{quotchap} \begin{document} \chapter{Hello world!} \appendix \chapter{Proof of Theorem~1} \end{document}
解决方案
问题根源是quotchap宏包重定义章节标题格式时,独立排版章节大号编号的模块默认只输出纯编号内容,不会自动携带\appendix命令切换后的章节类型前缀,提供两种可直接复用的实现方案:
- 方案一:全局修改章节编号格式,目录、交叉引用、章节标题处都会显示「Appendix + 字母编号」的格式,配置简单无需引入额外宏包:
\documentclass{book} \usepackage{quotchap} \begin{document} \chapter{Hello world!} \appendix % 新增以下配置即可 \renewcommand{\chaptername}{Appendix} \renewcommand{\thechapter}{\chaptername~\Alph{chapter}} \chapter{Proof of Theorem~1} 定理1的证明内容 \end{document}
- 方案二:仅修改章节页大号标题的显示效果,目录、交叉引用中仍然只显示字母编号,需要借助
etoolbox宏包打补丁实现:
\documentclass{book} \usepackage{quotchap} \usepackage{etoolbox} \begin{document} \chapter{Hello world!} \appendix % 新增以下补丁配置即可 \makeatletter \patchcmd{\@makechapterhead} {\thechapter} {\appendixname~\thechapter} {}{} \makeatother \chapter{Proof of Theorem~1} 定理1的证明内容 \end{document}
内容的提问来源于stack exchange,提问作者CLAUDE
相关产品推荐
相关产品推荐

