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.

In the subfig package, the command \captionsetup[subfigure]{width=<length>} extends the width of a subcaption. Now how can the subfloats be centered above their enlarged subcaptions? The subfloats appear to be left justified by default.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You could put the subfigure object into a \makebox[<width>][c]{...} via a macro:


and then use

\subfloat[ToC-entry][This is a very long subcaption that should span a couple of lines]%

Here is a draft of what it looks like where my figure consists of \rule{20pt}{30pt}:

    \subfloat[test1][This is a very long caption that should span over a couple of lines]{\makebox[5em][c]{\rule{20pt}{30pt}}}
    \caption{This is caption for the figure}

Centered subfloat/subfigure

Alternatively, if you only do this for limited number of subfigures, then manually using the \makebox[<width>][c]{...} should suffice, as I did in the minimal example above.

share|improve this answer
Your picture is exactly what I am looking for but copy/pasting your code didn't give me something like that...it gave me this. –  Tyson Williams Jul 21 '11 at 17:29
I've edited my answer to include the minimal example I used to reproduce the graphic. It works for me - centering the subfloat - even if I just use the word figure for my graphic. –  Werner Jul 21 '11 at 17:38
Thanks. I figured out my problem. First, I put whole subfloat into the makebox instead of just the figure inside the subfloat (that seems obvious now). Second, the width parameter of the makebox needs to match the width parameter of the subcaption (also seems fairly obvious now). –  Tyson Williams Jul 21 '11 at 17:51
@Tyson: Yes, the lengths should be the same. You could have a central location for updating this length by defining: \newlength{\subfigwidth}\setlength{subfigwidth}{5em} and then using \subfigwidth instead of the fixed 5em. This allows you to have one location that updates all references to the subfigure widths. –  Werner Jul 21 '11 at 22:27

Your Answer


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.