# How i can display short title into listoffigures with a custom caption with description

I would like to know if it is possible to combine the two next codes, i.e have a caption with a descrition and put only the short title into the listoffigures of TOC ?

This one

\caption[short title for list of figures]{long title for text}


with the custom caption with title + description Set different styles for "main" caption and description

\documentclass{article}
\newcommand\mycaption[2]{\caption{\textbf{#1}\newline\small#2}}
\begin{document}
\begin{figure}
\mycaption{Caption title}{I would like this sentence to be under the
title and smaller.}
\end{figure}
\end{document}


You can force the first argument as an optional argument for \caption:

\documentclass{article}

\newcommand{\mycaption}[2]{%
\caption[#1]{\textbf{#1}\newline\small#2}%
}

\begin{document}

\listoffigures

\begin{figure}[!h]
\mycaption
{Caption title}
{I would like this sentence to be under the title and smaller.}
\end{figure}

\end{document}


It would be possible to add an optional argument to \mycaption that would work in the same way you currently use \caption, allowing you to specify a different entry for the LoF.

• thx it's perfect ! – Tof Oct 11 '17 at 21:12

Here is a solution:

\documentclass{article}
\usepackage{graphicx}
\usepackage{float}
\newcommand\mycaption[3][\testOpt]{\xdef\testOpt{#2}\caption[#1]{\textbf{#2}\newline\small#3}}

\begin{document}
\listoffigures

\begin{figure}[H]
\mycaption[ Short Caption title]{Long Caption title}{I would like this sentence to be under the
title and smaller.}
\includegraphics[width=0.5\linewidth]{example-image-a}
\end{figure}

\begin{figure}[H]
\mycaption{Caption title}{I would like this sentence to be under the
title and smaller.}
\includegraphics[width=0.5\linewidth]{example-image-b}
\end{figure}

\end{document}


Output:

• thx it's perfect ! – Tof Oct 11 '17 at 21:09