1

Let's say we are in chapter 3, section 2

\begin{enumerate}
      \item abc \label{sec:L1}
      \item bcd
 \end{enumerate}

 \ref{sec:L1}

This will now do reference '(1)' because it's item 1. Can I change something, so the reference says (3.2)?

  • Isn't it easier to set the label just after the relevant \section command? – egreg Dec 19 '16 at 20:36
1

You can using enumitem's personalized ref key:

enter image description here

\documentclass{report}

\usepackage{enumitem}

\begin{document}

\setcounter{chapter}{2}% Just for this example
\chapter{A chapter}
\setcounter{section}{1}% Just for this example
\section{A section}
\begin{enumerate}[ref=(\thesection)]
  \item abc \label{sec:L1}
  \item bcd
\end{enumerate}

See Section~\ref{sec:L1}.

\end{document}

However, you will lose the capability to \label-and-\ref the individual \items (unless you do some extra work).

| improve this answer | |
2

Is this what you want?

\documentclass{article}
\usepackage{enumitem}
\usepackage{cleveref} 

\begin{document}

\section{Test section}

See \cref{item1,item3}. 

\begin{enumerate}[ref =\thesection.\theenumi]
\item A first item. \label{item1}

\item A second item \label{item2}. 

\item Last item. \label{item3}
\end{enumerate}

\end{document} 

enter image description here

| improve this answer | |
  • thanks, but not quite. I clarified the question. – Martin Čejka Dec 19 '16 at 20:20
  • @Martin Čejke: I don't understand: if you want to reference the section, you just have to put the label just after \section{section title}. Or am I missing something? – Bernard Dec 19 '16 at 20:42
  • Thank you, maybe this doesn't answer the OP's question, but this was exactly what I was looking after. – user43326 Sep 1 '18 at 16:06

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.