1

I have the following environment that is supposed to divide the beamer page in four equal parts:

\newcommand{\FourQuads}[4]{
\begin{minipage}[t][.5\textheight][t]{\textwidth}
    \begin{minipage}[t]{.47\textwidth}  
        \begin{block}{Second}
            #1
        \end{block}
    \end{minipage}
    \begin{minipage}[t]{.47\textwidth}
        \begin{block}{Second}
            #2
        \end{block}
    \end{minipage}
\end{minipage}
\begin{minipage}[t][.5\textheight][t]{\textwidth}
    \begin{minipage}[t]{.47\textwidth}
        \begin{block}{Third}
            #3
        \end{block}
    \end{minipage}
    \begin{minipage}[t]{.47\textwidth}
        \begin{block}{Fourth}
            #4
        \end{block}
    \end{minipage}
\end{minipage}
}

each of the four areas will present the text in a block environment: in particular, one may use it so:

\documentclass[t]{beamer}
\usecolortheme{rose}


\begin{document} 
\begin{frame}{A very important slide}
\FourQuads%
{first item\\
another first item}
{second item}
{third item}
{fourth item\\
another fourth item}
\end{frame}
\end{document}

which generates the following:

enter image description here

As you can see, according to the different lengths of the text in each area, the blocks stretch along: this means that whenever the lengths differ, the boxes might mismatch. I am looking for a way to somehow vertically stretch or fill the block environments, whether or not there is text in there (should there be no text, the block may just vertically fill the remaining space in the minipage environment).

It will most likely be some sort of combination of \vfill or \setlength, but I do not know where to exactly place those parameters to achieve the result. Of course, there might also be a better solution than using minipage four times (I have tried columns but it does not really give anything better).

3

Place the minipages inside the blocks to get a fixed height:

\documentclass[t]{beamer}
\usecolortheme{rose}

\newcommand{\FourQuads}[4]{
    \begin{columns}[onlytextwidth]
        \begin{column}{.45\textwidth}
            \begin{block}{First}
                \begin{minipage}[t][.25\textheight][t]{\textwidth}
                    #1
                \end{minipage}
            \end{block}
        \end{column}
        \begin{column}{.45\textwidth}
            \begin{block}{Second}
                \begin{minipage}[t][.25\textheight][t]{\textwidth}
                    #2
                \end{minipage}
            \end{block}
        \end{column}        
    \end{columns}
    \begin{columns}[onlytextwidth]
        \begin{column}{.45\textwidth}
            \begin{block}{Third}
                \begin{minipage}[t][.25\textheight][t]{\textwidth}
                    #3
                \end{minipage}
            \end{block}
        \end{column}
        \begin{column}{.45\textwidth}
            \begin{block}{Fourth}
                \begin{minipage}[t][.25\textheight][t]{\textwidth}
                    #4
                \end{minipage}
            \end{block}
        \end{column}        
    \end{columns}   
}




\begin{document} 
\begin{frame}{A very important slide}
\FourQuads%
{first item\\
another first item}
{second item}
{third item}
{fourth item\\
another fourth item}
\end{frame}
\end{document}

enter image description here

  • Awesome, it works just fine. – gented Feb 14 '18 at 20:47
2

Another solution is a tcbraster from tcolorbox.

\documentclass[t]{beamer}
\usecolortheme{rose}
\usepackage[most]{tcolorbox}

\newcommand{\FourQuads}[4]{
\begin{tcbraster}[raster columns=2, raster rows=2, raster height=.8\textheight,
    enhanced, size=small, sharp corners, boxrule=0pt,
    colbacktitle=structure.fg!20!bg,
    coltitle=structure.fg,
    colback=structure.fg!10!bg]
    \begin{tcolorbox}[title=First]#1\end{tcolorbox}
    \begin{tcolorbox}[title=Second]#2\end{tcolorbox}
    \begin{tcolorbox}[title=Third]#3\end{tcolorbox}
    \begin{tcolorbox}[title=Fourth]#4\end{tcolorbox}
\end{tcbraster}
}

\begin{document} 
\begin{frame}{A very important slide}
\FourQuads%
{first item\\
another first item}
{second item}
{third item}
{fourth item\\
another fourth item}

\end{frame}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.