[Tex/LaTex] Creating a second caption for a figure that won’t appear in the figure’s list index and is aligned with the first

captionssubfloatstable of contents

I decided to write my completion of course work for my computer's science degree using LaTeX, contrary to university's popular choice, MS Word.

I had a great time venturing though this tool and I must say that I loved it, but I'm having some troubles adapting some of the formatting rules that my university uses, specially with captions.

Inserting figures is a piece of cake, but formatting the caption to look like the way my university wants it is not. Take a look at the picture below:

enter image description here

The figure shown here is centered to the text, and so is the first caption. I've achieve this with the caption package:

\usepackage[center,small]{caption}

The second caption must be left aligned with the first one, and it must not be present at the figures list index.

Even after some though search on the internet, I could not find anything related to creating a second caption (or subcaption) right bellow the first one.

Actually, I don't think this kind of customization has ever been implemented by any package at all.

So what I want to know is: "What's the best way to achieve this specific caption formatting?".

I have another doubt related to customizing the figure's list index at the begging of my paper. I'm using these two commands …

% Creates an auxiliary command for the criation of the figures list
\newcommand{\figfillnum}[1]{%
  {\hspace{1em}\normalfont\dotfill}\nobreak
  \hb@xt@\@pnumwidth{\hfil\normalfont #1}{}\par}

% Changes the way that the figure's list is printed
\renewcommand*{\l@figure}[2]{
    \leftskip 3cm
    \rightskip 2cm
    \parfillskip -\rightskip
    \parindent 0cm
    \@tempdima 2.0em
    \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
    {Figure \normalfont #1}\nobreak \figfillnum{#2}}

… to create an output like this one:

Figure 1    Gauntlet ................................................... 1

What I need to do here is to add a dot after the number following the "Figure" text, like this:

Figure 1.   Gauntlet ................................................... 1

I studied those two commands, and I realized that the second one (\l@figure) is the one responsible for placing the "Figure" text, and that it's #1 argument represents this text: "1 \tab Gauntlet".

Now, I don't know where #1 comes from, but what I need to do here is to place a dot between those two words contained in the #1 argument.

Is this possible? How?

Best Answer

Here's one possible solution using some features provided by the caption package: basically, \caption for the numbered caption and \caption* for the unnumbered caption and some calculations to align both captions; the customization of the list of figures was done using the tocloft package:

\documentclass{article}
\usepackage{tocloft}
\usepackage[small]{caption}

\captionsetup[figure]{labelsep=period,textformat=period,font=it}

% some auxiliary lengths for aligning the captions
\newlength\mylena
\newlength\mylenb

% syntax: \MyCaption{First numbered caption}{Second unnumbered caption}
\newcommand\MyCaption[2]{%
  \captionsetup{belowskip=-\baselineskip}
  \settowidth\mylena{\small\itshape\figurename~\thefigure. #1.}
  \settowidth\mylenb{\small\itshape #2.}
  \caption{#1}
  \caption*{\hspace*{\dimexpr\mylenb-\mylena\relax} #2}
  \setlength\belowcaptionskip{\baselineskip}
}

% settings for the list of figures
\renewcommand\cftfigpresnum{Figure }
\renewcommand\cftfigaftersnum{.}
\newlength\mylend
\settowidth\mylend{\cftfigpresnum\cftfigaftersnum}
\addtolength\cftfignumwidth{\mylend}

\begin{document}

\listoffigures

\begin{figure}
  \centering
  \rule{6cm}{2cm}
  \MyCaption{Gauntlet}{Source: Atari Games 1990}
 \end{figure}

\begin{figure}
  \centering
  \rule{8cm}{2cm}
  \MyCaption{Some test text}{And some more text for testing purposes}
 \end{figure}

\end{document}

enter image description here

Related Question