LaTeX forum ⇒ Text FormattingCenter figures out of margin

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

Center figures out of margin

Postby MakezHD » Wed Feb 27, 2019 1:08 pm

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}

User avatar
Stefan Kottwitz
Site Admin
Posts: 9403
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Thu Feb 28, 2019 2:08 pm

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
Site admin

MakezHD
Posts: 10
Joined: Thu Jan 21, 2016 8:19 pm

Postby MakezHD » Fri Mar 01, 2019 2:21 pm

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: 207
Joined: Sun Nov 16, 2014 8:51 pm

Postby rais » Fri Mar 01, 2019 7:48 pm

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


Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 5 guests