0

Is there a way to center the theorem environment? In the past i have tried 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}
2

1 Answer 1

1

Based on 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}

enter image description here

8
  • One morev question: Is there a way to numerate the theorem?
    – user150752
    Jan 16, 2018 at 20:57
  • @Eric \setbeamertemplate{theorems}[numbered] Jan 16, 2018 at 20:58
  • It is already integrated in my code. But there is no numbering
    – user150752
    Jan 16, 2018 at 21:12
  • I guess your code overwrite the command
    – user150752
    Jan 16, 2018 at 21:12
  • When i put it afterwards the block environment in numbered, but it is in 100% textwide
    – user150752
    Jan 16, 2018 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .