Combing answers from this question:
How to use \pageref{foo} as a number?
Positioning TikZ picture on page background to be on each page of twosided document
I was able to create picture of my logo ("artistic" planetary model of atom) that is rotating with nucleus and electrons rotating separately (nested pictures, if I understand it correctly), but when my document exceeded about 90 pages, It stopped compiling with "Arithmetic overflow" error.
In response of Ms. Fischer to first question (I am using that one, because I have in my book arabic and roman counters; sadly after switch those are restarted), there is argument to set default value of last page
\zref@extractdefault{LastPage}{abspage}{1}
I am failing at using that instead of
\getpagerefnumber{LastPage}
I think its because of "@" character being in that statement, and I dont know how to fix it with \makeatletter and \makeatother with correct syntax.
I am opened to any solutions, even those with different approaches (I read also about using package "xassoccnt," in this question:
Refer to the current page number, but not \thepage, but the real absolute
but I dont know how to set default value of both counters to make it work for my case. For compilation I am using luaLaTeX and learning lua too, so that might be also a way, but my limited knowledge is still not enough.
Next i present MWE, which is pretty extensive given my (kinda) complicated picture, but with MWEs from mentioned questions, I can make it work by simple changing default counter value, but in my specific case I dont know how to do that.
Mwe is compilable, for "incompilable" state please uncomment the \newpage \lipsum commands.
EDIT: MWE shows not "arithmetic overflow," but exceeding dimensions, which I hope is simillar. My orginal document shows "Arithmetic overflow" error.
EDIT2: Edited MWE to represent my issue, compiling MWE now brings error (at least on my side). Lowering ammount of pages (removing some "newpages" and "lipsum" makes MWE compilable again).
Thank you very much for any help in this, regards
Tomas
MWE:
\documentclass[12pt,twoside]{book}
\usepackage{lastpage}
\usepackage[lastpage]{zref}
\makeatletter
\zref@newprop*{numpage}{\the\value{page}}
\zref@addprop{main}{abspage}
\makeatother
\usepackage{refcount}
\setrefcountdefault{-1}
\usepackage{eso-pic}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{shapes,calc,positioning,shadows.blur,decorations.pathreplacing}
\newcommand{\nuclei}[1]{%
\shade[ball color=white] (#1) circle (.4);
}
\newcommand{\nucleus}{%
\nuclei{0.1,0.3}
\nuclei{0,0}
\nuclei{0.3,0.2}
\nuclei{-0.2,0.1}
\nuclei{-0.1,0.3}
\nuclei{0.2,-0.15}
\nuclei{-0.05,-0.12}
\nuclei{0.17,0.21}
}
%\electron{xwidth,ywidth,rotation angle}
\newcommand{\electron}[3]{%
\draw[rotate = #3](0,0) ellipse (#1 and #2)[color=blue];
\shade[ball color=black] (0,#2)[rotate=#3] circle (.2);
}
\usepackage{changepage}
\strictpagecheck
\newcommand{\MyTikzLogo}{% For a logo drawn with TikZ
\begin{tikzpicture}[remember picture,overlay,scale=1]
\checkoddpage
\ifoddpage
\begin{scope}[shift={([xshift=2cm,yshift=2cm]current page.south west)}, scale=0.25]
\begin{scope}[rotate=360*\the\value{page}/\getpagerefnumber{LastPage}]
\nucleus
\end{scope}
\electron{1.2}{1.4}{260+(360*\the\value{page}/\getpagerefnumber{LastPage})}
\electron{4}{2}{30+(360*\the\value{page}/\getpagerefnumber{LastPage})}
\electron{5}{1}{60+(360*\the\value{page}/\getpagerefnumber{LastPage})}
\electron{5.5}{1.5}{150+(360*\the\value{page}/\getpagerefnumber{LastPage})}
\electron{4.8}{2.25}{80+(360*\the\value{page}/\getpagerefnumber{LastPage})}
\end{scope}
\else
\begin{scope}[shift={([xshift=-2cm,yshift=2cm]current page.south east)}, scale=0.25,local bounding box=test]
\begin{scope}[rotate=360*\the\value{page}/\getpagerefnumber{LastPage}]
\nucleus
\end{scope}
\electron{1.2}{1.4}{260+(360*\the\value{page}/\getpagerefnumber{LastPage})}
\electron{4}{2}{30+(360*\the\value{page}/\getpagerefnumber{LastPage})}
\electron{5}{1}{60+(360*\the\value{page}/\getpagerefnumber{LastPage})}
\electron{5.5}{1.5}{150+(360*\the\value{page}/\getpagerefnumber{LastPage})}
\electron{4.8}{2.25}{80+(360*\the\value{page}/\getpagerefnumber{LastPage})}
\end{scope}
\fi
\end{tikzpicture}
}
\AddToShipoutPictureBG{\MyTikzLogo}
\begin{document}
\section*{Lorem Ipsum}
\pagenumbering{roman}
\lipsum[1-60]
\newpage
\lipsum[1-60]
\newpage
\pagenumbering{arabic}
\lipsum[1-60]
\newpage
\lipsum[1-60]
\newpage
\lipsum[1-60]
\newpage
\lipsum[1-60]
\newpage
\lipsum[1-60]
\newpage
\lipsum[1-60]
\newpage
\lipsum[1-60]
\newpage
\lipsum[1-60]
\newpage
\lipsum[1-60]
\newpage
\lipsum[1-60]
\newpage
\lipsum[1-60]
\newpage
\lipsum[1-60]
\newpage
\end{document}
360/\getpagerefnumber{LastPage}*\the\value{page}. Btw: this a problem of pgf, as it uses internally dimensions it can't handle large value well. – Ulrike Fischer Jun 06 '19 at 14:44