Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am submitting an article to a journal with the following requirement:

Figure legends should be listed one after the other, as part of the text document, separate from the figure files.

Currently, my figure captions are in the format

\caption[short caption]{full caption}

And I only want the full caption to appear.

Can I insert the complete figure legends in a list of figures, and exclude them from the figure itself?

(Edit: without changing the behavior of table captions?)

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

This seems be what you're after...

Using the caption package you can modify captions by removing the label separator. Additionally, I've redefined \caption so you only need to specify a single (mandatory) argument. (Edit: Moved redefinition to after \begin{document}.) oldcaption gives the default behavior of caption.

\documentclass{article}
\usepackage{caption}% http://ctan.org/pkg/caption
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage[demo]{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{letltxmacro}% http://ctan.org/pkg/letltxmacro
\DeclareCaptionTextFormat{none}{} \captionsetup[figure]{labelsep=none,textformat=none}

\begin{document}

\tableofcontents
\listoffigures
\section{First section}
\lipsum[1]
\begin{figure}[ht]
  \centering \includegraphics{image1}
  \caption[Unused first legend]{This is a first legend}
\end{figure}
\lipsum[2]
\begin{table}[ht]
\caption[a, b, and c]{The first $3$ letters of the alphabet}
\centering
\begin{tabular}{lll}
  \hline 
  a & b & c \\ 
  \hline
\end{tabular}
\end{table}
\lipsum[1]
\begin{figure}[ht]
  \centering \includegraphics{image2}
  \caption[Unused second legend]{This is a second legend}
\end{figure}
\lipsum[3]
\end{document}

enter image description here

lipsum provides filler text, while the demo option to graphicx is just meant for this MWE example, since it doesn't have images included. Captions are just typeset as Figure <num>, while the actual figure caption is included in the "List of Figures".

share|improve this answer
1  
The example code will issue the warning "Package caption Warning: \caption will not be redefined since it's already redefined by a document class or package which is unknown to the caption package.". So IMHO one better put the redefinition of \caption inside \AtBeginDocument. –  Axel Sommerfeldt Oct 5 '11 at 5:25
    
@AxelSommerfeldt: Agreed, or move the \renewcommand{\caption}{...} to after \begin{document}. –  Werner Oct 5 '11 at 5:29
    
An alternative option would be dropping the redefinition of \caption and using \DeclareCaptionTextFormat{none}{} \captionsetup{labelsep=none,textformat=none} instead. –  Axel Sommerfeldt Oct 5 '11 at 5:30
1  
@David: I've updated my code. The only change is actually: renewcommand{\caption}[2][]{\oldcaption[#2]{}} which now allows for an optional first argument to \caption[..]{...}. It is not used at all in the document (it's discarded). –  Werner Oct 5 '11 at 21:01
1  
The actual version 3.2c of the caption package has a new option textformat=empty, so \usepackagelabelsep=none,textformat=empty]{caption} should do the trick, too. –  Axel Sommerfeldt Oct 12 '11 at 16:25
show 5 more comments

In the following solution the list of captions is printed at the end of the document. It has the advantage that it's sufficient to comment out the added code in order to have the normal version of the document printed. In the final list only "long captions" will be printed, while the normal list will have the short ones.

\documentclass[a4paper]{article}
\usepackage{lipsum}

\makeatletter
\usepackage{shorttoc,letltxmacro,etoolbox}
\LetLtxMacro{\ORIcaption}{\caption}
\renewcommand{\caption}{\@dblarg{\x@caption}}
\def\x@caption[#1]#2{\ORIcaption[\shortcaption{#1}\longcaption{#2}]{#2}}
\DeclareRobustCommand{\shortcaption}{}
\DeclareRobustCommand{\longcaption}{}
\let\ORIlistoffigures\listoffigures
\renewcommand{\listoffigures}{%
  \begingroup
    \def\shortcaption##1{##1} \def\longcaption##1{}
    \anothertableofcontents[lof]{\jobname}{\listfigurename}{1}
  \endgroup}
\newcommand{\listofcaptions}{\newpage
  \pagestyle{empty}
  \begingroup
    \def\shortcaption##1{} \def\longcaption##1{##1}%
    \def\listfigurename{Captions to figures}%
    \def\l@figure##1##2{\@dottedtocline{1}{1.5em}{2.3em}{##1}{}}%
    \patchcmd{\@dottedtocline}{\hbox{.}}{}{}{}%
    \listoffigures
    \endgroup}
\AtEndDocument{\listofcaptions}
\makeatother

\begin{document}

\listoffigures

\lipsum[1]

\begin{figure}
X
\caption{This has only a long caption}
\end{figure}

\begin{figure}
Y
\caption[This short one]{This has also a short caption}
\end{figure}

\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.