%%
%% This is file `zref-abspos.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% zref.dtx  (with options: `abspos')
%% 
%% This is a generated file.
%% 
%% Project: zref
%% Version: 2023-09-14 v2.35
%% 
%% Copyright (C)
%%   2006-2012 Heiko Oberdiek
%%   2016-2023 Oberdiek Package Support Group
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%%    https://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%%    https://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% The Current Maintainers of this work are
%% Heiko Oberdiek and the Oberdiek Package Support Group
%% https://github.com/ho-tex/zref/issues
%% 
%% This work consists of the main source file zref.dtx
%% and the derived files
%%    zref.sty, zref.pdf, zref.ins, zref.drv, zref-base.sty,
%%    zref-abspage.sty, zref-abspos.sty, zref-counter.sty,
%%    zref-dotfill.sty, zref-env.sty, zref-hyperref.sty,
%%    zref-lastpage.sty, zref-marks.sty, zref-nextpage.sty,
%%    zref-pageattr.sty, zref-pagelayout.sty, zref-perpage.sty,
%%    zref-runs.sty, zref-savepos.sty, zref-thepage.sty,
%%    zref-titleref.sty, zref-totpages.sty, zref-user.sty,
%%    zref-xr.sty, zref-example.tex, zref-example-lastpage.tex,
%%    zref-example-nextpage.tex, zref-test1.tex,
%%    zref-test-base.tex, zref-test-runs.tex,
%%    zref-test-titleref-memoir.tex.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-abspos}%
  [2023-09-14 v2.35 Module abspos for zref (HO)]%
\RequirePackage{zref-base}[2019/11/29]
\ifx\ZREF@base@ok Y%
\else
  \expandafter\endinput
\fi
\RequirePackage{zref-savepos}[2019/11/29]
\ifx\ZREF@savepos@ok Y%
\else
  \expandafter\endinput
\fi
\RequirePackage{zref-pagelayout}[2019/11/29]
\zref@addprop{savepos}{abspage}
\zref@addprop{savepos}{pagevalue}
\newcommand*{\zref@absposx}[3]{%
  \number
    \expandafter\zref@absposnumx\expandafter{%
      \number\zref@extractdefault{#1}{abspage}{0}%
    }{#2}{#3}%
  \ltx@space
}
\newcommand*{\zref@absposy}[3]{%
  \number
  \expandafter\zref@absposnumy\expandafter{%
    \number\zref@extractdefault{#1}{abspage}{0}%
  }{#2}{#3}%
  \ltx@space
}
\newcommand*{\zref@absposnumx}[3]{%
  \number
      \numexpr\ZREF@absposnum{thepage#1}{#2}{x}{#3}\relax
}
\newcommand*{\zref@absposnumy}[3]{%
  \number
      \numexpr\ZREF@absposnum{thepage#1}{#2}{y}{#3}\relax
}
\def\ZREF@absposnum#1#2#3#4{%
  \ltx@ifundefined{ZREF@abspos@#2@#3@#4}{%
    0%
  }{%
    \csname ZREF@abspos@#2@#3@#4\endcsname{#1}%
  }%
}
\ZREF@Robust\def\zref@def@absposx#1{%
  \zref@wrapper@babel{\ZREF@def@abspos{#1}\zref@absposx}%
}
\ZREF@Robust\def\zref@def@absposy#1{%
  \zref@wrapper@babel{\ZREF@def@abspos{#1}\zref@absposy}%
}
\ZREF@Robust\def\zref@def@absposnumx#1{%
  \zref@wrapper@babel{\ZREF@def@abspos{#1}\zref@absposnumx}%
}
\ZREF@Robust\def\zref@def@absposnumy#1{%
  \zref@wrapper@babel{\ZREF@def@abspos{#1}\zref@absposnumy}%
}
\def\ZREF@def@absposnumy#1#2#3#4#5{%
  \edef#1{#2{#3}{#4}{#5}}%
}
\ZREF@Robust\def\zref@absposused{%
  \zref@wrapper@babel\ZREF@abspos@used
}
\def\ZREF@abspos@used#1{%
  \zref@refused{#1}%
  \zref@ifrefundefined{#1}{%
  }{%
    \begingroup
      \edef\ZREF@temp{%
        \zref@extractdefault{#1}{abspage}{0}%
      }%
      \ifnum\ZREF@temp>\ltx@zero
        \zref@refused{thepage\ZREF@temp}%
      \else
        \@PackageError{zref-abspos}{%
          \string\zref@pos@label@used\ltx@space
          needs property `abspage'\MessageBreak
          in label `#1'%
        }\@ehc
      \fi
    \endgroup
  }%
}
\newcommand*{\zref@absposnumused}[1]{%
  \ifnum#1>\ltx@zero
    \zref@refused{thepage\number#1}%
  \else
    \@PackageError{zref-abspos}{%
      Invalid absolute page number (#1)\MessageBreak
      for \string\zref@pos@num@used.\MessageBreak
      A positive integer is expected%
    }\@ehc
  \fi
}
\def\zref@ifabsposundefined#1{%
  \zref@ifrefundefined{#1}\ltx@firsttwo{%
    \expandafter\zref@ifabsposnumundefined\expandafter{%
      \number\zref@extractdefault{#1}{abspage}{0}%
    }%
  }%
}
\def\zref@ifabsposnumundefined#1{%
  \ifnum\ZREF@number{#1}>\ltx@zero
    \zref@ifrefundefined{thepage#1}%
        \ltx@firstoftwo\ltx@secondoftwo
  \else
    \expandafter\ltx@firstoftwo
  \fi
}
\@ifundefined{stockwidth}{\newdimen\stockwidth}{}
\@ifundefined{stockheight}{\newdimen\stockheight}{}
\edef\ZREF@abspos@media@width{%
  \ltx@ifundefined{pdfpagewidth}{%
    \ltx@ifundefined{mediawidth}{%
      \ifdim\stockwidth > \z@
        stockwidth%
      \else
        paperwidth%
      \fi
    }{%
      mediawidth%
    }%
  }{%
    pdfpagewidth%
  }%
}
\ifluatex
\def\ZREF@abspos@media@width{pdfpagewidth}%
\fi
\edef\ZREF@abspos@media@height{%
  \ltx@ifundefined{pdfpageheight}{%
    \ltx@ifundefined{mediaheight}{%
      \ifdim\stockwidth > \z@
        stockheight%
      \else
        paperheight%
      \fi
    }{%
      mediaheight%
    }%
  }{%
    \noexpand\ifcase\pdfpageheight
      \ifdim\stockwidth > \z@
        stockheight%
      \else
        paperheight%
      \fi
    \noexpand\else
      pdfpageheight%
    \noexpand\fi
  }%
}
\ifluatex
\edef\ZREF@abspos@media@height{%
   \noexpand\ifcase\pageheight
     \ifdim\stockwidth > \z@
        stockheight%
     \else
        paperheight%
     \fi
    \noexpand\else
      pdfpageheight%
    \noexpand\fi}%
\fi
\def\ZREF@abspos@media@x@left#1{%
  0%
}
\def\ZREF@abspos@media@x@right#1{%
  \zref@extract{#1}\ZREF@abspos@media@width
}
\def\ZREF@abspos@media@x@center#1{%
  \ZREF@abspos@media@x@left{#1}%
  +\zref@extract{#1}\ZREF@abspos@media@width/2%
}
\def\ZREF@abspos@media@y@top#1{%
  \zref@extract{#1}\ZREF@abspos@media@height
}
\def\ZREF@abspos@media@y@bottom#1{%
  0%
}
\def\ZREF@abspos@media@y@center#1{%
  \zref@extract{#1}\ZREF@abspos@media@height/2%
}
\def\ZREF@abspos@paper@x@left#1{%
  0%
}
\def\ZREF@abspos@paper@x@right#1{%
  \zref@extract{#1}{paperwidth}%
}
\def\ZREF@abspos@paper@x@center#1{%
  \zref@extract{#1}{paperwidth}/2%
}
\let\ZREF@abspos@paper@y@top\ZREF@abspos@media@y@top
\def\ZREF@abspos@paper@y@bottom#1{%
  \ZREF@abspos@paper@y@top{#1}%
  -\zref@extract{#1}{paperheight}%
}
\def\ZREF@abspos@paper@y@center#1{%
  \ZREF@abspos@paper@y@top{#1}%
  -\zref@extract{#1}{paperheight}/2%
}
\let\ZREF@temp\ltx@two
\ltx@IfUndefined{pdfhorigin}{}{%
    \let\ZREF@temp\ltx@zero
}
\ifluatex
  \let\ZREF@temp\ltx@zero
\fi

\ifx\ZREF@temp\ltx@two
  \ifnum\mag=1000 %
    \let\ZREF@temp\ltx@one
  \fi
\fi
\ifcase\ZREF@temp
  \def\ZREF@abspos@origin@x#1{%
    \zref@extract{#1}{pdfhorigin}%
  }%
\or
  \def\ZREF@abspos@origin@x#1{%
    4736286%
  }%
\or
  \def\ZREF@abspos@origin@x#1{%
    \numexpr\mag/1000*\dimexpr 1truein\relax\relax
  }%
\fi
\let\ZREF@temp\ltx@two
\ltx@IfUndefined{pdfvorigin}{}{%
    \let\ZREF@temp\ltx@zero
}
\ifluatex
    \let\ZREF@temp\ltx@zero
\fi
\ifx\ZREF@temp\ltx@two
  \ifnum\mag=1000 %
    \let\ZREF@temp\ltx@one
  \fi
\fi
\ifcase\ZREF@temp
  \def\ZREF@abspos@origin@y#1{%
    \zref@extract{#1}{pdfvorigin}%
  }%
\or
  \def\ZREF@abspos@origin@y#1{%
    4736286%
  }%
\or
  \def\ZREF@abspos@origin@y#1{%
    \numexpr\mag/1000*\dimexpr 1truein\relax\relax
   }%
\fi
\def\ZREF@abspos@head@x@left#1{%
  \ZREF@abspos@paper@x@left{#1}%
  +\ZREF@abspos@origin@x{#1}%
  +\zref@extract{#1}{hoffset}%
  +\ifodd\zref@extractdefault{#1}{pagevalue}{\number\c@page} %
     \zref@extract{#1}{oddsidemargin}%
   \else
     \zref@extract{#1}{evensidemargin}%
   \fi
}
\def\ZREF@abspos@head@x@right#1{%
  \ZREF@abspos@head@x@left{#1}%
  +\zref@extract{#1}{textwidth}%
}
\def\ZREF@abspos@head@x@center#1{%
  \ZREF@abspos@head@x@left{#1}%
  +\zref@extract{#1}{textwidth}/2%
}
\def\ZREF@abspos@head@y@top#1{%
  \ZREF@abspos@paper@y@top{#1}%
  -\ZREF@abspos@origin@y{#1}%
  -\zref@extract{#1}{voffset}%
  -\zref@extract{#1}{topmargin}%
}
\def\ZREF@abspos@head@y@bottom#1{%
  \ZREF@abspos@head@y@top{#1}%
  -\zref@extract{#1}{headheight}%
}
\def\ZREF@abspos@head@y@center#1{%
  \ZREF@abspos@head@y@top{#1}%
  -\zref@extract{#1}{headheight}/2%
}
\let\ZREF@abspos@body@x@left\ZREF@abspos@head@x@left
\let\ZREF@abspos@body@x@right\ZREF@abspos@head@x@right
\let\ZREF@abspos@body@x@center\ZREF@abspos@head@x@center
\def\ZREF@abspos@body@y@top#1{%
  \ZREF@abspos@head@y@bottom{#1}%
  -\zref@extract{#1}{headsep}%
}
\def\ZREF@abspos@body@y@bottom#1{%
  \ZREF@abspos@body@y@top{#1}%
  -\zref@extract{#1}{textheight}%
}
\def\ZREF@abspos@body@y@center#1{%
  \ZREF@abspos@body@y@top{#1}%
  -\zref@extract{#1}{textheight}/2%
}
\let\ZREF@abspos@foot@x@left\ZREF@abspos@head@x@left
\let\ZREF@abspos@foot@x@right\ZREF@abspos@head@x@right
\let\ZREF@abspos@foot@x@center\ZREF@abspos@head@x@center
\def\ZREF@abspos@foot@y@bottom#1{%
  \ZREF@abspos@body@y@bottom{#1}%
  -\zref@extract{#1}{footskip}%
}
\def\ZREF@abspos@marginpar@x@left#1{%
  \ifodd\zref@extractdefault{#1}{pagevalue}{\number\c@page} %
    \ZREF@abspos@body@x@right{#1}%
    +\zref@extract{#1}{marginparsep}%
  \else
    \ZREF@abspos@body@x@left{#1}%
    -\zref@extract{#1}{marginparsep}%
    -\zref@extract{#1}{marginparwidth}%
  \fi
}
\def\ZREF@abspos@marginpar@x@right#1{%
  \ZREF@abspos@marginpar@x@left{#1}%
  +\zref@extract{#1}{marginparwidth}%
}
\def\ZREF@abspos@marginpar@x@center#1{%
  \ZREF@abspos@marginpar@x@left{#1}%
  +\zref@extract{#1}{marginparwidth}/2%
}
\let\ZREF@abspos@marginpar@y@top\ZREF@abspos@body@y@top
\let\ZREF@abspos@marginpar@y@bottom\ZREF@abspos@body@y@bottom
\let\ZREF@abspos@marginpar@y@center\ZREF@abspos@body@y@center
\let\ZREF@abspos@stock@x@left\ZREF@abspos@paper@x@left
\let\ZREF@abspos@stock@x@right\ZREF@abspos@paper@x@right
\let\ZREF@abspos@stock@x@center\ZREF@abspos@paper@x@center
\let\ZREF@abspos@stock@y@top\ZREF@abspos@paper@y@top
\let\ZREF@abspos@stock@y@bottom\ZREF@abspos@paper@y@bottom
\let\ZREF@abspos@stock@y@center\ZREF@abspos@paper@y@center
\endinput
%%
%% End of file `zref-abspos.sty'.
