Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
Did you create the plot with matplotlib? Then you could also add a title there, though the font wouldn't match the document font. –  Torbjørn T. Aug 14 '13 at 11:42
    
Yes, that's why I did not include one there. The fonts did not match and it all became so tacky. –  The Unfun Cat Aug 14 '13 at 11:44
    
The fonts don't match on your axis scales either (and presumably your axis labels) - your are labelling your axes I assume? I've just been testing an alternative approach for my thesis - see my answer below. –  Chris H Aug 15 '13 at 11:51

2 Answers 2

up vote 7 down vote accepted

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}
share|improve this answer
    
Thanks. Ps. for other newbs: \newcommands should be inserted in your config-file to get it to work in every chapter. In my case this is classicthesis-config.tex. –  The Unfun Cat Aug 14 '13 at 11:54
1  
This is not wrong but neither correct ;-) You can place the definition anywhere in sour document and use it frome there on. It is common sense to put definition in the preamble, i.e. the part before `\begin{document}, and the definition is scoped by a group, e.g. An environment ... –  Tobi Aug 14 '13 at 13:06
    
Thanks. Right. Classicthesis has even included a space in the preamble for this. Ps. I guess the \centering does not need to be included when you use the \figuretitle? –  The Unfun Cat Aug 15 '13 at 7:03
1  
@TheUnfunCat: Yes the \centering is kind of redundant in this case, but I used a group, i.e. a pair of braces {}, so \centering will only affect the title and not the image. If you want to center all images I’d do it globally, see tex.stackexchange.com/q/6033/4918. –  Tobi Aug 15 '13 at 10:47

An alternative method is to output from Matplotlib as .svg, with or without a title then read in to Inkscape. You can save from Inkscape as .pdf+.tex (or .eps+.tex I think), where the .pdf(.eps) contains the graphics, and the .tex overlays the text, in your current document font. All this can be done from the command line - Inkscape supports that.

A couple of links:

Setting up matplotlib to output text as text

Adjusting sizing of figure and text

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.