Justify text inside itemize environment with beamer class
beamer
has its own ways and, in particular, it redefines many standard LaTeX environments/commands; in particular, it redefines the basic list-like environments itemize
, enumerate
and description
.
Here's, for example, the definition of \itemize
as given in beamerbaselocalstructure.sty
:
\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%
\raggedright%
\beamer@firstlineitemizeunskip%
}
as you can see, \itemize
internally uses \raggedright
. The best approach to keep things overlay specification-aware is to redefine \itemize
to use \justifying
(from the ragged2e
package) instead; the following code shows this redefinition in an actual document:
\documentclass{beamer}
\usepackage{ragged2e}
\usepackage{lipsum}
\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%
}
\makeatother
\begin{document}
\begin{frame}
\begin{itemize}
\item<1->\lipsum[2]
\item<2>\lipsum[2]
\end{itemize}
\end{frame}
\end{document}
The output:
As a final note, I would suggest you to consider if this redefinition is really needed at all; frames with too much text (like the one I just build for the example) are to be avoided in a presentation.
Try this.
\documentclass{beamer}
\usepackage{ragged2e}
\usepackage{lipsum}
\let\olditem\item
\renewcommand\item{\olditem\justifying}
\begin{document}
\begin{frame}
\begin{itemize}
\item \lipsum[1-1]
\end{itemize}
\end{frame}
\end{document}
use the package ragged2e
\begin{itemize}
\justifying
\item...
\item...
\end{itemize}