[Tex/LaTex] How to give floats/figures titles

captionsfloats

Below is an excerpt from my thesis, showing a figure with a caption.

I'd like to give the figure a title too, that is, a few words written above the figure.

Can I do that in latex? If so, how?

enter image description here

\begin{figure}
\includegraphics[width=\linewidth]{./graphics/chapter6/mouse.pdf}
\caption{Blablabla}
\label{fig:length_eight_mouse}
\end{figure}

Best Answer

The {figure} environment isn't limited to contain only figures etc. You can add anything so just type in your title above the figure.

manually

\begin{figure}
    \centering
    \textbf{Your title}\par\medskip
    \includegraphics[scale=0.3]{example-image}
    \caption{Your caption}
\end{figure}

You can define a new command like \figuretitle to make the formatting and spacing consistent.

\newcommand*{\figuretitle}[1]{%
    {\centering%   <--------  will only affect the title because of the grouping (by the
    \textbf{#1}%              braces before \centering and behind \medskip). If you remove
    \par\medskip}%            these braces the whole body of a {figure} env will be centered.
}

Looks the same as above, but can be used as

\begin{figure}
    \centering
    \figuretitle{Your title}
    \includegraphics[scale=0.3]{example-image}
    \caption{Your caption}
\end{figure}

Or you can use the \caption above the figure. In this case you may use the caption package to adjust the spacing.

caption above

\documentclass{article}

\usepackage{graphicx}

\usepackage{caption}
\captionsetup[figure]{
    position=above,
}

\begin{document}
\begin{figure}
    \centering
    \caption{Your caption}
    \includegraphics[scale=0.3]{example-image}
\end{figure}
\end{document}