Beamer 中定理环境的对齐

Beamer 中定理环境的对齐

有没有办法将定理环境居中?过去我曾尝试过 minipage。

 \documentclass[hyperref={pdfpagelabels=false},10pt]{beamer}
  \usepackage{lmodern}
 \usepackage{beamerthemeshadow}
 \usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
 \usepackage[T1]{fontenc}

 \usetheme{CambridgeUS}
  \usefonttheme{professionalfonts} 

 \setbeamerfont{block title}{series=\bfseries,size=\small}

\setbeamercolor{block title}{fg=white, bg=blue}
 \setbeamercolor{block body}{bg=gray!20!bg}

\setbeamertemplate{theorems}[numbered]
\newtheorem{beisp}{Beispiel}

\addtobeamertemplate{block begin}{%
  \setlength{\textwidth}{0.95\textwidth}%
}{}


\begin{document}
\begin{frame}
\begin{beisp}[Konsumausgaben eines Haushalts]
This is the beginning of Theorem 1.
\end{beisp} 
\end{frame} 
\end{document}

答案1

基于https://tex.stackexchange.com/a/180462/36296

\documentclass{beamer}

\usetheme{CambridgeUS}

\setbeamerfont{block title}{series=\bfseries,size=\small}
\setbeamercolor{block title}{fg=white, bg=blue}
\setbeamercolor{block body}{bg=gray!20!bg}

\setbeamertemplate{theorems}[numbered]
\newtheorem{beisp}{Beispiel}

\makeatletter
\setbeamertemplate{theorem begin}{%
    \begin{center}
    \begin{minipage}{0.7\textwidth}
  \begin{\inserttheoremblockenv}
    {%
      \inserttheoremname
      \inserttheoremnumber
      \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
    }%
}

\setbeamertemplate{theorem end}{%
    \end{\inserttheoremblockenv}
    \end{minipage}
    \end{center}
}
\makeatother

\begin{document}

\begin{frame}

\begin{beisp}[Konsumausgaben eines Haushalts]
    This is the beginning of Theorem 1.
\end{beisp} 

\end{frame} 
\end{document}

在此处输入图片描述

相关内容