Alterando a largura do bloco de teorema no projetor: tema Boadilla

Aug 21 2020

Posso perguntar como você altera a largura do bloco de teorema (ou lema, etc.) no tema do beamer de Boadilla? O bloco padrão é um pouco largo demais e não corresponde à largura do itemize. Como posso fazer algo como mostrado na figura?

\documentclass[9pt]{beamer}
\usefonttheme{serif}
\usepackage[english]{babel}


\usetheme{Boadilla}


\begin{document}

\begin{frame}{A Lemma and a Theorem}{}
    \begin{itemize}
        \item This is one lemma and one theorem:
    \end{itemize}
    \begin{lemma}[Name of Lemma 1]
        Lemma
        \begin{equation}
        x + y = z
        \end{equation}
    \end{lemma}
    \begin{theorem}[Name of Theorem 1]
        \begin{equation}
        x - z = w
        \end{equation}
    \end{theorem} 
\end{frame}


\end{document}

Respostas

muzimuzhiZ Aug 21 2020 at 18:14

Experimente este patch:

\documentclass[9pt]{beamer}
\usefonttheme{serif}
\usepackage[english]{babel}

\usetheme{Boadilla}

\usepackage{xpatch}

\newlength{\thmwidth}
\setlength{\thmwidth}{0.85\textwidth}

\makeatletter
% patch beamer template "block begin"
\expandafter\xpatchcmd\csname beamer@@tmpl@block begin\endcsname
  {\begin{beamerboxesrounded}[}
  {%
    \hspace*{\dimexpr .5\textwidth-.5\thmwidth}% insert left skip
    \begin{beamerboxesrounded}[width=\thmwidth,% set width
  }
  {}{\fail}
\makeatother

\begin{document}

\begin{frame}{A Lemma and a Theorem}{}
    \begin{itemize}
        \item This is one lemma and one theorem:
    \end{itemize}
    \begin{lemma}[Name of Lemma 1]
        Lemma
        \begin{equation}
        x + y = z
        \end{equation}
    \end{lemma}
    \begin{theorem}[Name of Theorem 1]
        \begin{equation}
        x - z = w
        \end{equation}
    \end{theorem} 
\end{frame}

\end{document}