3

I want to include a pdf which has to cover the whole page with larger margins, but there needs to be room to put a caption under it. The pdf file is a table.

\begin{figure}[ht]
\begin{center}
\includegraphics[width=1.5\textwidth,height=1.5\textheight,keepaspectratio]{(IminusA)inverse.pdf}
\end{center}
\end{figure}

However, the pdf file does not fit on the page and it shows only a part of it.

Does anyone knows how to solve this problem?

4 Answers 4

3

If it's the case that the page is actually 1.5 times larger than the text width, you should be able to re-center the image by subtracting an appropriate amount of horizontal space.

...
\hspace*{-.25\textwidth}
\includegraphics[width=1.5\textwidth,height=1.5\textheight,keepaspectratio]{(IminusA)inverse.pdf}
...

If this doesn't look right, then tweak the amount of hspace. Note that this feels like a hack (and is a hack). For a more sustainable solution, see @Bordaigorl's answer.

3

You can hack it using negative spacings and oversized scaling but I would try a cleaner solution. First of all there might be multiple reasons why the appearance of your figure does not satisfy you:

  1. the pdf with the table contains its own margins and that's adding unnecessary padding to the table when you include it with includegraphics; otherwise you are happy with the margins of your document's layout
  2. the margins you are using for the rest of your document are too narrow for this figure to be included satisfactorily.

To solve problem 1 I would go with the bounding box settings of the graphicx package. You can find the relevant documentation in Section 4.4 "Including Graphics Files" of the graphicx manual (texdoc graphicx). The relevant options are bb, viewport, trim and clip.

To solve problem 2 you could use the \newgeometry (and \restoregeometry) commands of the geometry package: it allows you to temporarily change the layout.

2

If you start by a sample image, in this case let's assume a gray square, then one possible solution is to insert that figure with a declared width of:

\includegraphics[width=\paperwidth,keepaspectratio]{Square.pdf}

inside a box with variable width:

\makebox[\linewidth]{%
 \includegraphics[width=\paperwidth,keepaspectratio]{Immagine_Esempio.pdf}%
}

In this case the inserted parameter is not related to the portion of text by \textwidth, but from the page (physical paper) itself by \paperwidth.

So a complilable example with this figure Immagine_Esempio.pdf with a caption, is as follows:

Prima figura

\documentclass{article}
%
\usepackage{graphicx}
%
\begin{document}
%
\begin{figure}[p]
 \vspace*{-2cm}   % space inserted to fit within the page number
 \makebox[\linewidth]{%
  \includegraphics[width=\paperwidth,keepaspectratio]{Immagine_Esempio.pdf}%
 }
 \caption{A caption}
\end{figure}
%
\end{document}

Gives for the output:

enter image description here

The parameter keepaspectratio could be deactivated and set height=<>\textheight and playing around \vspace*{<>} for numbers in this case.

0
2

Thank you all for your help. I will tell you what worked for me:

\begin{figure}[ht]
\begin{center}
\captionof{table}{Transformation Table} \label{tab:Transformation Table}
\includegraphics[trim=2cm 1cm 1cm 1cm, scale=0.8]{(IminusA)inverse.pdf}
\end{center}
%\restoregeometry
\end{figure}

I used the trim function successfully to get rid of the pdf margins. Also I needed to put a caption of the pdf as a table on top.

However, I need the caption to be placed higher on the top of the page. My document class now is:

\documentclass[11pt, a4paper, oneside]{report} 

I do not want to use the geometry package. Any other ideas?

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .