![使用 Endfloat 更正阿拉伯语章节编号](https://linux22.com/image/283760/%E4%BD%BF%E7%94%A8%20Endfloat%20%E6%9B%B4%E6%AD%A3%E9%98%BF%E6%8B%89%E4%BC%AF%E8%AF%AD%E7%AB%A0%E8%8A%82%E7%BC%96%E5%8F%B7.png)
本 MWE 第二章中的第一个表格标记为“表 2.2 关于此处”。章节编号设置不正确,因为 Endfloat 通常只是在整个文档中按顺序对表格进行编号。如何确保第二章中的第一个表格列为“表 2.1 关于此处”?
\documentclass[oneside,12pt]{book}
\usepackage[tablesfirst,notablist]{endfloat}
\usepackage{titletoc}
\renewcommand\theposttable{\arabic{chapter}.\arabic{posttbl}}
\renewcommand\thepostfigure{\arabic{chapter}.\arabic{postfig}}
\begin{document}
\chapter{Data}
\startlist{lot}
\begin{table}
\caption{Data chapter table}
\begin{tabular}{c}
123 \\
\end{tabular}
\end{table}
\printlist{lot}{}{\chapter*{List of tables in Chapter~\thechapter}}
\processdelayedfloats
\chapter{Learning}
\startlist{lot}
\begin{table}
\caption{Learning chapter table}
\begin{tabular}{c}
123 \\
\end{tabular}
\end{table}
\printlist{lot}{}{\chapter*{List of tables in Chapter~\thechapter}}
\processdelayedfloats
\end{document}
答案1
您可以使用chngcntr
包并重置每章的计数器。另请注意,从 2.5 版开始,计数器posttbl
和已被postfigurepostfig
取代。摘自手册:posttable and
\documentclass[oneside,12pt]{book}
\usepackage[tablesfirst,notablist]{endfloat}
\usepackage{titletoc}
\usepackage{chngcntr} %% <-- new
\counterwithin{posttable}{chapter} %% <-- new
\counterwithin{postfigure}{chapter} %% <-- new
\renewcommand\theposttable{\arabic{chapter}.\arabic{posttable}}
\renewcommand\thepostfigure{\arabic{chapter}.\arabic{postfigure}}
\begin{document}
\chapter{Data}
\startlist{lot}
\begin{table}
\caption{Data chapter table}
\begin{tabular}{c}
123 \\
\end{tabular}
\end{table}
\printlist{lot}{}{\chapter*{List of tables in Chapter~\thechapter}}
\processdelayedfloats
\chapter{Learning}
\startlist{lot}
\begin{table}
\caption{Learning chapter table}
\begin{tabular}{c}
123 \\
\end{tabular}
\end{table}
\printlist{lot}{}{\chapter*{List of tables in Chapter~\thechapter}}
\processdelayedfloats
\end{document}