# Assessing BAPoster’s boxes as TikZ coordinates

I am using BAPoster and want to connect two boxes with a line. As BAPoster is uses TikZ to create and position its boxes, I expect that the boxes have TikZ identifiers and therefore can be used as TikZ coordinates. However, I fail to find how I can address them.

Here is a minimal example with a non-working naïve approach:

\documentclass[a0paper]{baposter}

% To avoid errors:
\usepackage{polyglossia}
\setdefaultlanguage[variant=uk]{english}

\begin{document}
\begin{poster}{textborder=roundedsmall}{}{}{}{}

\headerbox{Apples }{name=apples,  column=2, span=1}{Apples\\Apples}

% I want something like this, but working:
\begin{tikzpicture}[remember picture, overlay]
\draw (observations) to (references);
\end{tikzpicture}

\end{poster}
\end{document}

This throws the following error:

! Package pgf Error: No shape named bananas is known.

How can I make this work?

• Not sure if it's possible with baposter commands, but you could use tikzmark. – Ignasi May 16 '17 at 15:36
• @Ignasi: As far as I see it, tikzmark only allows me to mark certain points in the text, but not the boxes. – Wrzlprmft May 16 '17 at 16:06

May be I'm wrong, but after some diving inside baposter.cls I think that baposter boxes are not defined as nodes. Each box is built based on several coordinates which are remembered and can be used to connect boxes.

These coordinates are defined with syntax coordinate(\baposter@box@name nw) where \baposter@box@name is the name assigned to each box with name=.... It took me some time to discover that previous syntax doesn't consider the white space and the real name is namenw.

I've found coordinates: ...nw, ...se, ...tnw, ...tne, ...outer nw, ...outer ne, ...outer se, ...outer tnw and ...outer tne. They correspond to following points over the box:

I don't know what's the difference between outer and nonaouter coordinates.

In any case, you can use them to draw lines connecting baposter boxes.

\documentclass[a0paper]{baposter}

% To avoid errors:
\usepackage{polyglossia}
\setdefaultlanguage[variant=uk]{english}

\begin{document}
\begin{poster}{textborder=roundedsmall}{}{}{}{}

\draw[thick, blue] (bananasnw) to[out=180, in=-90] (applesse);
\path (bananasnw)|-(bananasse) coordinate[pos=.75] (aux1);
\path (applesnw)|-(applesse) coordinate[pos=.75] (aux2);

\draw[thick, green] (aux1) to[out=270, in=-90] (aux2);

%\begin{scope}[every node/.style={inner sep=3pt}]
%\filldraw[red] (bananasnw) circle (2pt) node[above left] {namenw};
%\filldraw[red] (bananasse) circle (2pt) node[below left] {namese};
%
%\filldraw[blue] (bananastnw) circle (2pt) node[above left] {nametnw};
%\filldraw[blue] (bananastne) circle (2pt) node[above left] {nametne};
%
%\filldraw[green] (applesouter nw) circle (2pt) node[above right] {nametouter nw};
%\filldraw[green] (applesouter ne) circle (2pt) node[above left] {nametouter ne};
%\filldraw[green] (applesouter se) circle (2pt) node[below left] {nametouter se};
%
%\filldraw[cyan] (applesouter tnw) circle (2pt) node[above right] {nametouter tnw};
%\filldraw[cyan] (applesouter tne) circle (2pt) node[above left] {nametouter tne};
%\end{scope}

\end{poster}
\end{document}

Another approach is to use \subnode or \pgfmark from the Tikzmark package. This facilitates placing marks associated with particular posterbox elements, such as certain words or letters of text. I should note that I was unable to get either \tikzmark[<drawing command>]{<name>} or \tikzmark{<name>}{<coordinate>} to work.

Marks can also be directed to the posterbox coordinates identified in @Ignasi's excellent answer, by shifting the placement of the marks using the usual TikZ syntax.

In the MWE, I changed headerbox to posterbox, as the former was deprecated, although it still functions. I also added a more complete specification of the baposter options.

This is the code:

\documentclass[a4paper]{baposter}
\usetikzlibrary{tikzmark}

\begin{document}
\begin{poster}{
grid=false,
columns=2, % how many columns 1-6
colspacing=5.0mm, % spacing between the columns
headerheight=0cm, % the height of the header for the title
background=none, %user or none or plain
eyecatcher=false, %turn left logo on/off
%posterbox options
headerborder=closed, % see the baposter manual for the rest
borderColor=darkgray,
textborder=rectangle,
boxColorOne=white,
textfont=\tiny,
linewidth=1pt}
{}{\textcolor{white}{dummy}}{}{} % Eyecatcher, title, author, right logo. There must be at least one entry.

\begin{posterbox}[name=bananas, column=0, span=1]{\subnode{C}{B}anana\pgfmark{Y}}{
\begin{tabular}{@{}l@{}}
Banana\subnode{A}{s} \\ Apples\pgfmark{Y}
\end{tabular}}
\end{posterbox}
\begin{posterbox}[name=apples, column=1, span=1]{Apples\pgfmark{Z}}{
\begin{tabular}{@{}l@{}}
\subnode{B}{D}urian \\ Mangostee\subnode{D}{n}
\end{tabular}}
\end{posterbox}

\draw[orange,thick,->] ([shift={(-2ex,-2ex)}]pic cs:A) to[out=-355, in=-200] ([shift={(-3ex,-2ex)}]pic cs:B);
\draw[magenta,thick,->] ([shift={(-4ex,-2ex)}]pic cs:C) to[out=230, in=-135] ([shift={(4ex,-4ex)}]pic cs:D);
\draw[blue,thick,->] ([shift={(0ex,5.5ex)}]pic cs:Y) to[out=-340, in=160] ([shift={(-3ex,0.5ex)}]pic cs:Z);

\end{poster}
\end{document}

This is the output:

• Thank you for your answer, but I need to access the boxes themselves, not their content. (Also, regarding the complete poster specifications: I removed them on purpose to acquire a minimal example. Don’t worry; I won’t use a eye-cancer colours.) – Wrzlprmft May 17 '17 at 7:40