I am trying to use the tweak provided in Display short title and long title (both) in a caption? together with the subcaption package.
Unfortunatelly it breaks:
\documentclass{scrartcl}
\usepackage{subcaption}
\makeatletter
\let\x@caption\caption % original \caption
\def\x@@caption[#1]#2{\x@caption[{#1}]{#1 --- #2}} % with optional arg
\def\x@@@caption#1{\x@caption[{#1}]{#1}} % without optional arg
\def\caption{\@ifnextchar[\x@@caption\x@@@caption} % new \caption
\makeatother
\begin{document}
\listoffigures
\begin{figure}
\centering
\rule{5cm}{5cm}
\caption[Optional text.]{Obligatory text.}
\end{figure}
\begin{figure}
\centering
\rule{5cm}{5cm}
\caption{Obligatory text only.}
\end{figure}
\end{document}
I am using many subfigures in my document, so going away from the subcaption package is no alternative.
Edit:
Using the caption package with option \usepackage[compatibility=false]{caption}
does produce figure captions of the intended format (Optional text. -- Obligatory text.) with the corresponding list of figures entry (Optional text.). Thanks to TeXnician for the remark.