Graphics, Figures & TablesUsing H placement (float package) with subfig

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
daviddoria
Posts: 60
Joined: Tue Sep 30, 2008 9:24 pm

Using H placement (float package) with subfig

Post by daviddoria »

I usually use the [H] placement because I want to specify exactly where the figure should end up. However, when using subfig, it seems to not produce the image at all if I use [H]. Is there an equivalent placement that works the same way for subfig's?

Code: Select all

\documentclass[10pt]{article}

\usepackage{float}
\usepackage{subfig}
\begin{document}

\section{Test}

%\begin{figure*}[ht!] %works properly
\begin{figure*}[H] %doesn't work
\centering
\subfloat[Original image]{
\fbox{\rule{0pt}{2in} \rule{0.2\linewidth}{0pt}}
\label{fig:FourierTransform:Original}
}
\subfloat[Fourier transform]{
\fbox{\rule{0pt}{2in} \rule{0.2\linewidth}{0pt}}
\label{fig:FourierTransform:Transform}
}
\caption{An image and its Fourier transform.}
\label{fig:FourierTransform}
\end{figure*}

\end{document}

Thanks,
Dave

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

Using H placement (float package) with subfig

Post by localghost »

I wonder if there is a special reason why you are using the starred version of the figure environment instead of the normal one. The starred version usually is for documents typeset in two columns to spread over the full text width.


Best regards
Thorsten
daviddoria
Posts: 60
Joined: Tue Sep 30, 2008 9:24 pm

Re: Using H placement (float package) with subfig

Post by daviddoria »

Nope, no special reason besides my terrible copy and paste habit. As usual, the problem lies right next to where I'm looking for it...

Sorry and thanks :)
badkya
Posts: 2
Joined: Thu Aug 27, 2009 4:31 pm

Re: Using H placement (float package) with subfig

Post by badkya »

I am having the same problem with my subfigs in figure*. And I do need to use the figure* environment for my 2-column document... Is there any way to control the placement of that figure under these conditions?
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Using H placement (float package) with subfig

Post by gmedina »

Hi,

instead of using the twocolumn class option, you can use the multicol package:

Code: Select all

\documentclass{article}
\usepackage{subfig}
\usepackage{multicol}

\begin{document}

\section{Test section}

\begin{multicols}{2}
text text
\end{multicols}
\begin{figure}[!ht]
  \centering
  \subfloat[first subfigure.]{\rule{4cm}{5cm}\label{fig:subfig1}}\qquad
  \subfloat[second subfigure.]{\rule{4cm}{5cm}\label{fig:subfig2}}
  \caption{two subfigures.}
  \label{fig:fig1}
\end{figure}
\begin{multicols}{2}
text text
\end{multicols}

\end{document}
Of course, if you are not using one of the standard document classes, please contact the designer of your particular class.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
badkya
Posts: 2
Joined: Thu Aug 27, 2009 4:31 pm

Re: Using H placement (float package) with subfig

Post by badkya »

Thanks.. I need to conform to the IEEE class template...

Is there no other way to specify placement under figure*?
Post Reply