3

How can I justify the text in the whole document in beamer without using \usepackage{ragged2e} and \justifying at the beginning of each frame?

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

enter image description here

Edit: I had already checked this out but it does not work for both the columns and the itemize environment.

5

1 Answer 1

7

To patch "normal" frames, the solution can be found text justify in beamer


Itemize has also already a solution on this side: Justify text inside itemize environment with beamer class


But I could not find one to automatically justify the contents of columns. So I tried a bit, failed in the attempt to patch \begin{column}..., but with \column it works as following:

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

enter image description here

1
  • As far as itemize is concerned, I have two issues: I would like to use \usepackage{enumitem} and \setlist{leftmargin=2.2mm} to indent the items: the problem is that I get an error. The second issue is that, when I have an itemize environment inside another, the font size decreases. Is there a way to maintain the font size the same?
    – Marco
    Commented Feb 5, 2016 at 18:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .