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.
Asked
Active
Viewed 1,293 times
2
1 Answers
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:

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.
Gonzalo Medina
- 505,128
\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}. – Nov 15 '14 at 13:58