我正在尝试使用 tocloft 格式化表格列表,但苦于不知道如何设置悬挂缩进,对于长标题,第一行之后的每一行都会缩进特定量。这在 tocloft 中可行吗?
以下是 MWE:
\documentclass[11pt]{article}
\usepackage{tocloft}
\begin{document}
\listoftables
\begin{table}
\begin{center}
\begin{tabular}{ |c|c|c| }
\hline
cell1 & cell2 & cell3 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
\hline
\end{tabular}
\caption{This is an extremely long table caption, which will need to be hanging indented inside of the list of tables, }
\end{center}
\end{table}
\end{document}
答案1
目录中的内容在标题中不起作用,因此您需要指定两者(特别是如果您不想在标题中悬挂缩进)。
\documentclass[11pt]{article}
\usepackage{tocloft}
\usepackage{caption}
\newcommand{\mycaption}[1]% duplicate long and short captions
{\caption[\addtolength{\leftskip}{\bibindent}\hspace{-\bibindent}#1]{#1}}
\captionsetup{format=hang}
\begin{document}
\listoftables
\begin{table}
\begin{center}
\begin{tabular}{ |c|c|c| }
\hline
cell1 & cell2 & cell3 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
\hline
\end{tabular}
\mycaption{This is an extremely long table caption, which will need to be hanging indented inside of the list of tables, }
\end{center}
\end{table}
\end{document}