Closed pauloney closed 4 months ago
Hi @pauloney , that's not really a feature of xr
, hence also not of zref-xr
. What comes imported from the external file is the url
property, which in the example would be the name of the file. You can't see it in the aux file, but in the manual example 11.8, if you add to the main file:
\ExplSyntaxOn
\tl_show:c{Z@R@B-sec:section-b1}
\ExplSyntaxOff
You'll find in the log:
> \Z@R@B-sec:section-b1=\default {1}\page {1}\abspage {1}\zc@counter
{section}\thecounter {1}\zc@type {section}\zc@cntval {1}\zc@pgval
{1}\zc@enclval {}\zc@pgfmt {1}\anchor {section.1}\externaldocument
{documentB}\url {documentB.pdf}.
The url
is documentB.pdf
. I guess you could use the externaldocument
property, if you actually named your file Volume 2.tex
.
Something like:
\documentclass{article}
\usepackage{zref-clever}
\usepackage{zref-xr}
\zexternaldocument[B-]{documentB}
\usepackage{hyperref}
\begin{document}
\section{Section A1}
\zlabel{sec:section-a1}
\zcref{B-sec:section-b1} of \zref[externaldocument]{B-sec:section-b1}
\end{document}
Or you could use zref
facilities and actually build whatever you want. For example:
\documentclass{article}
\usepackage{zref-clever}
\usepackage{zref-xr}
\zexternaldocument[B-]{documentB}
\usepackage{hyperref}
\begin{document}
\section{Section A1}
\zlabel{sec:section-a1}
\zcref{B-sec:section-b1} of \zref[volume]{B-sec:section-b1}
\end{document}
and
\documentclass{article}
\usepackage{zref-clever}
\makeatletter
\zref@newprop{volume}{Volume 2}
\zref@addprop{main}{volume}
\makeatother
\usepackage{hyperref}
\begin{document}
\section{Section B1}
\zlabel{sec:section-b1}
\end{document}
But, again, this is not really a typical use of xr
, even if interesting in itself, so I don't see a reason to change anything in the manual.
Is it possible to change the example in section 11.8 of the manual to use
zref-clever
withzref-xr
in a way one can reference the file itself, that contains the label?I have 2 volumes of a book, and refer to them as "Volume 1" and "Volume 2", and would like to be able from one of the volumes to refer to the other and obtain a result like:
(without having to enter the number of the volume that contains the label.)