I'm using the refcount
package to set some counters to the same values as counters from another .tex
file. The labels from the other .tex
file are imported with the zref-xr
package.
This method fails for chapter-wise numbering. For example if a figure in the external .tex
is numbered "3.2", the \setcounterref
will add "3" to whatever counter and print ".2" into the document.
How can I extract only the rear part ("2") and add this to a counter?
\documentclass{book}
\usepackage{filecontents}
\begin{filecontents*}{external.aux}
\newlabel{fig:external}{{3.2}{6}{external figure}{figure.3.2}{}}
\end{filecontents*}
\usepackage{refcount}
\setrefcountdefault{1}
\usepackage{zref-xr}
\zxrsetup{toltxlabel}
\zexternaldocument*[external-]{external}
\setcounter{chapter}{1}
\usepackage{hyperref}
\begin{document}
\setcounterref{figure}{external-fig:external}
\thefigure
\end{document}