I would like to have two captions for some tables and figures, where the first caption describes the general content and the second caption provides some additional information.
The idea is to have the second caption left-aligned with the caption text of the first caption rather than with the caption label, that is, left-aligned with the description of the contents of the table (figure) rather than with the word Table (Figure).
I thought the option [format=hang,indention=0cm] from the caption package would achieve that but the second caption appears centered. I would have thought that the second caption would be treated as a second paragraph in the caption but clearly I'm wrong (see Table 1).
I found a similar query in this site (see here), hence I modified a bit the code in the suggested answer. For short captions it works well (see Table 2), but for long captions, the second caption is not aligned with the first (see Table 3). I realise that my code probably is far from efficient and hence it is introducing some bugs, so any help will be greatly appreciated.
\documentclass{article}
\usepackage[format=hang,indention=0cm]{caption}
% some auxiliary lengths for aligning the captions
\newlength\mylena
\newlength\mylenb
\newlength\mylenc
% new command: \MyCaption{First numbered caption}{Second unnumbered caption}
\newcommand\MyCaption[2]{%
\captionsetup{belowskip=-\baselineskip}
\settowidth\mylena{\tablename~\thetable:~ #1}
\settowidth\mylenb{\small{#2}}
\settowidth\mylenc{\tablename~\thetable:~}
\caption{#1}
\caption*{\hspace*{\dimexpr%
\mylenb - \mylena + \mylenc + \mylenc \relax}
\small{#2}}
\setlength\belowcaptionskip{\baselineskip}
}
\begin{document}
\begin{table}[ht]
\caption[LoT entry]{The first caption
(The second caption)}
\centerline{
\begin{tabular}{lrr}
\hline
& C1 & C2 \\
\hline
R1 & & \\
R2 & & \\
\hline
\end{tabular}
}
\end{table}
\begin{table}[ht]
\MyCaption{The first caption}{(The second caption)}
\centerline{
\begin{tabular}{lrr}
\hline
& C1 & C2 \\
\hline
R1 & & \\
R2 & & \\
\hline
\end{tabular}
}
\end{table}
\begin{table}[ht]
\MyCaption{A long first caption A long first caption A long first caption A long first caption A long first caption }{(A long second caption A long second caption A long second caption A long second caption A long second caption )}
\centerline{
\begin{tabular}{lrr}
\hline
& C1 & C2 \\
\hline
R1 & & \\
R2 & & \\
\hline
\end{tabular}
}
\end{table}
\end{document}