I'm having problems with conflicting width requirements for subcaptions on subfloats that are horizontal versus vertical. I've spent considerable time searching here and more broadly, poring over the subfig package documentation, etc, and I figured out that the problem is with the widths.

For the subfloats that are arranged horizontally, the subcaptions need to be 3 inches wide; for the subfloats that are arranged vertically, the subcaptions need to be 5 inches wide. If I specify a 3in subcaption width, the subcaptions for the 5in images look awful. If I specify anything over a 3in subcaption width, the subcaptions for the 3in images are offset to the right and run off the page. When I was not specifying caption widths at all, the subfloat subcaptions became very narrow and weird.

I'm not sure how to resolve this; both subfloat arrangements need to be included in the same document. I realize that a custom environment might be in order, but don't have the first idea of how to construct something for this purpose.

Here is the example MWE (to the best of my ability, it's a first try...)






Vertically arranged images:

\subfloat[Calibration image on the front of the view guide.]{\label{fig:vizcardfront}}\includegraphics[width=5in]{figures/viewcardfront.jpg}
\subfloat[Data submission form on the back of the view guide.]{\label{fig:vizcardback}}\includegraphics[width=5in]{figures/viewcardback.jpg}
\caption{The visibility monitoring view guide.}

Horizontally arranged images:

\subfloat[A plantcam at a monitoring plot.]{\label{fig:plantcam}}{\includegraphics[width=3in]{figures/plantcam.jpg}}
\subfloat[A HOBO$\textsuperscript{\textregistered}$ data logger for air and soil data.]{\label{fig:logger}}{\includegraphics[width=3in]{figures/logger.jpg}}
\caption{Automatic data collection instruments.}


Any assistance will be very much appreciated!

  • 1
    Have you looked at the subcaption package? It provides the subfigure environment which takes a width as its first argument.
    – cmhughes
    Jan 24, 2012 at 3:33

1 Answer 1


Here are some suggestions to fix your current situation:

  • Note the subfloat notation:


    Since your <body> consisted only of a \label command, the <subcaption> (actually, the <LoF> entry) had to wrap around something that is "very thin", causing it to not typeset properly. See page 4 of the subfig documentation for an explanation of this.

  • Also, the \label should be included in the <body>.

  • If you put the entire \subfloat within a fixed-width environment, the caption will wrap according to that width. This can be achieved via a minipage environment, for example. In the following minimal example, I've defined two new commands:

    \vertfig[<subcaption>]{<body>}% For vertical figure placement
    \horizfig[<subcaption>]{<body>}% For horizontal figure placement

    that you can use to replace the traditional \subfloat. \vertfig typesets its contents in a 5in-width minipage, while \horizfig does so in a 3in-width minipage. Both dropped the second optional argument of \subfloat[..][..]{...}, since it didn't seem to matter to you.

    As you can see, no fixed-width \captionsetup is required, since the captions wrap to the box they're contained in.

Different subfloats with different widths

\usepackage[a3paper]{geometry}% http://ctan.org/pkg/geometry
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
%\usepackage{caption}% http://ctan.org/pkg/caption
\usepackage{subfig}% http://ctan.org/pkg/subfig
\pagestyle{empty}% No header/footer

  \vertfig% \subfloat
    [This is probably the biggest tiger you will ever see in your life.
     The caption associated with this subfloat should span more than one
     line even though the width of the contents is 5in.]

  \vertfig% \subfloat
    [Data submission form on the back of the view guide.]
  \caption{The visibility monitoring view guide.}\label{fig:viewcard}

    [Here is another picture of the tiger, this time a little smaller.
     It is still very fierce-looking, right?]
    [A HOBO$\textsuperscript{\textregistered}$ data logger for air and soil data.]
  \caption{Automatic data collection instruments.}\label{fig:autodata}


geometry was merely used to set the paper size to a3paper.

  • Marvelous, thanks @Werner! The minipages did the trick and all works very nicely. Now I just have to go through all the other docs and update them accordingly - a very small price to pay for having it lay out properly. Doubtless the issues with the <body> construction are from copying a poor example; I often have a hard time finding a usable example (they're never exactly what I need) and the documentation doesn't always remedy that problem for me. Jan 24, 2012 at 13:37
  • What does LoF mean? Aug 18, 2014 at 18:34
  • 1
    @moose: LoF = List of Figures; LoT = List of Tables; ToC = Table of Contents.
    – Werner
    Aug 20, 2014 at 5:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .