3

X–Y

Since my poster is on self-stabilizing algorithms (and quite frankly, I don't have much to say about it that's appropriate for a poster), I came up with a pretty cool idea for its layout. I'd like to set many blocks on the page and position them absolutely, manually connecting arbitrary blocks with edges to form a graph.

My Attempt

% arara: xelatex
% arara: xelatex

\documentclass{beamer}

\usepackage[absolute,overlay]{textpos}

\usepackage[orientation=portrait,width=36in,height=44in]{beamerposter}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\beamertemplategridbackground[1in]

\newenvironment{node}[4]{%
  \begin{textblock*}{#2}(#3,#4)%
    \begin{block}{#1}%
      \tikzmark{#1}\ignorespaces
    }{%
    \end{block}
  \end{textblock*}
}

\begin{document}
\begin{frame}

  \begin{node}{Introduction}{4in}{3in}{4in}
    What is a self-stabilizing algorithm?
    Example from paper.
  \end{node}

  \begin{node}{Motivation}{10in}{14in}{15in}
    blah
  \end{node}

  \begin{tikzpicture}[remember picture]
    \draw[overlay, line width=5mm]
      (pic cs:Motivation) -- (pic cs:Introduction);
  \end{tikzpicture}
\end{frame}
\end{document}

However, this unsurprisingly places the mark at the top left (where the text starts). How can I convince it to go to the center of the block, both vertically and horizontally, so as to make a convincing graph?

Sean Allred
  • 27,421
  • I've seen http://tex.stackexchange.com/q/96289/17423, but I'd like a solution that is a little less intrusive to the user layer. – Sean Allred Apr 23 '14 at 03:52

1 Answers1

7

This is a different approach not using tikzmarks but the remember as feature from tcolorbox. Here is the code:

\documentclass{beamer}

\usepackage[absolute,overlay]{textpos}

\usepackage[orientation=portrait,width=36in,height=44in]{beamerposter}

\usepackage{tcolorbox}                            %new code, tcb definition
\tcbuselibrary{skins}
\newtcolorbox{mybox}[1][]{
   enhanced jigsaw,
   colback=white,
   opacityback=0,
   opacityframe=0,
   coltitle=blue,
   #1
}

\beamertemplategridbackground[1in]

\newenvironment{node}[4]{%                         %changed code
  \begin{textblock*}{#2}(#3,#4)%
    \begin{mybox}[title=#1,remember as=#1]%
    }{%
    \end{mybox}
  \end{textblock*}
}

\begin{document}
\begin{frame}

  \begin{node}{Introduction}{4in}{3in}{4in}
    What is a self-stabilizing algorithm?
    Example from paper.
  \end{node}

  \begin{node}{Motivation}{2in}{14in}{15in}
       blah
  \end{node}

  \begin{tikzpicture}[remember picture]
    \draw[overlay, line width=5mm]
      (Introduction.center) -- (Motivation.center);     %changed code
  \end{tikzpicture}
\end{frame}
\end{document}

and the result:

enter image description here

What I did was to create a custom tcolorbox to be used instead of the block environment inside your nodes. The tcolorboxes titles are also used as remember as keys, so you can take advantage of the standard coordinate positioning (north, south, etc.) relative to each tcolorbox.

d-cmst
  • 23,095