Graphics, Figures & Tablessubfigure | Format of wrapped Captions

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
daviddoria
Posts: 60
Joined: Tue Sep 30, 2008 9:24 pm

subfigure | Format of wrapped Captions

Post by daviddoria »

Is there a way to change the wrapping in a subfigure caption? E.g. in this figure: http://daviddoria.com/Uploads/BlackWhiteSequence.png I don't like how the word "filled" in subfigure a) is not aligned with the word "Image".

Here is another example:

Code: Select all

\documentclass[10pt]{article}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{float} % to use [H] placement

\begin{document}
\section{Test Graphics}

In Figure \ref{fig:subfigureExample} we show three things. In \subref{fig:subfig1} we show the first thing, in \subref{fig:subfig2} we show the second thing, and in \subref{fig:subfig3} we show the third thing. In \ref{fig:subfig1} we do something.
%multiple figures
\begin{figure}[ht!]
\centering
\subfigure[Caption of subfigure 1]{
\fbox{\rule{0pt}{2in} \rule{0.2\linewidth}{0pt}}%box
%\includegraphics[width=0.4\linewidth]{Soldier}%actual image
\label{fig:subfig1}
}
\subfigure[Caption of subfigure 2]{
\fbox{\rule{0pt}{2in} \rule{0.2\linewidth}{0pt}}
\label{fig:subfig2}
}
\subfigure[Caption of subfigure 3]{
\fbox{\rule{0pt}{2in} \rule{0.2\linewidth}{0pt}}
\label{fig:subfig3}
}
\caption[Optional caption for list of figures]{Caption of subfigures \subref{fig:subfig1}, \subref{fig:subfig2} and \subref{fig:subfig3}}
\label{fig:subfigureExample}
\end{figure}


\end{document}

Any thoughts on how to make this look better?

David
Last edited by daviddoria on Wed Nov 16, 2011 9:25 pm, edited 1 time in total.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

subfigure | Format of wrapped Captions

Post by sommerfee »

daviddoria wrote:I don't like how the word "filled" in subfigure a) is not aligned with the word "Image".
Take a peek at the subfigure documentation, I'm quite sure there is a package option like "hang" or similar.
daviddoria
Posts: 60
Joined: Tue Sep 30, 2008 9:24 pm

Re: subfigure | Format of wrapped Captions

Post by daviddoria »

Ah, hanging indent, that is the word I was looking for. None of my searches found 'hang' haha.

\usepackage[hang]{subfigure}

does the trick, thanks.

David
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

subfigure | Format of wrapped Captions

Post by localghost »

Don't use the obsolete subfigure package [1]. Replace it with the subfig package from the same author (or other alternatives).

Code: Select all

\documentclass[10pt]{article}
\usepackage[T1]{fontenc}
\usepackage[format=hang]{subfig}

\begin{document}
  \section{Test Graphics}
    In Figure \ref{fig:subfigureExample} we show three things. In \subref{fig:subfig1} we show the first thing, in \subref{fig:subfig2} we show the second thing, and in \subref{fig:subfig3} we show the third thing. In \ref{fig:subfig1} we do something.

  \begin{figure}[!ht]
    \centering
    \subfloat[Caption of subfigure 1\label{fig:subfig1}]{%
      \rule{0.2\linewidth}{2in}
    }
    \subfloat[Caption of subfigure 2\label{fig:subfig2}]{%
      \rule{0.2\linewidth}{2in}
    }
    \subfloat[Caption of subfigure 3\label{fig:subfig3}]{%
      \rule{0.2\linewidth}{2in}
    }
    \caption[Optional caption for list of figures]{Caption of subfigures \subref{fig:subfig1}, \subref{fig:subfig2} and \subref{fig:subfig3}}\label{fig:subfigureExample}
  \end{figure}
\end{document}
[1] View topic: Obsolete Packages and Document Classes — Avoid Usage!


Thorsten
jane
Posts: 1
Joined: Tue Nov 27, 2012 6:19 pm

Re: subfigure | Format of wrapped Captions

Post by jane »

This is exactly what I was looking for! Thank you so much!
Post Reply