改变投影仪中的定理块宽度:Boadilla 主题

改变投影仪中的定理块宽度:Boadilla 主题

请问如何更改 Boadilla beamer 主题中定理(或引理等)块的宽度?默认块有点太宽,与 itemize 的宽度不匹配。我该如何做如图所示的操作?

在此处输入图片描述

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

答案1

尝试这个补丁:

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

在此处输入图片描述

相关内容