# Creating boxes with background in baposter

I am using the baposter package to create a poster. One can have colored boxes, but I want to have my own background for each box (and not for the poster itself). Is it possible?

• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – LaRiFaRi Aug 18 '15 at 5:38
• Exactly how are you making those boxes? Yesterday I had student who wanted something similar. Ended up changing baposter.cls such that \headposter can take a background option. It is a fairly simple addition. – daleif Aug 18 '15 at 11:15

It is not exactly clear what is being requested, so I will take a guess that you would like a background image under your box content. My approach is to take that content and place it in a \vbox with the macro

\setbox0=\vbox{<content>}


Then, I place the background image under it with an \ooalign, as in

\ooalign{\includegraphics[width=\textwidth,height=\ht0]{example-image-A}\cr\box0}


I am not a baposter user and so don't know if the small border around the background image can be eliminated, or even how to place multiple boxes on a single poster.

Here is my MWE. I just grabbed some box content from this question: Fitting as a background to nodes in multiple pictures

\documentclass[b3paper]{baposter}
\usepackage{tikz,amsmath,graphicx}
\usetikzlibrary{fit}

\begin{document}
\begin{poster}{bgColorOne=blue!20!white,background=plain}{}{}{}{}
\setbox0=\vbox{%
\begin{align}
x &=
\begin{tikzpicture}[remember picture]
\node[circle,fill=red,minimum width=1cm] {};
\end{tikzpicture}
+
\begin{tikzpicture}[remember picture]
\node[circle,fill=cyan,minimum width=1cm] (first node) {};
\end{tikzpicture}
\\
y &=
\begin{tikzpicture}[remember picture]
\node[circle,fill=red,minimum width=1cm] {};
\end{tikzpicture}
+
\begin{tikzpicture}[remember picture]
\node[circle,fill=cyan,minimum width=1cm] (second node) {};
\end{tikzpicture}
+
\begin{tikzpicture}[remember picture]
\node[circle,fill=green,minimum width=1cm] (third node) {};
\end{tikzpicture}
\end{align}
\begin{tikzpicture}[remember picture,overlay]
\node[draw=red,fill=yellow,fill opacity=0.8,fit=(first node) (second node) (third node),rectangle] {};
\end{tikzpicture}%
}
\ooalign{\includegraphics[width=\textwidth,height=\ht0]{example-image-A}\cr\box0}
\end{posterbox}
\end{poster}
\end{document}


I can actually remove the 5pt border around the background image, by loading my verbatimbox package and invoking the \ooalign as

\ooalign{\addvbuffer[-5pt]{\makebox[\textwidth]{\includegraphics%
[width=\dimexpr\textwidth+10pt\relax,height=\dimexpr\ht0+10pt\relax]{%
example-image-A}}}\cr\box0}


There are very likely better ways to accomplish that.

• Thanks! It worked. Actyally I needed just the following codes: – Mary Aug 19 '15 at 6:04
• \documentclass[b3paper]{baposter} \usepackage{tikz,amsmath,graphicx} \usetikzlibrary{fit} \begin{document} \begin{poster}{bgColorOne=blue!20!white,background=plain}{}{}{}{} \begin{posterbox}[textborder=none,headerborder=none,span=3,boxColorOne=white]{title} \setbox0=\vbox{% \text{My Text} } \ooalign{\includegraphics[width=\textwidth,height=\ht0]{example-image-A}\cr\box0} \end{posterbox} \end{poster} \end{document} – Mary Aug 19 '15 at 6:17
• @Mary I'm pleased that you can employ it for your purposes. – Steven B. Segletes Aug 19 '15 at 10:32

Here is a shorter version of what the user needed in my case. I'll post post it here for future reference

\usepackage{etoolbox}
\makeatletter
\define@cmdkey[ba]{posterbox}[baposter@box@]{background}{}
\presetkeys[ba]{posterbox}{
background=white,
}{}
\patchcmd{\poster}{%
text justified] {\usebox{\baposter@content}};% <- important
}{
text justified, fill=\baposter@box@background]
{\usebox{\baposter@content}};
}{\typeout{patched}}{\typeout{not patched}}
\makeatother


This enables the use of

\headerbox{title}{options}{contents}


where options can now include background=color