我正在撰写演示文稿,想使用以下布局:
顶部有一个横跨整个页面宽度的大框,下面有两个并排的框。
我的问题是上框和下框的左右边缘无法对齐。我已经尝试了各种选项,例如总宽度和文本宽度,但无法使其工作。
\documentclass{beamer}
\usecolortheme{orchid}
\begin{document}
\begin{frame}
\begin{block}{Single Column} \vspace{4em} \end{block}
\begin{columns}
\begin{column}{.5\textwidth}
\begin{block}{Two Columns} \vspace{4em} \end{block}
\end{column}
\begin{column}{.5\textwidth}
\begin{block}{Two Columns} \vspace{4em} \end{block}
\end{column}
\end{columns}
\end{frame}
\end{document}
答案1
\documentclass{beamer}
\usecolortheme{orchid}
\newsavebox{\squaredblocktext}
\setbeamertemplate{block begin}{
\par\vskip\medskipamount%
\makebox[\dimexpr\textwidth-1.5ex\relax][l]{%
\begin{beamercolorbox}[colsep*=.75ex]{block title}
\usebeamerfont*{block title}\insertblocktitle%
\end{beamercolorbox}}%
\begin{lrbox}{\squaredblocktext}%
\begin{minipage}[t]{\textwidth}%
\ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\setbeamertemplate{block end}{
\end{minipage}%
\end{lrbox}%
{\parskip0pt\par}%
\ifbeamercolorempty[bg]{block title}{}
{\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
\usebeamerfont{block body}%
\makebox[\dimexpr\textwidth-1.5ex\relax][l]{%
\begin{beamercolorbox}[colsep*=.75ex,vmode]{block body}%
\usebox{\squaredblocktext}
\end{beamercolorbox}%
}\vskip\smallskipamount%
}
\begin{document}
\begin{frame}
\begin{block}{Single Column} \vspace{4em} \end{block}
\begin{columns}[onlytextwidth, T]
\begin{column}{.45\textwidth}
\begin{block}{Two Columns} \vspace{4em} \end{block}
\end{column}
\begin{column}{.45\textwidth}
\begin{block}{Two Columns} \vspace{4em} \end{block}
\end{column}
\end{columns}
\end{frame}
\end{document}