1

I found a nice solution to change the width of the blocks within my beamer document.

The blocks themselves are aligned left. Is there any opportunity to automatically center each block without putting them into a \begin{center}<block>\end{center} or something like that?

Here is my MWE and how it looks like at the moment:

\documentclass{beamer}

\usetheme{Boadilla}

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

\begin{document}

    \begin{frame}
        \begin{theorem}[Pythagoras] 
            $ a^2 + b^2 = c^2$
        \end{theorem}
    \end{frame}

\end{document}

enter image description here

3

enter image description here

Use

\BeforeBeginEnvironment{block}{\begin{adjustbox}{minipage={\linewidth}, center, , frame}}
\AfterEndEnvironment{block}{\end{adjustbox}}

The frame is just to let you see what happens. The commands will place the block in a minipage then center it. The white space above the block means that the block environment automatically inserts an empty space above itself.

Full code

\documentclass{beamer}

\usetheme{Boadilla}

\addtobeamertemplate{block begin}{%
    \centering%
    \setlength{\textwidth}{0.5\textwidth}%
}{}

\BeforeBeginEnvironment{block}{\begin{adjustbox}{minipage={\linewidth}, center, frame}}
\AfterEndEnvironment{block}{\end{adjustbox}}

\usepackage{adjustbox}

\begin{document}

    \begin{frame}

        \begin{theorem}[Pythagoras] 
            $ a^2 + b^2 = c^2$
        \end{theorem}

    \end{frame}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.