Graphics, Figures & TablesUsing Subfigure with Figure* to span two columns?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
rjp
Posts: 2
Joined: Wed May 27, 2009 11:58 am

Using Subfigure with Figure* to span two columns?

Post by rjp »

I was hoping that someone could help with this as I'm currently stumped.

My understanding was that you could use \begin{figure*} instead of \begin{figure} to span two columns with an image and that this would work for subfigures as well.

However, my latex code won't compile and gives an error at the \end{figure*} line.

Below are examples with and without using the * to span the columns.

This won't compile.

Code: Select all

 \begin{figure*}
 \subfigure{\includegraphics[width=6cm]{fig1.eps}}
 \subfigure{\includegraphics[width=6cm]{fig2.eps}}
 \end{figure*}
This compiles fine but image is only in one column and not spanning the two.

Code: Select all

 \begin{figure}
 \subfigure{\includegraphics[width=6cm]{fig1.eps}}
 \subfigure{\includegraphics[width=6cm]{fig2.eps}}
 \end{figure}
Any ideas wherew I'm going wrong?

Recommended reading 2024:

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

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

fatra2
Posts: 126
Joined: Fri May 01, 2009 1:43 pm

Using Subfigure with Figure* to span two columns?

Post by fatra2 »

Hi there,

The asterisk (*) is not to be used in the figure environment. You can use it for example in the equation/eqnarray environment, so that it is not numbered.

To you problem per say, the subfigure environment will not necessarily put the figure side by side. The important word here is "necessarily". The subfigure environment will take the different options given and try its best to place the figures in a suitable position. Therefore, if your text is not wide enough for them to be put nxt to each other, then the second one will be shifted under.

What I would try is to give enough space so that both figure can fit nicely next to each other, like this:

Code: Select all

\begin{figure}
\subfigure{\includegraphics[width=0.45\textwidth]{fig1.eps}}
\hspace{0.05\textwidth}
\subfigure{\includegraphics[width=0.45\textwidth]{fig2.eps}}
\end{figure}
You can also try to leave a bit of space between the two figure by adding the \hspace command.

Cheers
rjp
Posts: 2
Joined: Wed May 27, 2009 11:58 am

Using Subfigure with Figure* to span two columns?

Post by rjp »

Hi,

Thanks for the help but I think you've maybe misundersatood my problem.

figure* is used in the fugure environment to span two columns of text.

See http://people.csail.mit.edu/jrennie/latex/
2-Column Images
When in 2-column mode (using either \twocolumn or the multicols environment (package multicol)), use \begin{figure*} and \begin{table*} to create figures and tables that span the entire width of the page. \begin{figure} and \begin{table} span only one column.
or

http://andrewjpage.com/index.php?/archi ... Latex.html
If your using 2 columns in a latex document, you'll usually find that a table or figure is just too big for a single column. All you do is use
\begin{figure*}
\end{figure*}
and that will make the figure span the width of the entire page.
My problem is that I've read that this should work when subfigure is used within figure but it doesn't seem to work and won't compile.
fatra2
Posts: 126
Joined: Fri May 01, 2009 1:43 pm

Re: Using Subfigure with Figure* to span two columns?

Post by fatra2 »

Hi there,

Never used the asterisk in the figure environment. Did you check that you have all the packages needed to run it (just a thought)???

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

Using Subfigure with Figure* to span two columns?

Post by localghost »

rjp wrote:[...] My understanding was that you could use \begin{figure*} instead of \begin{figure} to span two columns with an image and that this would work for subfigures as well. [...]
Your understanding is right. From your code I see that you are using the obsolete subfigure package. I have no problem with the subfig package.

Code: Select all

\documentclass[11pt,a4paper,english,titlepage,twocolumn]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage[font=footnotesize]{subfig}
\usepackage{blindtext}

\parindent0em
\author{Unknown}
\title{Figure with subfigures in multiple columns}

\begin{document}
  \maketitle
  \blindtext

  \begin{figure*}[!bt]
    \centering
    \subfloat[Dummy sub\label{subfig-1:dummy}]{%
      \rule{4cm}{3cm}
    }
    \subfloat[Dummy sub\label{subfig-2:dummy}]{%
      \rule{4cm}{3cm}
    }
    \caption{Dummy figure with subfigures}\label{fig:dummy}
  \end{figure*}
  \blindtext[6]
\end{document}
Regarding the fact that this package is not maintained any more, I suggest to try he subcaption package the comes with the caption package.


Best regards and welcome to the board
Thorsten
syf8d911
Posts: 1
Joined: Wed May 18, 2011 10:29 pm

Using Subfigure with Figure* to span two columns?

Post by syf8d911 »

I met the same problem when I was writing a IEEE journal paper. I solved it by using "minipage" and setting the column width to 1, which is shown as follows:

Code: Select all

\begin{figure*}[!ht]
    \captionstyle{centerlast}
    \begin{minipage}[l]{1.0\columnwidth}
        \centering
        \includegraphics[width=7.5cm, bb=0 0 1200 900]{A.png}
        \caption{AAA}\label{fig:AAA}
    \end{minipage}
    \hfill{}
    \begin{minipage}[r]{1.0\columnwidth}
        \centering
        \includegraphics[width=7.5cm, bb=0 0 1200 900]{B.jpg}
        \caption{BBB}\label{fig:BBB}
    \end{minipage}
\end{figure*}
It worked for me. I hope it is helpful to your problem.
Last edited by Stefan Kottwitz on Wed May 25, 2011 6:50 pm, edited 1 time in total.
benihakum
Posts: 1
Joined: Sat May 12, 2018 11:30 pm

Using Subfigure with Figure* to span two columns?

Post by benihakum »

Figure* does NOT allow blank lines - i.e. lines with no code on.
Post Reply