beamer block as wide as the entire page
Perhaps not the best solution, but lying about the \linewidth
using a minipage
with width \paperwidth
does work. The \makebox[\linwidth][c]
is to give everything the width of \linewidth
and centre-align it.
For the vertical placement you can change the argument given to \vspace*
.
\documentclass{beamer}
\usetheme{metropolis}
\begin{document}
\begin{frame}{Frame}
\centering
\vspace*{5cm}
\metroset{block=fill}
\makebox[\linewidth]{%
\begin{minipage}{\paperwidth}
\begin{block}{\vspace*{-3ex}}
\centering
A wide block
\end{block}
\end{minipage}
}
\end{frame}
\end{document}
Looking at the source of the metropolis theme (here), you see that the block
environment is made up of several beamercolorbox
environments. These take wd={width}
as an optional argument to resize them to your desired width. So just add wd=\paperwidth
to every occurence of beamercolorbox
in the \metropolis@block
macro.
The following example shows two things:
- First, I redefine
\metropolis@block
to have awd=\metropolis@blockwd
as argument for everybeamercolorbox
. The length\metropolis@blockwd
is set to\paperwidth
, but you could choose any other value you like. - Second, for the placement of the
block
environment on the slide: You might want to consider using thet
option on the frame. Enabling it, elements on the slide are not vertically centered but placed starting at the top of the slide. I feel it's easier this way to reach proper placement of theblock
by using\vpsace*{2cm}
(with any value you like).
Here's the code:
\documentclass{beamer}
\usetheme{metropolis}
\makeatletter
\newlength{\metropolis@blockwd}
\setlength{\metropolis@blockwd}{\paperwidth}
\renewcommand{\metropolis@block}[1]{
\par\vskip\medskipamount%
\setlength{\parskip}{0pt}
\ifbeamercolorempty[bg]{block title#1}{%
\begin{beamercolorbox}[rightskip=0pt plus 4em,wd=\metropolis@blockwd]{block title#1}}{%
\ifbeamercolorempty[bg]{block title}{%
\begin{beamercolorbox}[rightskip=0pt plus 4em,wd=\metropolis@blockwd]{block title#1}%
}%
{%
\begin{beamercolorbox}[
sep=\dimexpr\metropolis@blocksep-\metropolis@blockadjust\relax,
leftskip=\metropolis@blockadjust,
rightskip=\dimexpr\metropolis@blockadjust plus 4em\relax,
wd=\metropolis@blockwd
]{block title#1}%
}}%
\usebeamerfont*{block title#1}%
\metropolis@strut%
\insertblocktitle%
\metropolis@strut%
\end{beamercolorbox}%
\nointerlineskip%
\ifbeamercolorempty[bg]{block body#1}{%
\begin{beamercolorbox}[vmode,wd=\paperwidth]{block body#1}}{
\ifbeamercolorempty[bg]{block body}{%
\begin{beamercolorbox}[vmode,wd=\paperwidth]{block body#1}%
}{%
\begin{beamercolorbox}[sep=\metropolis@blocksep, vmode,wd=\metropolis@blockwd]{block body#1}%
\vspace{-\metropolis@parskip}
}}%
\usebeamerfont{block body#1}%
\setlength{\parskip}{\metropolis@parskip}%
}
\makeatother
\begin{document}
\begin{frame}[t]{Frame}
\centering
\vspace*{2cm}
\metroset{block=fill}
\begin{block}{\vspace*{-3ex}}
\centering
A wide block
\end{block}
\end{frame}
\end{document}
You can use one column that spans the whole \paperwidth
. For vertical alignment, as in the other answers, use the option [t]
for the frame to top align, and then push down with e.g. \vspace*{}
.
\documentclass{beamer}
\usetheme{metropolis}
\begin{document}
\begin{frame}[t]{Frame}
\begin{columns}
\begin{column}{\paperwidth}
\vspace*{3\baselineskip}
\metroset{block=fill}
\begin{block}{\vspace*{-3ex}}
\centering
A wide block
\end{block}
\end{column}
\end{columns}
\end{frame}
\end{document}