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.

1
  • 2
    Use enumitems build in features to make new lists. You can even make your own keys
    – daleif
    Apr 17, 2021 at 10:39

2 Answers 2

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

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .