You have two problems: A general one and one of using calc
.
First the general one: \CurrPage
expands to first setting a label and next using the value generated by the label. Setting the label is not a number, so adding \zlabel{…}
to a counter always fails. This problem could be solved by a simple change of \CurrPage
:
\newcommand*{\CurrPage}{%
\number\numexpr
\zref@extract{page.num}{abspage}%
-3%
\relax
\zlabel{page.num}%
}
Now, \CurrPage
first results in a number an then in generation of a label. With this:
\documentclass[a4paper, fontsize = 12pt,headsepline]{scrartcl}
% Page Numbering Roman
\pagenumbering{Roman}
\usepackage{lipsum}
%\usepackage{calc}
\usepackage[abspage,user,lastpage]{zref}
\makeatletter
\newcommand*{\CurrPage}{%
\number\numexpr
\zref@extract{page.num}{abspage}%
-3%
\relax
\zlabel{page.num}%
}
\makeatother
\begin{document}
% Counter Definition Framework
\newcounter{Page.Num.Framework}
\lipsum[1-25]
Current Page Num: {\CurrPage}
Before: \arabic{Page.Num.Framework}
\addtocounter{Page.Num.Framework}{\CurrPage}
After: \arabic{Page.Num.Framework}
\end{document}
works (but is still ugly).
The special problem of using calc
is, that calc
allows calculations in \addtocounter
and with that package the argument of \addtocounter
must be a numeric expression without commands that do not expand to numbers. So
\documentclass[a4paper, fontsize = 12pt,headsepline]{scrartcl}
% Page Numbering Roman
\pagenumbering{Roman}
\usepackage{lipsum}
\usepackage{calc}
\usepackage[abspage,user,lastpage]{zref}
\makeatletter
\newcommand*{\CurrPage}{%
\number\numexpr
\zref@extract{page.num}{abspage}%
-3%
\relax
\zlabel{page.num}%
}
\makeatother
\begin{document}
% Counter Definition Framework
\newcounter{Page.Num.Framework}
\lipsum[1-25]
Current Page Num: {\CurrPage}
Before: \arabic{Page.Num.Framework}
\addtocounter{Page.Num.Framework}{\CurrPage}
After: \arabic{Page.Num.Framework}
\end{document}
still fails and you have to split of \CurrPage
in a label generation and label usage:
\documentclass[a4paper, fontsize = 12pt,headsepline]{scrartcl}
% Page Numbering Roman
\pagenumbering{Roman}
\usepackage{lipsum}
\usepackage{calc}
\usepackage[abspage,user,lastpage]{zref}
\makeatletter
\newcommand*{\StoreCurrPage}{\zlabel{page.num}}
\newcommand*{\UseCurrPage}{%
\numexpr
\zref@extract{page.num}{abspage}%
-3%
\relax
}
\makeatother
\begin{document}
% Counter Definition Framework
\newcounter{Page.Num.Framework}
\lipsum[1-25]
Before: \arabic{Page.Num.Framework}
\StoreCurrPage\addtocounter{Page.Num.Framework}{\UseCurrPage}
After: \arabic{Page.Num.Framework}
\end{document}