Text FormattingCenter figures out of margin

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
MakezHD
Posts: 10
Joined: Thu Jan 21, 2016 8:19 pm

Center figures out of margin

Post by MakezHD »

I have some figures that are very big, so I placed them in landscape mode.

They are still too big for landscape mode so they get out of the page's margin. The problem is that the figure looks like it has a big blank space in the upper part of the page, so I would like to center the figure so that the distance between the figure and the upper and lower borders are the same.

Image

I need y1 and y2 distances to be the same.

\begin{landscape}
\begin{figure}[htbp]
\begin{center}
\centering
\textbf{----------}\par\medskip
\scalebox{0.9}{\frame{\includegraphics[clip, trim=0cm 11cm 0cm 1cm]{figs/-------.pdf}}}
\caption{\textit{---------}
\label{-----------}
\end{center}
\end{figure}
\end{landscape}

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

Stefan Kottwitz
Site Admin
Posts: 10328
Joined: Mon Mar 10, 2008 9:44 pm

Center figures out of margin

Post by Stefan Kottwitz »

You can remove both the figure environment and the center environment. figure is for floating, referencing, captions, but you don't use it anyway. Instead of \begin{center} and \end{center} just keep \centering, otherwise you get unnecessary space before and after it. \centering is for pure centering, while \begin{center} ... \end{center} is for displaying centered paragraphs within surrounding text, that's why it brings vertical space around.

Seems like you want also "vertical" centering in landscape mode. You could add \vspace*{\fill} before and after it to achieve that.

Stefan
LaTeX.org admin
MakezHD
Posts: 10
Joined: Thu Jan 21, 2016 8:19 pm

Center figures out of margin

Post by MakezHD »

Stefan Kottwitz wrote:You can remove both the figure environment and the center environment. figure is for floating, referencing, captions, but you don't use it anyway. Instead of \begin{center} and \end{center} just keep \centering, otherwise you get unnecessary space before and after it. \centering is for pure centering, while \begin{center} ... \end{center} is for displaying centered paragraphs within surrounding text, that's why it brings vertical space around.

Seems like you want also "vertical" centering in landscape mode. You could add \vspace*{\fill} before and after it to achieve that.

Stefan
If I remove figure I cannot add a caption right? I need the image to be a figure so it has a caption and it appears in the ToC.
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Center figures out of margin

Post by rais »

MakezHD wrote: If I remove figure I cannot add a caption right? I need the image to be a figure so it has a caption and it appears in the ToC.
try loading the capt-of package and use its \captionof command.

KR
Rainer
Post Reply