I want to do an enumerate that is formatted in a way if it has multiple items, but in a different way if it has a single item. Something like this:

A list with multiple items:

#1 Item1
#2 Item2
#3 Item3

A list with a single item:

* SingleItem

I'm currently using enumitem package to format my lists, so it would be nice to use it, but any other solution would be welcome.

  • 2
    Welcome to TeX.SX! I am struggling with my pupils saying them that a list with just one item should not be formatted as a list.
    – user31729
    Apr 18 '15 at 19:34
  • Do you know in advance, how many items the enumeration will have?
    – user31729
    Apr 18 '15 at 19:39
  • Well, I could count or even force a different format for a single item, but I'm looking for something more scalable and elegant. :) Apr 18 '15 at 20:03
  • See my possible solution
    – user31729
    Apr 18 '15 at 20:04
  • I'd agree that a list with one item should not be a list... but the list may grow in later revisions and I'd not like to change the code structure when that happens. Apr 18 '15 at 20:06

A quick and dirty trial solution, looping over a list using etoolbox macros and releasing it a specialized enumerate environment


\IntelligentEnumerate is a wrapper with three arguments:

  1. The first is optional, containing the label and other setups for the enumerate optional argument
  2. The first contains the list items as a comma-separated list (mandatory)
  3. The 3rd one is optional again, containing the options for the single item 'list'








    \item ##1
    \item  #2
  \def\myitemlist{}% 'Clear' the list at the end 


\IntelligentEnumerate{First, Second, Third}

\IntelligentEnumerate[label={\Roman*}]{First, Second, Third}

\IntelligentEnumerate{This is a single Item}

\IntelligentEnumerate{This is a single Item}[label={$\int$}]


enter image description here

  • If you want to have \par like stuff, you have to hide the content in a macro and enter this macro in the csv - list
    – user31729
    Apr 18 '15 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.