Beamer:全局块中的文本对齐

Beamer:全局块中的文本对齐

我可以使用 来对齐块中的文本\justifying。是否可以全局对齐每个块中的文本而不\justifying在每个块中使用?谢谢

平均能量损失

\documentclass{beamer}
\usetheme{default}


% For global Justification
%\usepackage{ragged2e}
%\justifying
\renewcommand{\raggedright}{\leftskip=0pt \rightskip=0pt plus 0cm} 


\begin{document}


\begin{frame}{Test}

\begin{block}{Test}
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{block}

\end{frame}


\end{document}

答案1

您可以加载包并在模板末尾ragged2e添加:\justifyingblock begin

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

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

\begin{document}
    \begin{frame}{Test}
        \begin{block}{Test}
            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{block}
    \end{frame}
\end{document}

在此处输入图片描述

答案2

在我的情况下,domenico camasta 给出的代码不起作用。但以下修改有效

\documentclass{beamer}
\usepackage{ragged2e}
\usepackage{lipsum}
\addtobeamertemplate{block begin}{}{\justifying}{}

为了使块外的文本对齐,我使用了以下命令以及上述代码:

\apptocmd{\frame}{}{\justifying}{}

相关内容