# Reference with entire number in enumerate

So I have made this file where I list my exercises as 1.A, 1.B,... for the exercises in Chapter 1, and 2.A,2.B,... for the exercises in Chapter 2.

\documentclass{book}

\usepackage{enumerate}

\begin{document}

\chapter{Chapter 1}

Text

\section{Exercises}

\begin{enumerate}[\arabic{chapter}.A]
\item Bla. \label{thislabel}
\item bla. Hint: use Exercise \ref{thislabel}.
\end{enumerate}

\end{document}


Now the reference prints only the letter A, I would like it to print 1.A instead. When using hyperref, this does not matter unless the material is printed of course.

• Welcome to TeX.SX. See this question: tex.stackexchange.com/q/464119/28557 , might be related. – nidhin Dec 13 '18 at 14:07
• In general it's probably better to use \thechapter rather than \arabic{chapter}. – Werner Dec 13 '18 at 16:16

Use the enumitem package:

\documentclass{book}

\usepackage{enumitem}

\begin{document}

\chapter{Chapter 1}

Text

\section{Exercises}

\begin{enumerate}[label=\arabic{chapter}.\Alph*]
\item Bla. \label{thislabel}
\item bla. Hint: use Exercise \ref{thislabel}.
\end{enumerate}

\end{document}


• Thank you for this solution. I've removed the enumerate package and used enumitem, as they are known not to work together. At first glance, I am not missing out on features of enumerate right now. – JSchoone Dec 13 '18 at 16:27
• @JSchoone if you load enumitem with the shortlabels option, then it covers all of the syntax features from the enumerate package. – daleif Dec 13 '18 at 17:18

A no package solution

\documentclass{book}

\renewcommand{\theenumi}{\arabic{chapter}.\Alph{enumi}}
\renewcommand{\labelenumi}{\theenumi}

\usepackage{hyperref}
\begin{document}

\chapter{Chapter 1}

Text

\section{Exercises}

\begin{enumerate}
\item Bla. \label{thislabel}
\item bla. Hint: use Exercise \ref{thislabel}.
\end{enumerate}

\end{document}


• I've decided not to use your solution, but in the future I might, when my co-authors need enumerate instead of enumitem. But your solution seems to be global, am I wrong in that? I need enumerate environments elsewhere and don't want the numbering to be the same as the exercises. But thank you for your solution, which most surely will help others. (: – JSchoone Dec 13 '18 at 16:29
• The approach is global but you can make it local of course for example by wrapping the two lines in a \zut macro (add a % at end of first line) and the use \begin{enumerate}\zut ... or better define some other environment wrapping enumerate and insert there the two lines. – jfbu Dec 13 '18 at 16:47
• But enumitem is a useful package and I trust (although I never really looked) you can get with it most if not all of enumerate functionality. (hence I of course +1ed Ulrike's answer and find it the better one) – jfbu Dec 13 '18 at 16:50