1

When I try to have a section start with a large image, an extra page is added before the start of the section. I tracked down the problem to the hyperref package; when it is not loaded the extra page disappears. The problem happens with either \figure{image}[H] or plain \includegraphics{image}. The problem is not present with smaller images, or when the section starts with text.

I'm facing this issue when trying to add scans of a4-pages as an appendix. A mwe showing the problem is shown below.

\documentclass{article}

\usepackage{mwe}

% \usepackage{hyperref} % uncommenting this causes an extra page to be created.

\begin{document}

\pagenumbering{gobble} % added so page numbers aren't drawn on top of images, doesn't affect the issue.

\section{Image 1}
\includegraphics[scale=0.7]{example-image-a4}
\includegraphics[scale=0.7]{example-image-a4}

\section{Image 2}
% \lipsum % and uncommenting this fixes the problem.
\includegraphics[scale=0.7]{example-image-a4} % issue not present with 'example-image'

\end{document}
Heihej
  • 11
  • 1
    Welcome to TeX.SX! Note directly a solution, but if your scans are PDFs, (especially if its one single file) have you considered using the pdfpages package to include them into your document? – ebosi May 18 '16 at 15:45
  • No I hadn't heard of it. Sounds like the perfect tool for the job, thanks. But this problem seems to have a larger scope as well, so it should still be relevant. – Heihej May 18 '16 at 15:51
  • 1
    There is somewhat of a duplicate at http://tex.stackexchange.com/questions/124959/blank-page-shows-up-after-adding-usepackagepdfpagelabelshyperref I don't see how I would have an overfull page here though. – Heihej May 18 '16 at 16:06
  • the fact that you say in a comment "so page numbers aren't drawn on top of images" indicates to me that the graphic is just too big for the remaining space on the page. you might try making the page larger, with \enlargethispage{2\baselineskip} or some other reasonable value. granted, it has to be done on a page-by-page basis, but fine tuning is not unknown in this endeavour. – barbara beeton May 18 '16 at 17:03
  • indeed: if you try with \includegraphics[width=\textwidth]{example-image-a4} (i.e. adapting you image to the text-area), there is no extra blank page inserted. However, you get an error (Package atveryend Info: Empty hookBeforeClearDocument') when you loadhyperref`... – ebosi May 19 '16 at 08:21
  • Thanks for the help. Using the packageshowframe and a \frame around the graphics helps show that the images are too large for the page. The problem was resolved for me by cropping the images and making them smaller via width=0.7\textwidth. Should I post my solution as an answer to the question? – Heihej May 19 '16 at 08:54

0 Answers0