GeneralFigure caption appears on top of figure after cropping

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
TheCOG
Posts: 1
Joined: Tue Apr 29, 2008 3:03 pm

Figure caption appears on top of figure after cropping

Post by TheCOG »

Hello all,
I'm trying to insert a figure into a document. However, the figure is too large to fit as is, so I've cropped the image using the viewport option for \includegraphics. While this makes the figure fit on the page, the figure caption is now overlaid on top of the figure (towards the bottom, but obviously not quite where I need it to be).

If anybody has any insights about a fix (e.g., how to specify the position of a caption), that would be marvelous!

Here's the relevant code:

\begin{landscape}
\begin{figure}[h]
\begin{center}
\includegraphics[viewport = 250 200 550 500]{figure}
\caption{the offending figure caption}
\label{fig:figure}
\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: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Figure caption appears on top of figure after cropping

Post by Stefan Kottwitz »

Hi TheCOG,

welcome to the LaTeX Community board!
The caption package could be useful for you. It provides many features and much flexibility and is well documented.
By the way: I would not use \begin{center} ... \end{center}, I prefer \centering instead, because the center environment produces additional vertical space, in your case probably even more unwanted.

Stefan
LaTeX.org admin
Post Reply