[Tex/LaTex] Use Roman Page Number in setcounter{page}

page-numbering

I would like to use the page number of a label as the input for \setcounter{page}{label's page}.
I tried using zref abspage, however, in my document there are a few uncounted pages before I start with the actual page numbering, therefore abspage is offset by 2 pages.
I also tried it with newcommand and variables, but I could not get it to work properly. An additional hurdle seems to be the roman style of page numbering making it hard to convert (got -1 using etoolbox's \rmntonum).

How can I resume the roman page numbering using a label placed at the end of the first part, before arabic numbering is used?
The solution should be as generic as possible, i.e. not subtracting a hard coded offset.

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}
    this is my title
    \thispagestyle{empty}
    \newpage

    some declarations
    \thispagestyle{empty}
    \newpage

    \setcounter{page}{1}
    \pagenumbering{Roman}
    \tableofcontents
    \newpage

    \addcontentsline{toc}{chapter}{List of Figures}
    \listoffigures
    \label{end of intro}
    \newpage

    \pagenumbering{arabic}
    \chapter{chapter one}
    \lipsum[2-5]
    \cite{kastenholz}

    \chapter{chapter two}
    \lipsum[2-4]

    \clearpage
    \pagenumbering{roman}
    \setcounter{page}{3}    % <-- set this value based on label 'end of intro', zref abspage gives 4

    \addcontentsline{toc}{chapter}{References} 
    \printbibliography

\end{document}

Best Answer

Do you have to use a \label? You might as well use a \newcount and use its value to set your counter:

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}
\newcount\pagebak

\begin{document}
    this is my title
    \thispagestyle{empty}
    \newpage

    some declarations
    \thispagestyle{empty}
    \newpage

    \setcounter{page}{1}
    \pagenumbering{Roman}
    \tableofcontents
    \newpage

    \addcontentsline{toc}{chapter}{List of Figures}
    \listoffigures
    \pagebak=\arabic{page}
    \label{end of intro}
    \newpage

    \pagenumbering{arabic}
    \chapter{chapter one}
    \lipsum[2-5]
    \cite{kastenholz}

    \chapter{chapter two}
    \lipsum[2-4]

    \clearpage
    \pagenumbering{roman}
    %\setcounter{page}{3}    % <-- set this value based on label 'end of intro', zref abspage gives 4
    \setcounter{page}{\numexpr\pagebak+1}    % <-- set this value based on label 'end of intro', zref abspage gives 4

    \addcontentsline{toc}{chapter}{References} 
    \printbibliography

\end{document}
Related Question