32

How to do right align a description list using beamer?

      Name | Joel Spolsky
   Address | Some address    

Using the enumitem package as suggested in Description list with right alignment of labels does not seem to work with the beamer package

1 Answers1

50

With beamer package, the description environment can use an optional argument: a text to fix the maximum width of terms (cf. section 12.1 "Itemizations, Enumerations, and Descriptions", p.113 of beamer guide v3.26).

Example:

\documentclass{beamer}
\setbeamercolor{normal text}{bg=cyan!10}
\begin{document}
\begin{frame}
  \begin{description}[Other description]
  \item[Name] Joel Spolsky
  \item[Address] Some address  
  \item[Other description] Some description
  \end{description}
\end{frame}
\end{document}

enter image description here

How to align items to the left

By default, items are aligned to the right. To align items to the the left :

  • in your preamble, define the predefined option align left for the template description item:

     \defbeamertemplate{description item}{align left}{\insertdescriptionitem\hfill}
    
  • apply this prefined option before a description list:

     \setbeamertemplate{description item}[align left]
    

Example:

enter image description here

\documentclass{beamer}
\setbeamercolor{normal text}{bg=gray!5}
\defbeamertemplate{description item}{align left}{\insertdescriptionitem\hfill}
\begin{document}
\begin{frame}
  \begin{block}{Default}
    \setbeamertemplate{description item}[default]
    \begin{description}[Other description]
    \item[Name] Joel Spolsky
    \item[Address] Some address  
    \item[Other description] Some description
    \end{description}
  \end{block}
  \begin{block}{Align left}
    \setbeamertemplate{description item}[align left]
    \begin{description}[Other description]
    \item[Name] Joel Spolsky
    \item[Address] Some address  
    \item[Other description] Some description
    \end{description}
  \end{block}
\end{frame}
\end{document}
Paul Gaborit
  • 70,770
  • 10
  • 176
  • 283