samcarter
I'm using a tcbraster with tcblistings inside. How can I

- align the top parts of the listings to have a common baseline

- align the lower parts of the listings so that their first lines are on the same height? (or the top of the lines, that's a good enough approximation)

![Screen Shot 2021-04-15 at 12.29.52.png](/image?hash=7741770a7251b824ed2f377092c1c21c29e77574ca24202b93bc8f94449e56a8)

What I have so far:


\documentclass{beamer}

\usepackage{tikzlings}
\usepackage[most]{tcolorbox}

\tcbset{%
lower separated=false,
}

\DeclareTCBListing{ducktop}{ O{} }{%
before upper={%
\centering
\hspace{12pt}
\begin{tikzpicture}[scale=1]
},
after upper={%
\end{tikzpicture}
},
text and listing,
valign lower=top,
space to upper,
#1
}

\begin{document}

\begin{frame}[fragile]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tcbraster}[raster columns=2, raster equal height=rows]
\begin{ducktop}[]
\pig[signpost={Q}]
\end{ducktop}
\begin{ducktop}[]
\bear[
speech={Q}]
\end{ducktop}
\end{tcbraster}
\end{frame}

\end{document}


![document.png](/image?hash=d81ce81c6a05e073a34fda318170b04c8b93df51760400e5ea132f9266c466fc)
user 3.14159
The 3dtools library has a key same bounding box, the main purpose of which is to allow the user to create animations in which a series of tikzpictures has the same bounding box. The usage is same bounding box=<id>, where the <id> is an identifier. In your example this yields

\documentclass{beamer}
\usepackage{tikzlings}
\usetikzlibrary{3dtools}% https://github.com/marmotghost/tikz-3dtools
\usepackage[most]{tcolorbox}

\tcbset{%
lower separated=false,
}

\DeclareTCBListing{ducktop}{ O{} }{%
before upper={%
\centering
\hspace{12pt}
\begin{tikzpicture}[scale=1,same bounding box=A]
},
after upper={%
\end{tikzpicture}
},
text and listing,
valign lower=top,
space to upper,
#1
}

\begin{document}

\begin{frame}[fragile]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tcbraster}[raster columns=2, raster equal height=rows]
\begin{ducktop}[]
\pig[signpost={Q}]
\end{ducktop}
\begin{ducktop}[]
\bear[
speech={Q}]
\end{ducktop}
\end{tcbraster}
\end{frame}
\end{document}

![Screen Shot 2021-04-15 at 8.51.29 AM.png](/image?hash=48dbac472456a0645cf66c80364fbf84de9ae9e37f7ed441106272bd019b1051)
samcarter
### Dirty hack:

Turns out, I'll just have to make sure that the tikzpictures at the top have the same height. I can ensure this by adding an (invisible) path:


\documentclass{beamer}

\usepackage{tikzlings}
\usepackage[most]{tcolorbox}

\tcbset{%
lower separated=false,
}

\DeclareTCBListing{ducktop}{ O{} }{%
before upper={%
\centering
\hspace{12pt}
\begin{tikzpicture}[scale=1]
\path (0,-0.1) -- (0,3.3);
},
after upper={%
\end{tikzpicture}
},
text and listing,
valign lower=top,
#1
}

\begin{document}

\begin{frame}[fragile]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tcbraster}[raster columns=2, raster equal height=rows]
\begin{ducktop}[]
\pig[signpost={Q}]
\end{ducktop}
\begin{ducktop}[]
\bear[
speech={Q}]
\end{ducktop}
\end{tcbraster}
\end{frame}

\end{document}


![document.png](/image?hash=85cdc57c736adb3ebdfa1a1626fda3c087758fc91ad6785fadadb1ebe8e2e00e)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.