1

I'm trying to write the article which include 2 figures, the first figure is all right at the first page, but when I include second figure, it always at the center of the second page, how to put it at the top of the second page? This is the code:

\documentclass{article}
\usepackage[utf8]{inputenc}

\title{}
\author{}
\date{}

\usepackage{natbib}
\usepackage{graphicx}

\begin{document}

\maketitle

\section{Introduction}

\begin{figure}[ht!]
\centering
\includegraphics[scale=3]{universe}
\caption{The Universe}
\label{fig:universe}
\end{figure}

\begin{figure}[ht!]
\centering
\includegraphics[scale=3]{universe}
\caption{The Universe}
\label{fig:universe}
\end{figure}


\end{document}

Can anyone help me with this? Thanks for your help!

2
  • Welcome to the community of the user of TeX.SE. +1
    – Sebastiano
    Apr 5 at 16:13
  • The input for a float (figure or table) should occur in the source file before any text that will be set on the target page. But if your figure does get set on the intended page, you should eliminate the [h] from the options and leave only [t]. Also, the ! may be affecting the placement, so I'd be inclined to omit that too. Apr 5 at 19:43
2

It is difficult to answer without a concrete example. Here I tried to imagine the situation you describe. If you add some text after the second image the position will be correct. You can get the same result with \pagebreak\null after the second figure environment.

\documentclass{article}
\usepackage{graphicx}
\usepackage{lipsum}

\begin{document}
 
 \section{Introduction}
 
 \begin{figure}[ht!]
  \centering
  \includegraphics[scale=1]{example-image-a}
  \caption{The Universe}
  \label{fig:universe}
 \end{figure}
 
 \begin{figure}[ht!]
  \centering
  \includegraphics[scale=1]{example-image-a}
  \caption{The Universe}
  \label{fig:universe}
 \end{figure}

\lipsum
% \pagebreak\null
 
\end{document}

With additional text via \lipsum:

enter image description here

With \pagebrek\null:

enter image description here

Your Answer

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