basically i need something like rowspan option in html table. I want that an figure 3 and figure 4 occupy three rows, I need a layout something like this:

|figure 1 | figure 2 |               |               |
|figure 5 | figure 6 | figure 3 | figure 4 |
|figure 7 | figure 8 |               |               |

how i can get this layout?




   & \subfloat[B]{\includegraphics[width=3cm]{logo}}\\
   & \subfloat[D]{\includegraphics[width=3cm]{logo}}\\
   & \subfloat[F]{\includegraphics[width=3cm]{logo}}\\

\caption{Many figures}\label{foo}


the demo output

  • Nice method , I am looking for an arrangement exactly like this only that I don't want '(a),(b),(c)...' alphabets below the images , but I do need individual captions below each subfloat. Thanks for any help – Nishant Jun 25 '14 at 8:07

Adding to Leo Liu's answer: As the figures 3 and 4 are probably larger than the others, you also need to use the multirow package to span several rows. The package has quite a bit of trouble with the vertical alignment, so you'll need to adjust the optional argument of the \multirow commands by hand.




\subfloat[A]{\includegraphics{logo}} & 
\subfloat[B]{\includegraphics{logo}} & 
\multirow{-3}[2.5]{*}{\subfloat[D]{\includegraphics[width=2cm,height=4cm]{logo}}} &
\multirow{-3}[-3]{*}{\subfloat[E]{\includegraphics[width=2cm,height=3cm]{logo}}} \\
\subfloat[E]{\includegraphics{logo}} & 
\subfloat[H]{\includegraphics{logo}} \\
\caption{Many figures}


Subfigures with rowspanning

This is the image file used (save as logo.png)

If you want to use a sledgehammer to crack a nut, you could also use TikZ nodes and matrices. Herbert pointed out in the comments that this approach is overkill for the given problem. I'll leave it here to serve as an example of what not to do and perhaps as a template for more complex subfigure layout challenges which might arise and justify the use of this "heavy machinery".



\captionsetup[subfloat]{farskip=0pt} % Remove the top glue from subfloats
\begin{tikzpicture}[every node/.style=inner sep=0pt]
\matrix [name=m,
column sep=0.8cm,row sep = 0.4cm]
\node (f1) {\subfloat[A]{\includegraphics{logo}} }; &
\node (f2) {\subfloat[B]{\includegraphics{logo}} }; \\
\node (f5)  {\subfloat[E]{\includegraphics{logo}} }; &
\node (f6) {\subfloat[F]{\includegraphics{logo}} }; \\
\node (f7)  {\subfloat[G]{\includegraphics{logo}} }; &
\node (f8)  {\subfloat[H]{\includegraphics[width=4cm]{logo}} };  \\
\node (f3) [right=.8cm of m] {\subfloat[C]{\includegraphics[height=4cm,width=2cm]{logo}} }; 
\node (f4) [right=.8cm of f3] {\subfloat[D]{\includegraphics[height=2cm,width=2cm]{logo}} }; 

\caption{Many figures}


Subfigures placed using TikZ

  • it is not powerful, it is absolutely overkill using nodes for this ... – user2478 Jan 24 '11 at 15:47
  • @Herbert How would you produce an array of such subfigures? – Jake Jan 24 '11 at 16:51
  • @Jake using package floatrow – user2478 Jan 24 '11 at 16:52
  • @Herbert Have you tried using floatrow for the case described by maxim? I tried adapting the "picture book" example (p. 97, floatrow manual), but it becomes completely unintuitive and unmaintainable very quickly. I'd be interested to see an answer to the OP's question using floatrow. Of course you're right that usually you shouldn't need to typeset subfigures using a TikZ picture, but the OP's problem is more complex than usual. – Jake Jan 24 '11 at 16:57
  • 1
    @Herbert: Indeed, your solution is much more elegant. I've added a paragraph to my answer pointing out that TikZ is not the right tool for the job. However, I can imagine that there'll be situations where the TikZ approach can be justified. The tabular solution does not handle different widths for subfigs C and D (G and H in your example) without manual adjustments, for example; or try replacing subfigs B and F (B and D) with one tall subfigure. That said, your approach is undoubtedly much better for the vast majority of cases. – Jake Jan 24 '11 at 17:57

You can put them in a tabular environment. If numbers are needed, you also have to change the figure counter.

\usepackage{array} % in preamble

one \caption{a} & two \caption{b} \\
\addtocounter{figure}{2}five \caption{b} & six \caption{b}
 & \addtocounter{figure}{-4}three \caption{b} & four \caption{b} \\
seven \caption{b} & eight \caption{b} \\

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy