[Tex/LaTex] Indent further paragraphs in the caption of a table

captionsfloatsindentationparagraphstables

I have a little problem how to create a caption to my table. It looks ok as of now, but I would like to indent the heading of a new paragraph. Also right now, I cannot even create a new paragraph because an error pops up. I read that I have to give an optional argument to the caption to prevent the error (is there another method? I don't want to have additional names in my LOT)

But my main question is if it is possible to start new intendet paragraphs within a caption, BUT WITHOUT having the very first paragraph below the numbering indented. There is no such example in the documentation of the package caption, also \DeclareCaptionFormatdoes not work in this case because we don't wanna change #3 in general but rather the following paragraphs.

If you compile my example you will see a nice little table. Again, the only change I would like to make is indentation of further paragraphs in case of rather long captions.

Thanks for any hints.

\documentclass[a4paper, headsepline, smallheadings]{scrreprt}
\usepackage{mathptmx}
\usepackage{booktabs}
\usepackage[labelfont=bf, labelsep=newline,singlelinecheck=false,format=plain,indention=2cm]{caption}
\usepackage{floatrow}

\KOMAoption{captions}{tableheading}
\setcapindent{0em}

\begin{document}
\begin{table}[htpb]
\begin{floatrow}
\ttabbox{%
\begin{tabular}{lcccc}
& \multicolumn{4}{c}{xax} \\
\cmidrule(rl){2-5}
& 3543 & 34535 & 1233 & 32525 \\
\midrule
AA  & 543235sdgf35 & sdf35sf & sf35 & sdfsf543s \\
BB  & gsfg35sf & dfgdfg &
235sf & 235f \\
CC & sdfdsf & sffsf & sdfsdf & 353w5fs \\
\bottomrule
\end{tabular}}
{\caption{Here is the table caption. It should be indented from the following paragraph: \\ 'indented new paragraph'.}}
\end{floatrow}
\end{table}
\end{document}

edit: I am using the floatrow-package because it allows you to start the caption in the next line below the numbering of the table.
ttabbox has 2 arguments, the 1st is the table and the 2nd is the caption, that's really all there is to know about that, looks more complicated than it is.

Best Answer

The problem is that some of the macros governing the typesetting of the caption aren't \long, that is, they don't accept \par in their argument.

A quick workaround is to add an empty optional argument to \caption, which however would be bad if you want to typeset the list of tables.

A different workaround is to say

\DeclareRobustCommand{\captionpar}{\par}

in the preamble and use \captionpar instead of \par or an empty line in the caption. This hides \par from TeX's eyes when it's absorbing the argument; it's similar to using \endgraf, the difference is that ultimately the “real” \par will be used (\endgraf might not have the current meaning of \par).

A more drastic solution is to make the relevant commands \long:

\usepackage{etoolbox}
\makeatletter
\patchcmd[\long]{\caption@prepareanchor}{}{}{}{}
\patchcmd[\long]{\caption@@@addcontentsline}{}{}{}{}
\patchcmd[\long]{\addcontentsline}{}{}{}{}
\makeatother

With this patch you can even type

\caption{Here is the table caption. It should be indented from
         the following paragraph:

         'indented new paragraph'.}

instead of the more awkward

\caption{Here is the table caption. It should be indented from
         the following paragraph:\captionpar
         'indented new paragraph'.}

required by the solution above.

In any case, you need to define a parindent for the caption:

\usepackage[
  labelfont=bf,
  labelsep=newline,
  singlelinecheck=false,
  format=plain,
  indention=2cm,
  parindent=1em, % <--- adjust to suit
]{caption}

enter image description here

Related Question