amsbook - 定制 LOT 和 LOF

amsbook - 定制 LOT 和 LOF

我修改了 amsbook 类中的 LOT 和 LOF,以便编号显示为例如“表 1.1”,而不仅仅是“1”。下面的 MWE 就是这样做的。但是,它弄乱了标题的对齐方式:第一行和第二行的缩进量不一致。

我的问题是:

  1. 我如何才能对齐 LOT 和 LOF 中的标题?
  2. 我怎样才能在页码前加上点?(例如,\@dottedtocline)

请注意,我必须使用 amsbook,因此无法使用 tocloft 包。谢谢您的建议。

\documentclass[12pt, oneside]{amsbook}

% Customize list of tables and list of figures
\usepackage{chngcntr} \counterwithin{figure}{chapter}
\counterwithin{table}{chapter} 
\makeatletter  
\def\l@figure#1#2{\@tocline{0}{3pt plus2pt}{0pt}{3pc}{}{Figure #1}{#2}}  
\def\l@table#1#2{\@tocline{0}{3pt plus2pt}{0pt}{3pc}{}{Table #1}{#2}} 
\makeatother

\begin{document}

\listoffigures 

\begin{figure}
\caption[Caption in the LOF extends beyond one line, but the second line is not aligned with the first line.]{Long caption...}
\end{figure} 

\end{document}

答案1

这里有一个例子,它应该能给出你想要的结果amsbook

\documentclass{amsbook}
\usepackage{etoolbox}

% Leader dots in toc
\makeatletter
%\renewcommand\@pnumwidth{1em} % <-- depending on total number of pages
\patchcmd{\@tocline}
  {\hfil}
  {\leaders\hbox{\,.\,}\hfil}
  {}{}
% Insert "Figure" or "Table" in "list of" entries
\newcommand\numberprefix{}
\def\numberline#1{\hb@xt@\@tempdima{\numberprefix #1\hfil}}
\def\l@figure#1#2{\@tocline{0}{3pt plus2pt}{0pt}{5pc}{}%
  {\renewcommand\numberprefix{Figure~}#1}{#2}}
\def\l@table#1#2{\@tocline{0}{3pt plus2pt}{0pt}{5pc}{}%
  {\renewcommand\numberprefix{Table~}#1}{#2}}
\makeatother

\begin{document}

\tableofcontents
\listoffigures
\listoftables

\chapter{test}

For TeX.sx question \#310359.

\section{section}
some text

\begin{figure}
some figure stuff
\caption{Test figure.  Make this a very long caption so that it will
  be forced to a second line in the list of figures, to check
  alignment.}
\end{figure}

\begin{table}
\caption{Test table}
some table stuff
\end{table}
\end{document}

相关内容