Enumerating list with correct reference

  • Context: LaTeX 
  • Thread starter Thread starter psie
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary
SUMMARY

The discussion focuses on structuring enumerating lists in LaTeX documents when equations are numbered using standard numeric formats. The user seeks to modify list item references to include both the main list number and sub-list letters, such as transforming item references from (b) to (2b). Solutions provided involve using the enumerate and enumitem packages, along with custom counters and list definitions to achieve the desired formatting.

PREREQUISITES
  • Familiarity with LaTeX document preparation system
  • Understanding of the enumerate package for list management
  • Knowledge of the enumitem package for list customization
  • Basic experience with LaTeX counters and referencing
NEXT STEPS
  • Explore advanced features of the enumitem package for list customization
  • Learn about creating and managing custom counters in LaTeX
  • Research best practices for referencing items in LaTeX documents
  • Investigate the etoolbox package for enhanced LaTeX functionality
USEFUL FOR

LaTeX users, document authors, and researchers who need to create structured documents with complex enumerating lists and precise item referencing.

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
8K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 1 ·
Replies
1
Views
22K
  • · Replies 9 ·
Replies
9
Views
6K
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
14K
  • · Replies 1 ·
Replies
1
Views
8K
  • · Replies 1 ·
Replies
1
Views
3K