# Creating a second caption for a figure that won't appear in the figure's list index and is aligned with the first

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:

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
{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?

-
Welcome to TeX.SE. While code snippets are useful for explaining your code, it is always best to compose a MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. –  Peter Grill Nov 9 '11 at 4:23
Hi Canella! I would recommend you split this question into two, that will make the information much more accessible to people coming across this later on. Also, as Peter said, complete minimal examples are almost always a good idea (certainly in this case). –  Jake Nov 9 '11 at 4:30
Thanks for the tips @Peter. I will keep that in mind the next time I ask a question here. ;) –  Canella Nov 12 '11 at 1:12
Hey @Jake, Gonzalo answered both of my questions, but I will take care to post only one question the next time I use the stack. ;) –  Canella Nov 12 '11 at 1:14

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}

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


-
In my solution I considered captions spanning one line; for longer captions some adjustments might be needed. –  Gonzalo Medina Nov 9 '11 at 5:20
Hey @Gonzalo, I can't thank you enough for these samples you posted to me. Honestly, I didn't know it was possible to automate something like this. Thank you. –  Canella Nov 12 '11 at 1:06