Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer 1

up vote 11 down vote accepted
+50

With beamer package, the description environment can use an optional argument: a text to fix the maximum width of terms (cf. 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}
share|improve this answer
    
(+1): Good solution. Is there any way to align items to left? –  MYaseen208 Mar 4 at 17:08
    
@MYaseen208 I edited my answer. –  Paul Gaborit Mar 4 at 23:19
    
Simply Awesome!!! I Opened the bounty and will reward you soon. Thanks –  MYaseen208 Mar 5 at 2:29
    
Can you guide me how to use \setbeamertemplate{description item}[align left] globally? Thanks –  MYaseen208 Mar 5 at 4:55
1  
@MYaseen208 To change alignment globally, insert this line before your first frame (or in your preamble). –  Paul Gaborit Mar 5 at 6:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.