2

I am looking for a similar solution as here Description list with aligned descriptions except that I want to use it with beamer. If I use enumitem with beamer, inner theme is replaced by enumitem. I do not want to use enumitem because of this problem. Is there any alternative package or solution which works only with description? Kindly suggest.

  • Try this: \documentclass{beamer} \newenvironment{mydescription}[1] {\begin{list}{}% {\renewcommand\makelabel[1]{\bfseries##1\hfill}% \settowidth\labelwidth{\makelabel{#1}}% \setlength\leftmargin{\labelwidth} \addtolength\leftmargin{\labelsep}}} {\end{list}} \begin{document} \begin{frame} \begin{mydescription}{The longest label} \item[The longest label] text \item[Short] long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long text \end{mydescription} \end{frame} \end{document}. – user11232 Nov 15 '14 at 13:58
4

Here's one possibility adaption the answer linked in the question to the beamer settings:

\documentclass{beamer} 
\usetheme{Warsaw}

\makeatletter
\def\Mdescription#1{%
  \advance\beamer@descdefault by \labelsep%
  \list
  {}
  {\labelwidth\beamer@descdefault%
  \leftmargin\beamer@descdefault%
  \let\makelabel\beamer@descriptionitem
  \settowidth\labelwidth{\beamer@descriptionitem{#1}}%
  \setlength\leftmargin{\labelwidth}% 
  \addtolength\leftmargin{\labelsep}%
  }%
  \beamer@cramped%
  \raggedright
  \beamer@firstlineitemizeunskip%
}
\def\endMdescription{\ifhmode\unskip\fi\endlist}
\long\def\beamer@descriptionitem#1{%
  \def\insertdescriptionitem{#1}%
  {\usebeamertemplate**{description item}}\hfil}
\makeatother  

\begin{document} 

\begin{frame} 
\begin{Mdescription}{The longest label}
\item[The longest label] some text 
\item[Short] some additional text so we can see line wrapping in the example 
\end{Mdescription} 

\begin{Mdescription}{ABC} 
\item[A] some text 
\item[ABC] some additional text so we can see line wrapping in the example  
\end{Mdescription} 
\end{frame} 

\end{document}

The result:

enter image description here

There's only one caveat: the Mdescription environment doesn't use now an optional argument of the form <+->, so overlay specifications will have to be made in \item.

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