# Open an “embedded” picture by clicking on text

Is it possible to achieve the following in Latex: Upon clicking on a specific text (e.g. a word) in a pdf, a box w/ predefined size and location opens, showing a picture1? It would be also nice if there were a way to get rid of the box (and picture), e.g. by clicking on it or specifying to disappear after n seconds. The text may (but doesn't have to) appear as a regular link. In case someone wonders, I want this for a beamer presentation

1 Or perhaps even a video

• You could use the \tootltip{<link text>}{<tip text>} command, with \includegraphics{...} as <tip text>. – AlexG Mar 21 '18 at 5:51
• @AlexG Your \tooltip code gave me "/usr/local/share/texmf/tex/latex/media9/pdfbase.sty:178: Undefined control sequence. l.178 \sys_if_engine_pdftex:T". I have TeX, Version 3.1415926 (TeX Live 2013/Debian), I suppose it's too old. I'll try to upgrade as soon as possible – jaam Mar 22 '18 at 9:09
• You seem to use an outdated TeXLive installation shipping with your Linux distro. You should install the current one (TL-2017) into your \$HOME directory and set the PATH accordingly. You can safely do this in parallel to your system wide installation. – AlexG Mar 22 '18 at 9:57
• @AlexG Is it also possible to embed videos w/ \tooltip? – jaam Mar 24 '18 at 13:12
• If you use media9 for embedding video,, it is better to use \includemedia with the windowed=<width>x<height>@<position> option. It opens the media in a floating window. See the media9 manual. – AlexG Mar 25 '18 at 17:47

I am very hesitant to post this, which is not very elegant, but does something along the lines you are describing.

\documentclass{beamer}
\usetheme{Warsaw}
\usepackage{tikz}
\newcommand{\tikznode}[2]{\tikz[remember picture,baseline=(#1.base)]{\node(#1)[inner sep=0pt]{#2};}}
\usepackage{lipsum}
\begin{document}

\begin{frame}
\frametitle{Some slide}\label{frame:SomeSlide}
\begin{overlayarea}{\textwidth}{\textheight}
\lipsum[1] This text is in \hyperlink{frame:SomeSlideWithPopUp}{Latin}.
\end{overlayarea}
\end{frame}

\begin{frame}
\frametitle{Some other slide}
\begin{overlayarea}{\textwidth}{\textheight}
\lipsum[2]
\end{overlayarea}
\end{frame}

\begin{frame}
\frametitle{Some slide}\label{frame:SomeSlideWithPopUp}
\begin{overlayarea}{\textwidth}{\textheight}
\lipsum[1] This text is in \tikznode{L}{Latin}.
\begin{tikzpicture}[overlay,remember picture]
\node[text width=5cm,opacity=0.8] at (L) {
Latin is an ancient language.
\end{block}};
\end{tikzpicture}
\end{overlayarea}
\end{frame}
\end{document}


This produces three slides. If you click on "Latin" in the first slide, you jump to the last slide, which coincides with the first one up to a box. You could also embed a movie or other media. If you click on the title of the box, you will jump back to the first slide. So in the presentation it will indeed lead to the scenario in which a box appears upon a click. Of course, if you want to avoid typing the frame twice, you can make use of \againframe. The problem with all this is that will require a lot of effort if you wish to have this effect several times.

• Better than nothing, but a problem w/ this is that the box will mess up your text layout† if it is not at the end of the text. † I.e. there's no way to tell Latex that it must cover the text -- or is there? – jaam Mar 22 '18 at 10:37
• @jaam It is straightforward to have the box on top of the clicked text. – user121799 Mar 22 '18 at 14:35