[Tex/LaTex] cropping problem with includegraphics and trim in beamer

beamer

I am including figures from a paper I'm writing into the associated presentation slides written in beamer. Both the paper and the slides are pdf and I'm typesetting using pdflatex. I'm using \includegraphics[page=1, trim=1 2 3 4,clip=true]{paper.pdf} to include chunks of the paper.pdf into the beamer presentation. However, I've found that the trim command seems to include the entire page, but renders everything outside the trim'd area transparent. If I drag my mouse cursor over the areas outside the included figure in the presentation slides, I can still see and select the text surrounding the figure which has also been inserted into my slides (it's just invisible).

This has the side effect of making the size of slides.pdf very large because all this extraneous information around the figure is dragged along, but rendered transparent. Is there anyway to not include or remove this extraneous information from my slides.pdf somehow?

Best Answer

Yes, the whole PDF page is always included. Options trim and viewport only select the box that is seen by TeX and option clip only makes the part outside the box invisible. But option clip does not read the PDF image page contents, analyzes its page stream operators and rewrites the page stream for the only inclusion of the visible elements. This is not a trivial task at all. I do not know a freeware tool that is able to do this automatically except for rendering to a bitmap.

Without converting to a bitmap (and loss of quality) it is not easy to remove the invisible parts.

  • Commercial tools?

  • Manually in vector programs that are able to deal with PDF, e.g. inkscape.

With good knowledges of PDF (or PostScript) the removal can also be manually done by editing the PDF or PostScript files directly. But it depends on the familiarity with the formats, the complexity of the PDF file and the elements that should be removed.

The box could cut through characters. It is possible to select the dot of an i. But if you want to remove the stem, you would have to go to the glyph description of the character in the embedded font.