如何在不使用每帧开头的“\usepackage{ragged2e}
和”的情况下,在 Beamer 中对齐整个文档中的文本?\justifying
\documentclass[8pt,handout,t]{beamer}
\usepackage{pifont} %used inside itemize environment \item[\ding{226}]
\usepackage{lipsum}
\begin{document}
\begin{frame}
\begin{columns}[T]
\begin{column}{0.3\textwidth}
\includegraphics[width=\columnwidth]{example-image-1x1}
\end{column}
\begin{column}{0.65\textwidth}
\begin{itemize}
\item[\ding{226}] \lipsum[2]
\item[\ding{226}] \lipsum[3]
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\begin{frame}
\lipsum[3]
\begin{itemize}
\item[\ding{226}] \lipsum[4]
\end{itemize}
\end{frame}
\begin{frame}
\begin{columns}[t]
\begin{column}{0.4\textwidth}
\lipsum[3]
\end{column}
\begin{column}{0.4\textwidth}
\lipsum[5]
\end{column}
\end{columns}
\end{frame}
\end{document}
编辑:我已经检查过了这columns
但它对和环境都不起作用itemize
。
答案1
要修补“正常”帧,可以找到解决方案投影机中的文本对齐
Itemize 在这方面也已经有了解决方案:使用 beamer 类对齐 itemize 环境内的文本
但是我找不到一个可以自动对齐列内容的程序。所以我尝试了一下,尝试修补失败\begin{column}...
,但\column
它的工作方式如下:
\documentclass[8pt,handout,t]{beamer}
\usepackage{pifont} %used inside itemize environment \item[\ding{226}]
\usepackage{lipsum}
\usepackage{ragged2e}
\usepackage{etoolbox}
\apptocmd{\frame}{}{\justifying}{}
\apptocmd{\column}{}{\justifying}{}
\makeatletter
\renewcommand{\itemize}[1][]{%
\beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
\ifnum \@itemdepth >2\relax\@toodeep\else
\advance\@itemdepth\@ne
\beamer@computepref\@itemdepth% sets \beameritemnestingprefix
\usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
\usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
\list
{\usebeamertemplate{itemize \beameritemnestingprefix item}}
{\def\makelabel##1{%
{%
\hss\llap{{%
\usebeamerfont*{itemize \beameritemnestingprefix item}%
\usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
}%
}%
}
\fi%
\beamer@cramped%
\justifying% NEW
%\raggedright% ORIGINAL
\beamer@firstlineitemizeunskip%
}
\renewcommand<>\beamer@columncom[2][\beamer@colmode]{%
\beamer@colclose%
\def\beamer@colclose{\end{minipage}\hfill\end{actionenv}\ignorespaces}%
\begin{actionenv}#3%
\setkeys{beamer@col}{#1}%
\begin{minipage}[\beamer@colalign]{#2}%
\leavevmode%
%\raggedright
\justifying% NEW
\beamer@colheadskip\ignorespaces}
\makeatother
\begin{document}
\begin{frame}
\begin{columns}[T]
\begin{column}{0.3\textwidth}
\includegraphics[width=\columnwidth]{example-image-1x1}
\end{column}
\begin{column}{0.65\textwidth}
\begin{itemize}
\item[\ding{226}] \lipsum[2]
\item[\ding{226}] \lipsum[3]
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\begin{frame}
\lipsum[3]
\begin{itemize}
\item[\ding{226}] \lipsum[4]
\end{itemize}
\end{frame}
\begin{frame}
\begin{columns}[t]
\column{0.4\textwidth}{
\lipsum[3]
}
\column{0.4\textwidth}{
\lipsum[5]
}
\end{columns}
\end{frame}
\end{document}