Closed xiexingxiang180 closed 1 year ago
经过私下交流, 问题是这样的:
由于题主要在附录中显示图片目录 (list of figures) 和表格目录 (list of tables), 按下面的方式修改了 \listoffigures
和 \listoftables
的定义
\renewcommand\listoffigures{\hitsz@listof{figure}{\listfigureename}}
\renewcommand*\l@figure{\addvspace{6bp}\@dottedtocline{1}{0em}{4em}}
\renewcommand\listoftables{\hitsz@listof{table}{\listtableename}}
\let\l@table\l@figure
然后在正文的致谢后面使用了
% % 致谢
\input{back/acknowledgements}
% % 插图索引
\listoffigures
% % 表格索引
\listoftables
然后发现致谢页的页眉变成了“插图目录”, 本应为“致谢”
故来提问.
众所周知本模板中页眉是由 fancyhdr
宏包控制的, 模板中说
\fancyhead[CO]{\songti\xiaowu[0]\leftmark}
那这个 \leftmark
是谁决定的呢, 是 \markboth{}{}
, 如果一页中有多个 \markboth
, 那就由最后一个来决定 .而模板中的一个缺陷是: 使用 \hitsz@appendix@chapter
定义的章在换页之前先把 \markboth
定义成了新的章名
\NewDocumentCommand{\hitsz@appendix@chapter}{s m o}{%
\IfBooleanT{#1}%
{
\phantomsection
\markboth{#2}{#2} % <- 这里先定义了 \markboth
...
\hitsz@chapter*{#2} % <- 这里的 \hitsz@chapter 实际就是 \chapter, 这里才执行换页
}
}
正好, 定义 \listoffigures
的 \hitsz@listof
命令中就用了上面这个 \hitsz@appendix@chapter
, 于是就发生了这样的事
\input{back/acknowledgements} % <- \markboth{致谢}{致谢}
\listoffigures % <- \markboth{插图索引}{插图索引}, 再换页生成新的一章
这就导致在致谢这一页 \markboth
已经被 \listoffigures
改掉了, 从而页眉错误. 这里也要 @YangLaTeX 抽空处理一下.
知道问题在哪了就好解决了, 只需要把上面定义变成这样
\NewDocumentCommand{\hitsz@appendix@chapter}{s m o}{%
\IfBooleanT{#1}%
{
\phantomsection
...
\hitsz@chapter*{#2}
\markboth{#2}{#2} % <- 把 \markboth 放到这里
}
}
已解决,感谢感谢!
各位大佬,我这里出现页眉不匹配,应该怎么解决呢?