Reputation: 465
I was looking for ways to have a side-by-side minipages on a Latex beamer. I will be clear, this is not two columns or mult-column or whatever. I specifically need minipages.
To do so, I created a nice command/function which does it nicely, but I am trying to make the two miniapges always be equal in height as well. Any suggestions on how to force them to be equal in size? Also general improvement suggestions and tips are welcomed.
\def \MinSideBySideGap {0.02} % minimal Gap between left/right sides
\newcommand{\SideBySide}[3][0.5]
{
%
\ifthenelse{\isempty{#1}}%
{\FPeval{\leftwidth}{0.5-\MinSideBySideGap/2}%
\FPeval{\rightwidth}{\leftwidth}%
}% if #1 is empty
{\FPeval{\leftwidth}{min(#1-\MinSideBySideGap/2,1.0)}%
\FPeval{\rightwidth}{max(1.0-\leftwidth-\MinSideBySideGap,0.0)}
}% if #1 is not empty
%
% Left Part
\begin{minipage}{\leftwidth\textwidth}
#2
\end{minipage}%
\hfill%
% Right Part
\begin{minipage}{\rightwidth\textwidth}
#3
\end{minipage}%
}
Towards @samcarter_is_at_topanswers.xyz questions, this was the very old origin of this:
\newcommand{\SideBySide}[2]
{
\begin{columns}[T] % align columns
\begin{column}{.48\textwidth}
#1
\end{column}%
\hfill%
\begin{column}{.48\textwidth}
#2
\end{column}%
\end{columns}
}
Upvotes: 1
Views: 2498
Reputation: 39002
I still don't see a reason why you would need minipages of the same height, but just as a proof of concept, you could use tcoloboxes instead of minipages. They have the ability to form "equal height groups":
\documentclass{beamer}
\usepackage[most]{tcolorbox}
\tcbset{width=(\linewidth-4mm)/2,before=,after={},enhanced,interior empty,equal height group=\insertframenumber,frame hidden}
\begin{document}
\begin{frame}
\begin{tcolorbox}%
test
\end{tcolorbox}%
\hfill%
\begin{tcolorbox}%
test
test
\end{tcolorbox}%
\end{frame}
\end{document}
(for the image, I removed the interior empty
option so one can see the height of the box)
Upvotes: 0