This is a follow-up question to Dealing with long description environment items
Gonzalo Medina was very helpfully resolving an issue I had with his solution to Dealing with long description environment items.
However, I still have a few issues with it, and want to avoid a lengthy discussion in comments. Hence this question. I believe any solution should be able to address all my issues simultaneously so I have not asked them separately.
- I don't quite understand how Gonzalo's solution works. In order to solve the
Overfull \hbox
issues I reported, he changed the length\beamer@descdefault
. Now, this appears to solve that problem, but I don't understand why, and it also changes the left-alignment of the item labels. - If possible, I'd personally favour the labels to always be aligned with the left margin.
However, more importantly:
When the first entity inside a
Ldescription
\item
body is another list environment, things go a bit wrong, as illustrated by the following example. The "bullet" in the first item in the sub-list is positioned on the wrong line (and causes an(other)Overfull \hbox
).
Any suggestions on how to ensure that nested lists work okay would be gratefully received. However, I'd rather not have to define my own \item
command if possible.
MWE:
\documentclass{beamer}
\usepackage{lipsum}
\makeatletter
\def\Ldescription{%
\@ifnextchar[{\beamer@testforospec}{\beamer@descdefault\beamer@descriptionwidth\@@Ldescription}%
}
\def\beamer@testforospec[{\@ifnextchar<{\beamer@scandefaultospec[}{\@Ldescription[}}%
\def\beamer@scandefaultospec[#1]{\def\beamer@defaultospec{#1}\Ldescription}
\def\@Ldescription[#1]{%
\setbox\beamer@tempbox=\hbox{\def\insertdescriptionitem{#1}
\usebeamertemplate**{description item}}%
\beamer@descdefault\wd\beamer@tempbox\@@description%
}%
\def\@@Ldescription{%
\beamer@descdefault35pt%
\list
{}
{\labelwidth\beamer@descdefault\leftmargin2.8em\let\makelabel\beamer@Ldescriptionitem}%
\beamer@cramped%
\raggedright
\beamer@firstlineitemizeunskip%
}
\def\endLdescription{\ifhmode\unskip\fi\endlist}
\long\def\beamer@Ldescriptionitem#1{%
\def\insertdescriptionitem{#1}%
\hspace\labelsep{\parbox[b]{\dimexpr\textwidth-\labelsep\relax}{%
\usebeamertemplate**{description item}%
}}}
\makeatother
\def\myLdescription{Ldescription}
%\def\myLdescription{description}%uncomment to compare with beamer's normal description environment
\overfullrule=1mm
\begin{document}
\begin{frame}
\noindent I live a very, very wild lifestyle.
\begin{\myLdescription}
\item[very very very very long item]
\begin{itemize}
\item description 1
\item[test] 1,2,3
\end{itemize}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut
purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.\par
Curabitur dictum gravida mauris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, magna. Donec
vehicula augue eu neque.
\begin{itemize}
\item description A
\item[test] x,y,z
\end{itemize}
\item[short item] description 2
\item[another very very very very long item] description 3
\item[i] description 4
\end{\myLdescription}
\end{frame}
\end{document}