17

I have the latest version of the enumitem package and I'm trying to use different labels for enumerate lists which are set as normal lists and enumerate lists which are set inline. However, it doesn't seem to work (one customization overwrites the other), and I've already asked a question about this where it turned out to be due to a bug.

However, I still can't get it to work. I have the following MWE:

\documentclass{article}
\usepackage[inline]{enumitem}

\setlist[enumerate,1]{%
  label=\arabic*.,
}
\setlist*[enumerate,1]{%
  label=(\roman*),
}

\begin{document}

\begin{enumerate}
  \item item 1
  \item item 2
  \item item 3
\end{enumerate}

\begin{enumerate*}
  \item item 1
  \item item 2
  \item item 3
\end{enumerate*}

\end{document}

and what I get is:

enter image description here

Either I don't understand how to use the \setlist to get this to work, or the bug still remains. I can't figure out which.

2
  • 2
    The documentation says explicitly that "that labels and settings [of the inline lists] are shared with the displayed lists". So if you want independant settings you should create a new list with \newlist. Beside this \setlist* is not for the starred list variant but "The starred form \setlist* adds the settings to previous ones." Mar 18, 2013 at 14:13
  • Aha, so that's how you were meant to do it! I mistakenly assumed that the starred version of \setlist dealt with the starred versions of itemize, enumerate, etc. Thanks for clearing this out. Could any of you please provide an answer that I can accept?
    – gablin
    Mar 18, 2013 at 14:22

3 Answers 3

29

Nothing can say it better than the manual.

The three inline lists have types enumerate*, itemize*, and description*, which are available always, even without the package option inline (which just defines three environments with these names).

The starred form \setlist* adds the settings to previous ones.

You should create a \newlist instead and there is no more need to put the inline option unless you want to use the predefined lists.

\documentclass{article}
\usepackage{enumitem}

\setlist[enumerate,1]{%
  label=\arabic*.,
}

\newlist{inlinelist}{enumerate*}{1}
\setlist*[inlinelist,1]{%
  label=(\roman*),
}

\begin{document}

\begin{enumerate}
  \item item 1
  \item item 2
  \item item 3
\end{enumerate}

\begin{inlinelist}
  \item item 1
  \item item 2
  \item item 3
\end{inlinelist}

\end{document}

enter image description here

2
  • I managed to completely confuse myself by assuming that enumerate* and \setlist* was somehow related. Thanks for showing how it's meant to be used. =)
    – gablin
    Mar 18, 2013 at 14:25
  • Is it possible to automatically insert some symbol at end of each item?
    – Sigur
    Jan 24, 2019 at 23:12
10

Easy control using "shortlabels" option

\documentclass{article}
\usepackage[inline,shortlabels]{enumitem}


\begin{document}

\begin{enumerate}[1.]
  \item item 1
  \item item 2
  \item item 3
\end{enumerate}

\begin{enumerate*}[(i)]
  \item item 1
  \item item 2
  \item item 3
\end{enumerate*}

\end{document}

enter image description here

0

If you do not want to create an extra new list environment, you could use etoolbox like the following:

  \documentclass{article}
  \usepackage[inline]{enumitem}
  \usepackage{etoolbox}

  \setlist[enumerate,1]{label=\arabic*.}
  \BeforeBeginEnvironment{enumerate*}{%
    \setlist[enumerate,1]{label=(\roman*)}
  }
  \AfterEndEnvironment{enumerate*}{%
    \setlist[enumerate,1]{label=\arabic*.}
  }

  \begin{document}

  \begin{enumerate}
    \item item 1
    \item item 2
    \item item 3
  \end{enumerate}

  \begin{enumerate*}
    \item item 1
    \item item 2
    \item item 3
  \end{enumerate*}

  \end{document}

You must log in to answer this question.

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