1

I included a long plot in Overleaf into a new page. The problem is that the plot shows up in middle and I want to "shift it up". I have desperately tried all the tips in this link: Figure placed on a separate page is centered and not on top

For instance, I putted this in my preamble without any success:

\makeatletter
\setlength{\@fptop}{0pt}
\makeatother

This link: https://www.texfaq.org/FAQ-vertposfp explaining the things above did not help.

Minimal example:

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

\makeatletter \setlength{@fptop}{0pt} \makeatother

\begin{document}

\section{Introduction}

\begin{figure}[t!] \includegraphics[scale=1]{Test_Figure.pdf} \end{figure}

\end{document}

Zarko
  • 296,517
  • 1
    if you set fptop to 0pt and float pages are vertically centred, you have some other code setting it back again, it is hard to tell you what to do if you show no example. make a small 1-page document with a vertically centred float and someone will debug – David Carlisle Apr 27 '21 at 16:04
  • I did an edit and provided a minimal example, still don't work. – MathStat2718 Apr 27 '21 at 16:19
  • we don't have that figure, you can use \rule{1cm}{3cm} or whatever size you need to show the problem. If I try with example-image then as you specified a top float it comes at the top of that page, above Introduction. you presumably want to test a [p] float. changing the option to [p] it goes to page 2 at the top, as expected. – David Carlisle Apr 27 '21 at 16:46

1 Answers1

1

The code shown produces top aligned float pages. In order to run it I used example-image

enter image description here

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

\makeatletter \setlength{@fptop}{0pt} \makeatother

\begin{document}

\section{Introduction}

\begin{figure}[p] \includegraphics[scale=1]{example-image} \end{figure}

\end{document}

Thi sis using [p] to get a float page. With [!t] as posted (which in practice is quite likely to force the image to the end of the document) float pages are suppressed as p is not specified so it comes at the top of the first page.

enter image description here

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

\makeatletter \setlength{@fptop}{0pt} \makeatother

\begin{document}

\section{Introduction}

\begin{figure}[t] \includegraphics[scale=1]{example-image} \end{figure}

\end{document}

David Carlisle
  • 757,742