我想将图表列表的外观更改为下面示例中“新图表列表”下的外观:在 lof 的标题和条目之间,我想要一行,其中包含两个小写字母的副标题,“figure”和“caption”。然后,在垂直空间之后是图号、水平空间、标题,然后是没有虚线但只有一小段空间,然后是页码。我知道 latex 不会将 lof、toc 等作为表格处理,而是将其作为列表处理,我将其格式化为表格只是为了举例。
\documentclass{memoir}
\usepackage{float}
% \usepackage{tocloft} % Actually I haven't used it yet.
\usepackage{ltablex}
\renewcommand\printloftitle[1]{\section*{#1}}
\renewcommand\afterloftitle{}
\begin{document}
\listoffigures
\section*{New List of Figures}
\vspace{-\baselineskip}
\begin{tabularx}{\linewidth}{@{}lX}
\textsc{figure} & \textsc{caption}\\
\\
0.1 & myfigureA \quad 1\\
0.2 & myfigureB \quad 1\\
0.3 & myfigureC has a longer caption, longer than a line. Still a little bit longer. \quad 1\\
\end{tabularx}
\begin{figure}[H]
\centering
AAA\\
AAA\\
AAA\\
\caption{myfigureA}
\end{figure}
\begin{figure}[H]
\centering
BBB\\
BBB\\
BBB\\
\caption{myfigureB}
\end{figure}
\begin{figure}[H]
\centering
CCC\\
CCC\\
CCC\\
\caption{myfigureC has a longer caption, longer than a line. Still a little bit longer.}
\end{figure}
\end{document}
编辑:Mike Renfro 的回答对我来说几乎可以正常工作,但是长标题存在一个问题,即它的最后一个单词和数字会打印在行末:
\documentclass{memoir}
\usepackage{calc}
\renewcommand\printloftitle[1]{\section*{#1}}
\renewcommand\afterloftitle{\vspace{\baselineskip}\textsc{Figure\quad Caption}\\}
\setlength{\cftfigurenumwidth}{\widthof{\textsc{Figure\quad}}}
\renewcommand{\cftfigureleader}{}
\begin{document}
\listoffigures
\begin{figure}
\caption{myfigureA}
\end{figure}
\begin{figure}
\caption{myfigureB}
\end{figure}
\begin{figure}
\caption{myfigureC has a longer caption, longer than a line. Still a little bit longer.}
\end{figure}
\end{document}
答案1
此答案不包括float
或ltablex
包,因为它们似乎不会以某种方式影响事物。如果您想要在 LoF 上方使用小写字母标题,只需相应地调整\afterloftitle
和\widthof
命令即可。
\documentclass{memoir}
\usepackage{calc} % for calculating width of LoF headings
\renewcommand\printloftitle[1]{\section*{#1}}
\renewcommand\afterloftitle{Figure Caption}
% adds a line of text after the LoF title
\setlength{\cftfigurenumwidth}{\widthof{Figure }}
% instead of "Figure " including the space, you can use whatever precedes the
% "Caption" header above
\renewcommand{\cftfigureleader}{}
% removes the dot leader between the figure title and the page number
\renewcommand{\cftfigureafterpnum}{\cftparfillskip}
% Ensure ragged right overall (http://tex.stackexchange.com/questions/53057/)
\begin{document}
{\raggedright
\listoffigures
}
\begin{figure}
\caption{myfigureA}
\end{figure}
\begin{figure}
\caption{myfigureB}
\end{figure}
\begin{figure}
\caption{myfigureC has a longer caption, longer than a line. Maybe a good bit longer. Or even longer still.}
\end{figure}
\end{document}