LaTeX Enumerating list with correct reference

  • Thread starter Thread starter psie
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary
The discussion focuses on structuring enumerated lists in LaTeX when equations are already numbered, complicating the use of standard numbering. The user opts for a format like (1a), (1b) for their lists but seeks a way to modify it to display as (2b) instead. Solutions involve using packages like `enumerate` and `enumitem` to create nested lists with custom labels. The provided code demonstrates how to implement these changes effectively. The conversation emphasizes the importance of clear referencing in documents with multiple enumerated lists.
psie
Messages
315
Reaction score
40
TL;DR
I have a couple of enumerating lists in a document. Item 3 in list number 1 reads (1c) and so on. When I label an item in a list, and refer to that item in the text, I only get the output (c), so on printed paper you can't tell where this reference leads to.
Apologies if this is a simple fix, but I currently do not see it. I also appreciate any other advice on how to structure my document in regards to having several enumerating lists.

Currently, equations are numbered by numbers (1), (2), etc., so I can't use just numbers for my enumerating lists. Therefor I've chosen (1a), (1b), etc. for the items in list 1 and so on. Basically these lists are remarks made after definitions and theorems.

Here's some code:

Code:
\documentclass{article}
\usepackage{enumerate}

\newcounter{foo}

\AtBeginEnvironment{enumerate}{\addtocounter{foo}{1}}

\begin{document}

\begin{enumerate}[({\thefoo}a)]
\item one
\item two
\end{enumerate}

text

\begin{enumerate}[({\thefoo}a)]
\item one
\item two \label{list2item2}
\end{enumerate}

Item (\ref{list2item2}) prints as (b). But I want it to appear as (2b) or something similar.

\end{document}
 
Physics news on Phys.org
Code:
\documentclass{article}
\usepackage{enumitem}

\newcounter{nestedenumerate}

\newlist{NestedEnumerate}{enumerate}{1}
\setlist[NestedEnumerate]{label=(\thenestedenumerate\alph*)}

\usepackage{etoolbox}
\AtBeginEnvironment{NestedEnumerate}{\refstepcounter{nestedenumerate}}

\begin{document}
    
    \begin{NestedEnumerate}
        \item\label{enum:spec} one
        \item two
    \end{NestedEnumerate}
    
    text; see item \ref{enum:spec}.
    
    \begin{NestedEnumerate}
        \item one
        \item two
    \end{NestedEnumerate}
    
    text
        
\end{document}
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 1 ·
Replies
1
Views
21K
  • · Replies 9 ·
Replies
9
Views
6K
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
13K
  • · Replies 1 ·
Replies
1
Views
8K
  • · Replies 1 ·
Replies
1
Views
3K