2

I have multiple PDF floats in my document using \includegraphics. It turns out the PDFs have transparent background, and one overlaps the page number which looks bad.

(I was initially hoping to suppress the page number, but that turned out to be surprisingly difficult and the solutions here did not help.)

Instead, is there an option to suppress the PDF transparency (so that it blocks the page number from view)? Equivalently, is there an option to add a white background colour to the image?

MWE:

\documentclass[11pt]{article}
\usepackage[a4paper]{geometry}
\usepackage[]{garamondx}
\usepackage[scaled=.84]{beramono}
\usepackage{amsmath,amsthm,amssymb}
\usepackage[garamondx,cmbraces]{newtxmath}
\useosfI
\usepackage[utf8x]{inputenx}
\usepackage{microtype}
\usepackage{subfig}
\usepackage{graphicx}

\begin{document}

Lorem ipsum dolor sit amet.

\begin{figure}
\centering
\subfloat[\label{fig:disttime1}A specific solution with no attempt at generality.]{\includegraphics[scale=0.7, trim={4cm 7cm 1cm 0}, clip]{disttime1.pdf}}\\
\caption{Students' responses to a challenging proof problem.}
\label{fig:disttime}
\end{figure}

\begin{figure}
\ContinuedFloat%
\centering%
\vspace{-1.5cm}%
\subfloat[\label{fig:disttime2}This student has hit on the idea of the lines crossing, but strictly speaking at the point he has identified the person would be $6\ \mathrm{km}$ \emph{up} the hill one day and $6\ \mathrm{km}$ \emph{down} the hill the other.]{\includegraphics[scale=0.7, trim={5.5cm 16cm 0cm 2cm}, clip]{disttime2.pdf}}\\
\subfloat[\label{fig:disttime3}This student has understood the generality required, but has not attempted to justify the universal claim.]{\includegraphics[scale=0.7, trim={3cm 7.5cm 0.5cm 3cm}, clip]{disttime3.pdf}}
\caption{(con't) Students' responses to a challenging proof problem.}
\end{figure}

\end{document}

On the below screenshots, there is no issue with pages 1 and 2, but on page 3 the figure is taller than the text height and overlaps the page number.

Note: I am aware that having such a large float is probably bad style; I am not interested in splitting these figures across to a third page, or making them smaller (as they would become unreadable).

I have also added a screenshot of page 3 with \fbox added around each \includeimage, as requested by @daleif.

Page 1 Page 2 Page 3 Page 3 with \fbox

dbmag9
  • 1,411
  • They are sections of a scanned document (a student's work); on one page they are too tall so exceed the margins. I do not have a problem with them exceeding the margins, though I understand that's what's causing the issue. – dbmag9 Jun 02 '17 at 15:44
  • 1
    It's easy to scale the height or width to fit the graphic into \textheight or \textwidth. But if you don't care about exceeding the margins, why not get rid of the page number with \thispagestyle(empty) rather than messing about with the graphics file? – alephzero Jun 02 '17 at 16:11
  • See "that turned out to be surprisingly difficult" above: I ran into the problems described at https://tex.stackexchange.com/questions/83860/remove-page-number-from-just-one-float-page and have not been able to resolve them. – dbmag9 Jun 02 '17 at 16:23
  • @daleif What do you mean by that? The PDF has been cropped (using the trim option) to display the relevant content. – dbmag9 Jun 03 '17 at 10:37
  • Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem. – Bobyandbob Jun 03 '17 at 10:41
  • @daleif Yes; the correct part of the PDFs are displayed. – dbmag9 Jun 03 '17 at 10:52
  • @daleif \fbox just makes a solid box around the cropped graphics; the page number is still visible behind the text inside the box. I don't understand your question – the trim trims the images down to the relevant part, as displayed in the screenshots above. The PDF files being included are scans of written work. – dbmag9 Jun 03 '17 at 11:05
  • @daleif I know all of this! I thought I made it clear that I was aware the float had overflowed the margins right from the start. I am happy with the float overflowing the margins in this instance. I am not happy with the page number being visible behind the image. That is the problem I wish to resolve. – dbmag9 Jun 03 '17 at 11:13
  • @daleif I thought that when I asked "is there an option to suppress the PDF transparency (so that it blocks the page number from view)?" it was reasonably clear. – dbmag9 Jun 03 '17 at 11:31
  • 1
    @dbmag9 I am afraid, you asked the wrong question. The layer with the page number is in front of the other content. So even if the image does not have any transparency, the page number is still on top of the image. You really need to ask "how to suppress the page number". – samcarter_is_at_topanswers.xyz Jun 03 '17 at 13:11
  • @samcarter Aha, thank you – that possibility hadn't even occured to me! – dbmag9 Jun 03 '17 at 13:21
  • I use: \colorbox{white}{ \includegraphics{pdffile} } to flatten pdfs in my talks. – Simd Oct 01 '17 at 09:05

1 Answers1

2

For you first question: No, there is no option to suppress the transparency of PDFs which use that feature when including these PDFs whith pdftex/xetex/luatex.

What you are asking for is called PDF transparency flattening and that can be done by other tools.