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 the following code:

\subsection{sub1}
\begin{figure*}
      \centering
      \includegraphics[scale=0.62]{fig1.png}
      \caption{
      this is fig1.
      \label{fig:fig1}
}
\end{figure*}

blabla [...]

\subsection{sub2}
\begin{figure}
      \centering
      \includegraphics[scale=0.42]{fig2.png}
      \caption{
      This is fig2.
      \label{fig:fig2}
}
\end{figure}

blabla[...]

I would like figure 1 to be printed before Figure 2, and both of them printed at the top. Please note that Figure 1 is double column. I always end up with Figure 1 in page three and Figure 2 in page two.

I found a lots of advice on how to use floats, for example: http://stackoverflow.com/questions/3936430/is-there-a-way-to-get-latex-to-place-figures-and-tables-in-the-order-they-are-re

But they do not seem to work at all (because I have a two-column figure?). Using [H] has Figure 1 moving to an otherwise blank page at the end of the document. I tried all possible variants of [!ht], with no success.

My hope is to get a solution that will not require me to download some hacked package (my file might have to be compiled by other people as well) or fighting with the .cls file (that I am not allow to change, for the same reason).

Any advice?

share|improve this question

migrated from stackoverflow.com Jan 16 at 20:09

This question came from our site for professional and enthusiast programmers.

    
Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Jan 16 at 20:12
    
add comment

1 Answer 1

Following some guidelines from How to place a multicolumn figure above a single column figure and a single column table?, here's an approach:

enter image description here

\documentclass[twocolumn]{article}
\usepackage{afterpage,lipsum,capt-of,graphicx}% http://ctan.org/pkg/{afterpage,lipsum,capt-of,graphicx}
\usepackage[margin=1in]{geometry}% Just for this example
\begin{document}
\lipsum[1-7]

\begin{figure*}
  \centering\includegraphics[width=.7\linewidth,height=2in]{example-image-a}\par
  \caption{This is a figure caption}
\end{figure*}%

\afterpage{%
  \noindent\begin{minipage}{\columnwidth}
    \centering
    \includegraphics[width=.8\linewidth,height=4\baselineskip]{example-image-b}
    \captionof{figure}{This is anoth figure caption}
    \vspace*{\textfloatsep}% Insert "regular" gap between float and text
  \end{minipage}%
}

\lipsum[8-14]
\end{document}

figure* prints the figure at the top of the following page (by default) in twocolumn mode. Immediately following the placement of figure* in your code, we use \afterpage to manually insert content on the following page. As such, they should end up one following the other, only that the second one will be part of the running text, and therefore be positioned inside the first column.

Instead of floating the second (column) figure, we place it in a minipage of width \columnwidth (and some vertical separation between the "float" and text; see How can I inject the proper amount of vertical space between captions and figures?). Since we're using a minipage and not a float, capt-of helps us set the appropriate caption.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.