3

I'm using enumitem package, and I often, in my code, have to input parameters as follows:

\begin{enumerate}[topsep=0.1cm, itemsep=0cm, parsep=0cm, label=(\roman*)]
\item
\end{enumerate}

I tried to quicken this by defining the command:

\newcommand{\EnumParams}{topsep=0.1cm, itemsep=0cm, parsep=0cm, label=(\roman*)}

However, when I run the following, error is shown.

\begin{enumerate}[\EnumParams]
\item
\end{enumerate}

Can you tell why this crahes? And what might be a solution?


I also tried defining:

\newcommand{\EnumParams}{\ItemSep, \ParSep, \TopSep, \Label}
\newcommand{\ItemSep}{itemsep=0cm}
\newcommand{\ParSep}{parsep=0cm}
\newcommand{\TopSep}{topsep=0.1cm}
\newcommand{\Label}{label=(\roman*)}

But this also shows error.

Atom
  • 665

2 Answers2

4

You have a couple of possibilities: you can define your own key, or define a new list altogether.

\documentclass{article}

\usepackage{enumitem}

% 1st possibility: define new key \SetEnumitemKey{mystyle}{topsep=0.1cm, itemsep=0cm, parsep=0cm, label=(\roman*)}

% 2nd possibility: define new list \newlist{mylist}{enumerate}{1}% last parameter is maximum depth of nested lists \setlist[mylist]{topsep=0.1cm, itemsep=0cm, parsep=0cm, label=(\roman*)}

\begin{document}

\noindent Either \begin{enumerate}[mystyle] \item foo \item bar \item baz \end{enumerate} or equivalently \begin{mylist} \item foo \item bar \item baz \end{mylist}

\end{document}

enter image description here

campa
  • 31,130
1

You could create a new environment using the given options:

\documentclass{article}
\usepackage{enumitem}

\newenvironment{myenumerate}{\enumerate[topsep=0.1cm, itemsep=0cm, parsep=0cm, label=(\roman*)]}% {\endenumerate}

\begin{document} \begin{myenumerate} \item \end{myenumerate}

\end{document}

John Kormylo
  • 79,712
  • 3
  • 50
  • 120