我有一份包含 2 个部分的文档(见下面的示例),每个部分都有一个图表列表和表格列表,这些列表列在部分内容和全局内容中。但是,当查看列出第 13 页和第 29 页图表(或第 15 页或第 31 页表格)的页面时,我在标题中看到的是“第 1 章。某些章节”,而不是“图表列表”或“表格列表”。
我怎样才能在标题中输入“图表列表”或“表格列表”?
\documentclass[12pt,twoside,openright]{report}
\usepackage[english]{babel}
\usepackage{emptypage}
\usepackage{fancyhdr}
\usepackage{titlesec,titletoc}
\setlength{\headheight}{14.5pt}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\partmark}[1]{\markboth{#1}{}}
\renewcommand{\chaptermark}[1]{\markright{{\chaptername}\ \thechapter.\ #1}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\renewcommand\headrulewidth{0.1pt}
\renewcommand\footrulewidth{0.1pt}
\fancyhf{}
\fancyhead[LO,RE]{\nouppercase\rightmark}
\fancyfoot[LE,RO]{\thepage}
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand{\headrulewidth}{0.1pt}
\renewcommand{\footrulewidth}{0.1pt}
\fancyhead[LO,RE]{\nouppercase\rightmark}
\fancyfoot[C]{}
\fancyfoot[LE,RO]{\thepage}
}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\markboth{Contents}{}
\cleardoublepage
\pagenumbering{arabic}
\setcounter{chapter}{0}
\startcontents[parts]
\startlist[mylof]{lof}
\startlist[mylot]{lot}
\part{A part}
\chapter*{Contents}
\printcontents[parts]{}{-1}{\setcounter{tocdepth}{3}}
\chapter{Some chapter}
% create a bunch of items to fill pages in the lists of tables and figures
\def\z{
\begin{figure}[htp]
\caption{A}
\end{figure}
zz
\begin{table}[htp]
\caption{B}
\end{table}
zz
}
\z\z\z\z\z\z\z\z\z\clearpage
\z\z\z\z\z\z\z\z\z\clearpage
\z\z\z\z\z\z\z\z\z\clearpage
\z\z\z\z\z\z\z\z\z
% \phantomsection
% \listoffigures
\addcontentsline{toc}{chapter}{List of figures}
\printlist[mylof]{lof}{0}{\chapter*{List of figures}}
% \listoftables
\addcontentsline{toc}{chapter}{List of tables}
\printlist[mylot]{lot}{0}{\chapter*{List of tables}}
\stoplist[mylof]{lof}
\stoplist[mylot]{lot}
\stopcontents[parts]
\setcounter{chapter}{0}
\startcontents[parts]
\startlist[mylof2]{lof}
\startlist[mylot2]{lot}
\part{A other part}
\chapter*{Contents}
\printcontents[parts]{}{-1}{\setcounter{tocdepth}{3}}
\chapter{Some chapter}
% create a bunch of items to fill pages in the lists of tables and figures
\def\z{
\begin{figure}[htp]
\caption{A}
\end{figure}
zz
\begin{table}[htp]
\caption{B}
\end{table}
zz
}
\z\z\z\z\z\z\z\z\z\clearpage
\z\z\z\z\z\z\z\z\z\clearpage
\z\z\z\z\z\z\z\z\z\clearpage
\z\z\z\z\z\z\z\z\z
% \phantomsection
% \listoffigures
\addcontentsline{toc}{chapter}{List of figures}
\printlist[mylof2]{lof}{0}{\chapter*{List of figures}}
% \listoftables
\printlist[mylot2]{lot}{0}{\chapter*{List of tables}}
\addcontentsline{toc}{chapter}{List of tables}
\stoplist[mylof2]{lof}
\stoplist[mylot2]{lot}
\stopcontents[parts]
\end{document}
答案1
所以下面的代码可以解决你的问题:
\addcontentsline{toc}{chapter}{List of figures}
\printlist[mylof2]{lof}{0}{\chapter*{List of figures}\markboth{List of Figures}{List of Figures}}
% \listoftables
\printlist[mylot2]{lot}{0}{\chapter*{List of tables}\markboth{List of Tables}{List of Tables}}
\addcontentsline{toc}{chapter}{List of tables}