![我希望 ToC、LoF、LoT 和参考书目在使用 fncychap 时具有默认样式](https://linux22.com/image/450815/%E6%88%91%E5%B8%8C%E6%9C%9B%20ToC%E3%80%81LoF%E3%80%81LoT%20%E5%92%8C%E5%8F%82%E8%80%83%E4%B9%A6%E7%9B%AE%E5%9C%A8%E4%BD%BF%E7%94%A8%20fncychap%20%E6%97%B6%E5%85%B7%E6%9C%89%E9%BB%98%E8%AE%A4%E6%A0%B7%E5%BC%8F.png)
我使用 fncychap 来获得漂亮的章节样式,但问题是所选样式应用于 ToC、LoF、LoT 和参考书目,而我希望它们采用默认样式。有没有办法为 fncychap 包设置例外?
谢谢
答案1
\documentclass{report}
\usepackage{etoolbox}
\makeatletter
\newcommand\FncychapCopyCmds[2]{%
\csletcs{appendix#1}{appendix#2}%
\csletcs{@makechapterhead#1} {@makechapterhead#2}%
\csletcs{@schapter#1} {@schapter#2}%
\csletcs{@makeschapterhead#1}{@makeschapterhead#2}%
}
\newcommand\FncychapStyleOn {\FncychapCopyCmds{}{@fncy}}
\newcommand\FncychapStyleOff{\FncychapCopyCmds{}{@orig}}
\makeatother
\FncychapCopyCmds{@orig}{}
\usepackage[Sonny]{fncychap}
\FncychapCopyCmds{@fncy}{}
\begin{document}
\FncychapStyleOff % deactivate fncychap style
\tableofcontents
\FncychapStyleOn % activate fncychap style
\chapter{title}
\chapter{title}
\appendix
\FncychapStyleOff % deactivate again
\chapter{title}
\end{document}