2

I am trying to format a List of Tables using tocloft, and I am having a devil of a time figuring out how to have hanging indents, where for long captions every line after the first is indented by a specific amount. Is this even possible in tocloft?

Here is a 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}
  • By how much should the second line (and any following lines) be indented? – Mico Nov 6 '15 at 19:37
  • By an arbitrary amount, say 10pt? – Teague Nov 6 '15 at 19:43
  • Hmmm, I thought this was going to be straightforward to achieve, e.g., by issuing the command \renewcommand\cfttabaftersnumb{\hangindent=10pt\hangafter=1}. However, that doesn't seem to work. :-( – Mico Nov 6 '15 at 20:08
1

What works in the toc doesn't work in the caption, so you will need to specify both (especially if you don't want hanging indentation in the caption).

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.