Text Formattingenumitem | Change the Enumeration Label

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

enumitem | Change the Enumeration Label

Post by Cham »

I have a list of enumerated items and I need to change their numbers as follows : first item should be "3b", second item "3c", etc. The only thing I know is this :

Code: Select all

\begin{enumerate}[leftmargin=0.5in,rightmargin=0.5in,start=3]
	\item First item (should be number "3b" instead of just "3").
	\itemSecond item (should be number "3c", instead of "4").
\end{enumerate}
How can I tell LaTeX to add "b", "c", etc, to the item numbers ?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

enumitem | Change the Enumeration Label

Post by localghost »

Please get used to always providing a minimal example that show the problem clearly, is reduced to only relevant code and compilable out of the box for everybody. Otherwise specific help becomes very difficult, especially when a problem is more compilcated.

Would it be an option for you just to nest two (or more) list environments?

Code: Select all

\documentclass[11pt,english]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}  
\usepackage{enumitem}

\begin{document}
  \begin{enumerate}[leftmargin=0.5in,rightmargin=0.5in,start=3]
    \item
      \begin{enumerate}[label=\alph*)]
        \item First item (should be number "3b" instead of just "3").
        \item Second item (should be number "3c", instead of "4").
      \end{enumerate}
  \end{enumerate}
\end{document}

Thorsten
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

enumitem | Change the Enumeration Label

Post by Cham »

localghost wrote:Would it be an option for you just to nest two (or more) list environments?
Hmmm, no, this isn't a good solution for what I'm trying to do. I really need the "3b", "3c", etc...
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

enumitem | Change the Enumeration Label

Post by frabjous »

I think we're having trouble understanding where that 3 is supposed to come from if you really want only the b and the c to go up. Does the 3 ever increase? What does the 3 mean? Is it the chapter number, or what?

If you want to force 3 before every item, and use letters for the enumeration, beginning with b, do:

Code: Select all

\begin{enumerate}[leftmargin=0.5in,rightmargin=0.5in,start=2,label=3\alph*.]
   \item First item (3b)
   \item Second item (3c)
\end{enumerate}
But it's very hard to imagine that being useful in any situation.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

enumitem | Change the Enumeration Label

Post by Cham »

The "3" comes from another list. Actually, the text is pretty long between each element of the list. So it's actually something like this :

Code: Select all

Bla bla bla (long text).
- Item #1.

Bla bla bla (long text).
- Item #2.

Bla bla bla (long text again).
- Item #3.

Bla bla bla (...)
- Item #3b.
- Item #3c.

Bla bla bla ...
- Item #4.

Etc....
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

enumitem | Change the Enumeration Label

Post by frabjous »

Are you sure you want to use enumerations rather than say, theorem-like environments (defined by amsthm or ntheorem or similar)?

If I were committed on doing it with enumerations, I guess I'd do it like this:

Code: Select all

\documentclass{article}
\usepackage{enumitem}
\newlist{mylist}{enumerate}{1}
\newlist{mysublist}{enumerate}{1}
\setlist[mylist]{leftmargin=0.5in,rightmargin=0.5in,resume,label=\arabic*.,ref=\arabic*}
\setlist[mysublist]{leftmargin=0.5in,rightmargin=0.5in,resume}
\begin{document}
Bla bla bla (long text).
\begin{mylist}
\item Item
\end{mylist}
Bla bla bla (long text).
\begin{mylist}
\item Item
\end{mylist}

Bla bla bla (long text again).
\begin{mylist}
\item Item \label{lastone}
\end{mylist}

Bla bla bla (...)
\begin{mysublist}[label={\ref{lastone}\alph*.}]
\item Item 
\item Item
\end{mysublist}

Bla bla bla ...
\begin{mylist}
\item Item 
\end{mylist}
Etc....
\end{document}
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

enumitem | Change the Enumeration Label

Post by Cham »

frabjous wrote: If I were committed on doing it with enumerations, I guess I'd do it like this:

Code: Select all

...
This is working, but there's an annoying glitch. When I make a reference to an item in the sublist, I'm getting a dot "." in the text, which isn't desirable. Yet, that dot must be visible in the sublist (item #3b., for example. But the dot shouldn't be visible in the text, if we do a reference).
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

enumitem | Change the Enumeration Label

Post by frabjous »

Use the ref= parameter, i.e., change:

Code: Select all

\begin{mysublist}[label={\ref{lastone}\alph*.}]
to

Code: Select all

\begin{mysublist}[label={\ref{lastone}\alph*.},ref={\ref{lastone}\alph*}]
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

enumitem | Change the Enumeration Label

Post by Cham »

This is also working.

But what if I want to generate a new list, with a new numbering ?

This also brings me to another problem : I would like to define some kind of citation without any numbering, but with exactly the same formating (spacing) as for the list items. What should be the proper way to do this ?

I'm currently using this code, which is working great, but I suspect it's a wrong way to do this :

Code: Select all

\begin{enumerate}[leftmargin=0.5in,rightmargin=0.5in,label=]
	\item Bla bla bla.
\end{enumerate}
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

enumitem | Change the Enumeration Label

Post by frabjous »

The way you're doing it is probably OK, though again, for all this, I wonder if enumerations would be better than theorems, etc.

As for setting up your own lists, read the enumitem manual!
Post Reply