I have a table with three columns; one is a text column, one contains images, and the last one a tikz graphics. But I am not being able to vertically align them. Somewhat minimal code:
\documentclass[demo]{beamer}
\usepackage{geometry}
\geometry{paperwidth=7.5in,paperheight=11in}
\usepackage{tabularray}
\usepackage[export]{adjustbox}
\usepackage{xcolor}
\usepackage{tikz}
\newcommand{\red}[1]{\textcolor{red}{#1}}
\newcommand{\animal}{\includegraphics[width=0.1\linewidth, height=0.1\linewidth]{animal.png}\hspace{1em}}
\newcommand{\mybox}{\tikz{\path[draw, line width=2pt] (0,0) rectangle (0.6in, 0.6in)}}
\begin{document}
\section{Introduction}
\begin{frame}{}
\begin{tblr}{
colspec={X[0.1]XX[0.12]@{}},
columns = {m},
column{1} = {font=\Huge},
hlines = {}{2-3}{},
}
\red{B} & \animal \animal \hspace{3em} \animal \animal \animal \animal \animal & \mybox\
\end{tblr}
\end{frame}
\end{document}
The output:
I have tried using the valign=c option from the adjustbox package. But that didn't also work.
Modification for valign:
\newcommand{\animal}{\includegraphics[width=0.1\linewidth, height=0.1\linewidth, valign=c]{animal.png}\hspace{1em}}
Adjustbox output:
How may I solve this?
Edit: My question presentation has created some confusion. So, I am updating the code a bit. Now I have added the all the horizontal and vertical lines to make it easier to show my problem.
\documentclass[demo]{beamer}
\usepackage{geometry}
\geometry{paperwidth=7.5in,paperheight=11in}
\usepackage{tabularray}
\usepackage[export]{adjustbox}
\usepackage{xcolor}
\usepackage{tikz}
\newcommand{\red}[1]{\textcolor{red}{#1}}
\newcommand{\animal}{\includegraphics[width=0.1\linewidth, height=0.1\linewidth]{animal.png}\hspace{1em}}
\newcommand{\mybox}{\tikz{\path[draw, line width=2pt] (0,0) rectangle (0.6in, 0.6in)}}
\begin{document}
\section{Introduction}
\begin{frame}{}
\begin{tblr}{
colspec={X[0.1, c]XX[0.12]@{}},
columns = {m},
column{1} = {font=\Huge},
hlines = {}{1-3}{},
vlines
}
\red{B} & \animal \animal \hspace{3em} \animal \animal \animal \animal \animal & \mybox\
\end{tblr}
\end{frame}
\end{document}
Output:
My expected output:







baselineof each. You can specify the baseline of the TikZ picture using thebaselineoption of thetikzpictureenvironment. Thetikzpicturelooks taller than the others, so you how should that difference be accommodated? – cfr Oct 08 '23 at 16:42heightis sufficient ... perhaps that solves your problem already? Images are rescaled to meet said height. – MS-SPO Oct 08 '23 at 17:27baselinekey of thetikzcommand (haven't yet been able to solve for the 1st column). And to answer your query, I want to vertically align all columns in the center. – Imran Oct 08 '23 at 17:34widthkey. In the MWE, I added theheightkey (along withwidth) to visually resemble my original output. Here is an output of the MWE if I don't specify theheightkey. – Imran Oct 08 '23 at 17:38