I'm currently writing my thesis and I'm struggling with my redefinition of the caption command.
I've got large captions which I don't want to show up in my list of figures. Of each caption I want only to use the first sentence. In some captions I would like to refer to other floats using the cleveref package. Below a minimal example is given.
\documentclass{article}
\usepackage{cleveref}
\def\mcaption#1{%
\begingroup
\edef\@tempa{#1}%
\expandafter\endgroup
\expandafter\split\@tempa\relax
}
\def\split#1.#2\relax{\caption[#1]{#1.#2}}
\begin{document}
\listoffigures
\begin{figure}
\centering
Insert figure here
\mcaption{This is a working caption. One can see that ......}
\label{fig:abc}
\end{figure}
\begin{figure}
\centering
Insert figure here
\mcaption{This caption does not work. See also Figure \cref{fig:abc}}
\end{figure}
\end{document}
This fails to produce a PDF with the following error message:
./temp.tex:27: Undefined control sequence. \@cref ...oup =1\count@group =1\def \cref@variant {#1}\newif \if@secondref ... l.27 ... not work. See also Figure \cref{fig:abc}}
./temp.tex:27: Undefined control sequence. \if@secondref
Is it possible to do what I want or should I forgo the idea of referencing other floats in a caption?
\mcaption{First sentence}{Rest of the caption}
: just as easy to type and much easier to parse for TeX. So\newcommand{\mcaption}[2]{\caption[#1]{#1. #2}}