GeneralProblem with subfig package

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
funkeejeffou
Posts: 2
Joined: Tue Jul 01, 2008 8:57 pm

Problem with subfig package

Post by funkeejeffou »

Hi,

I would like to place in a same figure multiple floats with each a subcaption, however, even with the subfig package I cannot achieve the desired effet. I would like to have in a left column one long image, and next to it on the right a column of the same height with 3 images this time :
Image

I would really appreciate any help on how to organize my subfloats, or even a recommendation for another latex package.

Cheers,
Jeff.

Recommended reading 2024:

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

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

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

Problem with subfig package

Post by localghost »

One approach could be to use minipage environments inside the figure environment to get a split into two columns.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[bindingoffset=1cm,centering,includeheadfoot,margin=2cm]{geometry}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage[font=footnotesize]{subfig}
\usepackage{txfonts}
\usepackage{multicol}
\usepackage{blindtext}

\parindent0em

\begin{document}
  \blindtext

  \begin{figure}[!ht]
    \begin{minipage}{7cm}
      \centering
      \subfloat[First Subfigure\label{subfig-1:dummy}]{%
        \rule{7cm}{14cm}
      }
    \end{minipage}
    \hfill
    \begin{minipage}{7cm}
      \centering    
      \subfloat[Second Subfigure\label{subfig-2:dummy}]{%
        \rule{7cm}{4cm}
      }

      \subfloat[Third Subfigure\label{subfig-3:dummy}]{%
        \rule{7cm}{4cm}
      }

      \subfloat[Fourth Subfigure\label{subfig-4:dummy}]{%
        \rule{7cm}{4cm}
      }
    \end{minipage}
    \caption{Dummy figure}\label{fig:dummy}
  \end{figure}

  \blindtext
\end{document}
I tried another way with the multicol package, but then I ran into trouble with the alignment of the subfloat environments. So I would suggest to use this version (but I could also provide the other).


Best regards
Thorsten¹
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Problem with subfig package

Post by gmedina »

The same approach that localghost suggested, but using the subcaption package (you need a recent version of the caption package, 3.x at least if I recall correctly).

Code: Select all

\documentclass{article} 
\usepackage[font=small,labelfont=bf]{caption}
\usepackage[list=true]{subcaption}

\begin{document} 
\listoffigures
\clearpage

\begin{figure}[!ht]
  \begin{minipage}[b]{.5\linewidth}
    \centering
    \rule{.9\linewidth}{14cm}
    \subcaption{A large subfigure}
    \label{fig:1a}
  \end{minipage}%
  \begin{minipage}[b]{.5\linewidth}
    \centering
    \rule{.9\linewidth}{4.15cm}
    \subcaption{A small subfigure}
    \label{fig:1b}
  
    \rule{.9\linewidth}{4.15cm}
    \subcaption{A small subfigure}
    \label{fig:1c}
    
    \rule{.9\linewidth}{4.15cm}
    \subcaption{A small subfigure}
    \label{fig:1d}
  \end{minipage}
  \caption{A figure}\label{fig:1}
\end{figure}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
funkeejeffou
Posts: 2
Joined: Tue Jul 01, 2008 8:57 pm

Re: Problem with subfig package

Post by funkeejeffou »

Both approaches work, thanks for your support guys.

Cheers,
Jeff.
lonetomato
Posts: 1
Joined: Wed Jul 23, 2008 6:30 am

Re: Problem with subfig package

Post by lonetomato »

Thorsten,
I was having the same problem and your example worked perfectly. Thanks for taking the time to write it up!

-Anna
Post Reply