I'm writing a book beginning with \documentclass[11pt]{amsbook}. I have an item counter set up within sections and I want the cross-references to appear as follows:
In chapter number X, a reference to item 3 of section 2 in the same chapter should be 2.3 ; but a reference to item 3 of section 2 from a different chapter number Y should be Y.2.3 .
How can I do this?
\documentclass{amsbook}
\newcounter{contRef}[section]
\setcounter{contRef}{0}Thank you
\renewcommand{\thecontRef}{\thesection.\arabic{contRef}}
\NewDocumentCommand \newItem{mo} {
\IfNoValueTF {#2}
{\noindent\hskip-.07in\refstepcounter{contRef} {\bf#1}\textbf{ \thecontRef}}
{\noindent\hskip-.07in\refstepcounter{contRef} {\bf#1}\textbf{ \thecontRef}{\bf \hskip.05in#2} }
}
\begin{document}
\chapter{(title)}
A reference to an item in this chapter from a location in this chapter should be of the form [section number].[item number].
\section{Section One in Chapter One}
\newItem{Definition}\label{def} This is a lemma that is references in this chapter as Definition \ref{def}.
\section{Section Two in Chapter One}
Here we refer to Definition \ref{def}
Now scroll down to Chapter 2.
\chapter{(title)}
I want a reference from this chapter to the item labelled ``def'' in chapter 1 to have the form 1.1.1.
However, the present numbering system refers to it as Definition \ref{def}.
\end{document}
\refand\subref(same label name with "sub@" added). – John Kormylo Mar 30 '24 at 00:34