I am writing a book using the amsbook style. I would like references to formulas and theorems to appear without chapter numbers when I cite within the chapter, and with them otherwise. For example, I want
... see (3.2) ... [if that equation is in the same chapter]
and
... see (II.3.2)... [if this appears in, say, Chapter IV but the equation is in Chapter II]
Is there an easy way to do this? I can do it now by writing (\ref{ChapterII}.\ref{3.2}) in the latter case, and just (\ref{3.2}) in the former but I wonder if there is an automatic way of doing it.
EDIT: I saw the linked answer - but that does not work with amsbook! Any idea?
=======
Here is an example based on the linked one. It works (without eq. numbers) but it does not with amsbook!
===============
\documentclass{book} \% does not work with amsbook
\usepackage{ntheorem}
% From your post I assume you have settings like this:
\renewcommand*\thechapter{\Roman{chapter}}
\newtheorem{mytheo}{MyTheo}[chapter]
% Redefine the format of the theorem number:
\renewcommand*\themytheo{%
\protect\maybechapter{\arabic{chapter}}\arabic{section}.\arabic{mytheo}%
}
% May print the chapter number
\newcommand*\maybechapter[1]{%
% Tests if current chapter is equal to the chapter number of label)
\ifnum\value{chapter}=0#1\relax
% Print nothing if so
\else
% Set 'chapter' locally (=> no \setcounter) to the label chapter and
% print it in the usual format followed by a dot
{\value{chapter}=#1\relax\thechapter.}%
\fi
}
% Test document:
\begin{document}
\chapter{One}
Here \ref{theo:11} % prints "1.1"
and there \ref{theo:21}. % print "II.1.1"
\section{Section1}
\begin{mytheo}\label{theo:11}
\begin{equation}\label{11}
x^n+y^n=z^n
\end{equation}
\end{mytheo}
The eq. number should be (1.1) (section.eq).
\section{Section 2}
\begin{mytheo}
Theo1-2\label{theo:12}
\end{mytheo}
\chapter{Two}
There \ref{theo:11} % prints "I.1.1"
and here \ref{theo:21}. % print "1.1"
\section{S1}
\begin{mytheo}
Theo2-1\label{theo:21}
\end{mytheo}
See (\ref{11}) for more details. I expected (I.1.1).
\end{document}
amsbookdocument class uses arabic rather than uppercase-Roman "numbers" for chapter. Have you redefined the numbering system? If so, please show the code you've utilized, as it may have some bearing on how your objective may be achieved. – Mico Sep 16 '14 at 19:41\theequation? Aschapter_number.section_number.eq_numor assection_number.eq_num? Ideally, you would be providing this information up front, in the form of an MWE (minimum working example). – Mico Sep 16 '14 at 20:33\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark} \newtheorem{ex}{Problem}[section] \newtheorem{example}{Example}[section]
\theoremstyle{remark} \newtheorem{remark}{Remark}[section]
\numberwithin{equation}{section} \numberwithin{figure}{chapter}
– ABC Sep 17 '14 at 15:52\documentclass{amsbook}to\end{document}. – Sean Allred Sep 18 '14 at 04:14\numberwithin{equation}{section}does redefine the way equation numbers are displayed -- by redefining\theequation... – Mico Sep 18 '14 at 05:12