GeneralPut a figure to the top of a page

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Alcol
Posts: 3
Joined: Tue Nov 27, 2007 7:27 pm

Put a figure to the top of a page

Post by Alcol »

I have a figure,
I put like that

Code: Select all

\begin{figure}[t]
  \centering
\includegraphics[width=0.8\textwidth]{./sdcsc}
    \caption{dsscdsfad.}
    \label{DrugConfront}
\end{figure}
Do you know why the figure can not stay at the top of the page?
A beginner

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Put a figure to the top of a page

Post by gmedina »

Latex handles figures and tables as floating objects. If you want to "force" the position, use something like

Code: Select all

\begin{figure}[!tp]
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Put a figure to the top of a page

Post by localghost »

Do not restrict LaTeX so strongly in placing figures. Try a combination of parameters for figure placement.

Code: Select all

\begin{figure}[!ht]
  \centering
  \includegraphics[width=0.8\textwidth]{./sdcsc}
  \caption{dsscdsfad.}\label{DrugConfront}
\end{figure}
The exclamation mark slackens the strong rules of figure placement. You should add that as a minimum to your parameter list for placing the figure at the top of the page. But note that the compiler will overwrite this (according to a message in the log file). I suggest the parameters as given in the code above. For me they yield to the best results.
Post Reply