When I write captions, I always type the first sentence twice, once in square brackets to use it in the list of figures, and a second time so that it appears underneath the figure with the rest of the caption (as described http://en.wikibooks.org/wiki/LaTeX/Floa ... and_tables). Is there a way to automate the inclusion of the short caption in the long one? I'd prefer not to type it twice, but the bigger problem is forgetting to make changes to both when editing.
I'm envisioning something like:
\begin{figure}[hb]
\includegraphics{someImage}
\caption[The astonishing results were highly significant]
{Unfortunately, the data were fabricated.}
\end{figure}
That would produce a listing in listoffigures:
The astonishing results were highly significant.
and a caption of,
The astonishing results were highly significant. Unfortunately, the data were fabricated.
I could add a kludgy sed command to my typesetting script, but I'd like to go with something as robust as possible.
Thanks!
Graphics, Figures & Tables ⇒ streamlining caption use for listoffigures
-
- Posts: 2
- Joined: Wed Feb 10, 2010 1:53 am
NEW: TikZ book now 40% off at Amazon.com for a short time.

streamlining caption use for listoffigures
Hi,
perhaps something along the lines of the command \mycaption
defined below could be useful:
Please note that both arguments of \mycaption are mandatory so you must use curly braces for both of them.
perhaps something along the lines of the command \mycaption
defined below could be useful:
Code: Select all
\documentclass{report}
\newcommand\mycaption[2]{\caption[#1]{#1.\ #2}}
\begin{document}
\listoffigures
\begin{figure}[!ht]
\centering
\rule{4cm}{2cm}
\mycaption{The astonishing results were highly significant}
{Unfortunately, the data were fabricated.}
\label{fig:test}
\end{figure}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
-
- Posts: 2
- Joined: Wed Feb 10, 2010 1:53 am
Re: streamlining caption use for listoffigures
Wow. Perfect. Thanks!