Short caption in margin

Is it possible to insert the short caption of a figure in the margin next to it? I tried to get it working with etoolbox but without success. Additionally it has to work with the package subcaption loaded.

MWE:

\documentclass{article}
\usepackage[demo]{graphics}
\usepackage{marginnote}
\usepackage{sidenotes}
\usepackage{subcaption}

% maybe use
\usepackage{etoolbox}

\begin{document}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, \marginpar{I want the short caption like this}
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida

\begin{figure}
\includegraphics{test}
\caption[Short Caption]{My Long Caption}
\end{figure}
\listoffigures
\end{document}

• Can you not use \caption[Short Caption]{My Long Caption\marginnote{Short caption}}? – user11232 Feb 13 '15 at 14:02
• marginnote is fine, however I don't wanna repeat the short caption. Hence I tried to use etoolbox – Manuel Schmidt Feb 13 '15 at 14:19

If you need it automatically done for every \caption, you can add the following to your preamble:

\let\oldcaption\caption
\renewcommand{\caption}[2][\empty]{%
\ifx#1\empty%
\oldcaption{#2}%
\else%
\oldcaption[#1]{\marginnote{#1}#2}%
\fi}


If no short caption is given, nothing will happen. If a short caption is given, it will append a \marginnote to the caption, containing the short caption.

To avoid compatibility issues with the caption package, you can wrap it inside a \caption@AtBeginDocument like this:

\makeatletter
\caption@AtBeginDocument{%
\let\oldcaption\caption
\renewcommand{\caption}[2][\empty]{%
\ifx#1\empty%
\oldcaption{#2}%
\else%
\oldcaption[#1]{\marginnote{#1}#2}%
\fi}%
}
\makeatother

• I think he would still want the short caption in the list of figures. – John Kormylo Feb 13 '15 at 17:27
• The short caption should be in the list of figures. – TonioElGringo Feb 13 '15 at 17:30
• So it is. One other thing, shouldn't the \marginote go before #2 in case the long caption is more than one line? – John Kormylo Feb 13 '15 at 18:18
• Thx, but I mentioned that it has to work with subcaption loaded. I tried your approach before and got ! Package caption Error: The subcaption' package does not work correctly – Manuel Schmidt Feb 16 '15 at 7:20
• @JohnKormylo Right, it is better. Thanks! @ManuelSchmidt I may not have an old version of the caption` package, but see my updated answer. Hope it works for you (remember to compile at least twice so that the note position is correct). – TonioElGringo Feb 16 '15 at 9:12