6

I'm using xr-hyper package by @David Carlisle and smartref package by Giuseppe Bilotta to compile a multi-volume book. xr-hyper enables cross-references between different volumes as shows the following code chunk:

\newcommand{Volume}{1}% put this is PlasmaBook1.tex 

% This is the code shared by all volumes
\usepackage{xr-hyper}
\usepackage{hyperref}

\ifnum\Volume=1
    \externaldocument{PlasmaBook2}
    \externaldocument{PlasmaBook3}
\else\ifnum\Volume=2
    \externaldocument{PlasmaBook1}
    \externaldocument{PlasmaBook3}
\else\ifnum\Volume=3
    \externaldocument{PlasmaBook1}
    \externaldocument{PlasmaBook2}
\fi\fi\fi

And the package smartref is used to hide a portion of equation number as explained in How do I discard a portion of an equation number when cross-referencing?

\usepackage{smartref}
\addtoreflist{chapter}
\newcommand*{\srefaux}[1]{%
    \ischapterchanged{#1}% checks if section number has changed
    \ifchapterchanged% if current chapter is different
        \chapterref{#1}.% put the section reference
    \fi% else do nothing
    \ref*{#1}%  <- we changed this to ref*
}

\makeatletter
\renewcommand \theequation {\@arabic\c@equation}
\renewcommand \thefigure   {\@arabic\c@figure}
\renewcommand \thetable    {\@arabic\c@table}
\makeatother

\newcommand*\sref[1]{\hyperref[#1]{\srefaux{#1}}}
\newcommand*\seqref[1]{(\hyperref[#1]{\srefaux{#1}})}

Unfortunately, smartref mechanism is working only within a single volume. I think this is because xr-hyper package reads in only \newlabel strings from aux files and ignores \newsmartlabel tags written by smartref as shows the following example borrowed from an actual aux file:

\newlabel{ch01}{{1}{6}{Общие сведения о плазме}{chapter.4}{}}
\newsmartlabel{ch01}{{1}{1}}

So my question is

how to instruct xr-hyper to read both \newlabel and \newsmartlabel tags?

Perhaps, appropriate code could be included into new version of xr-hyper package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.