我想制作一个图表列表,但我希望它能分段制作。有人知道怎么做吗?我尝试过\renewcommand
但做不到。
答案1
一种方法是使用titletoc
包。此模板将帮助您入门。
示例中有 5 个表格和 6 个图表,分布在一章的三个部分中。
将为章节以及每个单独的部分生成本地表格列表和图表列表。
元素(图形或表格)的集合以 激活\startlist[<local name>]{<lof or lot>}
,以 结束 \stoplist[<local name>]{<lof or lot>}
。
可以使用 打印收集到的列表 \printlist[<local name>]{<lof or lot>}{}{}
。
对于出现的部分 lof 或 toc,必须至少编译两次。
这是完整的代码。
\documentclass{report}
\usepackage{titletoc} % needed <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\usepackage{kantlipsum}% only for dummy text
\begin{document}
\listoffigures
\listoftables
\tableofcontents
\chapter{First}
% start local list tables and figures for chapter
\startlist[localchaplot]{lot}
\startlist[localchaplof]{lof}
% print the list
\printlist[localchaplot]{lot}{}{}
\printlist[localchaplof]{lof}{}{}
\bigskip
1. \kant[1]
\newpage
\section{One}
% start local list tables and figures for section
\startlist[localseclot]{lot}
\startlist[localseclof]{lof}
\printlist[localseclot]{lot}{}{}
\printlist[localseclof]{lof}{}{}
\bigskip
% start section content
2. \kant[2]
\begin{table}[ht!]\caption{table 1 sec One}\end{table}
\begin{table}[ht!]\caption{table 2 sec One}\end{table}
\begin{table}[ht!]\caption{table 3 sec One}\end{table}
\begin{figure}[ht!]\caption{figure 1 sec One}\end{figure}
\begin{figure}[ht!]\caption{figure 2 sec One}\end{figure}
% end section content
% stop the local list for section
\stoplist[localseclot]{lot}
\stoplist[localseclof]{lof}
\newpage
\section{Two}
\startlist[localseclot]{lot}
\startlist[localseclof]{lof}
\printlist[localseclot]{lot}{}{}
\printlist[localseclof]{lof}{}{}
\bigskip
% start section content
3. \kant[3]
\begin{table}[ht!]\caption{table 4 sec Two}\end{table}
\begin{figure}[ht!]\caption{figure 3 sec Two}\end{figure}
\begin{figure}[ht!]\caption{figure 4 sec Two}\end{figure}
\begin{figure}[ht!]\caption{figure 5 sec Two}\end{figure}
% end section content
\stoplist[localseclot]{lot}
\stoplist[localseclof]{lof}
\newpage
\section{Three}
\startlist[localseclot]{lot}
\startlist[localseclof]{lof}
\printlist[localseclot]{lot}{}{}
\printlist[localseclof]{lof}{}{}
\bigskip
4. \kant[4]
\begin{table}[ht!]\caption{table 5 sec Three}\end{table}
\begin{figure}[ht!]\caption{figure 6 sec Three}\end{figure}
\stoplist[localseclot]{lot}
\stoplist[localseclof]{lof}
% stop the local list for chapter
\stoplist[localchaplot]{lot}
\stoplist[localchaplof]{lof}
% chapter ends
\end{document}