3

Using this answer, I can justify text in block environments globally. However, if I replace the block environment by an example environment, the above solution doesn't work:

\documentclass{beamer}
\usepackage{ragged2e}   %new code
\usetheme{default}

\addtobeamertemplate{example begin}{}{\justifying}  %new code

\begin{document}

\begin{frame}{Test}
  \begin{example}
    The brown fox jumped over the lazy dog. The brown fox jumped over
    the lazy dog. The brown fox jumped over the lazy dog. The brown
    fox jumped over the lazy dog. The brown fox jumped over the lazy
    dog. The brown fox jumped over the lazy dog. The brown fox jumped
    over the lazy dog. The brown fox jumped over the lazy dog. The
    brown fox jumped over the lazy dog. The brown fox jumped over the
    lazy dog. The brown fox jumped over the lazy dog.
  \end{example}
\end{frame}
\end{document}

enter image description here

How can I justify text in the example environment globally?

Version: Beamer 3.55 from TeX Live 2018.

4

The template you want to modify is called block example begin and not example begin

\documentclass{beamer}
\usepackage{ragged2e}   %new code
\usetheme{default}

\addtobeamertemplate{block example begin}{}{\justifying}  %new code

\begin{document}

\begin{frame}{Test}
  \begin{example}
    The brown fox jumped over the lazy dog. The brown fox jumped over
    the lazy dog. The brown fox jumped over the lazy dog. The brown
    fox jumped over the lazy dog. The brown fox jumped over the lazy
    dog. The brown fox jumped over the lazy dog. The brown fox jumped
    over the lazy dog. The brown fox jumped over the lazy dog. The
    brown fox jumped over the lazy dog. The brown fox jumped over the
    lazy dog. The brown fox jumped over the lazy dog.
  \end{example}
\end{frame}
\end{document}

enter image description here

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.