2

Coming from MS Powerpoint I usually use SmartForms or other objects to highlight specific points in a picture or a table to draw the viewers attention. Just imagine a technical drawing and I want a big fat arrow pointing at a certain piece of that drawing. Or an arrow pointing to a certain number in a table.

So in Powerpoint I just use drag and drop and put the arrow where I want it to be, if I want to move the picture I put picture and arrow in a group and move them together.

In I use the textpos package to place my object on the frame:

\usepackage[absolute,overlay]{textpos}

the grid is supposed to help me doing that:

\setbeamertemplate{background}[grid][step=10mm]

but unfortunately it starts in the bottom-left corner of the frame, but textpos' origin is the top-left corner. That's a little annoying, how to get the grid right? Even if that would work it is still quite some pain in the ... to place the object correctly, and requires multiple compilations.

Now I edit my table or move my picture and the fiddly placement procedure starts again.

Here is the MWE showing an example:

\documentclass{beamer}

\usepackage[absolute,overlay]{textpos}
\usepackage{booktabs}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

\usepackage{bbding}
\newcommand{\BigArrow}{\scalebox{5}[1]\ArrowBoldRightShort\!}

\setbeamertemplate{background}[grid][step=10mm]
\begin{document}
\begin{frame}

\begin{table}
    \begin{tabularx}{\textwidth}{YYY}
    \toprule
    \textbf{Treatments} & \textbf{Response 1} & \textbf{Response 2}\\
    \midrule
    Treatment 1 & 0.0003262 & 0.512 \\
    Treatment 2 & 0.0015681 & 0.910 \\
    Treatment 3 & 0.0009271 & 0.296 \\
    \bottomrule
    \end{tabularx}
\end{table}

\begin{textblock*}{0mm}(80mm,37.875mm)
      \BigArrow
\end{textblock*}%

\begin{textblock*}{0mm}(106mm,49.5mm)
      \HandLeftUp
\end{textblock*}%

\end{frame}
\end{document}

enter image description here

As you can see, I actually want to place the arrow exactly between the two top row elements of the last two columns and let the finger point on the last number. But I don't want to alter the table itself.

I'm looking for something like:

...
Treatment 1 & 0.0003262 \setanchorpoint{1} & 0.512 \\
Treatment 2 & 0.0015681 & 0.910 \\
Treatment 3 & 0.0009271 & 0.296\setanchorpoint{2} \\
...
...
\begin{textblock*}{0mm}(\getanchorpointX{1}+10mm,\getanchorpointY{1}+0mm)
      \BigArrow
\end{textblock*}%

\begin{textblock*}{0mm}(\getanchorpointX{2}+5mm,\getanchorpointY{2}+5mm)
      \HandLeftUp
\end{textblock*}%

Is that possible?

If not, what general approach would you recommend to place objects relatively to others?

In case of tables for example I wouldn't consider it a good option to insert "invisible" rows and columns to insert the arrow and finger. Grouping multiple overlaying pictures seems more feasible though.


I hope this question is not too broad. But I'm quite enthusiastic about the possibilities offers me. This question is the last huge drawback of over Powerpoint for me, and if there is the time pressure to get the presentation ready in a day, I'd probably would rather go and use Powerpoint to get the work done, but I actually don't want to. To big are the advantages of Latex. As you see I'm not talking about perfect typesetting of presentations, sometimes these dirty tricks are just necessary.

Latex always gives me the "Everything can be done!" impression, so what is the magic trick in this case?


For further illustration a slide of one of my Powerpoint presentations and the objects I'd like to place as described in this question marked with red:

enter image description here

2

Looking arround TX.SX you'll find a lot of examples with \tikzmark

\documentclass{beamer}

\usepackage{booktabs}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{tikz}

\usepackage{bbding}
\newcommand{\BigArrow}{\scalebox{5}[1]\ArrowBoldRightShort\!}

\setbeamertemplate{background}[grid][step=10mm]

% tikzmark command, for shading over items
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\begin{document}
\begin{frame}

\begin{table}
    \begin{tabularx}{\textwidth}{YYY}
    \toprule
    \textbf{Treatments} & \textbf{Response 1} & \textbf{Response 2}\\
    \midrule
    Treatment 1 & 0.0003262\tikzmark{a} & \tikzmark{b}0.512 \\
    Treatment 2 & 0.0015681 & 0.910 \\
    Treatment 3 & 0.0009271 & 0.296\tikzmark{c} \\
    \bottomrule
    \end{tabularx}
\end{table}

\begin{tikzpicture}[overlay, remember picture] 
\path (a) -- node[midway, anchor=base] {\BigArrow} (b);
\node[rotate=-15, anchor=west] at (c) {\HandLeftUp};
\end{tikzpicture}

\end{frame}
\end{document}

Compile twice previous code and you'll get

enter image description here

For your second question I'd suggest something like Drawing on an image with TikZ

  • This looks like a great solution! It requires to load the heavy tikz though, but most of the people here do it anyway. I'm about to write an answer without tikz, but this one seems to offer much more possibilities. Thank you! – thewaywewalk May 7 '15 at 16:26
3

Yes there exists a generic workflow to place object relatively to another. This generic workflow is TeX itself. Only what you need is to know TeX.

For example, you can create the macro \putto{right}{up}{object} which pusts the object relative to the current point of typesetting but the typesetting point isn't moved. The macro can be defined as:

\def\putto#1#2#3{\vbox to0pt{\kern-#2\hbox to0pt{\kern#1{#3}\hss}\vss}}

And usage of such macro in your example:

\documentclass{beamer}

\usepackage[absolute,overlay]{textpos}
\usepackage{booktabs}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

\usepackage{bbding}
\newcommand{\BigArrow}{\scalebox{5}[1]\ArrowBoldRightShort\!}

\def\putto#1#2#3{\vbox to0pt{\kern-#2\hbox to0pt{\kern#1{#3}\hss}\vss}}

\setbeamertemplate{background}[grid][step=10mm]
\begin{document}
\begin{frame}

\begin{table}
    \begin{tabularx}{\textwidth}{YYY}
    \toprule
    \textbf{Treatments} & \textbf{Response 1} & \textbf{Response 2}\\
    \midrule
    Treatment 1 & 0.0003262\putto{8mm}{3mm}\BigArrow & 0.512 \\
    Treatment 2 & 0.0015681 & 0.910 \\
    Treatment 3 & 0.0009271 & 0.296\putto{2mm}{1.4mm}\HandLeftUp \\
    \bottomrule
    \end{tabularx}
\end{table}   

Edit If you need to keep the baseline of the object at the position of the current typesetting point when second parameter is 0mm then our macro is little more complicated:

\def\putto#1#2#3{\vbox to0pt{\kern-#2\hbox to0pt{\kern#1\puttoA{#3}\hss}\vss}}
\def\puttoA#1{\setbox0=\hbox{#1}\ht0=0pt\box0 }
  • Thank you, I really like that! I try to understand the macro and have a little problem: the upper left corner of the "object" is equal to the lower right corner of the number 0.0003262 in this case. It would be more logical to use the lower left corner of the "object" instead, but I have a hard time to change the macro accordingly. Can you help? do you know what I mean? So after the change 0.0003262\putto{8mm}{0mm}\BigArrow & 0.512 should lead to a similar result. – thewaywewalk May 7 '15 at 17:20
  • 1
    @thewaywewalk OK, I upgraded my answer, see the last two lines. – wipet May 7 '15 at 19:36
  • thanks for the update! Unfortunately I can't accept two answers. Though I like this one for its simplicity, I will accept Ignasis as it is answers my question more completely. – thewaywewalk May 8 '15 at 6:38

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.