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}
3
  • 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 Commented Apr 27, 2021 at 16:04
  • I did an edit and provided a minimal example, still don't work. Commented Apr 27, 2021 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. Commented Apr 27, 2021 at 16:46

1 Answer 1

2

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}
2
  • Thank you very much. Unfortunately did not get it to work, see my new answer. Commented Apr 27, 2021 at 17:37
  • 2
    @MathStat2718 please don't post non-answers as answers, yiou can add information to the question Commented Apr 27, 2021 at 18:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .