I want to include an excerpt of a pdf-document in my Beamer-presentation. Furthermore, I want to highlight a part of this document, i.e. draw a red rectangle around it, maybe even have an arrow point towards it.

I only have the free version of Adobe Acrobat Reader, so I don't even know how to do this without LaTeX. Except, of course, I can take a screenshot of the excerpt and then edit it using PowerPoint:

Is there a nice way to do this in Beamer ?

enter image description here

  • 1
    You can use \includegraphics[page=..., crop=...]{<your pdf file>} to select page and fragment inside a tikz node and add marks as is explained in Drawing on an image in TikZ
    – Ignasi
    Apr 27 '19 at 12:28

A little while ago I wrote some code for annotating images that works equally well for annotating PDF files inside beamer. My macros define an AnnotatedImage environment where the coordinates are scaled so that the rectangular image fits inside a suitably scaled unit square, which makes it pretty easy to draw on the image. For example, you can produce the following "beamer slide"

enter image description here

using the essentially the code:

    \draw[red, rounded corners, thick](0.2,0.85) rectangle(0.5,0.71);

[This MWE will not compile as I used a random PDF file abacus.pdf on my computer and you won't have this...unfortunately, nice packages like mwe don't supply PDF files.] The optional argument to the environment allows you set the mage dimensions and inside the environment you can use arbitrary tikz commands. In addition, there is also a \annotate command. See Image with some overlaid text for more details.

For a multi-page PDF file this almost certainly won't work but it will work if you extract the pages that you want to annotate. The other option would be to be use pdfpages to extract only the pages that you need. If you need this let me know as it shouldn't be hard to modify my code to use pdfpages directly.

Here is the full code:


\tikzset{% styling for the overlay
  annotatedImage/x/.initial = 0.7,% default overlay position
  annotatedImage/y/.initial = 0.7,
  annotatedImage/width/.initial = 1,% default image width
  annotatedImage/.unknown/.code = {% unknown keys are appended to style
    % to append to a style we need to expand everything first
    \edef\tikzappend{\noexpand\tikzset{annotatedImage/.append style =
  annotatedImage/.style = {% default overlay style
    draw=red, ultra thick, rounded corners, rectangle,

\newsavebox\annotatedImageBox% need to calculate the width and height

% internal helper functions
\newcommand\SetUpAnnotatedImage[2]{% set keys and dimensions to scale image
    \tikzset{annotatedImage/.cd, #1}%
    \pgfmathsetmacro\annotatedHeight{\ht\annotatedImageBox/28.453}% convert from px to a tikz length

% usage: \annotatedImage[node options]{image}{text}
\NewDocumentCommand\annotatedImage{ O{} m m}{%
  \bgroup% start a group to keep tikz changes local
    \begin{tikzpicture}[xscale=\annotatedWidth, yscale=\annotatedHeight]%
        \node[inner sep=0, anchor=south west] (image) at (0,0) {\usebox{\annotatedImageBox}};
        \node[annotatedImage] at (\AnnotatedImageVal{x},\AnnotatedImageVal{y}) {#3};

% usage: \annotate <insert favourite node commands>;

% usage: \begin{AnnotatedImage][width(default 1)]{image} tikz commands....\end{AnnotatedImage}
  \tikzpicture[xscale=\annotatedWidth, yscale=\annotatedHeight]
    \node[inner sep=0, anchor=south west] at (0,0) {\usebox{\annotatedImageBox}};


\begin{frame}{PDF example}

    \draw[red, rounded corners, thick](0.2,0.85) rectangle(0.5,0.71);


  • thank you so much, Andrew! ... here is a link to the pdf I want to include: researchgate.net/publication/… ... so. I want to include only the second page, and only points 3) to 5). I want to mark the first two lines, as well as the complete paragraph 5). ... I have just realized: In pdf24-Creator, when isolating a single page from a pdf, it becomes either a jpg or a png. ... does this render things a little easier?
    – Luk
    Apr 27 '19 at 13:42
  • My code works equally well with jpg, png, pdf, ... If you only want (part of) one page then I recommend extracting it and using the code above.
    – user30471
    Apr 27 '19 at 22:38
  • ok. Thx, again!
    – Luk
    Apr 28 '19 at 12:29

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.