0

I have something like this:

\section{a section name}
\subsection{a subsection name}
\begin{enumerate}
  \item\label{itm:first} Item one
  \item Item two
  \item Item three
\end{enumerate}
I am saying something else about \ref{itm:first}

The bottom line of the output looks like this: I am saying something else about 1. Is there a way to include the section number the list item is in, in the reference to it? This would look like I am saying something else about 1.1.1

1

If I understand right you want normal numbering of the enumeration items but numbering with subsection numbering in the reference. There are two commands you can play with here, \theenumi and \labelenumi. They are normally (like in article) defined like:

\newcommand\theenumi{\arabic{enumi}} %% Format for references
\newcommand\labelenumi{\theenumi.}.  %% Printed by \item (add '.')

To get the special format for the references you can do

\renewcommand\labelenumi{\arabic{enumi}.}
\renewcommand\theenumi{\thesubsection.\arabic{enumi}}%% references with subsection numbering

But even if it is possible, I doubt it is recommended. The references is there for the reader to find a specific place in the text, and using different formats in the \item and the reference will be confusing.

An alternative way is to add the extra numbering to both the \item and the reference with

\renewcommand\theenumi{\thesubsection.\arabic{enumi}}

Then, with the normal definition of \labelenumi the same is used with an additional period.

A third alternative, that I would prefer, is to just in the text a specification of which enumeration list you mean, e.g. in Subsection~\ref{sec:Mysubsection}.

All the above versions are given in one file below.

\documentclass{article}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\labelenumi{\arabic{enumi}.}
\renewcommand\theenumi{\thesubsection.\arabic{enumi}}%% references with subsection numbering
\section{a section name}
\subsection{a subsection name}
\begin{enumerate}
  \item\label{itm:first} Item one
  \item Item two
  \item Item three
\end{enumerate}
I am saying something else about item \ref{itm:first}

%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\theenumi{\arabic{enumi}}%% Back to normal
\renewcommand\labelenumi{\theenumi.}%% Back to normal
\renewcommand\theenumi{\thesubsection.\arabic{enumi}}%% Add subsection number to item
\section{a section name}
\subsection{a subsection name}
\begin{enumerate}
  \item Item one
  \item \label{itm:second}Item two
  \item Item three
\end{enumerate}
I am saying something else about item \ref{itm:second}

%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\theenumi{\arabic{enumi}}%% Back to normal
\section{a section name}
\label{sec:Mysection}
\subsection{a subsection name}
\label{sec:Mysubsection}
\begin{enumerate}
  \item Item one
  \item Item two
  \item \label{itm:third}Item three
\end{enumerate}
I am saying something else about item \ref{itm:third} in Subsection~\ref{sec:Mysubsection}.
\end{document}

enter image description here

|improve this answer|||||

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.