拉伸塊以在投影機中垂直填充小型頁面

拉伸塊以在投影機中垂直填充小型頁面

我有以下環境,應該將投影機頁面分成四個相等的部分:

\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}
}

四個區域中的每一個都將在區塊環境中呈現文字:特別是,可以這樣使用它:

\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}

產生以下內容:

在此輸入影像描述

正如您所看到的,根據每個區域中文字的不同長度,區塊會沿著延伸:這意味著每當長度不同時,框可能會不匹配。我正在尋找一種以某種方式垂直拉伸或填充塊環境的方法,無論其中是否有文本(如果沒有文本,塊可能只是垂直填充環境中的剩餘空間minipage)。

\vfill它很可能是或的某種組合\setlength,但我不知道在哪裡準確地放置這些參數來實現結果。當然,也可能有比使用minipage四次更好的解決方案(我已經嘗試過columns,但它並沒有真正提供任何更好的東西)。

答案1

將 s放在minipage區塊內以獲得固定高度:

\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}

在此輸入影像描述

答案2

另一個解決方案是tcbrasterfrom 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}

在此輸入影像描述

相關內容