비머에서 정리 블록 너비 변경 : Boadilla 테마

Aug 21 2020

Boadilla 비머 테마에서 정리 (또는 기본형 등) 블록의 너비를 어떻게 변경합니까? 기본 블록은 너무 넓고 항목 화의 너비와 일치하지 않습니다. 그림에 표시된 것과 같이 어떻게 할 수 있습니까?

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

답변

muzimuzhiZ Aug 21 2020 at 18:14

이 패치를 시도하십시오.

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