# Justify text inside itemize environment with beamer class

I would like to justify text inside an itemize environment with the beamer class. Text appears to be justified by default with the article class, but not with the beamer class.

The following code justifies text left and right:

    \documentclass{article}
\usepackage{lipsum}
\begin{document}
\begin{itemize}
\item \lipsum[1-1]
\end{itemize}
\end{document}


The following code does not:

    \documentclass{beamer}
\usepackage{lipsum}
\begin{document}
\begin{frame}
\begin{itemize}
\item \lipsum[1-1]
\end{itemize}
\end{frame}
\end{document}


I have tried this:

    \documentclass{beamer}
\usepackage{ragged2e}
\usepackage{lipsum}
\let\olditemize=\itemize
\renewenvironment{itemize}{\olditemize\justify}{\endlist}
\begin{document}
\begin{frame}
\begin{itemize}
\item \lipsum[1-1]
\end{itemize}
\end{frame}
\end{document}


but it won't justify text on the right. Any suggestions welcome!

• Oh, yes, it's true. I hadn't realized. I'll delete my comment. Thanks. – Dog_69 Dec 4 '18 at 8:35

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
\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
\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.

• Thanks Gonzalo, Thanks Ian, that does it! I just want to answer your question Gonzalo, the reason for wanting to have text justified within a beamer document is that I alternate frames designed for presentation and slides designed for the handout version (tagging with "beamer" or "handout"). I typeset some of the "handout" frames as plain text for reading, for instance writing out page-length proofs or long explanations. There may be a better way to do this, but I've found it to be easy to do this way. – PatrickT Apr 5 '12 at 11:02

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}

• But now \item is no longer overlay specification-aware. – Gonzalo Medina Mar 29 '12 at 21:13

use the package ragged2e

\begin{itemize}
\justifying
\item...
\item...
\end{itemize}

• This more like a comment than a qualified answer – user31729 Apr 11 '16 at 10:15

Please don't try this at home - I am sure this will break all kind of stuff I am currently not thinking about and if it does, don't complain to me.

A very very dirty hack: as all itemize/description/enumerate environments in beamer are set using raggedright, changing the meaning of raggedright might give the desired output:

\documentclass{beamer}
\usepackage{ragged2e}
\usepackage{lipsum}

\renewcommand{\raggedright}{\justifying}

\begin{document}
\begin{frame}
\begin{itemize}
\item \lipsum[66]
\end{itemize}
\begin{enumerate}
\item \lipsum[75]
\end{enumerate}
\begin{description}
\item[Item] \lipsum[66]
\end{description}
\end{frame}
\end{document}

• dangerous solution :) :) :). maybe someone should contact beamer maintainer(s) and suggest to redefine this part of beamer code with introduce new command, something like \listalign which default meaning is \riggedright but can be with renewcommand changed to what ever (from \justifying to \Raggedright) if someone wish to do this. – Zarko Aug 23 '17 at 19:37
• @Zarko Indeed :) Please feel free to contact the beamer maintainer. – samcarter_is_at_topanswers.xyz Aug 23 '17 at 19:55
• @samcarter I like your radical thinking! – PatrickT Aug 25 '17 at 11:30

I was using Gonzalo's solution for years, then noticed that it was not working for lists within lists (like enumerate within enumerate etc.). Redefining the list environments to include \justify works for me, though I am not sure whether this brings any drawbacks.

Paste this in the preample:

\let\tempItemizeBeg\itemize
\let\tempItemizeEnd\enditemize
\renewenvironment{itemize}{\tempItemizeBeg \justifying}{\tempItemizeEnd}
\let\tempEnumerateBeg\enumerate
\let\tempEnumerateEnd\endenumerate
\renewenvironment{enumerate}{\tempEnumerateBeg \justifying}{\tempEnumerateEnd}
`