1

I am trying to set global parameters to control items separation in enumerate and itemize environments. The command (from LaTeX Beamer: Define \itemsep globally)

\xpatchcmd{\itemize}{\def\makelabel}{\setlength{\itemsep}{\heightItemSepI}\def\makelabel}{}{}

Works well to set the separation for itemize to a predefined height of \heightItemSepI

The command (from Trouble combining enumitem and beamer)

\makeatletter
\patchcmd{\@listI}{\itemsep3\p@}{\itemsep=0.5em}{}{} % this sets the space globally (for itemize or enumerate)
\makeatother

Works for both enumerate and itemize, but it cannot accept a predefined height and, if put there, it will throw the error 'missing number, treated as zero'.

My question is how to combine the good features of both approaches? I do not like to enter the numbers directly in commands because I like to set parameters outside the commands modifying packages/classes codes. This helps me set things up quickly when I come back after a while. Also, I use predefined lengths for certain calculations about the layout of my documents.

I know that enumitem allows for easy customization of these parameters but enumitem in beamer can lead to 'TeX Capacity Exceeded' errors

\documentclass[aspectratio=169]{beamer}

\usepackage{xpatch}

\newlength{\heightItemSepI}
\setlength{\heightItemSepI}{0.3cm}
\newlength{\heightItemSepII}
\setlength{\heightItemSepII}{0.2cm}
\newlength{\heightItemSepIII}
\setlength{\heightItemSepIII}{0.15cm}

\makeatletter
    \xpatchcmd{\itemize}{\def\makelabel}{\setlength{\itemsep}{\heightItemSepI}\def\makelabel}{}{}
    \g@addto@macro\@listii{\itemsep \heightItemSepII}
    \g@addto@macro\@listiii{\itemsep \heightItemSepIII}
\makeatother

\makeatletter
\patchcmd{\@listI}{\itemsep3\p@}{\itemsep=1em}{}{} % this sets the space globally (for itemize or enumerate)
\makeatother


\usepackage{blindtext}


\begin{document}

\begin{frame}

    \blindlistlist[1]{enumerate}

\end{frame}

\begin{frame}

    \blindlistlist[1]{itemize}

\end{frame}

\begin{frame}[allowframebreaks=0.9]{Long Lists}

    You can insert a very long nested list by using a page-wide frame with multicols

    \blindlistlist[3]{enumerate}

\end{frame}

\end{document}
Bernard
  • 271,350

0 Answers0