General ⇒ Figure caption appears on top of figure after cropping
Figure caption appears on top of figure after cropping
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}
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
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