Graphics, Figures & TablesKey for diagram

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
drbob
Posts: 5
Joined: Sun Feb 08, 2009 4:17 pm

Key for diagram

Post by drbob »

I've got a diagram with caption to which I'm trying to add a key. Ideally, I would be able use an enumerated list for the key inside the caption, but LaTeX doesn't like that. It appears one can't use any block elements inside \caption, so how could I put a key with my figure?

Code: Select all

\begin{figure}[h]
	\centering
	\includegraphics[width=7cm]{images/Van_de_graaf_generator.png}
	\caption{Schematic of a Van de Graaff generator\cite{vdgg-wp}.}
	\label{fig:vdgg-schematic}
	% TODO: key for diagram (http://en.wikipedia.org/wiki/Van_de_Graaff_generator)
\end{figure}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Key for diagram

Post by gmedina »

Hi,

you could use the \caption* command provided by the caption package, and some boxes, as the following example suggests (please refer to the package documentation for further information):

Code: Select all

\documentclass{article}
\usepackage{caption}

\begin{document}

\begin{figure}[!ht]
  \centering
  \caption{A test figure}
  \rule{3cm}{2cm}
  \caption*{\parbox[t]{2cm}{\textbf{First item}} \parbox[t]{7cm}{text text   
  text text text text text text text text text text text text text text text 
  text text text text text text text text text text text text text text text 
  text text text text text text text text text text text text text text text 
  text text}}
  \caption*{\parbox[t]{2cm}{\textbf{Second item}} \parbox[t]{7cm}{text text 
  text text text text text text text text text text text text text text text 
  text text text text text text text text text text text text text text text 
  text text text text text text text text text text text text text text text 
  text text}}
  \caption*{\parbox[t]{2cm}{\textbf{Third item}} \parbox[t]{7cm}{text text 
  text text text text text text text text text text text text text text text 
  text text text text text text text text text text text text text text text 
  text text text text text text text text text text text text text text text 
  text text}}
\end{figure}

\end{document}


Remarks: 1) I used \rule only to simulate an actual figure.
2) The code I posted is just an example; as such, it admits improvements.
3) If your standard captions contain more than one paragraph, you must use the optional argument of the \caption command; otherwise, you'll get an error message.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
drbob
Posts: 5
Joined: Sun Feb 08, 2009 4:17 pm

Re: Key for diagram

Post by drbob »

That works quite nicely. Thank you very much! :D
Post Reply