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.

I have a document with a lot of subfigures which are different heights and need to be placed side-by-side and centered vertically. It seems like the floatrow package is ideal for this.

After much trial and error, I finally made it through the documentation enough to get the subfloats to center correctly, but now every time there is a subfloat, the figure counter gets incremented, so I have figure 10 followed by figure 13, when figure 10 has two subfloats in it. In the minimal example, notice that the single figure in the document is labelled Figure 3!

There was a similar question floating around the web about 5 years ago, but I didn't see an answer.

Here's minimal code:

\documentclass[11pt]{article}
\usepackage{subfig}  
\usepackage{tikz}

\usepackage[]{floatrow} 
\floatsetup[figure]{floatrowsep=qquad,valign=c }
\floatsetup[subfloat]{subfloatrowsep=qquad,valign=c}
\usepackage{graphicx}

\begin{document}

\begin{figure}[htbp]
\centering
\ffigbox{
\begin{subfloatrow}[3]
\subfloat[First, we see an empty green circle]{
\begin{tikzpicture}[scale=1] \draw[green]  (0,0) circle (1.2cm);\end{tikzpicture}
}

\subfloat[A large orange circle is the middle picture]{
\begin{tikzpicture}[scale=1]\draw[orange] (0,0) circle (2cm);\end{tikzpicture}}

\subfloat[Finally, a beautiful red circle with a black border]{
\begin{tikzpicture}[scale=1]\draw[fill=red]  (0,0) circle (.75cm);\end{tikzpicture}}
\end{subfloatrow}
}
{\caption{``Gadgets'' in reduced Levi graphs found as a consequence of using the construction in the configuration construction lemma.}
\label{CCLvolt}
}
\end{figure}
\end{document}  
share|improve this question
    
Ok, so clearly something's wrong with my code. The subfigures should be vertically centered---that's the whole point of using floatrow in the first place---and they're not. Sometimes, retypesetting will fix the centering, but it doesn't seem to in this case. –  Leah Wrenn Berman Apr 15 '12 at 21:51
add comment

1 Answer

up vote 6 down vote accepted

It seems the starred environment version subfloatrow* produces the correct numbering. The floatrow manual isn't too verbose, though, about why is so -- quoting from section 6.2:

subfloatrow*

The starred form loads settings for creation captions of float parts, but in this environment the \caption command restores its meaning. Thus, you need the \subcaption command for typesetting sub-captions.

\documentclass[11pt]{article}
\usepackage{subfig}  
\usepackage{tikz}

\usepackage[]{floatrow} 
\floatsetup[figure]{floatrowsep=qquad,valign=c }
\floatsetup[subfloat]{subfloatrowsep=qquad,valign=c}
\usepackage{graphicx}

\begin{document}

\begin{figure}[htbp]
\centering
\ffigbox{
\begin{subfloatrow*}[3]
\subfloat[First, we see an empty green circle]{
\begin{tikzpicture}[scale=1] \draw[green]  (0,0) circle (1.2cm);\end{tikzpicture}
}

\subfloat[A large orange circle is the middle picture]{
\begin{tikzpicture}[scale=1]\draw[orange] (0,0) circle (2cm);\end{tikzpicture}}

\subfloat[Finally, a beautiful red circle with a black border]{
\begin{tikzpicture}[scale=1]\draw[fill=red]  (0,0) circle (.75cm);\end{tikzpicture}}
\end{subfloatrow*}
}
{\caption{``Gadgets'' in reduced Levi graphs found as a consequence of using the construction in the configuration construction lemma.}
\label{CCLvolt}
}
\end{figure}
\end{document}

enter image description here

share|improve this answer
    
Thanks! Any idea why the subfloats are not centering vertically any more either? (which was the whole point of using floatrow in the first place...) –  Leah Wrenn Berman Apr 21 '12 at 19:21
    
@LeahWrennBerman Why "not [..] any more"? They look exactly like in your original example. (If you mean they should look different than in your example, please ask a new question, as it's not a numbering problem.) –  lockstep Apr 21 '12 at 19:24
    
The "not [...] any more" was that with the options I had set for floatrow, it should have been vertically centering, and had been before I introduced the floatrows. For what it's worth, I was missing an option for subfigure in floatrow: it needed \floatsetup[subfloat]{subfloatrowsep=qquad,valign=c, heightadjust=object} to actually make the vertical alignment work. –  Leah Wrenn Berman Apr 22 '12 at 5:13
add comment

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.