1

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

  • 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 2 '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 2 '17 at 16:11
  • See "that turned out to be surprisingly difficult" above: I ran into the problems described at tex.stackexchange.com/questions/83860/… and have not been able to resolve them. – dbmag9 Jun 2 '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 3 '17 at 10:37
  • 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". – user36296 Jun 3 '17 at 13:11
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.