As a default documentclass book
numbers chapters consecutively regardless of the division into parts, and I suppose the \ref
command had been designed with this in mind, returning as it does chapter
, section
and subsection
numbering. The clause \@addtoreset{chapter}{part}
will cause chapters to be numbered starting with 1 for each part. Is there a way of paramatrizing \ref
to return part
numbers?
\documentclass{book}
% RN. 10 Nov 2018
%=======================
%\usepackage{hyperref}
\makeatletter
\@addtoreset{chapter}{part}
\makeatother
\begin{document}
\chapter*{Preface}
Referencing both sections produce identical numbering. It would be helpful to distinguish parts:\\
\ref{A1}, page \pageref{A1}\\
\ref{B1}, page \pageref{B1}\\
\part{FIRST}
\chapter{A}
\section{A1}\label{A1}
\part{SECOND}
\chapter{B}
\section{B1}\label{B1}
\end{document}
\renewcommand*{\p@section}{\thepart.}
(within\makeatletter...\makeatother
)?\renewcommand*{\p@chapter}{\thepart.}
,\renewcommand*{\p@section}{\thepart.}
and\renewcommand*{\p@subsection}{\thepart.}
, sandwiched beween\makeatletter
and\makeatother
, and have\ref
return numbering for all `part/chapter/section/subsection' as required. Please repost your comment as an answer so I can tick it off.