| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: zref.dtx |
| 4 |
% Version: 2026-03-07 v2.37 |
| 5 |
% Info: A new reference scheme for LaTeX |
| 6 |
% |
| 7 |
% Copyright (C) |
| 8 |
% 2006-2012 Heiko Oberdiek |
| 9 |
% 2016-2025 Oberdiek Package Support Group |
| 10 |
% https://github.com/ho-tex/zref/issues |
| 11 |
% |
| 12 |
% This work may be distributed and/or modified under the |
| 13 |
% conditions of the LaTeX Project Public License, either |
| 14 |
% version 1.3c of this license or (at your option) any later |
| 15 |
% version. This version of this license is in |
| 16 |
% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 17 |
% and the latest version of this license is in |
| 18 |
% https://www.latex-project.org/lppl.txt |
| 19 |
% and version 1.3 or later is part of all distributions of |
| 20 |
% LaTeX version 2005/12/01 or later. |
| 21 |
% |
| 22 |
% This work has the LPPL maintenance status "maintained". |
| 23 |
% |
| 24 |
% The Current Maintainers of this work are |
| 25 |
% Heiko Oberdiek and the Oberdiek Package Support Group |
| 26 |
% https://github.com/ho-tex/zref/issues |
| 27 |
% |
| 28 |
% This work consists of the main source file zref.dtx |
| 29 |
% and the derived files |
| 30 |
% zref.sty, zref.pdf, zref.ins, zref.drv, zref-base.sty, |
| 31 |
% zref-abspage.sty, zref-abspos.sty, zref-counter.sty, |
| 32 |
% zref-dotfill.sty, zref-env.sty, zref-hyperref.sty, |
| 33 |
% zref-lastpage.sty, zref-marks.sty, zref-nextpage.sty, |
| 34 |
% zref-pageattr.sty, zref-pagelayout.sty, zref-perpage.sty, |
| 35 |
% zref-runs.sty, zref-savepos.sty, zref-thepage.sty, |
| 36 |
% zref-titleref.sty, zref-totpages.sty, zref-user.sty, |
| 37 |
% zref-xr.sty, zref-example.tex, zref-example-lastpage.tex, |
| 38 |
% zref-example-nextpage.tex, zref-test1.tex, |
| 39 |
% zref-test-base.tex, zref-test-runs.tex, |
| 40 |
% zref-test-titleref-memoir.tex. |
| 41 |
% |
| 42 |
% Distribution: |
| 43 |
% CTAN:macros/latex/contrib/zref/zref.dtx |
| 44 |
% CTAN:macros/latex/contrib/zref/zref.pdf |
| 45 |
% |
| 46 |
% Unpacking: |
| 47 |
% (a) If zref.ins is present: |
| 48 |
% tex zref.ins |
| 49 |
% (b) Without zref.ins: |
| 50 |
% tex zref.dtx |
| 51 |
% (c) If you insist on using LaTeX |
| 52 |
% latex \let\install=y\input{zref.dtx} |
| 53 |
% (quote the arguments according to the demands of your shell) |
| 54 |
% |
| 55 |
% Documentation: |
| 56 |
% (a) If zref.drv is present: |
| 57 |
% latex zref.drv |
| 58 |
% (b) Without zref.drv: |
| 59 |
% latex zref.dtx; ... |
| 60 |
% The class ltxdoc loads the configuration file ltxdoc.cfg |
| 61 |
% if available. Here you can specify further options, e.g. |
| 62 |
% use A4 as paper format: |
| 63 |
% \PassOptionsToClass{a4paper}{article} |
| 64 |
% |
| 65 |
% Program calls to get the documentation (example): |
| 66 |
% pdflatex zref.dtx |
| 67 |
% makeindex -s gind.ist zref.idx |
| 68 |
% pdflatex zref.dtx |
| 69 |
% makeindex -s gind.ist zref.idx |
| 70 |
% pdflatex zref.dtx |
| 71 |
% |
| 72 |
% Installation: |
| 73 |
% TDS:tex/latex/zref/zref.sty |
| 74 |
% TDS:tex/latex/zref/zref-base.sty |
| 75 |
% TDS:tex/latex/zref/zref-abspage.sty |
| 76 |
% TDS:tex/latex/zref/zref-abspos.sty |
| 77 |
% TDS:tex/latex/zref/zref-counter.sty |
| 78 |
% TDS:tex/latex/zref/zref-dotfill.sty |
| 79 |
% TDS:tex/latex/zref/zref-env.sty |
| 80 |
% TDS:tex/latex/zref/zref-hyperref.sty |
| 81 |
% TDS:tex/latex/zref/zref-lastpage.sty |
| 82 |
% TDS:tex/latex/zref/zref-marks.sty |
| 83 |
% TDS:tex/latex/zref/zref-nextpage.sty |
| 84 |
% TDS:tex/latex/zref/zref-pageattr.sty |
| 85 |
% TDS:tex/latex/zref/zref-pagelayout.sty |
| 86 |
% TDS:tex/latex/zref/zref-perpage.sty |
| 87 |
% TDS:tex/latex/zref/zref-runs.sty |
| 88 |
% TDS:tex/latex/zref/zref-savepos.sty |
| 89 |
% TDS:tex/latex/zref/zref-thepage.sty |
| 90 |
% TDS:tex/latex/zref/zref-titleref.sty |
| 91 |
% TDS:tex/latex/zref/zref-totpages.sty |
| 92 |
% TDS:tex/latex/zref/zref-user.sty |
| 93 |
% TDS:tex/latex/zref/zref-xr.sty |
| 94 |
% TDS:doc/latex/zref/zref.pdf |
| 95 |
% TDS:doc/latex/zref/zref-example.tex |
| 96 |
% TDS:doc/latex/zref/zref-example-lastpage.tex |
| 97 |
% TDS:doc/latex/zref/zref-example-nextpage.tex |
| 98 |
% TDS:source/latex/zref/zref.dtx |
| 99 |
% |
| 100 |
%<*ignore> |
| 101 |
\begingroup |
| 102 |
\catcode123=1 % |
| 103 |
\catcode125=2 % |
| 104 |
\def\x{LaTeX2e}% |
| 105 |
\expandafter\endgroup |
| 106 |
\ifcase 0\ifx\install y1\fi\expandafter |
| 107 |
\ifx\csname processbatchFile\endcsname\relax\else1\fi |
| 108 |
\ifx\fmtname\x\else 1\fi\relax |
| 109 |
\else\csname fi\endcsname |
| 110 |
%</ignore> |
| 111 |
%<*install> |
| 112 |
\input docstrip.tex |
| 113 |
\Msg{************************************************************************} |
| 114 |
\Msg{* Installation} |
| 115 |
\Msg{* Package: zref 2026-03-07 v2.37 A new reference scheme for LaTeX (HO)} |
| 116 |
\Msg{************************************************************************} |
| 117 |
|
| 118 |
\keepsilent |
| 119 |
\askforoverwritefalse |
| 120 |
|
| 121 |
\let\MetaPrefix\relax |
| 122 |
\preamble |
| 123 |
|
| 124 |
This is a generated file. |
| 125 |
|
| 126 |
Project: zref |
| 127 |
Version: 2026-03-07 v2.37 |
| 128 |
|
| 129 |
Copyright (C) |
| 130 |
2006-2012 Heiko Oberdiek |
| 131 |
2016-2026 Oberdiek Package Support Group |
| 132 |
|
| 133 |
This work may be distributed and/or modified under the |
| 134 |
conditions of the LaTeX Project Public License, either |
| 135 |
version 1.3c of this license or (at your option) any later |
| 136 |
version. This version of this license is in |
| 137 |
https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 138 |
and the latest version of this license is in |
| 139 |
https://www.latex-project.org/lppl.txt |
| 140 |
and version 1.3 or later is part of all distributions of |
| 141 |
LaTeX version 2005/12/01 or later. |
| 142 |
|
| 143 |
This work has the LPPL maintenance status "maintained". |
| 144 |
|
| 145 |
The Current Maintainers of this work are |
| 146 |
Heiko Oberdiek and the Oberdiek Package Support Group |
| 147 |
https://github.com/ho-tex/zref/issues |
| 148 |
|
| 149 |
|
| 150 |
This work consists of the main source file zref.dtx |
| 151 |
and the derived files |
| 152 |
zref.sty, zref.pdf, zref.ins, zref.drv, zref-base.sty, |
| 153 |
zref-abspage.sty, zref-abspos.sty, zref-counter.sty, |
| 154 |
zref-dotfill.sty, zref-env.sty, zref-hyperref.sty, |
| 155 |
zref-lastpage.sty, zref-marks.sty, zref-nextpage.sty, |
| 156 |
zref-pageattr.sty, zref-pagelayout.sty, zref-perpage.sty, |
| 157 |
zref-runs.sty, zref-savepos.sty, zref-thepage.sty, |
| 158 |
zref-titleref.sty, zref-totpages.sty, zref-user.sty, |
| 159 |
zref-xr.sty, zref-example.tex, zref-example-lastpage.tex, |
| 160 |
zref-example-nextpage.tex, zref-test1.tex, |
| 161 |
zref-test-base.tex, zref-test-runs.tex, |
| 162 |
zref-test-titleref-memoir.tex. |
| 163 |
|
| 164 |
\endpreamble |
| 165 |
\let\MetaPrefix\DoubleperCent |
| 166 |
|
| 167 |
\generate{% |
| 168 |
\file{zref.ins}{\from{zref.dtx}{install}}% |
| 169 |
\file{zref.drv}{\from{zref.dtx}{driver}}% |
| 170 |
\usedir{tex/latex/zref}% |
| 171 |
\file{zref.sty}{\from{zref.dtx}{package}}% |
| 172 |
\file{zref-base.sty}{\from{zref.dtx}{base}}% |
| 173 |
\file{zref-abspage.sty}{\from{zref.dtx}{abspage}}% |
| 174 |
\file{zref-abspos.sty}{\from{zref.dtx}{abspos}}% |
| 175 |
\file{zref-counter.sty}{\from{zref.dtx}{counter}}% |
| 176 |
\file{zref-dotfill.sty}{\from{zref.dtx}{dotfill}}% |
| 177 |
\file{zref-env.sty}{\from{zref.dtx}{env}}% |
| 178 |
\file{zref-hyperref.sty}{\from{zref.dtx}{hyperref}}% |
| 179 |
\file{zref-lastpage.sty}{\from{zref.dtx}{lastpage}}% |
| 180 |
\file{zref-marks.sty}{\from{zref.dtx}{marks}}% |
| 181 |
\file{zref-nextpage.sty}{\from{zref.dtx}{nextpage}}% |
| 182 |
\file{zref-pageattr.sty}{\from{zref.dtx}{pageattr}}% |
| 183 |
\file{zref-pagelayout.sty}{\from{zref.dtx}{pagelayout}}% |
| 184 |
\file{zref-perpage.sty}{\from{zref.dtx}{perpage}}% |
| 185 |
\file{zref-runs.sty}{\from{zref.dtx}{runs}}% |
| 186 |
\file{zref-savepos.sty}{\from{zref.dtx}{savepos}}% |
| 187 |
\file{zref-thepage.sty}{\from{zref.dtx}{thepage}}% |
| 188 |
\file{zref-titleref.sty}{\from{zref.dtx}{titleref}}% |
| 189 |
\file{zref-totpages.sty}{\from{zref.dtx}{totpages}}% |
| 190 |
\file{zref-user.sty}{\from{zref.dtx}{user}}% |
| 191 |
\file{zref-xr.sty}{\from{zref.dtx}{xr}}% |
| 192 |
\usedir{doc/latex/zref}% |
| 193 |
\file{zref-example.tex}{\from{zref.dtx}{example}}% |
| 194 |
\file{zref-example-lastpage.tex}{\from{zref.dtx}{example-lastpage}}% |
| 195 |
\file{zref-example-nextpage.tex}{\from{zref.dtx}{example-nextpage}}% |
| 196 |
% \usedir{doc/latex/zref/test}% |
| 197 |
% \file{zref-test1.tex}{\from{zref.dtx}{test1}}% |
| 198 |
% \file{zref-test-base.tex}{\from{zref.dtx}{test-base}}% |
| 199 |
% \file{zref-test-runs.tex}{\from{zref.dtx}{test-runs}}% |
| 200 |
% \file{zref-test-titleref-memoir.tex}{\from{zref.dtx}{test-titleref-memoir}}% |
| 201 |
} |
| 202 |
|
| 203 |
\catcode32=13\relax% active space |
| 204 |
\let =\space% |
| 205 |
\Msg{************************************************************************} |
| 206 |
\Msg{*} |
| 207 |
\Msg{* To finish the installation you have to move the following} |
| 208 |
\Msg{* files into a directory searched by TeX:} |
| 209 |
\Msg{*} |
| 210 |
\Msg{* zref.sty, zref-base.sty, zref-abspage.sty, zref-abspos.sty,} |
| 211 |
\Msg{* zref-counter.sty, zref-dotfill.sty, zref-env.sty,} |
| 212 |
\Msg{* zref-hyperref.sty, zref-lastpage.sty, zref-marks.sty,} |
| 213 |
\Msg{* zref-nextpage.sty, zref-pageattr.sty, zref-pagelayout.sty,} |
| 214 |
\Msg{* zref-perpage.sty, zref-runs.sty, zref-savepos.sty,} |
| 215 |
\Msg{* zref-thepage.sty, zref-titleref.sty, zref-totpages.sty,} |
| 216 |
\Msg{* zref-user.sty, zref-xr.sty} |
| 217 |
\Msg{*} |
| 218 |
\Msg{* To produce the documentation run the file `zref.drv'} |
| 219 |
\Msg{* through LaTeX.} |
| 220 |
\Msg{*} |
| 221 |
\Msg{* Happy TeXing!} |
| 222 |
\Msg{*} |
| 223 |
\Msg{************************************************************************} |
| 224 |
|
| 225 |
\endbatchfile |
| 226 |
%</install> |
| 227 |
%<*ignore> |
| 228 |
\fi |
| 229 |
%</ignore> |
| 230 |
%<*driver> |
| 231 |
\NeedsTeXFormat{LaTeX2e} |
| 232 |
\ProvidesFile{zref.drv}% |
| 233 |
[2026-03-07 v2.37 A new reference scheme for LaTeX (HO)]% |
| 234 |
\documentclass{ltxdoc} |
| 235 |
\usepackage{holtxdoc}[2011/11/22] |
| 236 |
\setlength{\emergencystretch}{1em} |
| 237 |
\begin{document} |
| 238 |
\DocInput{zref.dtx}% |
| 239 |
\end{document} |
| 240 |
%</driver> |
| 241 |
% \fi |
| 242 |
% |
| 243 |
% |
| 244 |
% |
| 245 |
% \GetFileInfo{zref.drv} |
| 246 |
% |
| 247 |
% \title{The \xpackage{zref} package} |
| 248 |
% \date{2026-03-07 v2.37} |
| 249 |
% \author{Heiko Oberdiek\thanks |
| 250 |
% {Please report any issues at \url{https://github.com/ho-tex/zref/issues}}} |
| 251 |
% |
| 252 |
% \maketitle |
| 253 |
% |
| 254 |
% \begin{abstract} |
| 255 |
% Package \xpackage{zref} tries to get rid of the restriction |
| 256 |
% in \hologo{LaTeX}'s reference system that only two properties are |
| 257 |
% supported. The package implements an extensible referencing |
| 258 |
% system, where properties are handled in a more flexible way. |
| 259 |
% It offers an interface for macro programmers for the access |
| 260 |
% to the system and some applications that uses the new |
| 261 |
% reference scheme. |
| 262 |
% \end{abstract} |
| 263 |
% |
| 264 |
% \tableofcontents |
| 265 |
% |
| 266 |
% \newcommand*{\metacs}[1]{\texttt{\itshape #1}} |
| 267 |
% |
| 268 |
% \newcommand{\markexp}{^^A |
| 269 |
% \textsuperscript{exp}^^A |
| 270 |
% \space |
| 271 |
% } |
| 272 |
% \newcommand{\markexptwo}{^^A |
| 273 |
% \textsuperscript{exp2}^^A |
| 274 |
% \space |
| 275 |
% } |
| 276 |
% \newcommand{\markrobust}{^^A |
| 277 |
% \textsuperscript{robust}^^A |
| 278 |
% \space |
| 279 |
% } |
| 280 |
% \newcommand{\marknowarn}{^^A |
| 281 |
% \textsuperscript{nowarn}^^A |
| 282 |
% \space |
| 283 |
% } |
| 284 |
% \newcommand{\markbabel}{^^A |
| 285 |
% \textsuperscript{babel}^^A |
| 286 |
% \space |
| 287 |
% } |
| 288 |
% |
| 289 |
% \section{Introduction} |
| 290 |
% |
| 291 |
% Standard \hologo{LaTeX}'s reference system with \cs{label}, \cs{ref}, |
| 292 |
% and \cs{pageref} supports two properties, the appearance of |
| 293 |
% the counter that is last incremented by \cs{refstepcounter} and |
| 294 |
% the page with the \cs{label} command. |
| 295 |
% |
| 296 |
% Unhappily \hologo{LaTeX} does not provide an interface for adding |
| 297 |
% another properties. Packages such as \xpackage{hyperref}, |
| 298 |
% \xpackage{nameref}, or \xpackage{titleref} are forced to |
| 299 |
% use ugly hacks to extend the reference system. |
| 300 |
% These ugly hacks are one of the causes for \xpackage{hyperref}'s |
| 301 |
% difficulty regarding compatibility with other packages. |
| 302 |
% |
| 303 |
% \subsection{Standard \hologo{LaTeX} behaviour} |
| 304 |
% |
| 305 |
% References are created by the \cs{label} command: |
| 306 |
% \begin{quote} |
| 307 |
% |\chapter{Second chapter}|\\ |
| 308 |
% |\section{First section on page 7} % section 2.1|\\ |
| 309 |
% |\label{myref}| |
| 310 |
% \end{quote} |
| 311 |
% Now \hologo{LaTeX} records the section number |2.1| and the page |7| |
| 312 |
% in the reference. Internally the reference is a list with |
| 313 |
% two entries: |
| 314 |
% \begin{quote} |
| 315 |
% |\r@myref| $\rightarrow$ |{2.1}{7}| |
| 316 |
% \end{quote} |
| 317 |
% The length of the list if fixed in the \hologo{LaTeX} kernel, |
| 318 |
% An interface for adding new properties is missing. |
| 319 |
% |
| 320 |
% There are several tries to add new properties: |
| 321 |
% \begin{description} |
| 322 |
% \item[\xpackage{hyperref}] uses a list of five |
| 323 |
% properties instead of the standard list with two entries. |
| 324 |
% This causes many compatibility problems with \hologo{LaTeX} and |
| 325 |
% other packages. |
| 326 |
% \item[\xpackage{titleref}] stores its title data into the |
| 327 |
% first entry in the list. \hologo{LaTeX} is happy because it |
| 328 |
% does only see its list with two entries. The situation |
| 329 |
% becomes more difficult, if more properties are added |
| 330 |
% this way. Then the macros form a nested structure |
| 331 |
% inside the first reference argument for the label. |
| 332 |
% Expandable extractions will then become painful. |
| 333 |
% \end{description} |
| 334 |
% |
| 335 |
% \subsection{Basic idea} |
| 336 |
% |
| 337 |
% Some time ago Morten H\o gholm sent me an experimental |
| 338 |
% cross referencing mechanism as ``expl3'' code. His |
| 339 |
% idea is: |
| 340 |
% \begin{quote} |
| 341 |
% |\g_xref_mylabel_plist| $\rightarrow$\\ |
| 342 |
% \mbox{}\qquad|\xref_dance_key{salsa}\xref_name_key{Morten}|\dots |
| 343 |
% \end{quote} |
| 344 |
% The entries have the following format: |
| 345 |
% \begin{quote} |
| 346 |
% |\xref_|\meta{your key}|_key{|\meta{some text}|}| |
| 347 |
% \end{quote} |
| 348 |
% This approach is much more flexible: |
| 349 |
% \begin{itemize} |
| 350 |
% \item New properties can easily be added, just use a new key. |
| 351 |
% \item The length of the list is not fixed. A reference |
| 352 |
% can use a subset of the keys. |
| 353 |
% \item The order of the entries does not matter. |
| 354 |
% \end{itemize} |
| 355 |
% Unhappily I am not familiar with the experimental code |
| 356 |
% for \hologo{LaTeX3} that will need some time before its first release. |
| 357 |
% Thus I have implemented it as \hologo{LaTeXe} package without disturbing |
| 358 |
% the existing \hologo{LaTeX} reference system. |
| 359 |
% |
| 360 |
% \subsection{Interfaces} |
| 361 |
% |
| 362 |
% The package provides a generic \emph{interface for programmers}. |
| 363 |
% Commands of this interface are prefixed by \cs{zref@}. |
| 364 |
% |
| 365 |
% Option \xoption{user} enables the \emph{user interface}. |
| 366 |
% Here the commands are prefixed by \cs{z} to avoid name |
| 367 |
% clashes with existing macros. |
| 368 |
% |
| 369 |
% Then the packages provides some \emph{modules}. They |
| 370 |
% are applications for the reference system and can also be |
| 371 |
% considered as examples how to use the reference system. |
| 372 |
% |
| 373 |
% The modules can be loaded as packages. The package |
| 374 |
% name is prefixed with |zref-|, for example: |
| 375 |
%\begin{quote} |
| 376 |
%\begin{verbatim} |
| 377 |
%\RequirePackage{zref-abspage} |
| 378 |
%\end{verbatim} |
| 379 |
%\end{quote} |
| 380 |
% This is the preferred way if the package is loaded from |
| 381 |
% within other packages to avoid option clashes. |
| 382 |
% |
| 383 |
% As alternative package |zref| can be used and the modules |
| 384 |
% are given as options: |
| 385 |
%\begin{quote} |
| 386 |
%\begin{verbatim} |
| 387 |
%\usepackage[perpage,user]{zref} |
| 388 |
%\end{verbatim} |
| 389 |
%\end{quote} |
| 390 |
% |
| 391 |
% \section{Interface for programmers} |
| 392 |
% |
| 393 |
% The user interface is described in the next section \ref{sec:user}. |
| 394 |
% |
| 395 |
% \subsection{Entities} |
| 396 |
% |
| 397 |
% \paragraph{Reference.} |
| 398 |
% Internally a reference is a list of key value pairs: |
| 399 |
% \begin{quote} |
| 400 |
% |\Z@R@myref| $\rightarrow$ |
| 401 |
% |\default{2.1}\page{7}| |
| 402 |
% \end{quote} |
| 403 |
% The generic format of a entry is: |
| 404 |
% \begin{quote} |
| 405 |
% |\Z@R@|\meta{refname} $\rightarrow$ |
| 406 |
% |\|\meta{propname}|{|\meta{value}|}| |
| 407 |
% \end{quote} |
| 408 |
% \meta{refname} is the name that denoted references |
| 409 |
% (the name used in \cs{label} and \cs{ref}). \meta{propname} |
| 410 |
% is the name of the property or key. The property key macro |
| 411 |
% is never executed, it is used in parameter text matching only. |
| 412 |
% |
| 413 |
% \paragraph{Property.} |
| 414 |
% Because the name of a property is used in a macro name |
| 415 |
% that must survive the \xfile{.aux} file, the name is |
| 416 |
% restricted to letters and `@'. |
| 417 |
% |
| 418 |
% \paragraph{Property list.} |
| 419 |
% Often references are used for special purposes. Thus it |
| 420 |
% saves memory if just the properties are used in this |
| 421 |
% reference that are necessary for its purpose. |
| 422 |
% |
| 423 |
% Therefore this package uses the concept of \emph{property lists}. |
| 424 |
% A property list is a set of properties. The set of properties |
| 425 |
% that is used by the default \cs{label} command is the |
| 426 |
% \emph{main property list}. |
| 427 |
% |
| 428 |
% \subsection{Property list} |
| 429 |
% |
| 430 |
% \markexp means that the implementation of the |
| 431 |
% marked macro is expandable. \markexptwo goes a step further |
| 432 |
% and marks the macro expandable in exact two expansion steps. |
| 433 |
% |
| 434 |
% \begin{declcs}{zref@newlist} |
| 435 |
% \M{listname} |
| 436 |
% \end{declcs} |
| 437 |
% Declares a new empty property list. |
| 438 |
% |
| 439 |
% \begin{declcs}{zref@addprop} |
| 440 |
% \M{listname} \M{propname}\\ |
| 441 |
% \cs{zref@localaddprop} \M{listname} \M{propname} |
| 442 |
% \end{declcs} |
| 443 |
% Adds the property \meta{propname} |
| 444 |
% to the property list \meta{listname}. |
| 445 |
% The property and list must exist. |
| 446 |
% The addition is global by \cs{zref@addprop} and limited to |
| 447 |
% local scope by \cs{zref@localaddprop}. |
| 448 |
% Between 2010/04/19 v2.13 and 2010/10/22 v2.19 a comma separated list |
| 449 |
% of properties could be used as argument \meta{propname}. |
| 450 |
% Since 2010/10/22 v2.19 the addition of several properties |
| 451 |
% at once is supported by \cs{zref@addprops}. |
| 452 |
% |
| 453 |
% \begin{declcs}{zref@addprops} |
| 454 |
% \M{listname} \M{propname list}\\ |
| 455 |
% \cs{zref@localaddprops} \M{listname} \M{propname list} |
| 456 |
% \end{declcs} |
| 457 |
% These macros add a comma separated list of properties |
| 458 |
% \meta{propname list} to list \meta{listname}. |
| 459 |
% \cs{zref@addprops} works globally and \cs{zref@localaddprops} |
| 460 |
% locally. Since 2010/10/22 v2.19. |
| 461 |
% |
| 462 |
% \begin{declcs}{zref@listexists} |
| 463 |
% \M{listname} \M{then} |
| 464 |
% \end{declcs} |
| 465 |
% Executes \meta{then} if the property list \meta{listname} exists |
| 466 |
% or raise an error otherwise. |
| 467 |
% |
| 468 |
% \begin{declcs}{zref@iflistundefined}\markexp \M{listname} |
| 469 |
% \M{then} \M{else} |
| 470 |
% \end{declcs} |
| 471 |
% Executes \meta{then} if the list exists or \meta{else} |
| 472 |
% otherwise. |
| 473 |
% |
| 474 |
% \begin{declcs}{zref@iflistcontainsprop} |
| 475 |
% \M{listname} \M{propname} \M{then} \M{else} |
| 476 |
% \end{declcs} |
| 477 |
% Executes \meta{then} if the property \meta{propname} is part |
| 478 |
% of property list \meta{listname} or otherwise it |
| 479 |
% runs the \meta{else} part. |
| 480 |
% |
| 481 |
% \subsection{Property} |
| 482 |
% |
| 483 |
% \begin{declcs}{zref@newprop} |
| 484 |
% \* \M{propname} |[|\meta{default}|]| \M{value} |
| 485 |
% \end{declcs} |
| 486 |
% This command declares and configures a new property with |
| 487 |
% name \meta{propname}. |
| 488 |
% |
| 489 |
% In case of unknown references |
| 490 |
% or the property does not exist in the reference, the |
| 491 |
% \meta{default} is used as value. If it is not specified |
| 492 |
% here, a global default is used, see \cs{zref@setdefault}. |
| 493 |
% |
| 494 |
% The correct values of some properties are not known |
| 495 |
% immediately but at page shipout time. Prominent example |
| 496 |
% is the page number. These properties are declared with |
| 497 |
% the star form of the command. |
| 498 |
% |
| 499 |
% \begin{declcs}{zref@setcurrent} |
| 500 |
% \M{propname} \M{value} |
| 501 |
% \end{declcs} |
| 502 |
% This sets the current value of the property \meta{propname}. |
| 503 |
% It is a generalization of setting \hologo{LaTeX}'s \cs{currentlabel}. |
| 504 |
% |
| 505 |
% \begin{declcs}{zref@getcurrent}\markexptwo |
| 506 |
% \M{propname} |
| 507 |
% \end{declcs} |
| 508 |
% This returns the current value of the property \meta{propname}. |
| 509 |
% The value may not be correct, especially if the property |
| 510 |
% is bound to a page (start form of \cs{zref@newprop}) and the |
| 511 |
% right value is only known at shipout time (e.g. property `page'). |
| 512 |
% In case of errors (e.g. unknown property) the empty string is |
| 513 |
% returned. |
| 514 |
% |
| 515 |
% Since version 2010/04/22 v2.14 \cs{zref@getcurrent} supports |
| 516 |
% \cs{zref@wrapper@unexpanded}. |
| 517 |
% |
| 518 |
% \begin{declcs}{zref@propexists} |
| 519 |
% \M{propname} \M{then} |
| 520 |
% \end{declcs} |
| 521 |
% Calls \meta{then} if the property \meta{propname} is available |
| 522 |
% or generates an error message otherwise. |
| 523 |
% |
| 524 |
% \begin{declcs}{zref@ifpropundefined}\markexp |
| 525 |
% \M{propname} \M{then} \M{else} |
| 526 |
% \end{declcs} |
| 527 |
% Calls \meta{then} or \meta{else} depending on the existence |
| 528 |
% of property \meta{propname}. |
| 529 |
% |
| 530 |
% \subsection{Reference generation} |
| 531 |
% |
| 532 |
% \begin{declcs}{zref@label} |
| 533 |
% \M{refname} |
| 534 |
% \end{declcs} |
| 535 |
% This works similar to \cs{label}. The reference \meta{refname} is |
| 536 |
% created and put into the \xfile{.aux} file with the |
| 537 |
% properties of the main property list. |
| 538 |
% |
| 539 |
% \begin{declcs}{zref@labelbylist} |
| 540 |
% \M{refname} \M{listname} |
| 541 |
% \end{declcs} |
| 542 |
% Same as \cs{zref@label} except that the properties are |
| 543 |
% taken from the specified property list \meta{listname}. |
| 544 |
% |
| 545 |
% \begin{declcs}{zref@labelbyprops} |
| 546 |
% \M{refname} |{|\meta{propnameA}|,|\meta{propnameB}|,|\dots|}| |
| 547 |
% \end{declcs} |
| 548 |
% Same as \cs{zref@label} except that these properties |
| 549 |
% are used that are given as comma separated list in the |
| 550 |
% second argument. |
| 551 |
% |
| 552 |
% \begin{declcs}{zref@newlabel} |
| 553 |
% \M{refname} |{|\dots|}| |
| 554 |
% \end{declcs} |
| 555 |
% This is the macro that is used in the \xfile{.aux} file. |
| 556 |
% It is basically the same as \cs{newlabel} apart from |
| 557 |
% the format of the data in the second argument. |
| 558 |
% |
| 559 |
% \subsection{Data extraction} |
| 560 |
% |
| 561 |
% \begin{declcs}{zref@extractdefault}\markexptwo |
| 562 |
% \M{refname} \M{propname} \M{default} |
| 563 |
% \end{declcs} |
| 564 |
% This is the basic command that references the value of a |
| 565 |
% property \meta{propname} for the reference \meta{refname}. |
| 566 |
% In case of errors such as undefined reference the \meta{default} |
| 567 |
% is used instead. |
| 568 |
% |
| 569 |
% \begin{declcs}{zref@extract}\markexptwo |
| 570 |
% \M{refname} \M{propname} |
| 571 |
% \end{declcs} |
| 572 |
% The command is an abbreviation for \cs{zref@extractdefault}. |
| 573 |
% As default the default of the property is taken, otherwise |
| 574 |
% the global default. |
| 575 |
% |
| 576 |
% Example for page references: |
| 577 |
% \begin{quote} |
| 578 |
% \begin{tabular}{@{}ll} |
| 579 |
% \hologo{LaTeX}:& |\pageref{foobar}|\\ |
| 580 |
% \xpackage{zref}:& |\zref@extract{foobar}{page}| |
| 581 |
% \end{tabular} |
| 582 |
% \end{quote} |
| 583 |
% Both \cs{zref@extract} and \cs{zref@extractdefault} are |
| 584 |
% expandable. That means, these macros can directly |
| 585 |
% be used in expandable calculations, see the example file. |
| 586 |
% On the other side, babel's shorthands are not supported, |
| 587 |
% there are no warnings in case of undefined references. |
| 588 |
% |
| 589 |
% If an user interface doesn't need expandable macros |
| 590 |
% then it can use \cs{zref@refused} and \cs{zref@wrapper@babel} |
| 591 |
% for its user macros. |
| 592 |
% |
| 593 |
% \begin{declcs}{zref@refused} |
| 594 |
% \M{refname} |
| 595 |
% \end{declcs} |
| 596 |
% This command is not expandable. It causes the warnings if |
| 597 |
% the reference \meta{refname} is not defined. Use the |
| 598 |
% \cs{zref@extract} commands inside expandable contexts and |
| 599 |
% mark their use outside by \cs{zref@refused}, see the example |
| 600 |
% file. |
| 601 |
% |
| 602 |
% \begin{declcs}{zref@def@extract}% |
| 603 |
% \M{cmd} \M{refname} \M{propname}\\ |
| 604 |
% \cs{zref@def@extractdefault} |
| 605 |
% \M{cmd} \M{refname} \M{propname} \M{default} |
| 606 |
% \end{declcs} |
| 607 |
% Both macros extract the property \meta{propname} from the reference |
| 608 |
% \meta{refname} the same way as macros \cs{zref@extract} and |
| 609 |
% \cs{zref@extractdefault}. The result is stored in macro \meta{cmd}. |
| 610 |
% Also \cs{zref@refused} is called to notify \hologo{LaTeX} that |
| 611 |
% the reference \meta{refname} is used. Added in 2011/10/04 v2.22. |
| 612 |
% |
| 613 |
% \begin{declcs}{zref@ifrefundefined}\markexp |
| 614 |
% \M{refname} \M{then} \M{else} |
| 615 |
% \end{declcs} |
| 616 |
% Macro \cs{zref@ifrefundefined} calls arguments \meta{then} or \meta{else} |
| 617 |
% dependent on the existence of the reference \meta{refname}. |
| 618 |
% |
| 619 |
% \begin{declcs}{zifrefundefined} |
| 620 |
% \M{refname} \M{then} \M{else} |
| 621 |
% \end{declcs} |
| 622 |
% Macro \cs{zifrefundefined} calls \cs{ref@refused} before |
| 623 |
% executing \cs{zref@ifrefundefined}. Babel shorthands are |
| 624 |
% supported in \meta{refname}. |
| 625 |
% |
| 626 |
% \begin{declcs}{zref@ifrefcontainsprop}\markexp |
| 627 |
% \M{refname} \M{propname} \M{then} \M{else} |
| 628 |
% \end{declcs} |
| 629 |
% Test whether a reference provides a property. |
| 630 |
% |
| 631 |
% \subsection{Setup} |
| 632 |
% |
| 633 |
% \begin{declcs}{zref@default} |
| 634 |
% \end{declcs} |
| 635 |
% Holds the global default for unknown values. |
| 636 |
% |
| 637 |
% \begin{declcs}{zref@setdefault} |
| 638 |
% |{|\meta{value}|}| |
| 639 |
% \end{declcs} |
| 640 |
% Sets the global default for unknown values. |
| 641 |
% The global default is used, if a property does not specify |
| 642 |
% an own default and the value for a property |
| 643 |
% cannot be extracted. This can happen if the reference is |
| 644 |
% unknown or the reference does not have the property. |
| 645 |
% |
| 646 |
% \begin{declcs}{zref@setmainlist} |
| 647 |
% |{|\meta{value}|}| |
| 648 |
% \end{declcs} |
| 649 |
% Sets the name of the main property list. The package |
| 650 |
% sets and uses |main|. |
| 651 |
% |
| 652 |
% \subsection{Declared properties} |
| 653 |
% |
| 654 |
% \begin{quote} |
| 655 |
% \renewcommand*{\arraystretch}{1.05} |
| 656 |
% \setlength{\tabcolsep}{2\tabcolsep} |
| 657 |
% \def\VV{\vphantom{\large \"Ag}} |
| 658 |
% \def\EMPTY{{\itshape\textless empty\textgreater}} |
| 659 |
% \def\pl#1{&thepage&\cs{number}\cs{#1}} |
| 660 |
% \begin{tabular}{@{}>{\sffamily}l|>{\ttfamily}l|>{\ttfamily}l|>{\ttfamily}l@{}} |
| 661 |
% \rmfamily Module& |
| 662 |
% \rmfamily Property& |
| 663 |
% \rmfamily Property list& |
| 664 |
% \rmfamily Default\\ |
| 665 |
% \hline |
| 666 |
% (base) |
| 667 |
% & default & main & \EMPTY\\ |
| 668 |
% & page & main & \EMPTY\\ |
| 669 |
% \hline |
| 670 |
% abspage |
| 671 |
% & abspage & main & 0\\ |
| 672 |
% \hline |
| 673 |
% counter |
| 674 |
% & counter & main & \EMPTY\\ |
| 675 |
% \hline |
| 676 |
% hyperref |
| 677 |
% & anchor & main & \EMPTY\\ |
| 678 |
% & url & & \EMPTY\\ |
| 679 |
% \hline |
| 680 |
% pageattr |
| 681 |
% & pdfpageattr & thepage & \dots\\ |
| 682 |
% & pdfpagesattr & LastPage & \dots\\ |
| 683 |
% \hline |
| 684 |
% pagelayout\footnotemark |
| 685 |
% \pl{mag}\\ |
| 686 |
% \pl{paperwidth}\\ |
| 687 |
% \pl{paperheight}\\ |
| 688 |
% \pl{stockwidth}\\ |
| 689 |
% \pl{stockheight}\\ |
| 690 |
% \pl{pdfpageheight}\\ |
| 691 |
% \pl{pdfpagewidth}\\ |
| 692 |
% \pl{pdfhorigin}\\ |
| 693 |
% \pl{pdfvorigin}\\ |
| 694 |
% \pl{hoffset}\\ |
| 695 |
% \pl{voffset}\\ |
| 696 |
% \pl{topmargin}\\ |
| 697 |
% \pl{oddsidemargin}\\ |
| 698 |
% \pl{evensidemargin}\\ |
| 699 |
% \pl{textwidth}\\ |
| 700 |
% \pl{textheight}\\ |
| 701 |
% \pl{headheight}\\ |
| 702 |
% \pl{headsep}\\ |
| 703 |
% \pl{footskip}\\ |
| 704 |
% \pl{marginparwidth}\\ |
| 705 |
% \pl{marginparsep}\\ |
| 706 |
% \pl{columnwidth}\\ |
| 707 |
% \pl{columnsep}\\ |
| 708 |
% \hline |
| 709 |
% perpage |
| 710 |
% & pagevalue & perpage & 0\\ |
| 711 |
% & page & perpage & \EMPTY\\ |
| 712 |
% & abspage & perpage & 0\\ |
| 713 |
% \hline |
| 714 |
% savepos |
| 715 |
% & posx & savepos & 0\\ |
| 716 |
% & posy & savepos & 0\\ |
| 717 |
% \hline |
| 718 |
% titleref |
| 719 |
% & title & main & \EMPTY\\ |
| 720 |
% \hline |
| 721 |
% xr |
| 722 |
% & anchor & & \EMPTY\\ |
| 723 |
% & externaldocument & & \EMPTY\\ |
| 724 |
% & theotype & & \EMPTY\\ |
| 725 |
% & title & & \EMPTY\\ |
| 726 |
% & url & & \EMPTY\\ |
| 727 |
% \end{tabular} |
| 728 |
% \footnotetext{Module \xmodule{pagelayout} only defines properties |
| 729 |
% if the parameter exists.}% |
| 730 |
% \end{quote} |
| 731 |
% |
| 732 |
% \subsection{Wrapper for advanced situations} |
| 733 |
% |
| 734 |
% \begin{declcs}{zref@wrapper@babel} |
| 735 |
% |{|\dots|}| \M{name} |
| 736 |
% \end{declcs} |
| 737 |
% This macro helps to add shorthand support. The second |
| 738 |
% argument is protected, then the code of the first argument |
| 739 |
% is called with the protected name appended. Examples |
| 740 |
% are in the sources. |
| 741 |
% |
| 742 |
% \begin{declcs}{zref@wrapper@immediate} |
| 743 |
% |{|\dots|}| |
| 744 |
% \end{declcs} |
| 745 |
% There are situations where a label must be written instantly |
| 746 |
% to the \xfile{.aux} file, for example after the last page. |
| 747 |
% If the \cs{zlabel} or \cs{label} command is put inside this wrapper, |
| 748 |
% immediate writing is enabled. See the implementation for |
| 749 |
% module \xmodule{lastpage} for an example of its use. |
| 750 |
% |
| 751 |
% \begin{declcs}{zref@wrapper@unexpanded} |
| 752 |
% |{|\dots|}| |
| 753 |
% \end{declcs} |
| 754 |
% Assuming someone wants to extract a value for property |bar| |
| 755 |
% and store the result in a macro |\foo| without traces of |
| 756 |
% the expanding macros and without expanding the value. |
| 757 |
% This (theoretical?) problem can be solved by this wrapper: |
| 758 |
% \begin{quote} |
| 759 |
%\begin{verbatim} |
| 760 |
%\zref@wrapper@unexpanded{% |
| 761 |
% \edef\foo{% |
| 762 |
% \zref@extract{someref}{bar}% |
| 763 |
% }% |
| 764 |
%} |
| 765 |
%\end{verbatim} |
| 766 |
% \end{quote} |
| 767 |
% The \cs{edef} forces the expansion of \cs{zref@extract}, |
| 768 |
% but the extraction of the value is prevented by |
| 769 |
% the wrapper that uses \hologo{eTeX}'\ \cs{unexpanded} for this |
| 770 |
% purpose. Supported macros are \cs{zref@extract}, \cs{zref@extractdefault} |
| 771 |
% and since version 2010/04/22 v2.14 macro \cs{zref@getcurrent}. |
| 772 |
% |
| 773 |
% \subsection{Counter for unique names} |
| 774 |
% |
| 775 |
% Some modules (\xmodule{titleref} and \xmodule{dotfillmin}) |
| 776 |
% need unique names for automatically generated label names. |
| 777 |
% |
| 778 |
% \begin{declcs}{zref@require@unique} |
| 779 |
% \end{declcs} |
| 780 |
% This command creates the unique counter |zref@unique| if the |
| 781 |
% counter does not already exist. |
| 782 |
% |
| 783 |
% \begin{declcs}{thezref@unique} |
| 784 |
% \end{declcs} |
| 785 |
% This command is used to generate unique label names. |
| 786 |
% |
| 787 |
% \section{User interface}\label{sec:user} |
| 788 |
% |
| 789 |
% \subsection{Module \xmodule{user}} |
| 790 |
% |
| 791 |
% The user interface for this package and its modules |
| 792 |
% is enabled by \xpackage{zref}'s package option \xmodule{user} |
| 793 |
% or package \xpackage{zref-user}. |
| 794 |
% The names of user commands are prefixed by |z| in order |
| 795 |
% to avoid name clashes with existing macros of the same |
| 796 |
% functionality. Thus the package does not disturb the |
| 797 |
% traditional reference scheme, both can be used together. |
| 798 |
% |
| 799 |
% The syntax descriptions contain the following markers |
| 800 |
% that are intended as hints for programmers: |
| 801 |
% \begin{quote} |
| 802 |
% \begin{tabular}{@{}ll@{}} |
| 803 |
% \markbabel\unskip & Babel shorthands are allowed.\\ |
| 804 |
% \markrobust\unskip & Robust macro.\\ |
| 805 |
% \markexp\unskip & Expandable version:\\ |
| 806 |
% & \textbullet\ robust, |
| 807 |
% unless the extracted values are fragile,\\ |
| 808 |
% & \textbullet\ no babel shorthand support.\\ |
| 809 |
% \markexptwo\unskip & Expandable like \markexp and:\\ |
| 810 |
% & \textbullet\ expandable in exact two steps.\\ |
| 811 |
% \end{tabular} |
| 812 |
% \end{quote} |
| 813 |
% |
| 814 |
% The basic user interface of the package without modules |
| 815 |
% are commands that mimic the standard \hologo{LaTeX} behaviour |
| 816 |
% of \cs{label}, \cs{ref}, and \cs{pageref}: |
| 817 |
% |
| 818 |
% \begin{declcs}{zlabel} |
| 819 |
% \M{refname}\markbabel |
| 820 |
% \end{declcs} |
| 821 |
% Similar to \cs{label}. It generates a label with name |
| 822 |
% \meta{refname} in the new reference scheme. |
| 823 |
% |
| 824 |
% \begin{declcs}{zref} |
| 825 |
% |[|\meta{propname}|]| \M{refname}\markbabel |
| 826 |
% \end{declcs} |
| 827 |
% Without optional argument similar to \cs{ref}, it returns |
| 828 |
% the default reference property. This property is named |
| 829 |
% |default|: |
| 830 |
% \[ |
| 831 |
% |\zref{|x|}| \equiv |\zref[default]{|x|}| |
| 832 |
% \] |
| 833 |
% |
| 834 |
% \begin{declcs}{zpageref} |
| 835 |
% \M{refname}\markbabel |
| 836 |
% \end{declcs} |
| 837 |
% Convenience macro, similar to \cs{pageref}. |
| 838 |
% \[ |
| 839 |
% |\zpageref{|x|}| \equiv |\zref[page]{|x|}| |
| 840 |
% \] |
| 841 |
% |
| 842 |
% \begin{declcs}{zrefused} |
| 843 |
% \M{refname}\markbabel |
| 844 |
% \end{declcs} |
| 845 |
% Some of the user commands in the modules are expandable. |
| 846 |
% The use of such commands do not cause any undefined |
| 847 |
% reference warnings, because inside of expandable |
| 848 |
% contexts this is not possible. However, if there is |
| 849 |
% a place outside of expandable contexts, \cs{refused} |
| 850 |
% is strongly recommended. The reference \meta{refname} |
| 851 |
% is marked as used, undefined ones will generate |
| 852 |
% warnings. |
| 853 |
% |
| 854 |
% \subsection{Module \xmodule{abspage}} |
| 855 |
% A new property |abspage| is defined and added to the |
| 856 |
% main property list. It makes use of the LaTeX count |\ReadonlyShipoutCounter| |
| 857 |
% to keep track of the page numbers. |
| 858 |
% |
| 859 |
% Thus you can reference the absolute page number: |
| 860 |
% \begin{quote} |
| 861 |
% |Section \zref{foo} is on page \zpageref{foo}.|\\ |
| 862 |
% |This is page \zref[abspage]{foo}|\\ |
| 863 |
% |of \zref[abspage]{LastPage}.| |
| 864 |
% \end{quote} |
| 865 |
% The example also makes use of module \xmodule{lastpage}. |
| 866 |
% |
| 867 |
% For compatibility also a counter |abspage| is provided |
| 868 |
% which is increased at shipout too. |
| 869 |
% For technical and historical reasons this counter is zero based: |
| 870 |
% if you use it directly on the first page, e.g |
| 871 |
% with |\arabic{abspage}| you will get 0 as value. (When using |\zref| to retrieve |
| 872 |
% the |abspage| property the first page will be page 1 as expected.). |
| 873 |
% It must be noted that the \texttt{perpage} package also provides a |abspage| |
| 874 |
% counter which is \emph{not} zero based but gives 1 on the first page if \texttt{zref-abspage} is |
| 875 |
% not loaded or loaded after \texttt{perpage}. |
| 876 |
% |
| 877 |
% |
| 878 |
% \subsection{Module \xmodule{lastpage}} |
| 879 |
% |
| 880 |
% Provides the functionality of package \xpackage{lastpage} |
| 881 |
% \cite{lastpage} in the new reference scheme. |
| 882 |
% The label |LastPage| is put at the end of the document. |
| 883 |
% You can refer the last page number with: |
| 884 |
% \begin{quote} |
| 885 |
% |\zref@extract{LastPage}{page}| (+ |\zref@refused{LastPage}|)\\ |
| 886 |
% \end{quote} |
| 887 |
% or |
| 888 |
% \begin{quote} |
| 889 |
% |\zpageref{LastPage}| (module \xmodule{user}) |
| 890 |
% \end{quote} |
| 891 |
% |
| 892 |
% Since version 2008/10/01 v2.3 the module defines the list |LastPage|. |
| 893 |
% In addition to the properties of the main list label |LastPage| also |
| 894 |
% stores the properties of this list |LastPage|. The default of this |
| 895 |
% list is empty. The list can be used by the user to add additional |
| 896 |
% properties for label |LastPage|. |
| 897 |
% |
| 898 |
% \subsubsection{Tests for last page} |
| 899 |
% |
| 900 |
% Since version 2010/03/26 v2.8 the macros \cs{zref@iflastpage} |
| 901 |
% and \cs{ziflastpage} were added. They test the reference, |
| 902 |
% whether it is a reference of the last page. |
| 903 |
% |
| 904 |
% \begin{declcs}{zref@iflastpage}\markexp \M{refname} \M{then} \M{else} |
| 905 |
% \end{declcs} |
| 906 |
% Macro \cs{zref@iflastpage} compares the references \meta{refname} |
| 907 |
% with \meta{LastPage}. Basis of the comparison is the value of |
| 908 |
% property |abspage|, because the values are different for different |
| 909 |
% pages. This is not ensured by property |page|. Therefore module |
| 910 |
% \xmodule{abspage} is loaded by module \xmodule{lastpage}. |
| 911 |
% If both values of property |abspage| are present and match, |
| 912 |
% then \meta{then} is executed, otherwise code \meta{else} is called. |
| 913 |
% If one or both references are undefined or lack the property |abspage|, |
| 914 |
% then \meta{else} is executed. |
| 915 |
% |
| 916 |
% Macro \cs{zref@iflastpage} is expandable, therefore \cs{zref@refused} |
| 917 |
% should be called on \meta{refname} and \meta{LastPage}. |
| 918 |
% |
| 919 |
% \begin{declcs}{ziflastpage} \M{refname} \M{then} \M{else} |
| 920 |
% \end{declcs} |
| 921 |
% Macro \cs{ziflastpage} has the same function as \cs{zref@iflastpage}, |
| 922 |
% but adds support for babel shorthands in \meta{refname} and |
| 923 |
% calls \cs{zref@refused}. However macro \cs{ziflastpage} is not |
| 924 |
% expandable. |
| 925 |
% |
| 926 |
% \subsubsection{Example} |
| 927 |
% |
| 928 |
% \begin{macrocode} |
| 929 |
%<*example-lastpage> |
| 930 |
%<<END_EXAMPLE |
| 931 |
\NeedsTeXFormat{LaTeX2e} |
| 932 |
\documentclass{report} |
| 933 |
|
| 934 |
\newcounter{foo} |
| 935 |
\renewcommand*{\thefoo}{\Alph{foo}} |
| 936 |
|
| 937 |
\usepackage{zref-lastpage,zref-user}[2019/11/29] |
| 938 |
|
| 939 |
\makeatletter |
| 940 |
\zref@newprop{thefoo}{\thefoo} |
| 941 |
\zref@newprop{valuefoo}{\the\value{foo}} |
| 942 |
\zref@newprop{chapter}{\thechapter} |
| 943 |
\zref@addprops{LastPage}{thefoo,valuefoo,chapter} |
| 944 |
\makeatother |
| 945 |
|
| 946 |
\newcommand*{\foo}{% |
| 947 |
\stepcounter{foo}% |
| 948 |
[Current foo: \thefoo]% |
| 949 |
} |
| 950 |
|
| 951 |
\begin{document} |
| 952 |
\chapter{First chapter} |
| 953 |
Last page is \zref{LastPage}.\\ |
| 954 |
Last chapter is \zref[chapter]{LastPage}.\\ |
| 955 |
Last foo is \zref[thefoo]{LastPage}.\\ |
| 956 |
Last value of foo is \zref[valuefoo]{LastPage}.\\ |
| 957 |
\foo |
| 958 |
\chapter{Second chapter} |
| 959 |
\foo\foo\foo |
| 960 |
\chapter{Last chapter} |
| 961 |
\foo |
| 962 |
\end{document} |
| 963 |
%END_EXAMPLE |
| 964 |
%</example-lastpage> |
| 965 |
% \end{macrocode} |
| 966 |
% |
| 967 |
% \subsection{Module \xmodule{thepage}} |
| 968 |
% |
| 969 |
% This module \xmodule{thepage} loads module \xmodule{abspage}, |
| 970 |
% constructs a reference name using the absolute page number |
| 971 |
% and remembers property |page|. Other properties can be added |
| 972 |
% by adding them to the property list |thepage|. |
| 973 |
% |
| 974 |
% \begin{declcs}{zthepage} \M{absolute page number}\\ |
| 975 |
% \end{declcs} |
| 976 |
% Macro \cs{zthepage} is basically a \cs{zpageref}. The reference |
| 977 |
% name is yield by the \meta{absolute page number}. If the reference |
| 978 |
% is not defined, then the default for property |page| is used. |
| 979 |
% |
| 980 |
% \begin{declcs}{zref@thepage@name}\markexp \M{absolute page number} |
| 981 |
% \end{declcs} |
| 982 |
% Macro \cs{zref@thepage@name} returns the internal reference |
| 983 |
% name that is constructed using the \meta{absolute page number}. |
| 984 |
% The internal reference name should not be used directly, because |
| 985 |
% it might change in future versions. |
| 986 |
% |
| 987 |
% \begin{declcs}{zref@thepage}\markexp \M{absolute page number}\\ |
| 988 |
% \cs{zref@thepage@refused} \M{absolute page number} |
| 989 |
% \end{declcs} |
| 990 |
% Macro \cs{zref@thepage} returns the page number (\cs{thepage}) |
| 991 |
% of \meta{absolute page number}. Because this macro is expandable, |
| 992 |
% \cs{zref@thepage@refused} is used outside an expandable context |
| 993 |
% to mark the reference as used. |
| 994 |
% |
| 995 |
% |
| 996 |
% \subsection{Module \xmodule{nextpage}} |
| 997 |
% |
| 998 |
% \begin{declcs}{znextpage} |
| 999 |
% \end{declcs} |
| 1000 |
% Macro \cs{znextpage} prints \cs{thepage} of the following page. |
| 1001 |
% It gets the current absolute page number by using a label. |
| 1002 |
% There are three cases for the next page: |
| 1003 |
% \begin{enumerate} |
| 1004 |
% \item The next page is not known yet because of undefined references. |
| 1005 |
% Then \cs{zunknownnextpagename} is used instead. The default for |
| 1006 |
% this macro is the default of property |page|. |
| 1007 |
% \item This page is the last page. Then \cs{znonextpagename} |
| 1008 |
% is used. Its default is empty. |
| 1009 |
% \item The next page is known, then \cs{thepage} of the next |
| 1010 |
% page is used (the value of property |page| of the next page). |
| 1011 |
% \end{enumerate} |
| 1012 |
% |
| 1013 |
% \subsubsection{Configuration} |
| 1014 |
% |
| 1015 |
% The behaviour can be configured by the following macros. |
| 1016 |
% |
| 1017 |
% \begin{declcs}{zunknownnextpagename}\\ |
| 1018 |
% \cs{znonextpagename} |
| 1019 |
% \end{declcs} |
| 1020 |
% If the next page is not known or available, then |
| 1021 |
% \cs{znextpage} uses these name macros as default. |
| 1022 |
% \cs{zunknownnextpagename} is used in case of undefined |
| 1023 |
% references. Default is the value of property |page| of the |
| 1024 |
% next page (\cs{thepage}). Module \xmodule{thepage} is used. |
| 1025 |
% |
| 1026 |
% Macro \cs{znonextpagename} is used, if the next page does |
| 1027 |
% not exists. That means that the current page is last page. |
| 1028 |
% The default is empty. |
| 1029 |
% |
| 1030 |
% \begin{declcs}{znextpagesetup} \M{unknown} \M{no next} |
| 1031 |
% \M{next} |
| 1032 |
% \end{declcs} |
| 1033 |
% According to the case (see \cs{znextpage}) macro \cs{znextpage} |
| 1034 |
% calls an internal macro with an argument. The argument is |
| 1035 |
% either \cs{thepage} of the next page or one of \cs{zunknownnextpagename} |
| 1036 |
% or \cs{znonextpagename}. These internal macro can be changed by |
| 1037 |
% \cs{znextpagesetup}. It expects the definition texts for these |
| 1038 |
% three cases of a macro with one argument. |
| 1039 |
% The default is |
| 1040 |
% \begin{quote} |
| 1041 |
% |\znextpagesetup{#1}{#1}{#1}| |
| 1042 |
% \end{quote} |
| 1043 |
% |
| 1044 |
% \subsubsection{Example} |
| 1045 |
% |
| 1046 |
% \begin{macrocode} |
| 1047 |
%<*example-nextpage> |
| 1048 |
%<<END_EXAMPLE |
| 1049 |
\documentclass{book} |
| 1050 |
|
| 1051 |
\usepackage{zref-nextpage}[2019/11/29] |
| 1052 |
\znextpagesetup |
| 1053 |
{\thepage}% next page is unknown |
| 1054 |
{\thepage\ (#1)}% this page is last page |
| 1055 |
{\thepage\ $\rightarrow$ #1}% next page is known |
| 1056 |
\renewcommand*{\znonextpagename}{last page} |
| 1057 |
|
| 1058 |
\usepackage{fancyhdr} |
| 1059 |
\pagestyle{fancy} |
| 1060 |
\fancyhf{} |
| 1061 |
\fancyhead[LE,RO]{\znextpage} |
| 1062 |
\fancypagestyle{plain}{% |
| 1063 |
\fancyhf{}% |
| 1064 |
\fancyhead[LE,RO]{\znextpage}% |
| 1065 |
} |
| 1066 |
|
| 1067 |
\begin{document} |
| 1068 |
\frontmatter |
| 1069 |
\tableofcontents |
| 1070 |
\mainmatter |
| 1071 |
\chapter{Hello World} |
| 1072 |
\clearpage |
| 1073 |
\section{Last section} |
| 1074 |
\end{document} |
| 1075 |
%END_EXAMPLE |
| 1076 |
%</example-nextpage> |
| 1077 |
% \end{macrocode} |
| 1078 |
% |
| 1079 |
% |
| 1080 |
% \subsection{Module \xmodule{totpages}} |
| 1081 |
% |
| 1082 |
% For the total number of pages of a document you need to |
| 1083 |
% know the absolute page number of the last page. |
| 1084 |
% Both modules \xmodule{abspage} and \xmodule{lastpage} |
| 1085 |
% are necessary and automatically enabled. |
| 1086 |
% |
| 1087 |
% \begin{declcs}{ztotpages}\markexp |
| 1088 |
% \end{declcs} |
| 1089 |
% Prints the total number of pages or |0| if this |
| 1090 |
% number is not yet known. It expands to an explicit number |
| 1091 |
% and can also used even in expandable calculations (\cs{numexpr}) |
| 1092 |
% or counter assignments. |
| 1093 |
% |
| 1094 |
% \subsection{Module \xmodule{pagelayout}} |
| 1095 |
% |
| 1096 |
% The module defines additional properties for each parameter |
| 1097 |
% of the page layout that is effective during page shipout. |
| 1098 |
% The value of length parameters is given in sp without the |
| 1099 |
% unit as plain number. |
| 1100 |
% |
| 1101 |
% Some parameters are specific for a class (e.g.\@ \xoption{stockwidth} |
| 1102 |
% and \xoption{stockheight} for class \xclass{memoir}) or the |
| 1103 |
% \hologo{TeX} engine like \hologo{pdfTeX}. If the parameter is not |
| 1104 |
% available, then the property will not be defined. The default value |
| 1105 |
% of the property is the current setting of the parameter. |
| 1106 |
% |
| 1107 |
% The module \xmodule{thepage} is loaded that generates a label |
| 1108 |
% for each page. The properties of module \xmodule{pagelayout} |
| 1109 |
% are added to the property list |thepage| of module \xmodule{thepage}. |
| 1110 |
% |
| 1111 |
% List of properties: |
| 1112 |
% \begin{quote} |
| 1113 |
% \def\x#1{\cs{#1}}% |
| 1114 |
% \begin{tabular}{l>{\sffamily}ll} |
| 1115 |
% \textrm{parameter} & \textrm{property} & remarks\\ |
| 1116 |
% \hline |
| 1117 |
% \x{mag}\\ |
| 1118 |
% \x{paperwidth}\\ |
| 1119 |
% \x{paperheight}\\ |
| 1120 |
% \x{stockwidth}& class \xclass{memoir}\\ |
| 1121 |
% \x{stockheight}& class \xclass{memoir}\\ |
| 1122 |
% \x{pdfpagewidth}& \hologo{pdfTeX}, \hologo{LuaTeX}\\ |
| 1123 |
% \x{pdfpageheight}& \hologo{pdfTeX}, \hologo{LuaTeX}\\ |
| 1124 |
% \x{pdfhorigin}& \hologo{pdfTeX}, \hologo{LuaTeX}\\ |
| 1125 |
% \x{pdfvorigin}& \hologo{pdfTeX}, \hologo{LuaTeX}\\ |
| 1126 |
% \x{hoffset}\\ |
| 1127 |
% \x{voffset}\\ |
| 1128 |
% \x{topmargin}\\ |
| 1129 |
% \x{oddsidemargin}\\ |
| 1130 |
% \x{evensidemargin}\\ |
| 1131 |
% \x{textwidth}\\ |
| 1132 |
% \x{textheight}\\ |
| 1133 |
% \x{headheight}\\ |
| 1134 |
% \x{headsep}\\ |
| 1135 |
% \x{footskip}\\ |
| 1136 |
% \x{marginparwidth}\\ |
| 1137 |
% \x{marginparsep}\\ |
| 1138 |
% \x{columnwidth}\\ |
| 1139 |
% \x{columnsep}\\ |
| 1140 |
% \end{tabular} |
| 1141 |
% \end{quote} |
| 1142 |
% |
| 1143 |
% \begin{declcs}{zlistpagelayout} |
| 1144 |
% \end{declcs} |
| 1145 |
% At the end of document the page layout parameter for each page are |
| 1146 |
% printed into the \xext{log} file if macro \cs{zlistpagelayout} |
| 1147 |
% is called before |\end{document}| (preamble is a good place). |
| 1148 |
% |
| 1149 |
% \subsection{Module \xmodule{marks}} |
| 1150 |
% |
| 1151 |
% ToDo. |
| 1152 |
% |
| 1153 |
% \subsection{Module \xmodule{runs}} |
| 1154 |
% |
| 1155 |
% Module \xmodule{runs} counts the \hologo{LaTeX} runs since last |
| 1156 |
% \xext{aux} file creation and prints the number in the |
| 1157 |
% \xext{log} file. |
| 1158 |
% |
| 1159 |
% \begin{declcs}{zruns}\markexp |
| 1160 |
% \end{declcs} |
| 1161 |
% Prints the the total number of \hologo{LaTeX} runs including |
| 1162 |
% the current one. It expands to an explicit number. |
| 1163 |
% Before |begin{document}| the value is zero meaning |
| 1164 |
% the \xext{aux} file is not read yet. If a previous |
| 1165 |
% \xext{aux} file exists, the value found there increased |
| 1166 |
% by one is the new number. Otherwise \cs{zruns} is set to one. |
| 1167 |
% \hologo{LaTeX}~runs where the \xext{aux} files are not rewritten |
| 1168 |
% are not counted (see \cs{nofiles}). |
| 1169 |
% |
| 1170 |
% \subsection{Module \xmodule{perpage}} |
| 1171 |
% |
| 1172 |
% With \cs{@addtoreset} or \cs{numberwithin} a counter can be |
| 1173 |
% reset if another counter is incremented. This do not work |
| 1174 |
% well if the other counter is the page counter. The page counter is |
| 1175 |
% incremented in the output routine that is often called asynchronous |
| 1176 |
% somewhere on the next page. A reference mechanism costs at least |
| 1177 |
% two \hologo{LaTeX} runs, but ensures correct page counter values. |
| 1178 |
% |
| 1179 |
% \begin{declcs}{zmakeperpage} |
| 1180 |
% |[|\meta{reset}|]| \M{counter} |
| 1181 |
% \end{declcs} |
| 1182 |
% At the of a new page counter \meta{counter} starts |
| 1183 |
% counting with value \meta{reset} (default is \texttt{1}). |
| 1184 |
% The macro has the same |
| 1185 |
% syntax and semantics as \cs{MakePerPage} of package |
| 1186 |
% \xpackage{perpage} \cite{perpage}. |
| 1187 |
% Also \xoption{perpage} of package \xpackage{footmisc} \cite{footmisc} |
| 1188 |
% can easily be simulated by |
| 1189 |
% \begin{quote} |
| 1190 |
% |\zmakeperpage{footnote}| \itshape |% \usepackage[perpage]{footmisc}| |
| 1191 |
%\end{quote} |
| 1192 |
% If footnote symbols are used, some people dislike the |
| 1193 |
% first symbol \ensuremath{\dagger}. It can easily be skipped: |
| 1194 |
% \begin{quote} |
| 1195 |
% |\zmakeperpage[2]{footnote}| |
| 1196 |
% \end{quote} |
| 1197 |
% |
| 1198 |
% \begin{declcs}{thezpage}\\ |
| 1199 |
% counter |zpage| |
| 1200 |
% \end{declcs} |
| 1201 |
% If the formatted counter value of the counter that is reset at |
| 1202 |
% a new page contains the page value, then you can use \cs{thezpage}, |
| 1203 |
% the page number of the current page. Or counter |zpage| can be |
| 1204 |
% used, if the page number should be formatted differently from |
| 1205 |
% the current page number. Example: |
| 1206 |
%\begin{quote} |
| 1207 |
%\begin{verbatim} |
| 1208 |
%\newcounter{foobar} |
| 1209 |
%\zmakeperpage{foobar} |
| 1210 |
%\renewcommand*{\thefoobar}{\thezpage-\arabic{foobar}} |
| 1211 |
% % or |
| 1212 |
%\renewcommand*{\thefoobar}{\roman{zpage}-\arabic{foobar}} |
| 1213 |
%\end{verbatim} |
| 1214 |
%\end{quote} |
| 1215 |
% |
| 1216 |
% \begin{declcs}{zunmakeperpage} |
| 1217 |
% \M{counter} |
| 1218 |
% \end{declcs} |
| 1219 |
% The reset mechanism for this counter is deactivated. |
| 1220 |
% |
| 1221 |
% |
| 1222 |
% \subsection{Module \xmodule{counter}} |
| 1223 |
% |
| 1224 |
% This option just add the property |counter| to the main |
| 1225 |
% property list. The property stores the counter name, |
| 1226 |
% that was responsible for the reference. This is the |
| 1227 |
% property \xpackage{hyperref}'s \cs{autoref} feature |
| 1228 |
% uses. Thus this property |counter| may be useful |
| 1229 |
% for a reimplementation of the autoref feature, |
| 1230 |
% see the section \ref{sec:todo} with the todo list. |
| 1231 |
% |
| 1232 |
% \subsection{Module \xmodule{titleref}} |
| 1233 |
% |
| 1234 |
% This option makes section and caption titles available |
| 1235 |
% to the reference system similar to packages \xpackage{titleref} |
| 1236 |
% or \xpackage{nameref}. |
| 1237 |
% |
| 1238 |
% \begin{declcs}{ztitleref} |
| 1239 |
% \M{refname}\markbabel |
| 1240 |
% \end{declcs} |
| 1241 |
% Print the section or caption title of reference \meta{refname}, |
| 1242 |
% similar to \cs{nameref} or \cs{titleref}. |
| 1243 |
% |
| 1244 |
% \begin{declcs}{ztitlerefsetup} |
| 1245 |
% |{|\textit{key$_1$=value$_1$, key$_2$=value$_2$, \dots}|}| |
| 1246 |
% \end{declcs} |
| 1247 |
% This command allows to configure the behaviour of module |
| 1248 |
% \xmodule{titleref}. The following keys are available: |
| 1249 |
% \begin{description} |
| 1250 |
% \let\bfseries\relax |
| 1251 |
% \item[\texttt{title=}\meta{value}]\mbox{}\\* |
| 1252 |
% Sets the current title. |
| 1253 |
% \item[\texttt{stripperiod=true\string|false}]\mbox{}\\* |
| 1254 |
% Follow package \xpackage{nameref} that |
| 1255 |
% removes a last period. Default: |true|. |
| 1256 |
% \item[\texttt{expand=true\string|false}]\mbox{}\\* |
| 1257 |
% Package \cs{titleref} expands the title first. This way |
| 1258 |
% garbage and dangerous commands can be removed, e.g. |
| 1259 |
% \cs{label}, \cs{index}\dots. See implementation section |
| 1260 |
% for more details. Default is |false|. |
| 1261 |
% \item[\texttt{cleanup=\{}\textrm{\dots}\texttt{\}}]\mbox{}\\* |
| 1262 |
% Hook to add own cleanup code, if method |expand| is used. |
| 1263 |
% See implementation section for more details. |
| 1264 |
% \end{description} |
| 1265 |
% |
| 1266 |
% \subsection{Module \xmodule{savepos}} |
| 1267 |
% |
| 1268 |
% This option supports a feature that all engines nowadays provide: |
| 1269 |
% (and \hologo{XeTeX}). |
| 1270 |
% They are able to tell the current position on the |
| 1271 |
% page. The page position is not instantly known. First the |
| 1272 |
% page must be constructed by \hologo{TeX}'s asynchronous output |
| 1273 |
% routine. Thus the time where the position is known is |
| 1274 |
% the page shipout time. Thus a reference system where the |
| 1275 |
% information is recorded in the first run and made available |
| 1276 |
% for use in the second run comes in handy. |
| 1277 |
% |
| 1278 |
% \begin{declcs}{zsavepos} |
| 1279 |
% \M{refname} |
| 1280 |
% \end{declcs} |
| 1281 |
% It generates a reference with name \meta{refname}. |
| 1282 |
% The reference stores the location where \cs{zsavepos} |
| 1283 |
% is executed in properties |posx| and |posy|. |
| 1284 |
% |
| 1285 |
% \begin{declcs}{zsaveposx} |
| 1286 |
% \M{refname}\\ |
| 1287 |
% \cs{zsaveposy} |
| 1288 |
% \M{refname} |
| 1289 |
% \end{declcs} |
| 1290 |
% Same as \cs{zsavepos} except that only the |x| or |y| component |
| 1291 |
% of the position is stored. Since 2011/12/05 v2.23. |
| 1292 |
% |
| 1293 |
% \begin{declcs}{zposx}\markexp |
| 1294 |
% \M{refname}\\ |
| 1295 |
% \SpecialUsageIndex{\zposy}\cs{zposy}\markexp \M{refname} |
| 1296 |
% \end{declcs} |
| 1297 |
% Get the position as number. Unit is sp. Horizontal |
| 1298 |
% positions by \cs{zposx} increase from left to right. |
| 1299 |
% Vertical positions by \cs{zposy} from bottom to top. |
| 1300 |
% |
| 1301 |
% Do not rely on absolute page numbers. Because of problems |
| 1302 |
% with the origin the numbers may differ in DVI or PDF mode |
| 1303 |
% of \pdfTeX. Therefore work with relative values by comparisons. |
| 1304 |
% |
| 1305 |
% Both \cs{zposx} and \cs{zposy} are expandable and can be |
| 1306 |
% used inside calculations (\cs{setcounter}, \cs{addtocounter}, |
| 1307 |
% package \xpackage{calc}, \cs{numexpr}). However this property |
| 1308 |
% prevents from notifying \hologo{LaTeX} that the reference is actually |
| 1309 |
% used (the notifying is not expandable). Therefore you should |
| 1310 |
% mark the reference as used by \cs{zrefused}. |
| 1311 |
% |
| 1312 |
% This module uses \pdfTeX's \cs{pdfsavepos}, \cs{pdflastxpos}, |
| 1313 |
% and \cs{pdflastypos} and similar commands in the other engines. |
| 1314 |
% They are available in PDF mode and |
| 1315 |
% since \pdfTeX\ version 1.40.0 also in DVI mode. |
| 1316 |
% |
| 1317 |
% \begin{declcs}{zref@savepos} |
| 1318 |
% \end{declcs} |
| 1319 |
% Macro \cs{zref@savepos} performs the first part of \cs{zsavepos} |
| 1320 |
% by calling \cs{tex\_savepos:D} (if \xext{aux} files are writable). |
| 1321 |
% |
| 1322 |
% Thus \cs{zsavepos} is basically \cs{zref@savepos} followed |
| 1323 |
% by |\zref@labelbylist{|\texttt{\meta{refname}}|}{savepos}|. |
| 1324 |
% \cs{savepos} also adds \cs{zref@savepos} at the end to support \cs{beginR} |
| 1325 |
% where the whatits are processed in reverse order. |
| 1326 |
% The property list |savepos| contains the properties |posx| |
| 1327 |
% and |posy|. |
| 1328 |
% |
| 1329 |
% \subsection{Module \xmodule{abspos}} |
| 1330 |
% Module \xmodule{abspos} allows to get various values of the page layout. There is no user |
| 1331 |
% command, only a number of internal commands. For example: |
| 1332 |
% \begin{quote} |
| 1333 |
% |\zref@absposx{|\meta{label}|}{|\meta{value}|}{|\meta{position}|}|\\ |
| 1334 |
% |\zref@absposy{|\meta{label}|}{|\meta{value}|}{|\meta{position}|}| |
| 1335 |
% \end{quote} |
| 1336 |
% |
| 1337 |
% The return value is like in the module \xmodule{savepos} a number representing a length in sp. |
| 1338 |
% The length are measured from the bottom left of the page. |
| 1339 |
% |
| 1340 |
% \meta{label} is a label set with \cs{zlabel} or \cs{zsavepos} that allows to retrieve the |
| 1341 |
% absolute page number. |
| 1342 |
% |
| 1343 |
% \meta{position} is for the x-command one of |left|, |right| or |center|. For the y-command |
| 1344 |
% it is one of |top|, |bottom|, |center|. |
| 1345 |
% |
| 1346 |
% The possible content of \meta{value} can be seen in the following table. Be aware that the code |
| 1347 |
% makes some assumptions which are perhaps not always true -- for example that the left of |
| 1348 |
% the head is identical to the left of the body. |
| 1349 |
% |
| 1350 |
% \medskip |
| 1351 |
% \begin{tabular}{lll} |
| 1352 |
% \textbf{value} & \textbf{axis} & \textbf{comments}\\\hline |
| 1353 |
% media & x & left=0, right=\cs{pdfpagewidth} \\ |
| 1354 |
% paper & x & left=0, right=\cs{paperwidth}\\ |
| 1355 |
% stock & x & derived from paper\\ |
| 1356 |
% media & y & bottom=0, top=\cs{pdfpageheigh}\\ |
| 1357 |
% paper & y & top=\cs{pdfpageheight}, bottom=top-\cs{paperheight}\\ |
| 1358 |
% stock & y & top derived from paper\\ |
| 1359 |
% head & x & calculated with hoffset, horigin, etc\\ |
| 1360 |
% head & y & calculated\\ |
| 1361 |
% body & x & = head value\\% |
| 1362 |
% body & y & = head bottom - \cs{headsep}\\ |
| 1363 |
% foot & x & = head\\ |
| 1364 |
% foot & y & calculated from body bottom and \cs{footskip}\\ |
| 1365 |
% marginpar & x &different on odd/even pages! \\ |
| 1366 |
% marginpar & y & = body % |
| 1367 |
% \end{tabular} |
| 1368 |
% |
| 1369 |
% \subsection{Module \xmodule{dotfill}} |
| 1370 |
% |
| 1371 |
% \begin{declcs}{zdotfill} |
| 1372 |
% \end{declcs} |
| 1373 |
% This package provides the command \cs{zdotfill} that works |
| 1374 |
% similar to \cs{dotfill}, but can be configured. Especially |
| 1375 |
% it suppresses the dots if a minimum number of dots cannot be set. |
| 1376 |
% |
| 1377 |
% \begin{declcs}{zdotfillsetup} |
| 1378 |
% |{|\textit{key$_1$=value$_1$, key$_2$=value$_2$, \dots}|}| |
| 1379 |
% \end{declcs} |
| 1380 |
% This command allows to configure the behaviour of \cs{zdotfill}. |
| 1381 |
% The following keys are available: |
| 1382 |
% \begin{description} |
| 1383 |
% \let\bfseries\relax |
| 1384 |
% \item[\texttt{min=}\meta{count value}]\mbox{}\\* |
| 1385 |
% If the actual number of dots are smaller than \meta{count value}, |
| 1386 |
% then the dots are suppressed. Default: |2|. |
| 1387 |
% \item[\texttt{unit=}\meta{dimen value}]\mbox{}\\* |
| 1388 |
% The width of a dot unit is given by \meta{dimen value}. |
| 1389 |
% Default: |0.44em| (same as the unit in \cs{dotfill}). |
| 1390 |
% \item[\texttt{dot=}\meta{value}]\mbox{}\\* |
| 1391 |
% The dot itself is given by \meta{value}. Default: |.| (dot, same as |
| 1392 |
% the dot in \cs{dotfill}). |
| 1393 |
% \end{description} |
| 1394 |
% |
| 1395 |
% \subsection{Module \xmodule{env}} |
| 1396 |
% |
| 1397 |
% This module defines two properties |envname| and |envline|. They |
| 1398 |
% remember the name of the environment and the line number at |
| 1399 |
% the start of the environment. |
| 1400 |
% |
| 1401 |
% \subsection{Module \xmodule{xr}} |
| 1402 |
% |
| 1403 |
% This package provides the functionality of package \xpackage{xr}, |
| 1404 |
% see \cite{xr}. It also supports the syntax of \xpackage{xr-hyper}. |
| 1405 |
% |
| 1406 |
% \begin{declcs}{zexternaldocument} |
| 1407 |
% \* |[|\meta{prefix}|]|\markbabel \M{external document} |
| 1408 |
% |[|\meta{url}|]| |
| 1409 |
% \end{declcs} |
| 1410 |
% See \cs{externaldocument} for a description of this option. |
| 1411 |
% The found labels also get a property |externaldocument| that |
| 1412 |
% remembers \meta{external document}. |
| 1413 |
% The standard reference scheme and the scheme of this |
| 1414 |
% package use different name spaces for reference names. |
| 1415 |
% If the external document uses both systems. Then one |
| 1416 |
% import statement would put the names in one namespace |
| 1417 |
% and probably causing problems with multiple references |
| 1418 |
% of the same name. Thus the star form only looks for |
| 1419 |
% \cs{newlabel} in the \xfile{.aux} files, whereas without |
| 1420 |
% star only \cs{zref@newlabel}s are used. |
| 1421 |
% |
| 1422 |
% In the star form it tries to detect labels from |
| 1423 |
% \xpackage{hyperref}, \xpackage{titleref}, and \xpackage{ntheorem}. |
| 1424 |
% If such an extended property from the packages before cannot |
| 1425 |
% be found or are empty, they are not included in the |
| 1426 |
% imported reference. |
| 1427 |
% |
| 1428 |
% Warnings are given if a reference name is already in use |
| 1429 |
% and the item is ignored. Unknown properties will automatically |
| 1430 |
% be declared. |
| 1431 |
% |
| 1432 |
% If the external references contain |anchor| properties, |
| 1433 |
% then we need also a url to be able to address the external |
| 1434 |
% file. As default the filename is taken with a default |
| 1435 |
% extension. |
| 1436 |
% |
| 1437 |
% \begin{declcs}{zxrsetup} |
| 1438 |
% |{|\textit{key$_1$=value$_1$, key$_2$=value$_2$, \dots}|}| |
| 1439 |
% \end{declcs} |
| 1440 |
% The following setup options are available: |
| 1441 |
% \begin{description} |
| 1442 |
% \item[\xoption{ext}:] It sets the default extension. |
| 1443 |
% \item[\xoption{tozreflabel}:] Boolean option. The found references |
| 1444 |
% are imported as zref labels. This is enabled by default. |
| 1445 |
% \item[\xoption{toltxlabel}:] Boolean option. The found references |
| 1446 |
% are imported as \hologo{LaTeX} labels. Packages \xpackage{nameref}, |
| 1447 |
% \xpackage{titleref} and class \xclass{memoir} are supported. |
| 1448 |
% \item[\xoption{urluse}:] Boolean option. If enabled, then a URL |
| 1449 |
% is stored in a macro and the macro is put in property `urluse'. |
| 1450 |
% The URL is not put in property `url'. |
| 1451 |
% The purpose is to save \hologo{TeX} memory. |
| 1452 |
% \item[\xoption{verbose}:] Boolean option. List the imported labels in the |
| 1453 |
% \xext{log} file. Default is |false|. |
| 1454 |
% \end{description} |
| 1455 |
% |
| 1456 |
% \begin{declcs}{zref@xr@ext} |
| 1457 |
% \end{declcs} |
| 1458 |
% If the \meta{url} is not specified in \cs{zref@externaldocument}, |
| 1459 |
% then the url will be constructed with the file name and |
| 1460 |
% this macro as extension. \cs{XR@ext} is used if |
| 1461 |
% \xpackage{hyperref} is loaded, otherwise |pdf|. |
| 1462 |
% |
| 1463 |
% \subsection{Module \xmodule{pageattr}} |
| 1464 |
% |
| 1465 |
% This module allows to recover the content of the register |
| 1466 |
% \cs{pdfpageattr} and \cs{pdfpagesattr} in pdftex and the equivalent register |
| 1467 |
% in luatex. There is no user command. Programmer commands are |
| 1468 |
% |
| 1469 |
% \begin{quote} |
| 1470 |
% |\zref@pdfpageattr{|\meta{absolute page number}|}| |
| 1471 |
% |
| 1472 |
% |\zref@pdfpagesattr{|\meta{absolute page number}|}| |
| 1473 |
% \end{quote} |
| 1474 |
% \section{ToDo}\label{sec:todo} |
| 1475 |
% |
| 1476 |
% Among other things the following issues are left for future work: |
| 1477 |
% \begin{itemize} |
| 1478 |
% \item Other applications: autoref, hyperref, \dots |
| 1479 |
% \end{itemize} |
| 1480 |
% |
| 1481 |
% \section{Example} |
| 1482 |
% |
| 1483 |
% \begin{macrocode} |
| 1484 |
%<*example> |
| 1485 |
% \end{macrocode} |
| 1486 |
% |
| 1487 |
% \begin{macrocode} |
| 1488 |
\documentclass{book} |
| 1489 |
|
| 1490 |
\usepackage[ngerman]{babel}% |
| 1491 |
|
| 1492 |
\usepackage[savepos,totpages,titleref,dotfill,counter,user]{zref} |
| 1493 |
|
| 1494 |
% \end{macrocode} |
| 1495 |
% |
| 1496 |
% Chapters are wrapped inside \cs{ChapterStart} and |
| 1497 |
% \cs{ChapterStop}. The first argument \verb|#1| of \cs{ChapterStart} |
| 1498 |
% is used to form a label id \verb|chap:#1|. At the end of |
| 1499 |
% the chapter another label is set by \cs{zref@wrapper@immediate} in older |
| 1500 |
% LaTeX formats, because otherwise at the end of document a |
| 1501 |
% deferred write would not |
| 1502 |
% be written, because there is no page for shipout. |
| 1503 |
% |
| 1504 |
% Also this example shows how chapter titles can be recorded. |
| 1505 |
% A new property \verb|chaptitle| is declared and added to the |
| 1506 |
% main property list. In \cs{ChapterStart} the current value |
| 1507 |
% of the property is updated. |
| 1508 |
% \begin{macrocode} |
| 1509 |
\makeatletter |
| 1510 |
\zref@newprop{chaptitle}{} |
| 1511 |
\zref@addprop{main}{chaptitle} |
| 1512 |
|
| 1513 |
\newcommand*{\ChapterStart}[2]{% |
| 1514 |
\cleardoublepage |
| 1515 |
\def\current@chapid{#1}% |
| 1516 |
\zref@setcurrent{chaptitle}{#2}% |
| 1517 |
\chapter{#2}% |
| 1518 |
\zlabel{chap:#1}% |
| 1519 |
} |
| 1520 |
\newcommand*{\ChapterStop}{% |
| 1521 |
\cleardoublepage |
| 1522 |
\zref@wrapper@immediate{% |
| 1523 |
\zref@labelbyprops{chapend:\current@chapid}{abspage}% |
| 1524 |
}% |
| 1525 |
} |
| 1526 |
% \end{macrocode} |
| 1527 |
% \cs{ChapterPages} calculates and returns the number of pages of the |
| 1528 |
% referenced chapter. |
| 1529 |
% \begin{macrocode} |
| 1530 |
\newcommand*{\ChapterPages}[1]{% |
| 1531 |
\zrefused{chap:#1}% |
| 1532 |
\zrefused{chapend:#1}% |
| 1533 |
\number\numexpr |
| 1534 |
\zref@extract{chapend:#1}{abspage}% |
| 1535 |
-\zref@extract{chap:#1}{abspage}% |
| 1536 |
+1\relax |
| 1537 |
} |
| 1538 |
\makeatother |
| 1539 |
% \end{macrocode} |
| 1540 |
% \begin{macrocode} |
| 1541 |
\begin{document} |
| 1542 |
% \end{macrocode} |
| 1543 |
% As exception we use \cs{makeatletter} here, because |
| 1544 |
% this is just an example file that also should show some of |
| 1545 |
% programmer's interface. |
| 1546 |
% \begin{macrocode} |
| 1547 |
\makeatletter |
| 1548 |
|
| 1549 |
\frontmatter |
| 1550 |
\zlabel{documentstart} |
| 1551 |
|
| 1552 |
\begin{itemize} |
| 1553 |
\item |
| 1554 |
The frontmatter part has |
| 1555 |
\number\numexpr\zref@extract{chap:first}{abspage}-1\relax |
| 1556 |
~pages. |
| 1557 |
\item |
| 1558 |
Chapter \zref{chap:first} has \ChapterPages{first} page(s). |
| 1559 |
\item |
| 1560 |
Section \zref{hello} is on the |
| 1561 |
\ifcase\numexpr |
| 1562 |
\zref@extractdefault{hello}{page}{0}% |
| 1563 |
-\zref@extractdefault{chap:first}{page}{0}% |
| 1564 |
+1\relax |
| 1565 |
??\or first\or second\or third\or forth\fi |
| 1566 |
~page inside its chapter. |
| 1567 |
\item |
| 1568 |
The document has |
| 1569 |
\zref[abspage]{LastPage} pages. |
| 1570 |
This number is \ifodd\ztotpages odd\else even\fi. |
| 1571 |
\item |
| 1572 |
The last page is labeled with \zpageref{LastPage}. |
| 1573 |
\item |
| 1574 |
The title of chapter \zref{chap:next} % |
| 1575 |
is ``\zref[chaptitle]{chap:next}''. |
| 1576 |
\end{itemize} |
| 1577 |
|
| 1578 |
\tableofcontents |
| 1579 |
|
| 1580 |
\mainmatter |
| 1581 |
\ChapterStart{first}{First chapter} |
| 1582 |
|
| 1583 |
% \end{macrocode} |
| 1584 |
% The user level commands should protect babel shorthands |
| 1585 |
% where possible. On the other side, expandable extracting |
| 1586 |
% macros are useful in calculations, see above the |
| 1587 |
% examples with \cs{numexpr}. |
| 1588 |
% \begin{macrocode} |
| 1589 |
\section{Test} |
| 1590 |
\zlabel{a"o} |
| 1591 |
Section \zref{a"o} on page |
| 1592 |
\zref@wrapper@babel\zref@extract{a"o}{page}. |
| 1593 |
|
| 1594 |
Text. |
| 1595 |
\newpage |
| 1596 |
|
| 1597 |
\section{Hello World} |
| 1598 |
\zlabel{hello} |
| 1599 |
|
| 1600 |
\ChapterStop |
| 1601 |
|
| 1602 |
\ChapterStart{next}{Next chapter with \emph{umlauts}: "a"o"u"s} |
| 1603 |
|
| 1604 |
% \end{macrocode} |
| 1605 |
% |
| 1606 |
% Here an example follows that makes use of the ``savepos'' |
| 1607 |
% feature. The position on the page is not known before the |
| 1608 |
% page is constructed and shipped out. Therefore the position |
| 1609 |
% ist stored in references and are available for calculations |
| 1610 |
% in the next \hologo{LaTeX} compile run. |
| 1611 |
% \begin{macrocode} |
| 1612 |
The width of the first column is |
| 1613 |
\the\dimexpr \zposx{secondcol}sp - \zposx{firstcol}sp\relax,\\ |
| 1614 |
the height difference of the two baselines is |
| 1615 |
\the\dimexpr \zposy{firstcol}sp - \zposy{secondline}sp\relax:\\ |
| 1616 |
\begin{tabular}{ll} |
| 1617 |
\zsavepos{firstcol}Hello&\zsavepos{secondcol}World\\ |
| 1618 |
\zsavepos{secondline}Second line&foobar\\ |
| 1619 |
\end{tabular} |
| 1620 |
|
| 1621 |
% \end{macrocode} |
| 1622 |
% With \cs{zrefused} \hologo{LaTeX} is notified, if the references |
| 1623 |
% are not yet available and \hologo{LaTeX} can generate the rerun |
| 1624 |
% hint. |
| 1625 |
% \begin{macrocode} |
| 1626 |
\zrefused{firstcol} |
| 1627 |
\zrefused{secondcol} |
| 1628 |
\zrefused{secondline} |
| 1629 |
|
| 1630 |
\ChapterStop |
| 1631 |
% \end{macrocode} |
| 1632 |
% Test for module \cs{dotfill}. |
| 1633 |
% \begin{macrocode} |
| 1634 |
\ChapterStart{dotfill}{Test for dotfill feature} |
| 1635 |
\newcommand*{\dftest}[1]{% |
| 1636 |
#1& |
| 1637 |
[\makebox[{#1}]{\dotfill}]& |
| 1638 |
[\makebox[{#1}]{\zdotfill}]\\ |
| 1639 |
} |
| 1640 |
\begin{tabular}{rll} |
| 1641 |
& [\verb|\dotfill|] & [\verb|\zdotfill|]\\ |
| 1642 |
\dftest{0.43em} |
| 1643 |
\dftest{0.44em} |
| 1644 |
\dftest{0.45em} |
| 1645 |
\dftest{0.87em} |
| 1646 |
\dftest{0.88em} |
| 1647 |
\dftest{0.89em} |
| 1648 |
\dftest{1.31em} |
| 1649 |
\dftest{1.32em} |
| 1650 |
\dftest{1.33em} |
| 1651 |
\end{tabular} |
| 1652 |
\ChapterStop |
| 1653 |
\end{document} |
| 1654 |
% \end{macrocode} |
| 1655 |
% |
| 1656 |
% \begin{macrocode} |
| 1657 |
%</example> |
| 1658 |
% \end{macrocode} |
| 1659 |
% |
| 1660 |
% \StopEventually{ |
| 1661 |
% } |
| 1662 |
% |
| 1663 |
% \section{Implementation} |
| 1664 |
% |
| 1665 |
% \subsection{Package \xpackage{zref}} |
| 1666 |
% |
| 1667 |
% \subsubsection{Identification} |
| 1668 |
% |
| 1669 |
% \begin{macrocode} |
| 1670 |
%<*package> |
| 1671 |
\NeedsTeXFormat{LaTeX2e} |
| 1672 |
\ProvidesPackage{zref} |
| 1673 |
[2026-03-07 v2.37 A new reference scheme for LaTeX (HO)]% |
| 1674 |
% \end{macrocode} |
| 1675 |
% |
| 1676 |
% \subsubsection{Load basic module} |
| 1677 |
% |
| 1678 |
% \begin{macrocode} |
| 1679 |
\RequirePackage{zref-base}[2019/11/29] |
| 1680 |
% \end{macrocode} |
| 1681 |
% Abort package loading if \xpackage{zref-base} could not be |
| 1682 |
% loaded successfully. |
| 1683 |
% \begin{macrocode} |
| 1684 |
\@ifundefined{ZREF@base@ok}{\endinput}{} |
| 1685 |
% \end{macrocode} |
| 1686 |
% |
| 1687 |
% \subsubsection{Process options} |
| 1688 |
% |
| 1689 |
% Known modules are loaded and the release date is checked. |
| 1690 |
% \begin{macrocode} |
| 1691 |
\def\ZREF@temp#1{% |
| 1692 |
\DeclareOption{#1}{% |
| 1693 |
\AtEndOfPackage{% |
| 1694 |
\RequirePackage{zref-#1}[2019/11/29]% |
| 1695 |
}% |
| 1696 |
}% |
| 1697 |
} |
| 1698 |
\ZREF@temp{abspage} |
| 1699 |
\ZREF@temp{counter} |
| 1700 |
\ZREF@temp{dotfill} |
| 1701 |
\ZREF@temp{hyperref} |
| 1702 |
\ZREF@temp{lastpage} |
| 1703 |
\ZREF@temp{marks} |
| 1704 |
\ZREF@temp{nextpage} |
| 1705 |
\ZREF@temp{pageattr} |
| 1706 |
\ZREF@temp{pagelayout} |
| 1707 |
\ZREF@temp{perpage} |
| 1708 |
\ZREF@temp{runs} |
| 1709 |
\ZREF@temp{savepos} |
| 1710 |
\ZREF@temp{thepage} |
| 1711 |
\ZREF@temp{titleref} |
| 1712 |
\ZREF@temp{totpages} |
| 1713 |
\ZREF@temp{user} |
| 1714 |
\ZREF@temp{xr} |
| 1715 |
% \end{macrocode} |
| 1716 |
% \begin{macrocode} |
| 1717 |
\ProcessOptions\relax |
| 1718 |
%</package> |
| 1719 |
% \end{macrocode} |
| 1720 |
% |
| 1721 |
% |
| 1722 |
% \subsection{Module \xmodule{base}} |
| 1723 |
% |
| 1724 |
% \subsubsection{Prefixes} |
| 1725 |
% |
| 1726 |
% This package uses the following prefixes for macro names: |
| 1727 |
% \begin{description} |
| 1728 |
% \item[\cs{zref@}:] Macros of the programmer's interface. |
| 1729 |
% \item[\cs{ZREF@}:] Internal macros. |
| 1730 |
% \item[\cs{Z@L@}\metacs{listname}:] |
| 1731 |
% The properties of the list \meta{listname}. |
| 1732 |
% \item[\cs{Z@D@}\metacs{propname}:] |
| 1733 |
% The default value for property \meta{propname}. |
| 1734 |
% \item[\cs{Z@E@}\metacs{propname}:] |
| 1735 |
% Extract function for property \meta{propname}. |
| 1736 |
% \item[\cs{Z@X@}\metacs{propname}:] |
| 1737 |
% Information whether a property value for property |
| 1738 |
% \meta{propname} is expanded |
| 1739 |
% immediately or at shipout time. |
| 1740 |
% \item[\cs{Z@C@}\metacs{propname}:] |
| 1741 |
% Current value of the property \meta{propname}. |
| 1742 |
% \item[\cs{Z@R@}\metacs{labelname}:] |
| 1743 |
% Data for reference \meta{labelname}. |
| 1744 |
% \item[\cs{ZREF@org@}:] Original versions of patched commands. |
| 1745 |
% \item[\cs{z}:] For macros in user land, defined if |
| 1746 |
% module \xmodule{user} is set. |
| 1747 |
% \end{description} |
| 1748 |
% The following family names are used for keys defined |
| 1749 |
% according to the \xpackage{keyval} package: |
| 1750 |
% \begin{description} |
| 1751 |
% \item[\texttt{ZREF@TR}:] Setup for module \xmodule{titleref}. |
| 1752 |
% \end{description} |
| 1753 |
% |
| 1754 |
% \subsubsection{Identification} |
| 1755 |
% |
| 1756 |
% \begin{macrocode} |
| 1757 |
%<*base> |
| 1758 |
\NeedsTeXFormat{LaTeX2e} |
| 1759 |
\ProvidesPackage{zref-base}% |
| 1760 |
[2026-03-07 v2.37 Module base for zref (HO)]% |
| 1761 |
% \end{macrocode} |
| 1762 |
% |
| 1763 |
% \subsubsection{Utilities} |
| 1764 |
% |
| 1765 |
% \begin{macrocode} |
| 1766 |
\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} |
| 1767 |
\RequirePackage{ltxcmds}[2010/12/02] |
| 1768 |
\RequirePackage{infwarerr}[2010/04/08] |
| 1769 |
\RequirePackage{kvsetkeys}[2010/03/01] |
| 1770 |
\RequirePackage{kvdefinekeys}[2010/03/01] |
| 1771 |
\RequirePackage{pdftexcmds}[2010/04/01] |
| 1772 |
% \end{macrocode} |
| 1773 |
% |
| 1774 |
% \begin{macro}{\ZREF@name} |
| 1775 |
% Several times the package name is used, thus we store it |
| 1776 |
% in \cmd{\ZREF@name}. |
| 1777 |
% \begin{macrocode} |
| 1778 |
\def\ZREF@name{zref} |
| 1779 |
% \end{macrocode} |
| 1780 |
% \end{macro} |
| 1781 |
% |
| 1782 |
% \begin{macrocode} |
| 1783 |
\ltx@IfUndefined{protected}{% |
| 1784 |
\RequirePackage{makerobust}[2006/03/18]% |
| 1785 |
% \end{macrocode} |
| 1786 |
% \begin{macro}{\ZREF@Robust} |
| 1787 |
% \begin{macrocode} |
| 1788 |
\def\ZREF@Robust#1#2{% |
| 1789 |
\def\ZREF@temp{\MakeRobustcommand#2}% |
| 1790 |
\afterassignment\ZREF@temp |
| 1791 |
#1#2% |
| 1792 |
}% |
| 1793 |
% \end{macrocode} |
| 1794 |
% \end{macro} |
| 1795 |
% \begin{macrocode} |
| 1796 |
}{% |
| 1797 |
% \end{macrocode} |
| 1798 |
% \begin{macro}{\ZREF@Robust} |
| 1799 |
% \begin{macrocode} |
| 1800 |
\def\ZREF@Robust#1{% |
| 1801 |
\protected#1% |
| 1802 |
}% |
| 1803 |
% \end{macrocode} |
| 1804 |
% \end{macro} |
| 1805 |
% \begin{macrocode} |
| 1806 |
} |
| 1807 |
% \end{macrocode} |
| 1808 |
% \begin{macro}{\ZREF@IfDefinable} |
| 1809 |
% \begin{macrocode} |
| 1810 |
\def\ZREF@IfDefinable#1#2#3{% |
| 1811 |
\@ifdefinable{#1}{% |
| 1812 |
\ZREF@Robust{#2}#1#3% |
| 1813 |
}% |
| 1814 |
} |
| 1815 |
% \end{macrocode} |
| 1816 |
% \end{macro} |
| 1817 |
% |
| 1818 |
% \begin{macro}{\ZREF@UpdatePdfTeX} |
| 1819 |
% \cs{ZREF@UpdatePdfTeX} is used as help message text in |
| 1820 |
% error messages. |
| 1821 |
% \begin{macrocode} |
| 1822 |
\def\ZREF@UpdatePdfTeX{Update pdfTeX.} |
| 1823 |
% \end{macrocode} |
| 1824 |
% \end{macro} |
| 1825 |
% |
| 1826 |
% \begin{macro}{\ifZREF@found} |
| 1827 |
% The following switch is used in list processing. |
| 1828 |
% \begin{macrocode} |
| 1829 |
\newif\ifZREF@found |
| 1830 |
% \end{macrocode} |
| 1831 |
% \end{macro} |
| 1832 |
% |
| 1833 |
% \begin{macro}{\ZREF@patch} |
| 1834 |
% Macro \cs{ZREF@patch} first checks the existence of |
| 1835 |
% the command and safes it. |
| 1836 |
% \begin{macrocode} |
| 1837 |
\def\ZREF@patch#1{% |
| 1838 |
\ltx@IfUndefined{#1}{% |
| 1839 |
\ltx@gobble |
| 1840 |
}{% |
| 1841 |
\expandafter\let\csname ZREF@org@#1\expandafter\endcsname |
| 1842 |
\csname #1\endcsname |
| 1843 |
\ltx@firstofone |
| 1844 |
}% |
| 1845 |
} |
| 1846 |
% \end{macrocode} |
| 1847 |
% \end{macro} |
| 1848 |
% |
| 1849 |
% \subsubsection{Check for \hologo{eTeX}} |
| 1850 |
% |
| 1851 |
% The use of \hologo{eTeX} should be standard nowadays for \hologo{LaTeX}. |
| 1852 |
% We test for \hologo{eTeX} in order to use its features later. |
| 1853 |
% \begin{macrocode} |
| 1854 |
\ltx@IfUndefined{eTeXversion}{% |
| 1855 |
\PackageError\ZREF@name{% |
| 1856 |
Missing support for eTeX; package is abandoned% |
| 1857 |
}{% |
| 1858 |
Use a TeX compiler that support eTeX and enable eTeX % |
| 1859 |
in the format.% |
| 1860 |
}% |
| 1861 |
\endinput |
| 1862 |
}{}% |
| 1863 |
% \end{macrocode} |
| 1864 |
% |
| 1865 |
% \begin{macrocode} |
| 1866 |
\RequirePackage{etexcmds}[2007/09/09] |
| 1867 |
\ifetex@unexpanded |
| 1868 |
\else |
| 1869 |
\PackageError\ZREF@name{% |
| 1870 |
Missing e-TeX's \string\unexpanded.\MessageBreak |
| 1871 |
Add \string\RequirePackage\string{etexcmds\string} before % |
| 1872 |
\string\documentclass% |
| 1873 |
}{% |
| 1874 |
Probably you are using some package (e.g. ConTeXt) that % |
| 1875 |
redefines \string\unexpanded% |
| 1876 |
}% |
| 1877 |
\expandafter\endinput |
| 1878 |
\fi |
| 1879 |
% \end{macrocode} |
| 1880 |
% |
| 1881 |
% \subsubsection{Auxiliary file stuff} |
| 1882 |
% |
| 1883 |
% We are using some commands in the \xfile{.aux} files. |
| 1884 |
% However sometimes these auxiliary files are interpreted |
| 1885 |
% by \hologo{LaTeX} processes that haven't loaded this package |
| 1886 |
% (e.g. package \xpackage{xr}). |
| 1887 |
% Therefore we provide dummy definitions. |
| 1888 |
% \begin{macrocode} |
| 1889 |
\RequirePackage{auxhook} |
| 1890 |
\AddLineBeginAux{% |
| 1891 |
\string\providecommand\string\zref@newlabel[2]{}% |
| 1892 |
} |
| 1893 |
% \end{macrocode} |
| 1894 |
% \begin{macro}{\ZREF@RefPrefix} |
| 1895 |
% \begin{macrocode} |
| 1896 |
\def\ZREF@RefPrefix{Z@R} |
| 1897 |
% \end{macrocode} |
| 1898 |
% \end{macro} |
| 1899 |
% \begin{macro}{\zref@newlabel} |
| 1900 |
% For the implementation of \cs{zref@newlabel} we call |
| 1901 |
% the same internal macro \cs{@newl@bel} that is used |
| 1902 |
% in \cs{newlabel}. Thus we have for free: |
| 1903 |
% \begin{itemize} |
| 1904 |
% \item \cs{Z@R@}\metacs{labelname} is defined. |
| 1905 |
% \item \hologo{LaTeX}'s check for multiple references. |
| 1906 |
% \item \hologo{LaTeX}'s check for changed references. |
| 1907 |
% \end{itemize} |
| 1908 |
% \begin{macrocode} |
| 1909 |
\ZREF@Robust\edef\zref@newlabel{% |
| 1910 |
\noexpand\@newl@bel{\ZREF@RefPrefix}% |
| 1911 |
} |
| 1912 |
% \end{macrocode} |
| 1913 |
% \end{macro} |
| 1914 |
% |
| 1915 |
% \subsubsection{Property lists} |
| 1916 |
% |
| 1917 |
% \begin{macro}{\zref@newlist} |
| 1918 |
% Property lists are stored as list of property names |
| 1919 |
% enclosed in curly braces. \cs{zref@newlist} |
| 1920 |
% creates a new list as empty list. Assignments to |
| 1921 |
% property lists are global. |
| 1922 |
% \begin{macrocode} |
| 1923 |
\ZREF@Robust\def\zref@newlist#1{% |
| 1924 |
\zref@iflistundefined{#1}{% |
| 1925 |
\@ifdefinable{Z@L@#1}{% |
| 1926 |
\global\expandafter\let\csname Z@L@#1\endcsname\ltx@empty |
| 1927 |
\PackageInfo\ZREF@name{New property list: #1}% |
| 1928 |
}% |
| 1929 |
}{% |
| 1930 |
\PackageError\ZREF@name{% |
| 1931 |
Property list `#1' already exists% |
| 1932 |
}\@ehc |
| 1933 |
}% |
| 1934 |
} |
| 1935 |
% \end{macrocode} |
| 1936 |
% \end{macro} |
| 1937 |
% |
| 1938 |
% \begin{macro}{\zref@iflistundefined} |
| 1939 |
% \cs{zref@iflistundefined} checks the existence of the |
| 1940 |
% property list \verb|#1|. If the property list is present, |
| 1941 |
% then \verb|#2| is executed and \verb|#3| otherwise. |
| 1942 |
% \begin{macrocode} |
| 1943 |
\def\zref@iflistundefined#1{% |
| 1944 |
\ltx@ifundefined{Z@L@#1}% |
| 1945 |
} |
| 1946 |
% \end{macrocode} |
| 1947 |
% \end{macro} |
| 1948 |
% \begin{macro}{\zref@listexists} |
| 1949 |
% \cs{zref@listexists} only executes \verb|#2| if the |
| 1950 |
% property list \verb|#1| exists and raises an error |
| 1951 |
% message otherwise. |
| 1952 |
% \begin{macrocode} |
| 1953 |
\ZREF@Robust\def\zref@listexists#1{% |
| 1954 |
\zref@iflistundefined{#1}{% |
| 1955 |
\PackageError\ZREF@name{% |
| 1956 |
Property list `#1' does not exist% |
| 1957 |
}\@ehc |
| 1958 |
}% |
| 1959 |
} |
| 1960 |
% \end{macrocode} |
| 1961 |
% \end{macro} |
| 1962 |
% |
| 1963 |
% \begin{macro}{\zref@iflistcontainsprop} |
| 1964 |
% \cs{zref@iflistcontainsprop} checks, whether a property \verb|#2| is |
| 1965 |
% already present in a property list \verb|#1|. |
| 1966 |
% \begin{macrocode} |
| 1967 |
\ZREF@Robust\def\zref@iflistcontainsprop#1#2{% |
| 1968 |
\zref@iflistundefined{#1}{% |
| 1969 |
\ltx@secondoftwo |
| 1970 |
}{% |
| 1971 |
\begingroup\expandafter\endgroup |
| 1972 |
\expandafter\in@ |
| 1973 |
\csname#2\expandafter\expandafter\expandafter\endcsname |
| 1974 |
\expandafter\expandafter\expandafter{\csname Z@L@#1\endcsname}% |
| 1975 |
\csname ltx@\ifin@ first\else second\fi oftwo\endcsname |
| 1976 |
}% |
| 1977 |
} |
| 1978 |
% \end{macrocode} |
| 1979 |
% \end{macro} |
| 1980 |
% |
| 1981 |
% \begin{macro}{\zref@listforloop} |
| 1982 |
% \begin{macrocode} |
| 1983 |
\def\zref@listforloop#1#2{% |
| 1984 |
\zref@listexists{#1}{% |
| 1985 |
\expandafter\expandafter\expandafter\@tfor |
| 1986 |
\expandafter\expandafter\expandafter\zref@prop |
| 1987 |
\expandafter\expandafter\expandafter:% |
| 1988 |
\expandafter\expandafter\expandafter=% |
| 1989 |
\csname Z@L@#1\endcsname |
| 1990 |
\do{% |
| 1991 |
\begingroup |
| 1992 |
\escapechar=-1 % |
| 1993 |
\edef\x{\endgroup |
| 1994 |
\def\noexpand\zref@prop{% |
| 1995 |
\expandafter\string\zref@prop |
| 1996 |
}% |
| 1997 |
}% |
| 1998 |
\x |
| 1999 |
#2\zref@prop |
| 2000 |
}% |
| 2001 |
}% |
| 2002 |
} |
| 2003 |
% \end{macrocode} |
| 2004 |
% \end{macro} |
| 2005 |
% |
| 2006 |
% \begin{macro}{\zref@addprops} |
| 2007 |
% \cs{zref@addprop} adds the properties \verb|#2| to the property |
| 2008 |
% list \verb|#1|, if the property is not already in the list. |
| 2009 |
% Otherwise a warning is given. |
| 2010 |
% \begin{macrocode} |
| 2011 |
\ZREF@Robust\def\zref@addprops#1#2{% |
| 2012 |
\zref@listexists{#1}{% |
| 2013 |
\comma@parse{#2}{% |
| 2014 |
\zref@propexists\comma@entry{% |
| 2015 |
\zref@iflistcontainsprop{#1}\comma@entry{% |
| 2016 |
\PackageWarning\ZREF@name{% |
| 2017 |
Property `\comma@entry' is already in list `#1'% |
| 2018 |
}% |
| 2019 |
}{% |
| 2020 |
\begingroup\expandafter\endgroup |
| 2021 |
\expandafter\g@addto@macro |
| 2022 |
\csname Z@L@#1\expandafter\endcsname |
| 2023 |
\expandafter{\csname\comma@entry\endcsname}% |
| 2024 |
}% |
| 2025 |
}% |
| 2026 |
\ltx@gobble |
| 2027 |
}% |
| 2028 |
}% |
| 2029 |
} |
| 2030 |
% \end{macrocode} |
| 2031 |
% \end{macro} |
| 2032 |
% \begin{macro}{\zref@addprop} |
| 2033 |
% \cs{zref@addprop} adds the property \verb|#2| to the property |
| 2034 |
% list \verb|#1|, if the property is not already in the list. |
| 2035 |
% Otherwise a warning is given. |
| 2036 |
% \begin{macrocode} |
| 2037 |
\ZREF@Robust\def\zref@addprop#1#2{% |
| 2038 |
\zref@listexists{#1}{% |
| 2039 |
\zref@propexists{#2}{% |
| 2040 |
\zref@iflistcontainsprop{#1}{#2}{% |
| 2041 |
\PackageWarning\ZREF@name{% |
| 2042 |
Property `#2' is already in list `#1'% |
| 2043 |
}% |
| 2044 |
}{% |
| 2045 |
\begingroup\expandafter\endgroup |
| 2046 |
\expandafter\g@addto@macro |
| 2047 |
\csname Z@L@#1\expandafter\endcsname |
| 2048 |
\expandafter{\csname#2\endcsname}% |
| 2049 |
}% |
| 2050 |
}% |
| 2051 |
}% |
| 2052 |
} |
| 2053 |
% \end{macrocode} |
| 2054 |
% \end{macro} |
| 2055 |
% |
| 2056 |
% \begin{macro}{\zref@localaddprops} |
| 2057 |
% \begin{macrocode} |
| 2058 |
\ZREF@Robust\def\zref@localaddprops#1#2{% |
| 2059 |
\zref@listexists{#1}{% |
| 2060 |
\comma@parse{#2}{% |
| 2061 |
\zref@propexists\comma@entry{% |
| 2062 |
\zref@iflistcontainsprop{#1}\comma@entry{% |
| 2063 |
\PackageWarning\ZREF@name{% |
| 2064 |
Property `\comma@entry' is already in list `#1'% |
| 2065 |
}% |
| 2066 |
}{% |
| 2067 |
\begingroup\expandafter\endgroup |
| 2068 |
\expandafter\ltx@LocalAppendToMacro |
| 2069 |
\csname Z@L@#1\expandafter\endcsname |
| 2070 |
\expandafter{\csname\comma@entry\endcsname}% |
| 2071 |
}% |
| 2072 |
}% |
| 2073 |
\ltx@gobble |
| 2074 |
}% |
| 2075 |
}% |
| 2076 |
} |
| 2077 |
% \end{macrocode} |
| 2078 |
% \end{macro} |
| 2079 |
% \begin{macro}{\zref@localaddprop} |
| 2080 |
% \begin{macrocode} |
| 2081 |
\ZREF@Robust\def\zref@localaddprop#1#2{% |
| 2082 |
\zref@listexists{#1}{% |
| 2083 |
\zref@propexists{#2}{% |
| 2084 |
\zref@iflistcontainsprop{#1}{#2}{% |
| 2085 |
\PackageWarning\ZREF@name{% |
| 2086 |
Property `#2' is already in list `#1'% |
| 2087 |
}% |
| 2088 |
}{% |
| 2089 |
\begingroup\expandafter\endgroup |
| 2090 |
\expandafter\ltx@LocalAppendToMacro |
| 2091 |
\csname Z@L@#1\expandafter\endcsname |
| 2092 |
\expandafter{\csname#2\endcsname}% |
| 2093 |
}% |
| 2094 |
}% |
| 2095 |
}% |
| 2096 |
} |
| 2097 |
% \end{macrocode} |
| 2098 |
% \end{macro} |
| 2099 |
% |
| 2100 |
% \begin{macrocode} |
| 2101 |
\ltx@IfUndefined{pdf@strcmp}{% |
| 2102 |
% \end{macrocode} |
| 2103 |
% \begin{macro}{\zref@delprop} |
| 2104 |
% \begin{macrocode} |
| 2105 |
\ZREF@Robust\def\zref@delprop{% |
| 2106 |
\ZREF@delprop\gdef |
| 2107 |
}% |
| 2108 |
% \end{macrocode} |
| 2109 |
% \end{macro} |
| 2110 |
% \begin{macro}{\zref@localdelprop} |
| 2111 |
% \begin{macrocode} |
| 2112 |
\ZREF@Robust\def\zref@localdelprop{% |
| 2113 |
\ZREF@delprop\def |
| 2114 |
}% |
| 2115 |
% \end{macrocode} |
| 2116 |
% \end{macro} |
| 2117 |
% \begin{macro}{\ZREF@delprop} |
| 2118 |
% \begin{macrocode} |
| 2119 |
\def\ZREF@delprop#1#2#3{% |
| 2120 |
\zref@listexists{#2}{% |
| 2121 |
\begingroup |
| 2122 |
\escapechar=-1 % |
| 2123 |
\def\ZREF@param{#3}% |
| 2124 |
\@onelevel@sanitize\ZREF@param |
| 2125 |
\toks@{}% |
| 2126 |
\expandafter\expandafter\expandafter\ZREF@@delprop |
| 2127 |
\csname Z@L@#2\endcsname!% |
| 2128 |
\expandafter\endgroup |
| 2129 |
\expandafter#1\csname Z@L@#2\expandafter\endcsname |
| 2130 |
\expandafter{% |
| 2131 |
\the\toks@ |
| 2132 |
}% |
| 2133 |
}% |
| 2134 |
}% |
| 2135 |
% \end{macrocode} |
| 2136 |
% \end{macro} |
| 2137 |
% \begin{macro}{\ZREF@@delprop} |
| 2138 |
% \begin{macrocode} |
| 2139 |
\def\ZREF@@delprop#1{% |
| 2140 |
\expandafter\ZREF@@@delprop\expandafter{\string#1}#1% |
| 2141 |
}% |
| 2142 |
% \end{macrocode} |
| 2143 |
% \end{macro} |
| 2144 |
% \begin{macro}{\ZREF@@@delprop} |
| 2145 |
% \begin{macrocode} |
| 2146 |
\def\ZREF@@@delprop#1#2{% |
| 2147 |
\ifx#2!% |
| 2148 |
\else |
| 2149 |
\def\ZREF@temp{#1}% |
| 2150 |
\@onelevel@sanitize\ZREF@temp |
| 2151 |
\ifx\ZREF@param\ZREF@temp |
| 2152 |
\else |
| 2153 |
\toks@\expandafter{% |
| 2154 |
\the\expandafter\toks@\csname#1\endcsname |
| 2155 |
}% |
| 2156 |
\fi |
| 2157 |
\expandafter\ZREF@@delprop |
| 2158 |
\fi |
| 2159 |
}% |
| 2160 |
% \end{macrocode} |
| 2161 |
% \end{macro} |
| 2162 |
% \begin{macrocode} |
| 2163 |
}{% |
| 2164 |
% \end{macrocode} |
| 2165 |
% \begin{macro}{\zref@delprop} |
| 2166 |
% \begin{macrocode} |
| 2167 |
\ZREF@Robust\def\zref@delprop{% |
| 2168 |
\ZREF@delprop\xdef |
| 2169 |
}% |
| 2170 |
% \end{macrocode} |
| 2171 |
% \end{macro} |
| 2172 |
% \begin{macro}{\zref@localdelprop} |
| 2173 |
% \begin{macrocode} |
| 2174 |
\ZREF@Robust\def\zref@localdelprop{% |
| 2175 |
\ZREF@delprop\edef |
| 2176 |
}% |
| 2177 |
% \end{macrocode} |
| 2178 |
% \end{macro} |
| 2179 |
% \begin{macro}{\ZREF@delprop} |
| 2180 |
% \begin{macrocode} |
| 2181 |
\def\ZREF@delprop#1#2#3{% |
| 2182 |
\zref@listexists{#2}{% |
| 2183 |
\def\ZREF@param{#3}% |
| 2184 |
\edef\ZREF@SavedEscapechar{\the\escapechar}% |
| 2185 |
\escapechar=-1 % |
| 2186 |
\expandafter#1\csname Z@L@#2% |
| 2187 |
\expandafter\expandafter\expandafter\endcsname{% |
| 2188 |
\expandafter\expandafter\expandafter\ZREF@@delprop |
| 2189 |
\csname Z@L@#2\endcsname!% |
| 2190 |
}% |
| 2191 |
\escapechar=\ZREF@SavedEscapechar\relax |
| 2192 |
}% |
| 2193 |
}% |
| 2194 |
% \end{macrocode} |
| 2195 |
% \end{macro} |
| 2196 |
% \begin{macro}{\ZREF@@delprop} |
| 2197 |
% Caution: |#1| might be an \cs{if} or similar token. |
| 2198 |
% \begin{macrocode} |
| 2199 |
\def\ZREF@@delprop#1{% |
| 2200 |
\expandafter\ZREF@@@delprop\expandafter{\string#1}#1% |
| 2201 |
}% |
| 2202 |
% \end{macrocode} |
| 2203 |
% \end{macro} |
| 2204 |
% \begin{macro}{\ZREF@@@delprop} |
| 2205 |
% \begin{macrocode} |
| 2206 |
\def\ZREF@@@delprop#1#2{% |
| 2207 |
\ifx#2!% |
| 2208 |
\else |
| 2209 |
\ifnum\pdf@strcmp{#1}{\ZREF@param}=\ltx@zero |
| 2210 |
\else |
| 2211 |
\expandafter\noexpand\csname#1\endcsname |
| 2212 |
\fi |
| 2213 |
\expandafter\ZREF@@delprop |
| 2214 |
\fi |
| 2215 |
}% |
| 2216 |
% \end{macrocode} |
| 2217 |
% \end{macro} |
| 2218 |
% \begin{macrocode} |
| 2219 |
} |
| 2220 |
% \end{macrocode} |
| 2221 |
% |
| 2222 |
% \subsubsection{Properties} |
| 2223 |
% |
| 2224 |
% \begin{macro}{\zref@ifpropundefined} |
| 2225 |
% \cs{zref@ifpropundefined} checks the existence of the |
| 2226 |
% property \verb|#1|. If the property is present, |
| 2227 |
% then \verb|#2| is executed and \verb|#3| otherwise. |
| 2228 |
% \begin{macrocode} |
| 2229 |
\def\zref@ifpropundefined#1{% |
| 2230 |
\ltx@ifundefined{Z@E@#1}% |
| 2231 |
} |
| 2232 |
% \end{macrocode} |
| 2233 |
% \end{macro} |
| 2234 |
% \begin{macro}{\zref@propexists} |
| 2235 |
% Some macros rely on the existence of a property. |
| 2236 |
% \cs{zref@propexists} only executes \verb|#2| if the |
| 2237 |
% property \verb|#1| exists and raises an error |
| 2238 |
% message otherwise. |
| 2239 |
% \begin{macrocode} |
| 2240 |
\ZREF@Robust\def\zref@propexists#1{% |
| 2241 |
\zref@ifpropundefined{#1}{% |
| 2242 |
\PackageError\ZREF@name{% |
| 2243 |
Property `#1' does not exist% |
| 2244 |
}\@ehc |
| 2245 |
}% |
| 2246 |
} |
| 2247 |
% \end{macrocode} |
| 2248 |
% \end{macro} |
| 2249 |
% |
| 2250 |
% \begin{macro}{\zref@newprop} |
| 2251 |
% A new property is declared by \cs{zref@newprop}, the |
| 2252 |
% property name \meta{propname} is given in \verb|#1|. The |
| 2253 |
% property is created and configured. If the star form |
| 2254 |
% is given, then the expansion of the property value |
| 2255 |
% is delayed to page shipout time, when the reference |
| 2256 |
% is written to the \xfile{.aux} file. |
| 2257 |
% \begin{description} |
| 2258 |
% \item[\cs{Z@D@}\metacs{propname}:] |
| 2259 |
% Stores the default value for this property. |
| 2260 |
% \item[\cs{Z@E@}\metacs{propname}:] |
| 2261 |
% Extract function. |
| 2262 |
% \item[\cs{Z@X@}\metacs{propname}:] |
| 2263 |
% Information whether the expansion of the property value |
| 2264 |
% is delayed to shipout time. |
| 2265 |
% \item[\cs{Z@C@}\metacs{propname}:] |
| 2266 |
% Current value of the property. |
| 2267 |
% \end{description} |
| 2268 |
% \begin{macrocode} |
| 2269 |
\ZREF@Robust\def\zref@newprop{% |
| 2270 |
\@ifstar{% |
| 2271 |
\let\ZREF@X\noexpand |
| 2272 |
\ZREF@newprop |
| 2273 |
}{% |
| 2274 |
\let\ZREF@X\ltx@empty |
| 2275 |
\ZREF@newprop |
| 2276 |
}% |
| 2277 |
} |
| 2278 |
% \end{macrocode} |
| 2279 |
% \end{macro} |
| 2280 |
% \begin{macro}{\ZREF@newprop} |
| 2281 |
% \begin{macrocode} |
| 2282 |
\def\ZREF@newprop#1{% |
| 2283 |
\edef\ZREF@P{#1}% |
| 2284 |
\@onelevel@sanitize\ZREF@P |
| 2285 |
\begingroup |
| 2286 |
\ifx\ZREF@P\ZREF@par |
| 2287 |
\@PackageError\ZREF@name{% |
| 2288 |
Invalid property name `\ZREF@P'% |
| 2289 |
}{% |
| 2290 |
The property name `par' is not allowed % |
| 2291 |
because of internal reasons.% |
| 2292 |
\MessageBreak |
| 2293 |
\@ehc |
| 2294 |
}% |
| 2295 |
\def\ZREF@@newprop[##1]##2{\endgroup}% |
| 2296 |
\else |
| 2297 |
\zref@ifpropundefined\ZREF@P{% |
| 2298 |
\endgroup |
| 2299 |
\PackageInfo\ZREF@name{% |
| 2300 |
New property: \ZREF@P |
| 2301 |
}% |
| 2302 |
}{% |
| 2303 |
\@PackageError\ZREF@name{% |
| 2304 |
Property `\ZREF@P' already exists% |
| 2305 |
}\@ehc |
| 2306 |
\def\ZREF@@newprop[##1]##2{\endgroup}% |
| 2307 |
}% |
| 2308 |
\fi |
| 2309 |
\@ifnextchar[\ZREF@@newprop{\ZREF@@newprop[\zref@default]}% |
| 2310 |
} |
| 2311 |
% \end{macrocode} |
| 2312 |
% \end{macro} |
| 2313 |
% \begin{macro}{\ZREF@par} |
| 2314 |
% \begin{macrocode} |
| 2315 |
\def\ZREF@par{par} |
| 2316 |
\@onelevel@sanitize\ZREF@par |
| 2317 |
% \end{macrocode} |
| 2318 |
% \end{macro} |
| 2319 |
% \begin{macro}{\ZREF@@newprop} |
| 2320 |
% \begin{macrocode} |
| 2321 |
\def\ZREF@@newprop[#1]{% |
| 2322 |
\global\@namedef{Z@D@\ZREF@P}{#1}% |
| 2323 |
\global\expandafter\let\csname Z@X@\ZREF@P\endcsname\ZREF@X |
| 2324 |
\begingroup\expandafter\endgroup |
| 2325 |
\expandafter\ZREF@@@newprop\csname\ZREF@P\endcsname |
| 2326 |
\expandafter\gdef\csname Z@C@\ZREF@P\endcsname{}% |
| 2327 |
\zref@setcurrent\ZREF@P |
| 2328 |
} |
| 2329 |
\def\ZREF@@@newprop#1{% |
| 2330 |
\expandafter |
| 2331 |
\gdef\csname Z@E@\ZREF@P\endcsname##1#1##2##3\ZREF@nil{##2}% |
| 2332 |
} |
| 2333 |
% \end{macrocode} |
| 2334 |
% \end{macro} |
| 2335 |
% |
| 2336 |
% \begin{macro}{\zref@showprop} |
| 2337 |
% \begin{macrocode} |
| 2338 |
\ZREF@Robust\def\zref@showprop#1{% |
| 2339 |
\zref@ifpropundefined{#1}{% |
| 2340 |
\@PackageInfoNoLine{\ZREF@name}{% |
| 2341 |
Show property `#1': <undefined>% |
| 2342 |
}% |
| 2343 |
}{% |
| 2344 |
\begingroup |
| 2345 |
\toks@\expandafter\expandafter\expandafter{% |
| 2346 |
\csname Z@C@#1\endcsname |
| 2347 |
}% |
| 2348 |
\edef\ZREF@value{\the\toks@}% |
| 2349 |
\ltx@onelevel@sanitize\ZREF@value |
| 2350 |
\toks@\expandafter\expandafter\expandafter{% |
| 2351 |
\csname Z@D@#1\endcsname |
| 2352 |
}% |
| 2353 |
\edef\ZREF@default{\the\toks@}% |
| 2354 |
\ltx@onelevel@sanitize\ZREF@default |
| 2355 |
\@PackageInfoNoLine{\ZREF@name}{% |
| 2356 |
Show property `#1':\MessageBreak |
| 2357 |
\expandafter\ifx\csname Z@X@#1\endcsname\ltx@empty |
| 2358 |
Immediate % |
| 2359 |
\else |
| 2360 |
Delayed % |
| 2361 |
\fi |
| 2362 |
value: [\ZREF@value]\MessageBreak |
| 2363 |
Default: [\ZREF@default]% |
| 2364 |
}% |
| 2365 |
\endgroup |
| 2366 |
}% |
| 2367 |
} |
| 2368 |
% \end{macrocode} |
| 2369 |
% \end{macro} |
| 2370 |
% |
| 2371 |
% \begin{macro}{\zref@setcurrent} |
| 2372 |
% \cs{zref@setcurrent} sets the current value for a property. |
| 2373 |
% \begin{macrocode} |
| 2374 |
\ZREF@Robust\def\zref@setcurrent#1#2{% |
| 2375 |
\zref@propexists{#1}{% |
| 2376 |
\expandafter\def\csname Z@C@#1\endcsname{#2}% |
| 2377 |
}% |
| 2378 |
} |
| 2379 |
% \end{macrocode} |
| 2380 |
% \end{macro} |
| 2381 |
% |
| 2382 |
% \begin{macro}{\ZREF@getcurrent} |
| 2383 |
% \cs{zref@getcurrent} gets the current value for a property. |
| 2384 |
% \begin{macrocode} |
| 2385 |
\def\ZREF@getcurrent#1{% |
| 2386 |
\romannumeral0% |
| 2387 |
\ltx@ifundefined{Z@C@#1}{% |
| 2388 |
\ltx@space |
| 2389 |
}{% |
| 2390 |
\expandafter\expandafter\expandafter\ltx@space |
| 2391 |
\csname Z@C@#1\endcsname |
| 2392 |
}% |
| 2393 |
} |
| 2394 |
% \end{macrocode} |
| 2395 |
% \end{macro} |
| 2396 |
% \begin{macro}{\ZREF@u@getcurrent} |
| 2397 |
% \begin{macrocode} |
| 2398 |
\def\ZREF@wu@getcurrent#1{% |
| 2399 |
\etex@unexpanded\expandafter\expandafter\expandafter{% |
| 2400 |
\ZREF@getcurrent{#1}% |
| 2401 |
}% |
| 2402 |
} |
| 2403 |
% \end{macrocode} |
| 2404 |
% \end{macro} |
| 2405 |
% \begin{macro}{\zref@getcurrent} |
| 2406 |
% \begin{macrocode} |
| 2407 |
\let\zref@getcurrent\ZREF@getcurrent |
| 2408 |
% \end{macrocode} |
| 2409 |
% \end{macro} |
| 2410 |
% |
| 2411 |
% \subsubsection{Reference generation} |
| 2412 |
% |
| 2413 |
% \begin{macro}{\zref@label} |
| 2414 |
% Label macro that uses the main property list. |
| 2415 |
% \begin{macrocode} |
| 2416 |
\ZREF@Robust\def\zref@label#1{% |
| 2417 |
\zref@labelbylist{#1}\ZREF@mainlist |
| 2418 |
} |
| 2419 |
% \end{macrocode} |
| 2420 |
% \end{macro} |
| 2421 |
% \begin{macro}{\zref@labelbylist} |
| 2422 |
% Label macro that stores the properties, specified in the |
| 2423 |
% property list \verb|#2|. |
| 2424 |
% \begin{macrocode} |
| 2425 |
\ZREF@Robust\def\zref@labelbylist#1#2{% |
| 2426 |
\@bsphack |
| 2427 |
\zref@listexists{#2}{% |
| 2428 |
\expandafter\expandafter\expandafter\ZREF@label |
| 2429 |
\expandafter\expandafter\expandafter{% |
| 2430 |
\csname Z@L@#2\endcsname |
| 2431 |
}{#1}% |
| 2432 |
}% |
| 2433 |
\@esphack |
| 2434 |
} |
| 2435 |
% \end{macrocode} |
| 2436 |
% \end{macro} |
| 2437 |
% \begin{macro}{\zref@labelbyprops} |
| 2438 |
% The properties are directly specified in a comma separated list. |
| 2439 |
% \begin{macrocode} |
| 2440 |
\ZREF@Robust\def\zref@labelbyprops#1#2{% |
| 2441 |
\@bsphack |
| 2442 |
\begingroup |
| 2443 |
\toks@{}% |
| 2444 |
\comma@parse{#2}{% |
| 2445 |
\zref@ifpropundefined\comma@entry{% |
| 2446 |
\PackageWarning\ZREF@name{% |
| 2447 |
Property `\comma@entry' is not known% |
| 2448 |
}% |
| 2449 |
}{% |
| 2450 |
\toks@\expandafter{% |
| 2451 |
\the\expandafter\toks@\csname\comma@entry\endcsname |
| 2452 |
}% |
| 2453 |
}% |
| 2454 |
\ltx@gobble |
| 2455 |
}% |
| 2456 |
\expandafter\endgroup |
| 2457 |
\expandafter\ZREF@label\expandafter{\the\toks@}{#1}% |
| 2458 |
\@esphack |
| 2459 |
} |
| 2460 |
% \end{macrocode} |
| 2461 |
% \end{macro} |
| 2462 |
% \begin{macro}{\zref@labelbykv} |
| 2463 |
% \begin{macrocode} |
| 2464 |
\ZREF@Robust\def\zref@labelbykv#1#2{% |
| 2465 |
\@bsphack |
| 2466 |
\begingroup |
| 2467 |
\let\Z@L@ZREF@temp\ltx@empty |
| 2468 |
\kvsetkeys{ZREF@LABEL}{#1}% |
| 2469 |
\ifZREF@immediate |
| 2470 |
\expandafter\zref@wrapper@immediate\expandafter{% |
| 2471 |
\expandafter\ZREF@label\expandafter{\Z@L@ZREF@temp}{#2}% |
| 2472 |
}% |
| 2473 |
\else |
| 2474 |
\expandafter\ZREF@label\expandafter{\Z@L@ZREF@temp}{#2}% |
| 2475 |
\fi |
| 2476 |
\endgroup |
| 2477 |
\@esphack |
| 2478 |
} |
| 2479 |
% \end{macrocode} |
| 2480 |
% \end{macro} |
| 2481 |
% \begin{macrocode} |
| 2482 |
\kv@define@key{ZREF@LABEL}{prop}{% |
| 2483 |
\edef\ZREF@param{#1}% |
| 2484 |
\zref@propexists\ZREF@param{% |
| 2485 |
\zref@iflistcontainsprop{ZREF@temp}\ZREF@param{}{% |
| 2486 |
\begingroup\expandafter\endgroup |
| 2487 |
\expandafter\ltx@LocalAppendToMacro |
| 2488 |
\expandafter\Z@L@ZREF@temp |
| 2489 |
\expandafter{\csname\ZREF@param\endcsname}% |
| 2490 |
}% |
| 2491 |
}% |
| 2492 |
} |
| 2493 |
\kv@define@key{ZREF@LABEL}{list}{% |
| 2494 |
\zref@listforloop{#1}{% |
| 2495 |
\zref@iflistcontainsprop{ZREF@temp}\zref@prop{}{% |
| 2496 |
\begingroup\expandafter\endgroup |
| 2497 |
\expandafter\ltx@LocalAppendToMacro |
| 2498 |
\expandafter\Z@L@ZREF@temp |
| 2499 |
\expandafter{\csname\zref@prop\endcsname}% |
| 2500 |
}% |
| 2501 |
\ltx@gobble |
| 2502 |
}% |
| 2503 |
} |
| 2504 |
\kv@define@key{ZREF@LABEL}{delprop}{% |
| 2505 |
\zref@propexists{#1}{% |
| 2506 |
\zref@localdelprop{ZREF@temp}{#1}% |
| 2507 |
}% |
| 2508 |
} |
| 2509 |
\kv@define@key{ZREF@LABEL}{immediate}[true]{% |
| 2510 |
\edef\ZREF@param{#1}% |
| 2511 |
\ifx\ZREF@param\ZREF@true |
| 2512 |
\ZREF@immediatetrue |
| 2513 |
\else |
| 2514 |
\ifx\ZREF@param\ZREF@false |
| 2515 |
\ZREF@immediatefalse |
| 2516 |
\else |
| 2517 |
\PackageWarning\ZREF@name{% |
| 2518 |
Option `immediate' expects `true' or `false'.\MessageBreak |
| 2519 |
Ignoring invalid value `\ZREF@param'% |
| 2520 |
}% |
| 2521 |
\fi |
| 2522 |
\fi |
| 2523 |
} |
| 2524 |
% \end{macrocode} |
| 2525 |
% \begin{macro}{\ZREF@false} |
| 2526 |
% \begin{macrocode} |
| 2527 |
\def\ZREF@false{false} |
| 2528 |
% \end{macrocode} |
| 2529 |
% \end{macro} |
| 2530 |
% \begin{macro}{\ZREF@true} |
| 2531 |
% \begin{macrocode} |
| 2532 |
\def\ZREF@true{true} |
| 2533 |
% \end{macrocode} |
| 2534 |
% \end{macro} |
| 2535 |
% |
| 2536 |
% \begin{macrocode} |
| 2537 |
\kv@define@key{ZREF@LABEL}{values}[]{% |
| 2538 |
\kv@parse{#1}{% |
| 2539 |
\ifx\kv@value\relax |
| 2540 |
\@PackageWarning\ZREF@name{% |
| 2541 |
Missing value for property `\kv@key'% |
| 2542 |
}% |
| 2543 |
\expandafter\ltx@gobbletwo |
| 2544 |
\else |
| 2545 |
\expandafter\zref@setcurrent |
| 2546 |
\fi |
| 2547 |
}% |
| 2548 |
} |
| 2549 |
% \end{macrocode} |
| 2550 |
% |
| 2551 |
% \begin{macro}{\ifZREF@immediate} |
| 2552 |
% The switch \cs{ifZREF@immediate} tells us, whether the |
| 2553 |
% label should be written immediately or at page shipout time. |
| 2554 |
% \cs{ZREF@label} need to be notified about this, because |
| 2555 |
% it must disable the deferred execution of property values, |
| 2556 |
% if the label is written immediately. |
| 2557 |
% \begin{macrocode} |
| 2558 |
\newif\ifZREF@immediate |
| 2559 |
% \end{macrocode} |
| 2560 |
% \end{macro} |
| 2561 |
% \begin{macro}{\zref@wrapper@immediate} |
| 2562 |
% The argument of \cs{zref@wrapper@immediate} is executed inside |
| 2563 |
% a group where \cs{write} is redefined by adding |
| 2564 |
% \cs{immediate} before its execution. Also \cs{ZREF@label} |
| 2565 |
% is notified via the switch \cs{ifZREF@immediate}. |
| 2566 |
% \begin{macrocode} |
| 2567 |
\ZREF@Robust{\long\def}\zref@wrapper@immediate#1{% |
| 2568 |
\begingroup |
| 2569 |
\ZREF@immediatetrue |
| 2570 |
\let\ZREF@org@write\write |
| 2571 |
\def\write{\immediate\ZREF@org@write}% |
| 2572 |
#1% |
| 2573 |
\endgroup |
| 2574 |
} |
| 2575 |
% \end{macrocode} |
| 2576 |
% \end{macro} |
| 2577 |
% |
| 2578 |
% \begin{macro}{\ZREF@label} |
| 2579 |
% \cs{ZREF@label} writes the data in the \xfile{.aux} file. |
| 2580 |
% \verb|#1| contains the list of valid properties, |
| 2581 |
% \verb|#2| the name of the reference. In case of immediate |
| 2582 |
% writing, the deferred execution of property values is |
| 2583 |
% disabled. Also \thepage is made expandable in this case. |
| 2584 |
% \begin{macrocode} |
| 2585 |
\def\ZREF@label#1#2{% |
| 2586 |
\if@filesw |
| 2587 |
\begingroup |
| 2588 |
\ifZREF@immediate |
| 2589 |
\let\ZREF@org@thepage\thepage |
| 2590 |
\fi |
| 2591 |
\protected@write\@auxout{% |
| 2592 |
\ifZREF@immediate |
| 2593 |
\let\thepage\ZREF@org@thepage |
| 2594 |
\fi |
| 2595 |
\let\ZREF@temp\ltx@empty |
| 2596 |
\@tfor\ZREF@P:=#1\do{% |
| 2597 |
\begingroup |
| 2598 |
\escapechar=-1 % |
| 2599 |
\edef\x{\endgroup |
| 2600 |
\def\noexpand\ZREF@P{% |
| 2601 |
\expandafter\string\ZREF@P |
| 2602 |
}% |
| 2603 |
}% |
| 2604 |
\x |
| 2605 |
\expandafter\ifx |
| 2606 |
\csname |
| 2607 |
\ifZREF@immediate |
| 2608 |
relax% |
| 2609 |
\else |
| 2610 |
Z@X@\ZREF@P% |
| 2611 |
\fi |
| 2612 |
\endcsname |
| 2613 |
\noexpand |
| 2614 |
\expandafter\let\csname Z@C@\ZREF@P\endcsname\relax |
| 2615 |
\fi |
| 2616 |
\toks@\expandafter{\ZREF@temp}% |
| 2617 |
\edef\ZREF@temp{% |
| 2618 |
\the\toks@ |
| 2619 |
\ltx@backslashchar\ZREF@P{% |
| 2620 |
\expandafter\noexpand\csname Z@C@\ZREF@P\endcsname |
| 2621 |
}% |
| 2622 |
}% |
| 2623 |
}% |
| 2624 |
}{% |
| 2625 |
\string\zref@newlabel{#2}{\ZREF@temp}% |
| 2626 |
}% |
| 2627 |
\endgroup |
| 2628 |
\fi |
| 2629 |
} |
| 2630 |
\def\ZREF@addtoks#1{% |
| 2631 |
\toks@\expandafter\expandafter\expandafter{% |
| 2632 |
\expandafter\the\expandafter\toks@#1% |
| 2633 |
}% |
| 2634 |
} |
| 2635 |
% \end{macrocode} |
| 2636 |
% \end{macro} |
| 2637 |
% |
| 2638 |
% \subsubsection{Reference querying and extracting} |
| 2639 |
% |
| 2640 |
% Design goal for the extracting macros is that the extraction |
| 2641 |
% process is full expandable. Thus these macros can be used |
| 2642 |
% in expandable contexts. But there are problems that cannot |
| 2643 |
% be solved by full expandable macros: |
| 2644 |
% \begin{itemize} |
| 2645 |
% \item In standard \hologo{LaTeX} undefined references sets a flag |
| 2646 |
% and generate a warning. Both actions are not expandable. |
| 2647 |
% \item Babel's support for its shorthand uses commands that |
| 2648 |
% use non-expandable assignments. However currently there |
| 2649 |
% is hope, that primitives are added to \pdfTeX\ that |
| 2650 |
% allows the detection of contexts. Then the shorthand |
| 2651 |
% can detect, if they are executed inside \cs{csname} |
| 2652 |
% and protect themselves automatically. |
| 2653 |
% \end{itemize} |
| 2654 |
% \begin{macro}{\zref@ifrefundefined} |
| 2655 |
% If a reference \verb|#1| is undefined, then macro |
| 2656 |
% \cs{zref@ifrefundefined} calls \verb|#2| and \verb|#3| otherwise. |
| 2657 |
% \begin{macrocode} |
| 2658 |
\def\zref@ifrefundefined#1{% |
| 2659 |
\ltx@ifundefined{Z@R@#1}% |
| 2660 |
} |
| 2661 |
% \end{macrocode} |
| 2662 |
% \end{macro} |
| 2663 |
% |
| 2664 |
% \begin{macro}{\zifrefundefined} |
| 2665 |
% If a reference \verb|#1| is undefined, then macro |
| 2666 |
% \cs{zref@ifrefundefined} calls \verb|#2| and \verb|#3| otherwise. |
| 2667 |
% Also the reference is marked used. |
| 2668 |
% \begin{macrocode} |
| 2669 |
\ZREF@IfDefinable\zifrefundefined\def{% |
| 2670 |
#1{% |
| 2671 |
\zref@wrapper@babel\ZREF@ifrefundefined{#1}% |
| 2672 |
}% |
| 2673 |
} |
| 2674 |
% \end{macrocode} |
| 2675 |
% \end{macro} |
| 2676 |
% \begin{macro}{\ZREF@ifrefundefined} |
| 2677 |
% \begin{macrocode} |
| 2678 |
\def\ZREF@ifrefundefined#1{% |
| 2679 |
\zref@refused{#1}% |
| 2680 |
\zref@ifrefundefined{#1}% |
| 2681 |
} |
| 2682 |
% \end{macrocode} |
| 2683 |
% \end{macro} |
| 2684 |
% |
| 2685 |
% \begin{macro}{\zref@refused} |
| 2686 |
% The problem with undefined references is addressed by |
| 2687 |
% the macro \cs{zref@refused}. This can be used outside |
| 2688 |
% the expandable context. In case of an undefined reference |
| 2689 |
% the flag is set to notify \hologo{LaTeX} and a warning is given. |
| 2690 |
% \begin{macrocode} |
| 2691 |
\ZREF@Robust\def\zref@refused#1{% |
| 2692 |
\zref@wrapper@babel\ZREF@refused{#1}% |
| 2693 |
} |
| 2694 |
% \end{macrocode} |
| 2695 |
% \end{macro} |
| 2696 |
% \begin{macro}{\ZREF@refused} |
| 2697 |
% \begin{macrocode} |
| 2698 |
\def\ZREF@refused#1{% |
| 2699 |
\zref@ifrefundefined{#1}{% |
| 2700 |
\protect\G@refundefinedtrue |
| 2701 |
\@latex@warning{% |
| 2702 |
Reference `#1' on page \thepage \space undefined% |
| 2703 |
}% |
| 2704 |
}{}% |
| 2705 |
} |
| 2706 |
% \end{macrocode} |
| 2707 |
% \end{macro} |
| 2708 |
% |
| 2709 |
% \begin{macro}{\zref@ifrefcontainsprop} |
| 2710 |
% \cs{zref@ifrefcontainsprop} looks, if the reference \verb|#1| |
| 2711 |
% has the property \verb|#2| and calls then \verb|#3| and |
| 2712 |
% \verb|#4| otherwise. \verb|#2| must be a defined property. |
| 2713 |
% \begin{macrocode} |
| 2714 |
\def\zref@ifrefcontainsprop#1#2{% |
| 2715 |
\zref@ifrefundefined{#1}{% |
| 2716 |
\ltx@secondoftwo |
| 2717 |
}{% |
| 2718 |
\expandafter\ZREF@ifrefcontainsprop |
| 2719 |
\csname Z@E@#2\expandafter\endcsname |
| 2720 |
\csname#2\expandafter\expandafter\expandafter\endcsname |
| 2721 |
\expandafter\expandafter\expandafter{% |
| 2722 |
\csname Z@R@#1\endcsname |
| 2723 |
}% |
| 2724 |
}% |
| 2725 |
} |
| 2726 |
\def\ZREF@ifrefcontainsprop#1#2#3{% |
| 2727 |
\expandafter\ifx\expandafter\ZREF@novalue |
| 2728 |
#1#3#2\ZREF@novalue\ZREF@nil\ltx@empty |
| 2729 |
\expandafter\ltx@secondoftwo |
| 2730 |
\else |
| 2731 |
\expandafter\ltx@firstoftwo |
| 2732 |
\fi |
| 2733 |
} |
| 2734 |
\def\ZREF@novalue{\ZREF@NOVALUE} |
| 2735 |
% \end{macrocode} |
| 2736 |
% \end{macro} |
| 2737 |
% |
| 2738 |
% \begin{macro}{\zref@extract} |
| 2739 |
% \cs{zref@extract} is an abbreviation for the case |
| 2740 |
% that the default of the property is used as default |
| 2741 |
% value. |
| 2742 |
% \begin{macrocode} |
| 2743 |
\def\ZREF@extract#1#2{% |
| 2744 |
\romannumeral0% |
| 2745 |
\ltx@ifundefined{Z@D@#2}{% |
| 2746 |
\expandafter\ltx@space\zref@default |
| 2747 |
}{% |
| 2748 |
\expandafter\expandafter\expandafter\ZREF@@extract |
| 2749 |
\expandafter\expandafter\expandafter{% |
| 2750 |
\csname Z@D@#2\endcsname |
| 2751 |
}{#1}{#2}% |
| 2752 |
}% |
| 2753 |
} |
| 2754 |
% \end{macrocode} |
| 2755 |
% \end{macro} |
| 2756 |
% \begin{macro}{\ZREF@@extract} |
| 2757 |
% \begin{macrocode} |
| 2758 |
\def\ZREF@@extract#1#2#3{% |
| 2759 |
\expandafter\expandafter\expandafter\ltx@space |
| 2760 |
\zref@extractdefault{#2}{#3}{#1}% |
| 2761 |
} |
| 2762 |
% \end{macrocode} |
| 2763 |
% \end{macro} |
| 2764 |
% \begin{macro}{\ZREF@wu@extract} |
| 2765 |
% \begin{macrocode} |
| 2766 |
\def\ZREF@wu@extract#1#2{% |
| 2767 |
\etex@unexpanded\expandafter\expandafter\expandafter{% |
| 2768 |
\ZREF@extract{#1}{#2}% |
| 2769 |
}% |
| 2770 |
} |
| 2771 |
% \end{macrocode} |
| 2772 |
% \end{macro} |
| 2773 |
% \begin{macro}{\zref@extract} |
| 2774 |
% \begin{macrocode} |
| 2775 |
\let\zref@extract\ZREF@extract |
| 2776 |
% \end{macrocode} |
| 2777 |
% \end{macro} |
| 2778 |
% |
| 2779 |
% \begin{macro}{\ZREF@extractdefault} |
| 2780 |
% The basic extracting macro is \cs{zref@extractdefault} with |
| 2781 |
% the reference name in \verb|#1|, the property in \verb|#2| and |
| 2782 |
% the default value in \verb|#3| in case for problems. |
| 2783 |
% \begin{macrocode} |
| 2784 |
\def\ZREF@extractdefault#1#2#3{% |
| 2785 |
\romannumeral0% |
| 2786 |
\zref@ifrefundefined{#1}\ltx@firstoftwo{% |
| 2787 |
\zref@ifpropundefined{#2}\ltx@firstoftwo\ltx@secondoftwo |
| 2788 |
}{% |
| 2789 |
\ltx@space |
| 2790 |
#3% |
| 2791 |
}{% |
| 2792 |
\expandafter\expandafter\expandafter\ltx@space |
| 2793 |
\csname Z@E@#2\expandafter\expandafter\expandafter\endcsname |
| 2794 |
\csname Z@R@#1\expandafter\endcsname |
| 2795 |
\csname#2\endcsname{#3}\ZREF@nil |
| 2796 |
}% |
| 2797 |
} |
| 2798 |
% \end{macrocode} |
| 2799 |
% \end{macro} |
| 2800 |
% \begin{macro}{\ZREF@wu@extractdefault} |
| 2801 |
% \begin{macrocode} |
| 2802 |
\def\ZREF@wu@extractdefault#1#2#3{% |
| 2803 |
\etex@unexpanded\expandafter\expandafter\expandafter{% |
| 2804 |
\ZREF@extractdefault{#1}{#2}{#3}% |
| 2805 |
}% |
| 2806 |
} |
| 2807 |
% \end{macrocode} |
| 2808 |
% \end{macro} |
| 2809 |
% \begin{macro}{\zref@extractdefault} |
| 2810 |
% \begin{macrocode} |
| 2811 |
\let\zref@extractdefault\ZREF@extractdefault |
| 2812 |
% \end{macrocode} |
| 2813 |
% \end{macro} |
| 2814 |
% |
| 2815 |
% \begin{macro}{\zref@def@extract} |
| 2816 |
% \begin{macrocode} |
| 2817 |
\ZREF@Robust\def\zref@def@extract#1{% |
| 2818 |
\zref@wrapper@babel{\ZREF@def@extract{#1}}% |
| 2819 |
} |
| 2820 |
% \end{macrocode} |
| 2821 |
% \end{macro} |
| 2822 |
% \begin{macro}{\ZREF@def@extract} |
| 2823 |
% \begin{macrocode} |
| 2824 |
\def\ZREF@def@extract#1#2#3{% |
| 2825 |
\zref@refused{#2}% |
| 2826 |
\expandafter\expandafter\expandafter\def |
| 2827 |
\expandafter\expandafter\expandafter#1% |
| 2828 |
\expandafter\expandafter\expandafter{% |
| 2829 |
\zref@extract{#2}{#3}% |
| 2830 |
}% |
| 2831 |
} |
| 2832 |
% \end{macrocode} |
| 2833 |
% \end{macro} |
| 2834 |
% \begin{macro}{\zref@def@extractdefault} |
| 2835 |
% \begin{macrocode} |
| 2836 |
\ZREF@Robust\def\zref@def@extractdefault#1{% |
| 2837 |
\zref@wrapper@babel{\ZREF@def@extractdefault{#1}}% |
| 2838 |
} |
| 2839 |
% \end{macrocode} |
| 2840 |
% \end{macro} |
| 2841 |
% \begin{macro}{\ZREF@def@extractdefault} |
| 2842 |
% \begin{macrocode} |
| 2843 |
\def\ZREF@def@extractdefault#1#2#3#4{% |
| 2844 |
\zref@refused{#2}% |
| 2845 |
\expandafter\expandafter\expandafter\def |
| 2846 |
\expandafter\expandafter\expandafter#1% |
| 2847 |
\expandafter\expandafter\expandafter{% |
| 2848 |
\zref@extractdefault{#2}{#3}{#4}% |
| 2849 |
}% |
| 2850 |
} |
| 2851 |
% \end{macrocode} |
| 2852 |
% \end{macro} |
| 2853 |
% |
| 2854 |
% \begin{macro}{\ZREF@wrapper@unexpanded} |
| 2855 |
% \begin{macrocode} |
| 2856 |
\ZREF@Robust{\long\def}\ZREF@wrapper@unexpanded#1{% |
| 2857 |
\let\zref@wrapper@unexpanded\ltx@firstofone |
| 2858 |
\let\zref@getcurrent\ZREF@wu@getcurrent |
| 2859 |
\let\zref@extractdefault\ZREF@wu@extractdefault |
| 2860 |
\let\zref@extract\ZREF@wu@extract |
| 2861 |
#1% |
| 2862 |
\let\zref@wrapper@unexpanded\ZREF@wrapper@unexpanded |
| 2863 |
\let\zref@getcurrent\ZREF@getcurrent |
| 2864 |
\let\zref@extractdefault\ZREF@extractdefault |
| 2865 |
\let\zref@extract\ZREF@extract |
| 2866 |
} |
| 2867 |
% \end{macrocode} |
| 2868 |
% \end{macro} |
| 2869 |
% \begin{macro}{\zref@wrapper@unexpanded} |
| 2870 |
% \begin{macrocode} |
| 2871 |
\ltx@IfUndefined{etex@unexpanded}{% |
| 2872 |
\let\zref@wrapper@unexpanded\ltx@firstofone |
| 2873 |
}{% |
| 2874 |
\let\zref@wrapper@unexpanded\ZREF@wrapper@unexpanded |
| 2875 |
} |
| 2876 |
% \end{macrocode} |
| 2877 |
% \end{macro} |
| 2878 |
% |
| 2879 |
% \subsubsection{Compatibility with \xpackage{babel}} |
| 2880 |
% |
| 2881 |
% \begin{macro}{\zref@wrapper@babel} |
| 2882 |
% \begin{macrocode} |
| 2883 |
\ZREF@Robust{\long\def}\zref@wrapper@babel#1#2{% |
| 2884 |
\ifcsname if@safe@actives\endcsname |
| 2885 |
\expandafter\ltx@firstofone |
| 2886 |
\else |
| 2887 |
\expandafter\ltx@secondoftwo |
| 2888 |
\fi |
| 2889 |
{% |
| 2890 |
\if@safe@actives |
| 2891 |
\expandafter\ltx@secondoftwo |
| 2892 |
\else |
| 2893 |
\expandafter\ltx@firstoftwo |
| 2894 |
\fi |
| 2895 |
{% |
| 2896 |
\begingroup |
| 2897 |
\csname @safe@activestrue\endcsname |
| 2898 |
\edef\x{#2}% |
| 2899 |
\expandafter\endgroup |
| 2900 |
\expandafter\ZREF@wrapper@babel\expandafter{\x}{#1}% |
| 2901 |
}% |
| 2902 |
}{% |
| 2903 |
#1{#2}% |
| 2904 |
}% |
| 2905 |
} |
| 2906 |
\long\def\ZREF@wrapper@babel#1#2{% |
| 2907 |
#2{#1}% |
| 2908 |
} |
| 2909 |
% \end{macrocode} |
| 2910 |
% \end{macro} |
| 2911 |
% |
| 2912 |
% \subsubsection{Unique counter support} |
| 2913 |
% |
| 2914 |
% \begin{macro}{\zref@require@unique} |
| 2915 |
% Generate the counter |zref@unique| if the counter does not |
| 2916 |
% already exist. |
| 2917 |
% change 2022-08-03: The counter is no longer removed from the reset, |
| 2918 |
% so that the behaviour with includeonly is improved, see issue |
| 2919 |
% https://github.com/ho-tex/zref/issues/10 |
| 2920 |
% \begin{macrocode} |
| 2921 |
\ZREF@Robust\def\zref@require@unique{% |
| 2922 |
\@ifundefined{c@zref@unique}{% |
| 2923 |
\newcounter{zref@unique}% |
| 2924 |
% \end{macrocode} |
| 2925 |
% \end{macro} |
| 2926 |
% |
| 2927 |
% \begin{macro}{\thezref@unique} |
| 2928 |
% \cs{thezref@unique} is used for automatically generated unique |
| 2929 |
% labelnames. |
| 2930 |
% \begin{macrocode} |
| 2931 |
\renewcommand*{\thezref@unique}{% |
| 2932 |
zref@\number\c@zref@unique |
| 2933 |
}% |
| 2934 |
% \end{macrocode} |
| 2935 |
% To improve the behaviour if include/includeonly is used, we round the |
| 2936 |
% counter up at every include, see https://github.com/ho-tex/zref/issues/10 |
| 2937 |
% \begin{macrocode} |
| 2938 |
\IfFormatAtLeastTF{2020/10/01} |
| 2939 |
{% |
| 2940 |
\AddToHook |
| 2941 |
{include/after} |
| 2942 |
{\setcounter{zref@unique} |
| 2943 |
{\csname fp_to_int:n\endcsname{ceil(\c@zref@unique +100,-2)}}} |
| 2944 |
}{}% |
| 2945 |
}{}% |
| 2946 |
} |
| 2947 |
% \end{macrocode} |
| 2948 |
% \end{macro} |
| 2949 |
% |
| 2950 |
% |
| 2951 |
% \subsubsection{Utilities} |
| 2952 |
% |
| 2953 |
% \begin{macro}{\ZREF@number} |
| 2954 |
% \begin{macrocode} |
| 2955 |
\ltx@IfUndefined{numexpr}{% |
| 2956 |
\def\ZREF@number#1{\number#1}% |
| 2957 |
}{% |
| 2958 |
\def\ZREF@number#1{\the\numexpr(#1)\relax}% |
| 2959 |
} |
| 2960 |
% \end{macrocode} |
| 2961 |
% \end{macro} |
| 2962 |
% |
| 2963 |
% \subsubsection{Setup} |
| 2964 |
% |
| 2965 |
% \begin{macro}{\zref@setdefault} |
| 2966 |
% Standard \hologo{LaTeX} prints ``??'' in bold face if a reference |
| 2967 |
% is not known. \cs{zref@default} holds the text that is |
| 2968 |
% printed in case of unknown references and is used, if |
| 2969 |
% the default was not specified during the definition |
| 2970 |
% of the new property by \cs{ref@newprop}. |
| 2971 |
% The global default value can be set by \cs{zref@setdefault}. |
| 2972 |
% \begin{macrocode} |
| 2973 |
\ZREF@Robust\def\zref@setdefault#1{% |
| 2974 |
\def\zref@default{#1}% |
| 2975 |
} |
| 2976 |
% \end{macrocode} |
| 2977 |
% \end{macro} |
| 2978 |
% \begin{macro}{\zref@default} |
| 2979 |
% Now we initialize \cs{zref@default} with the same value |
| 2980 |
% that \hologo{LaTeX} uses for its undefined references. |
| 2981 |
% \begin{macrocode} |
| 2982 |
\zref@setdefault{% |
| 2983 |
\nfss@text{\reset@font\bfseries ??}% |
| 2984 |
} |
| 2985 |
% \end{macrocode} |
| 2986 |
% \end{macro} |
| 2987 |
% |
| 2988 |
% \paragraph{Main property list.} |
| 2989 |
% |
| 2990 |
% \begin{macro}{\zref@setmainlist} |
| 2991 |
% The name of the default property list is stored in |
| 2992 |
% \cs{ZREF@mainlist} and can be set by \cs{zref@setmainlist}. |
| 2993 |
% \begin{macrocode} |
| 2994 |
\ZREF@Robust\def\zref@setmainlist#1{% |
| 2995 |
\def\ZREF@mainlist{#1}% |
| 2996 |
} |
| 2997 |
\zref@setmainlist{main} |
| 2998 |
% \end{macrocode} |
| 2999 |
% \end{macro} |
| 3000 |
% Now we create the list. |
| 3001 |
% \begin{macrocode} |
| 3002 |
\zref@newlist\ZREF@mainlist |
| 3003 |
% \end{macrocode} |
| 3004 |
% |
| 3005 |
% \paragraph{Main properties.} |
| 3006 |
% |
| 3007 |
% The two properties \texttt{default} and \texttt{page} |
| 3008 |
% are created and added to the main property list. |
| 3009 |
% They store the data that |
| 3010 |
% standard \hologo{LaTeX} uses in its references created by |
| 3011 |
% \cs{label}. |
| 3012 |
% \begin{description} |
| 3013 |
% \item[\texttt{default}] the appearance of the latest |
| 3014 |
% counter that is incremented by \cs{refstepcounter} |
| 3015 |
% \item[\texttt{page}] the appearance of the page counter |
| 3016 |
% \end{description} |
| 3017 |
% \begin{macrocode} |
| 3018 |
\zref@newprop{default}{\@currentlabel} |
| 3019 |
\zref@newprop*{page}{\thepage} |
| 3020 |
\zref@addprops\ZREF@mainlist{default,page} |
| 3021 |
% \end{macrocode} |
| 3022 |
% |
| 3023 |
% \paragraph{Properties} |
| 3024 |
% |
| 3025 |
% \begin{macro}{\ZREF@NewPropAnchor} |
| 3026 |
% \begin{macrocode} |
| 3027 |
\def\ZREF@NewPropAnchor{% |
| 3028 |
\zref@newprop{anchor}{% |
| 3029 |
\ltx@ifundefined{@currentHref}{}{\@currentHref}% |
| 3030 |
}% |
| 3031 |
\global\let\ZREF@NewPropAnchor\relax |
| 3032 |
} |
| 3033 |
% \end{macrocode} |
| 3034 |
% \end{macro} |
| 3035 |
% \begin{macro}{\zref@titleref@current} |
| 3036 |
% Later we will redefine the section and caption macros |
| 3037 |
% to catch the current title and remember the value in |
| 3038 |
% \cs{zref@titleref@current}. |
| 3039 |
% \begin{macro}{\ZREF@NewPropTitle} |
| 3040 |
% \begin{macrocode} |
| 3041 |
\def\ZREF@NewPropTitle{% |
| 3042 |
\gdef\zref@titleref@current{}% |
| 3043 |
\zref@newprop{title}{\zref@titleref@current}% |
| 3044 |
\global\let\ZREF@NewPropTitle\relax |
| 3045 |
} |
| 3046 |
% \end{macrocode} |
| 3047 |
% \end{macro} |
| 3048 |
% \end{macro} |
| 3049 |
% \begin{macro}{\ZREF@NewPropTheotype} |
| 3050 |
% \begin{macrocode} |
| 3051 |
\def\ZREF@NewPropTheotype{% |
| 3052 |
\zref@newprop{theotype}{}% |
| 3053 |
\global\let\ZREF@NewPropTheotype\relax |
| 3054 |
} |
| 3055 |
% \end{macrocode} |
| 3056 |
% \end{macro} |
| 3057 |
% \begin{macro}{\ZREF@NewPropPageValue} |
| 3058 |
% \begin{macrocode} |
| 3059 |
\def\ZREF@NewPropPageValue{% |
| 3060 |
\zref@newprop*{pagevalue}[0]{\number\c@page}% |
| 3061 |
\global\let\ZREF@NewPropPageValue\relax |
| 3062 |
} |
| 3063 |
% \end{macrocode} |
| 3064 |
% \end{macro} |
| 3065 |
% |
| 3066 |
% \paragraph{Mark successful loading} |
| 3067 |
% |
| 3068 |
% \begin{macrocode} |
| 3069 |
\let\ZREF@base@ok=Y |
| 3070 |
%</base> |
| 3071 |
% \end{macrocode} |
| 3072 |
% |
| 3073 |
% |
| 3074 |
% \subsection{Module \xmodule{user}} |
| 3075 |
% |
| 3076 |
% \begin{macrocode} |
| 3077 |
%<*user> |
| 3078 |
\NeedsTeXFormat{LaTeX2e} |
| 3079 |
\ProvidesPackage{zref-user}% |
| 3080 |
[2026-03-07 v2.37 Module user for zref (HO)]% |
| 3081 |
\RequirePackage{zref-base}[2019/11/29] |
| 3082 |
\ifx\ZREF@base@ok Y% |
| 3083 |
\else |
| 3084 |
\expandafter\endinput |
| 3085 |
\fi |
| 3086 |
% \end{macrocode} |
| 3087 |
% |
| 3088 |
% Module \xmodule{user} enables a small user interface. |
| 3089 |
% All macros are prefixed by \cs{z}. |
| 3090 |
% |
| 3091 |
% First we define the pendants to the standard \hologo{LaTeX} referencing |
| 3092 |
% commands \cs{label}, \cs{ref}, and \cs{pageref}. |
| 3093 |
% |
| 3094 |
% \begin{macro}{\zlabel} |
| 3095 |
% Similar to \cs{label} the macro \cs{zlabel} writes a reference |
| 3096 |
% entry in the \xfile{.aux} file. The main property list is used. |
| 3097 |
% Also we add the babel patch. The \cs{label} command can also be |
| 3098 |
% used inside section titles, but it must not go into the |
| 3099 |
% table of contents. Therefore we have to check this situation. |
| 3100 |
% \begin{macrocode} |
| 3101 |
\IfFormatAtLeastTF{2025-06-01} |
| 3102 |
{ |
| 3103 |
\newcommand*\zlabel{% |
| 3104 |
\ifx\label\@gobble@om |
| 3105 |
\expandafter\ltx@gobble |
| 3106 |
\else |
| 3107 |
\expandafter\zref@wrapper@babel\expandafter\zref@label |
| 3108 |
\fi |
| 3109 |
} |
| 3110 |
} |
| 3111 |
{ |
| 3112 |
\newcommand*\zlabel{% |
| 3113 |
\ifx\label\ltx@gobble |
| 3114 |
\expandafter\ltx@gobble |
| 3115 |
\else |
| 3116 |
\expandafter\zref@wrapper@babel\expandafter\zref@label |
| 3117 |
\fi |
| 3118 |
} |
| 3119 |
}% |
| 3120 |
% \end{macrocode} |
| 3121 |
% \end{macro} |
| 3122 |
% |
| 3123 |
% \begin{macro}{\zkvlabel} |
| 3124 |
% \begin{macrocode} |
| 3125 |
\newcommand*{\zkvlabel}[1]{% |
| 3126 |
\ifx\label\ltx@gobble |
| 3127 |
\expandafter\ltx@gobblethree |
| 3128 |
\fi |
| 3129 |
\zref@wrapper@babel{\zref@labelbykv{#1}}% |
| 3130 |
}% |
| 3131 |
% \end{macrocode} |
| 3132 |
% \end{macro} |
| 3133 |
% |
| 3134 |
% \begin{macro}{\zref} |
| 3135 |
% Macro \cs{zref} is the corresponding macro for \cs{ref}. |
| 3136 |
% Also it provides an optional argument in order to |
| 3137 |
% select another property. |
| 3138 |
% \begin{macrocode} |
| 3139 |
\newcommand*{\zref}[2][default]{% robust because of optional argument |
| 3140 |
\zref@propexists{#1}{% |
| 3141 |
\zref@wrapper@babel\ZREF@zref{#2}{#1}% |
| 3142 |
}% |
| 3143 |
}% |
| 3144 |
\def\ZREF@zref#1{% |
| 3145 |
\zref@refused{#1}% |
| 3146 |
\zref@extract{#1}% |
| 3147 |
}% |
| 3148 |
% \end{macrocode} |
| 3149 |
% \end{macro} |
| 3150 |
% |
| 3151 |
% \begin{macro}{\zpageref} |
| 3152 |
% For macro \cs{zpageref} we just call \cs{zref} |
| 3153 |
% with property \verb|page|. |
| 3154 |
% \begin{macrocode} |
| 3155 |
\ZREF@IfDefinable\zpageref\def{% |
| 3156 |
{\zref[page]}% |
| 3157 |
} |
| 3158 |
% \end{macrocode} |
| 3159 |
% \end{macro} |
| 3160 |
% |
| 3161 |
% \begin{macro}{\zrefused} |
| 3162 |
% For the following expandable user macros \cs{zrefused} |
| 3163 |
% should be used to notify \hologo{LaTeX} in case of undefined |
| 3164 |
% references. |
| 3165 |
% \begin{macrocode} |
| 3166 |
\ZREF@IfDefinable\zrefused\def{% |
| 3167 |
{\zref@refused}% |
| 3168 |
} |
| 3169 |
% \end{macrocode} |
| 3170 |
% \end{macro} |
| 3171 |
% |
| 3172 |
% \begin{macrocode} |
| 3173 |
%</user> |
| 3174 |
% \end{macrocode} |
| 3175 |
% |
| 3176 |
% |
| 3177 |
% \subsection{Module \xmodule{abspage}} |
| 3178 |
% |
| 3179 |
% \begin{macrocode} |
| 3180 |
%<*abspage> |
| 3181 |
\NeedsTeXFormat{LaTeX2e} |
| 3182 |
\ProvidesPackage{zref-abspage}% |
| 3183 |
[2026-03-07 v2.37 Module abspage for zref (HO)]% |
| 3184 |
\RequirePackage{zref-base}[2019/11/29] |
| 3185 |
\ifx\ZREF@base@ok Y% |
| 3186 |
\else |
| 3187 |
\expandafter\endinput |
| 3188 |
\fi |
| 3189 |
% \end{macrocode} |
| 3190 |
% |
| 3191 |
% Module \xmodule{abspage} adds a new property \verb|abspage| |
| 3192 |
% to the \verb|main| property list for absolute page numbers. |
| 3193 |
% These are recorded by the help of the standard LaTeX shipout hooks. |
| 3194 |
% The count used as property is the standard LaTeX counter \verb|\ReadonlyShipoutCounter|, |
| 3195 |
% but we still provide also the counter \verb|abspage| for compatibility with older |
| 3196 |
% code. |
| 3197 |
% The counter \verb|abspage| must not go in the clear list |
| 3198 |
% of \verb|@ckpt| that is used to set counters in |
| 3199 |
% \xfile{.aux} files of included \hologo{TeX} files. |
| 3200 |
% \begin{macrocode} |
| 3201 |
\begingroup |
| 3202 |
\@ifundefined{c@abspage} |
| 3203 |
{% |
| 3204 |
\let\@addtoreset\ltx@gobbletwo |
| 3205 |
\newcounter{abspage}% |
| 3206 |
}{} |
| 3207 |
\endgroup |
| 3208 |
\setcounter{abspage}{0}% |
| 3209 |
\AddToHook{shipout/before}{% |
| 3210 |
\stepcounter{abspage}% |
| 3211 |
}% |
| 3212 |
\zref@newprop*{abspage}[0]{\the\ReadonlyShipoutCounter}% |
| 3213 |
\zref@addprop\ZREF@mainlist{abspage}% |
| 3214 |
% \end{macrocode} |
| 3215 |
% Note that counter \verb|\ReadonlyShipoutCounter| |
| 3216 |
% and \verb|abspage| show the |
| 3217 |
% previous page during page processing. Before |
| 3218 |
% shipout the counters are incremented. |
| 3219 |
% Thus the property is correctly written with |
| 3220 |
% deferred writing. If the counter is written |
| 3221 |
% using \cs{zref@wrapper@immediate}, then the number |
| 3222 |
% is too small by one. |
| 3223 |
% |
| 3224 |
% \begin{macrocode} |
| 3225 |
%</abspage> |
| 3226 |
% \end{macrocode} |
| 3227 |
% |
| 3228 |
% |
| 3229 |
% \subsection{Module \xmodule{counter}} |
| 3230 |
% |
| 3231 |
% \begin{macrocode} |
| 3232 |
%<*counter> |
| 3233 |
\NeedsTeXFormat{LaTeX2e} |
| 3234 |
\ProvidesPackage{zref-counter}% |
| 3235 |
[2026-03-07 v2.37 Module counter for zref (HO)]% |
| 3236 |
\RequirePackage{zref-base}[2019/11/29] |
| 3237 |
\ifx\ZREF@base@ok Y% |
| 3238 |
\else |
| 3239 |
\expandafter\endinput |
| 3240 |
\fi |
| 3241 |
% \end{macrocode} |
| 3242 |
% |
| 3243 |
% For features such as \xpackage{hyperref}'s \cs{autoref} |
| 3244 |
% we need the name of the counter. The property |
| 3245 |
% \verb|counter| is defined and added to the main property |
| 3246 |
% list. Starting with \LaTeX\ 2020-10-01 the proper can use |
| 3247 |
% \@currentcounter. In older formats |
| 3248 |
% \cs{refstepcounter} has to be patched but this can fail in some |
| 3249 |
% cases, see issue \#5. |
| 3250 |
% \begin{macrocode} |
| 3251 |
\@ifl@t@r\fmtversion{2020-10-01} |
| 3252 |
{ |
| 3253 |
\zref@newprop{counter}{\@currentcounter} |
| 3254 |
\zref@addprop\ZREF@mainlist{counter} |
| 3255 |
} |
| 3256 |
{ |
| 3257 |
\zref@newprop{counter}{} |
| 3258 |
\zref@addprop\ZREF@mainlist{counter} |
| 3259 |
\AtBeginDocument{% |
| 3260 |
\ZREF@patch{refstepcounter}{% |
| 3261 |
\def\refstepcounter#1{% |
| 3262 |
\zref@setcurrent{counter}{#1}% |
| 3263 |
\ZREF@org@refstepcounter{#1}% |
| 3264 |
}% |
| 3265 |
}% |
| 3266 |
} |
| 3267 |
} |
| 3268 |
% \end{macrocode} |
| 3269 |
% \begin{macrocode} |
| 3270 |
%</counter> |
| 3271 |
% \end{macrocode} |
| 3272 |
% |
| 3273 |
% |
| 3274 |
% \subsection{Module \xmodule{lastpage}} |
| 3275 |
% |
| 3276 |
% \begin{macrocode} |
| 3277 |
%<*lastpage> |
| 3278 |
\NeedsTeXFormat{LaTeX2e} |
| 3279 |
\ProvidesPackage{zref-lastpage}% |
| 3280 |
[2026-03-07 v2.37 Module lastpage for zref (HO)]% |
| 3281 |
\RequirePackage{zref-base}[2019/11/29] |
| 3282 |
\RequirePackage{zref-abspage}[2019/11/29] |
| 3283 |
\ifx\ZREF@base@ok Y% |
| 3284 |
\else |
| 3285 |
\expandafter\endinput |
| 3286 |
\fi |
| 3287 |
% \end{macrocode} |
| 3288 |
% |
| 3289 |
% The module \xmodule{lastpage} implements the service |
| 3290 |
% of package \xpackage{lastpage} by setting a reference |
| 3291 |
% \verb|LastPage| at the end of the document. |
| 3292 |
% If module \xmodule{abspage} is given, also the absolute |
| 3293 |
% page number is available, because the properties of |
| 3294 |
% the main property list are used. |
| 3295 |
% 2025-06-07: adapted to new format which changes the page at end. |
| 3296 |
% \begin{macrocode} |
| 3297 |
\zref@newlist{LastPage} |
| 3298 |
\@ifl@t@r\fmtversion{2025-06-01}{% |
| 3299 |
\AddToHook {enddocument/afterlastpage}{% |
| 3300 |
\if@filesw |
| 3301 |
\begingroup |
| 3302 |
\toks@\expandafter\expandafter\expandafter{% |
| 3303 |
\expandafter\Z@L@main |
| 3304 |
\Z@L@LastPage |
| 3305 |
}% |
| 3306 |
\expandafter\ZREF@label\expandafter{\the\toks@}{LastPage}% |
| 3307 |
\endgroup |
| 3308 |
\fi |
| 3309 |
}} |
| 3310 |
{\AddToHook {enddocument/afterlastpage}{% |
| 3311 |
\if@filesw |
| 3312 |
\begingroup |
| 3313 |
\advance\c@page\m@ne |
| 3314 |
\toks@\expandafter\expandafter\expandafter{% |
| 3315 |
\expandafter\Z@L@main |
| 3316 |
\Z@L@LastPage |
| 3317 |
}% |
| 3318 |
\expandafter\zref@wrapper@immediate\expandafter{% |
| 3319 |
\expandafter\ZREF@label\expandafter{\the\toks@}{LastPage}% |
| 3320 |
}% |
| 3321 |
\endgroup |
| 3322 |
\fi |
| 3323 |
}} |
| 3324 |
% \end{macrocode} |
| 3325 |
% \begin{macro}{\zref@iflastpage} |
| 3326 |
% \begin{macrocode} |
| 3327 |
\def\zref@iflastpage#1{% |
| 3328 |
\ifnum\zref@extractdefault{#1}{abspage}{-1}=% |
| 3329 |
\zref@extractdefault{LastPage}{abspage}{-2} % |
| 3330 |
\expandafter\ltx@firstoftwo |
| 3331 |
\else |
| 3332 |
\expandafter\ltx@secondoftwo |
| 3333 |
\fi |
| 3334 |
} |
| 3335 |
% \end{macrocode} |
| 3336 |
% \end{macro} |
| 3337 |
% \begin{macro}{\ziflastpage} |
| 3338 |
% \begin{macrocode} |
| 3339 |
\ZREF@IfDefinable\ziflastpage\def{% |
| 3340 |
{\zref@wrapper@babel\ZREF@iflastpage}% |
| 3341 |
} |
| 3342 |
% \end{macrocode} |
| 3343 |
% \end{macro} |
| 3344 |
% \begin{macro}{ZREF@iflastpage} |
| 3345 |
% \begin{macrocode} |
| 3346 |
\def\ZREF@iflastpage#1{% |
| 3347 |
\zref@refused{LastPage}% |
| 3348 |
\zref@refused{#1}% |
| 3349 |
\zref@iflastpage{#1}% |
| 3350 |
} |
| 3351 |
% \end{macrocode} |
| 3352 |
% \end{macro} |
| 3353 |
% \begin{macrocode} |
| 3354 |
%</lastpage> |
| 3355 |
% \end{macrocode} |
| 3356 |
% |
| 3357 |
% |
| 3358 |
% \subsection{Module \xmodule{thepage}} |
| 3359 |
% |
| 3360 |
% \begin{macrocode} |
| 3361 |
%<*thepage> |
| 3362 |
\NeedsTeXFormat{LaTeX2e} |
| 3363 |
\ProvidesPackage{zref-thepage}% |
| 3364 |
[2026-03-07 v2.37 Module thepage for zref (HO)]% |
| 3365 |
\RequirePackage{zref-base}[2019/11/29] |
| 3366 |
\ifx\ZREF@base@ok Y% |
| 3367 |
\else |
| 3368 |
\expandafter\endinput |
| 3369 |
\fi |
| 3370 |
% \end{macrocode} |
| 3371 |
% |
| 3372 |
% \begin{macrocode} |
| 3373 |
\RequirePackage{atbegshi}[2011/10/05] |
| 3374 |
\RequirePackage{zref-abspage}[2019/11/29] |
| 3375 |
% \end{macrocode} |
| 3376 |
% \begin{macrocode} |
| 3377 |
\zref@newlist{thepage} |
| 3378 |
\zref@addprop{thepage}{page} |
| 3379 |
\ZREF@NewPropPageValue |
| 3380 |
% \end{macrocode} |
| 3381 |
% \begin{macro}{\zref@thepage@atbegshi@hook} |
| 3382 |
% \begin{macrocode} |
| 3383 |
\let\zref@thepage@atbegshi@hook\ltx@empty |
| 3384 |
% \end{macrocode} |
| 3385 |
% \end{macro} |
| 3386 |
% \begin{macrocode} |
| 3387 |
\zref@addprop{thepage}{pagevalue} |
| 3388 |
\AddToHook{shipout/before}{% |
| 3389 |
\AtBeginShipoutAddToBox{% |
| 3390 |
\zref@thepage@atbegshi@hook |
| 3391 |
\zref@labelbylist{thepage\the\value{abspage}}{thepage}% |
| 3392 |
}% |
| 3393 |
} |
| 3394 |
% \end{macrocode} |
| 3395 |
% \begin{macro}{\zref@thepage@name} |
| 3396 |
% \begin{macrocode} |
| 3397 |
\ltx@IfUndefined{numexpr}{% |
| 3398 |
\def\zref@thepage@name#1{thepage\number#1}% |
| 3399 |
}{% |
| 3400 |
\def\zref@thepage@name#1{thepage\the\numexpr#1}% |
| 3401 |
} |
| 3402 |
% \end{macrocode} |
| 3403 |
% \end{macro} |
| 3404 |
% \begin{macro}{\zref@thepage} |
| 3405 |
% \begin{macrocode} |
| 3406 |
\def\zref@thepage#1{% |
| 3407 |
\zref@extract{\zref@thepage@name{#1}}{page}% |
| 3408 |
}% |
| 3409 |
% \end{macrocode} |
| 3410 |
% \end{macro} |
| 3411 |
% \begin{macro}{\zref@thepage@refused} |
| 3412 |
% \begin{macrocode} |
| 3413 |
\ZREF@Robust\def\zref@thepage@refused#1{% |
| 3414 |
\zref@refused{\zref@thepage@name{#1}}% |
| 3415 |
}% |
| 3416 |
% \end{macrocode} |
| 3417 |
% \end{macro} |
| 3418 |
% \begin{macro}{\zthepage} |
| 3419 |
% \begin{macrocode} |
| 3420 |
\ZREF@IfDefinable\zthepage\def{% |
| 3421 |
#1{% |
| 3422 |
\zref@thepage@refused{#1}% |
| 3423 |
\zref@thepage{#1}% |
| 3424 |
}% |
| 3425 |
} |
| 3426 |
% \end{macrocode} |
| 3427 |
% \end{macro} |
| 3428 |
% \begin{macrocode} |
| 3429 |
%</thepage> |
| 3430 |
% \end{macrocode} |
| 3431 |
% |
| 3432 |
% |
| 3433 |
% \subsection{Module \xmodule{nextpage}} |
| 3434 |
% |
| 3435 |
% \begin{macrocode} |
| 3436 |
%<*nextpage> |
| 3437 |
\NeedsTeXFormat{LaTeX2e} |
| 3438 |
\ProvidesPackage{zref-nextpage}% |
| 3439 |
[2026-03-07 v2.37 Module nextpage for zref (HO)]% |
| 3440 |
\RequirePackage{zref-base}[2019/11/29] |
| 3441 |
\ifx\ZREF@base@ok Y% |
| 3442 |
\else |
| 3443 |
\expandafter\endinput |
| 3444 |
\fi |
| 3445 |
% \end{macrocode} |
| 3446 |
% |
| 3447 |
% \begin{macrocode} |
| 3448 |
\RequirePackage{zref-abspage}[2019/11/29] |
| 3449 |
\RequirePackage{zref-thepage}[2019/11/29] |
| 3450 |
\RequirePackage{zref-lastpage}[2019/11/29] |
| 3451 |
\RequirePackage{uniquecounter}[2009/12/18] |
| 3452 |
% \end{macrocode} |
| 3453 |
% \begin{macrocode} |
| 3454 |
\UniqueCounterNew{znextpage} |
| 3455 |
|
| 3456 |
\newcommand*{\znextpagesetup}{% |
| 3457 |
\afterassignment\ZREF@np@setup@i |
| 3458 |
\def\ZREF@np@call@unknown##1% |
| 3459 |
} |
| 3460 |
\def\ZREF@np@setup@i{% |
| 3461 |
\afterassignment\ZREF@np@setup@ii |
| 3462 |
\def\ZREF@np@call@nonext##1% |
| 3463 |
} |
| 3464 |
\def\ZREF@np@setup@ii{% |
| 3465 |
\def\ZREF@np@call@next##1% |
| 3466 |
} |
| 3467 |
\def\ZREF@np@call@unknown#1{#1} |
| 3468 |
\def\ZREF@np@call@nonext#1{#1} |
| 3469 |
\def\ZREF@np@call@next#1{#1} |
| 3470 |
\ZREF@IfDefinable\znextpage\def{% |
| 3471 |
{\UniqueCounterCall{znextpage}{\ZREF@nextpage}}% |
| 3472 |
}% |
| 3473 |
\newcommand*{\znonextpagename}{} |
| 3474 |
\newcommand*{\zunknownnextpagename}{\Z@D@page} |
| 3475 |
\def\ZREF@nextpage#1{% |
| 3476 |
\begingroup |
| 3477 |
\def\ZREF@refname@this{zref@np#1}% |
| 3478 |
\zref@labelbyprops\ZREF@refname@this{abspage}% |
| 3479 |
\chardef\ZREF@call=0 % unknown |
| 3480 |
\ZREF@ifrefundefined\ZREF@refname@this{% |
| 3481 |
}{% |
| 3482 |
\edef\ZREF@pagenum@this{% |
| 3483 |
\zref@extractdefault\ZREF@refname@this{abspage}{0}% |
| 3484 |
}% |
| 3485 |
\edef\ZREF@refname@next{% |
| 3486 |
\zref@thepage@name{% |
| 3487 |
\the\numexpr\ZREF@pagenum@this+1% |
| 3488 |
}% |
| 3489 |
}% |
| 3490 |
\ifnum\ZREF@pagenum@this>0 % |
| 3491 |
\ZREF@ifrefundefined{LastPage}{% |
| 3492 |
\zref@ifrefundefined\ZREF@refname@next{% |
| 3493 |
}{% |
| 3494 |
\chardef\ZREF@call=2 % next page |
| 3495 |
}% |
| 3496 |
}{% |
| 3497 |
\edef\ZREF@pagenum@last{% |
| 3498 |
\zref@extractdefault{LastPage}{abspage}{0}% |
| 3499 |
}% |
| 3500 |
\ifnum\ZREF@pagenum@this<\ZREF@pagenum@last\ltx@space |
| 3501 |
\ZREF@ifrefundefined\ZREF@refname@next{% |
| 3502 |
}{% |
| 3503 |
\chardef\ZREF@call=2 % next page |
| 3504 |
}% |
| 3505 |
\else |
| 3506 |
\ifnum\ZREF@pagenum@this=\ZREF@pagenum@this\ltx@space |
| 3507 |
\chardef\ZREF@call=1 % no next page |
| 3508 |
\fi |
| 3509 |
\fi |
| 3510 |
}% |
| 3511 |
\fi |
| 3512 |
}% |
| 3513 |
\edef\x{% |
| 3514 |
\endgroup |
| 3515 |
\ifcase\ZREF@call |
| 3516 |
\noexpand\ZREF@np@call@unknown{% |
| 3517 |
\noexpand\zunknownnextpagename |
| 3518 |
}% |
| 3519 |
\or |
| 3520 |
\noexpand\ZREF@np@call@nonext{% |
| 3521 |
\noexpand\znonextpagename |
| 3522 |
}% |
| 3523 |
\else |
| 3524 |
\noexpand\ZREF@np@call@next{% |
| 3525 |
\noexpand\zref@extract{\ZREF@refname@next}{page}% |
| 3526 |
}% |
| 3527 |
\fi |
| 3528 |
}% |
| 3529 |
\x |
| 3530 |
} |
| 3531 |
% \end{macrocode} |
| 3532 |
% \begin{macrocode} |
| 3533 |
%</nextpage> |
| 3534 |
% \end{macrocode} |
| 3535 |
% |
| 3536 |
% |
| 3537 |
% \subsection{Module \xmodule{totpages}} |
| 3538 |
% |
| 3539 |
% \begin{macrocode} |
| 3540 |
%<*totpages> |
| 3541 |
\NeedsTeXFormat{LaTeX2e} |
| 3542 |
\ProvidesPackage{zref-totpages}% |
| 3543 |
[2026-03-07 v2.37 Module totpages for zref (HO)]% |
| 3544 |
\RequirePackage{zref-base}[2019/11/29] |
| 3545 |
\ifx\ZREF@base@ok Y% |
| 3546 |
\else |
| 3547 |
\expandafter\endinput |
| 3548 |
\fi |
| 3549 |
% \end{macrocode} |
| 3550 |
% |
| 3551 |
% The absolute page number of the last page is the total |
| 3552 |
% page number. |
| 3553 |
% \begin{macrocode} |
| 3554 |
\RequirePackage{zref-abspage}[2019/11/29] |
| 3555 |
\RequirePackage{zref-lastpage}[2019/11/29] |
| 3556 |
% \end{macrocode} |
| 3557 |
% |
| 3558 |
% \begin{macro}{\ztotpages} |
| 3559 |
% Macro \cs{ztotpages} contains the number of pages. It can be |
| 3560 |
% used inside expandable calculations. It expands to zero if |
| 3561 |
% the reference is not yet available. |
| 3562 |
% \begin{macrocode} |
| 3563 |
\newcommand*{\ztotpages}{% |
| 3564 |
\zref@extractdefault{LastPage}{abspage}{0}% |
| 3565 |
} |
| 3566 |
% \end{macrocode} |
| 3567 |
% \end{macro} |
| 3568 |
% Also we mark the reference |LastPage| as used: |
| 3569 |
% \begin{macrocode} |
| 3570 |
\AtBeginDocument{% |
| 3571 |
\zref@refused{LastPage}% |
| 3572 |
} |
| 3573 |
% \end{macrocode} |
| 3574 |
% \begin{macrocode} |
| 3575 |
%</totpages> |
| 3576 |
% \end{macrocode} |
| 3577 |
% |
| 3578 |
% |
| 3579 |
% \subsection{Module \xmodule{pagelayout}} |
| 3580 |
% |
| 3581 |
% \begin{macrocode} |
| 3582 |
%<*pagelayout> |
| 3583 |
\NeedsTeXFormat{LaTeX2e} |
| 3584 |
\ProvidesPackage{zref-pagelayout}% |
| 3585 |
[2026-03-07 v2.37 Module pagelayout for zref (HO)]% |
| 3586 |
\RequirePackage{zref-base}[2019/11/29] |
| 3587 |
\ifx\ZREF@base@ok Y% |
| 3588 |
\else |
| 3589 |
\expandafter\endinput |
| 3590 |
\fi |
| 3591 |
% \end{macrocode} |
| 3592 |
% |
| 3593 |
% \begin{macrocode} |
| 3594 |
\RequirePackage{zref-thepage}[2019/11/29] |
| 3595 |
\RequirePackage{iftex}[2019/11/07]% |
| 3596 |
% \end{macrocode} |
| 3597 |
% |
| 3598 |
% |
| 3599 |
% \subsubsection{Define layout properties} |
| 3600 |
% |
| 3601 |
% \begin{macrocode} |
| 3602 |
\def\ZREF@temp#1{% |
| 3603 |
\begingroup |
| 3604 |
\escapechar=-1 % |
| 3605 |
\ltx@ifundefined{\string#1}{\endgroup}{% |
| 3606 |
\edef\x{% |
| 3607 |
\endgroup |
| 3608 |
\noexpand\zref@newprop*{\string#1}% |
| 3609 |
[\noexpand\number\noexpand#1]% hash-ok |
| 3610 |
{\noexpand\number\noexpand#1}% |
| 3611 |
\noexpand\zref@addprop{thepage}{\string#1}% |
| 3612 |
}% |
| 3613 |
\x |
| 3614 |
}% |
| 3615 |
} |
| 3616 |
\ZREF@temp\mag |
| 3617 |
\ZREF@temp\paperwidth |
| 3618 |
\ZREF@temp\paperheight |
| 3619 |
\ZREF@temp\stockwidth % memoir.cls, crop.sty |
| 3620 |
\ZREF@temp\stockheight % memoir.cls, crop.sty |
| 3621 |
\ZREF@temp\mediawidth % VTeX |
| 3622 |
\ZREF@temp\mediaheight % VTeX |
| 3623 |
\ifluatex |
| 3624 |
\zref@newprop*{pdfvorigin}% |
| 3625 |
[\number\pdfvariable vorigin]% hash-ok |
| 3626 |
{\number\pdfvariable vorigin}% |
| 3627 |
\zref@addprop{thepage}{pdfvorigin} |
| 3628 |
\zref@newprop*{pdfhorigin}% |
| 3629 |
[\number\pdfvariable horigin]% hash-ok |
| 3630 |
{\number\pdfvariable horigin}% |
| 3631 |
\zref@addprop{thepage}{pdfhorigin} |
| 3632 |
\zref@newprop*{pdfpageheight}% |
| 3633 |
[\number\pageheight]% hash-ok |
| 3634 |
{\number\pageheight}% |
| 3635 |
\zref@addprop{thepage}{pdfpageheight} |
| 3636 |
\zref@newprop*{pdfpagewidth}% |
| 3637 |
[\number\pagewidth]% hash-ok |
| 3638 |
{\number\pagewidth}% |
| 3639 |
\zref@addprop{thepage}{pdfpagewidth} |
| 3640 |
\else |
| 3641 |
\ZREF@temp\pdfpagewidth |
| 3642 |
\ZREF@temp\pdfpageheight |
| 3643 |
\ZREF@temp\pdfhorigin |
| 3644 |
\ZREF@temp\pdfvorigin |
| 3645 |
\fi |
| 3646 |
\ZREF@temp\hoffset |
| 3647 |
\ZREF@temp\voffset |
| 3648 |
\ZREF@temp\topmargin |
| 3649 |
\ZREF@temp\oddsidemargin |
| 3650 |
\ZREF@temp\evensidemargin |
| 3651 |
\ZREF@temp\textwidth |
| 3652 |
\ZREF@temp\textheight |
| 3653 |
\ZREF@temp\headheight |
| 3654 |
\ZREF@temp\headsep |
| 3655 |
\ZREF@temp\footskip |
| 3656 |
\ZREF@temp\marginparwidth |
| 3657 |
\ZREF@temp\marginparsep |
| 3658 |
\ZREF@temp\columnwidth |
| 3659 |
\ZREF@temp\columnsep |
| 3660 |
\ZREF@temp\trimedge % memoir.cls |
| 3661 |
\ZREF@temp\spinemargin % memoir.cls |
| 3662 |
\ZREF@temp\foremargin % memoir.cls |
| 3663 |
\ZREF@temp\trimtop % memoir.cls |
| 3664 |
\ZREF@temp\uppermargin % memoir.cls |
| 3665 |
\ZREF@temp\headmargin % memoir.cls |
| 3666 |
% \end{macrocode} |
| 3667 |
% |
| 3668 |
% \begin{macrocode} |
| 3669 |
\IfFormatAtLeastTF{2020/10/01} |
| 3670 |
{ |
| 3671 |
\zref@newprop*{outputboxwd}[0pt]{\ShipoutBoxWidth} |
| 3672 |
\zref@newprop*{outputboxht}[0pt]{\ShipoutBoxHeight} |
| 3673 |
\zref@newprop*{outputboxdp}[0pt]{\ShipoutBoxDepth} |
| 3674 |
} |
| 3675 |
{ |
| 3676 |
\zref@newprop*{outputboxwd}[0pt]{\AtBeginShipoutBoxWidth} |
| 3677 |
\zref@newprop*{outputboxht}[0pt]{\AtBeginShipoutBoxHeight} |
| 3678 |
\zref@newprop*{outputboxdp}[0pt]{\AtBeginShipoutBoxDepth} |
| 3679 |
} |
| 3680 |
% \end{macrocode} |
| 3681 |
% \begin{macrocode} |
| 3682 |
\zref@addprops{thepage}{outputboxwd,outputboxht,outputboxdp} |
| 3683 |
% \end{macrocode} |
| 3684 |
% |
| 3685 |
% \begin{macro}{\ifZREF@pl@list} |
| 3686 |
% \begin{macrocode} |
| 3687 |
\ltx@newif\ifZREF@pl@list |
| 3688 |
% \end{macrocode} |
| 3689 |
% \end{macro} |
| 3690 |
% \begin{macro}{\zref@listpagelayout} |
| 3691 |
% \begin{macrocode} |
| 3692 |
\ZREF@IfDefinable\zlistpagelayout\def{% |
| 3693 |
{\global\ZREF@pl@listtrue}% |
| 3694 |
} |
| 3695 |
% \end{macrocode} |
| 3696 |
% \end{macro} |
| 3697 |
% \begin{macro}{\ZREF@pl@AfterLastShipout} |
| 3698 |
% \begin{macrocode} |
| 3699 |
\def\ZREF@pl@AfterLastShipout{% |
| 3700 |
\ifZREF@pl@list |
| 3701 |
\edef\ZREF@page@max{\the\value{abspage}}% |
| 3702 |
\ltx@ifundefined{ZREF@org@testdef}{% |
| 3703 |
\let\ZREF@org@testdef\@testdef |
| 3704 |
\def\@testdef##1##2##3{% |
| 3705 |
\ZREF@org@testdef{##1}{##2}{##3}% |
| 3706 |
\def\ZREF@temp{##1}% |
| 3707 |
\ifx\ZREF@temp\ZREF@RefPrefix |
| 3708 |
\expandafter\gdef\csname##1@##2\endcsname{##3}% |
| 3709 |
\fi |
| 3710 |
}% |
| 3711 |
}{}% |
| 3712 |
\AddToHook{enddocument/afteraux}{\ZREF@pl@AtVeryEnd}% |
| 3713 |
\fi |
| 3714 |
} |
| 3715 |
% \end{macrocode} |
| 3716 |
% \end{macro} |
| 3717 |
% \begin{macro}{\ZREF@pl@AtVeryEnd} |
| 3718 |
% \begin{macrocode} |
| 3719 |
\def\ZREF@pl@AtVeryEnd{% |
| 3720 |
\begingroup |
| 3721 |
\toks@{Page layout parameters:\MessageBreak}% |
| 3722 |
\count@=1 % |
| 3723 |
\ZREF@pl@ListPage |
| 3724 |
\edef\x{\endgroup |
| 3725 |
\noexpand\@PackageInfoNoLine{zref-pagelayout}{\the\toks@}% |
| 3726 |
}% |
| 3727 |
\x |
| 3728 |
} |
| 3729 |
% \end{macrocode} |
| 3730 |
% \end{macro} |
| 3731 |
% \begin{macro}{\ZREF@pl@ListPage} |
| 3732 |
% \begin{macrocode} |
| 3733 |
\def\ZREF@pl@ListPage{% |
| 3734 |
\edef\x{% |
| 3735 |
\toks@={% |
| 3736 |
\the\toks@ |
| 3737 |
Page \the\count@:\noexpand\MessageBreak |
| 3738 |
\zref@ifrefundefined{thepage\the\count@}{}{% |
| 3739 |
\ltx@space\ltx@space mag = % |
| 3740 |
\zref@extract{thepage\the\count@}{mag}% |
| 3741 |
\noexpand\MessageBreak |
| 3742 |
\ZREF@pl@ListEntry{paperwidth}% |
| 3743 |
\ZREF@pl@ListEntry{paperheight}% |
| 3744 |
\ZREF@pl@ListEntry{stockwidth}% |
| 3745 |
\ZREF@pl@ListEntry{stockheight}% |
| 3746 |
\ZREF@pl@ListEntry{mediawidth}% |
| 3747 |
\ZREF@pl@ListEntry{mediaheight}% |
| 3748 |
\ZREF@pl@ListEntry{pdfpagewidth}% |
| 3749 |
\ZREF@pl@ListEntry{pdfpageheight}% |
| 3750 |
\ZREF@pl@ListEntry{pdfhorigin}% |
| 3751 |
\ZREF@pl@ListEntry{pdfvorigin}% |
| 3752 |
\ZREF@pl@ListEntry{hoffset}% |
| 3753 |
\ZREF@pl@ListEntry{voffset}% |
| 3754 |
\ZREF@pl@ListEntry{topmargin}% |
| 3755 |
\ZREF@pl@ListEntry{oddsidemargin}% |
| 3756 |
\ZREF@pl@ListEntry{evensidemargin}% |
| 3757 |
\ZREF@pl@ListEntry{textwidth}% |
| 3758 |
\ZREF@pl@ListEntry{textheight}% |
| 3759 |
\ZREF@pl@ListEntry{headheight}% |
| 3760 |
\ZREF@pl@ListEntry{headsep}% |
| 3761 |
\ZREF@pl@ListEntry{footskip}% |
| 3762 |
\ZREF@pl@ListEntry{marginparwidth}% |
| 3763 |
\ZREF@pl@ListEntry{marginparsep}% |
| 3764 |
\ZREF@pl@ListEntry{columnwidth}% |
| 3765 |
\ZREF@pl@ListEntry{columnsep}% |
| 3766 |
\ZREF@pl@ListEntry{trimedge}% |
| 3767 |
\ZREF@pl@ListEntry{spinemargin}% |
| 3768 |
\ZREF@pl@ListEntry{foremargin}% |
| 3769 |
\ZREF@pl@ListEntry{trimtop}% |
| 3770 |
\ZREF@pl@ListEntry{uppermargin}% |
| 3771 |
\ZREF@pl@ListEntry{headmargin}% |
| 3772 |
}% |
| 3773 |
}% |
| 3774 |
}\x |
| 3775 |
\ifnum\ZREF@page@max>\count@ |
| 3776 |
\advance\count@ by\ltx@one |
| 3777 |
\else |
| 3778 |
\expandafter\ltx@gobble |
| 3779 |
\fi |
| 3780 |
\ZREF@pl@ListPage |
| 3781 |
} |
| 3782 |
% \end{macrocode} |
| 3783 |
% \end{macro} |
| 3784 |
% \begin{macro}{\ZREF@pl@ListEntry} |
| 3785 |
% \begin{macrocode} |
| 3786 |
\def\ZREF@pl@ListEntry#1{% |
| 3787 |
\zref@ifpropundefined{#1}{% |
| 3788 |
}{% |
| 3789 |
\zref@ifrefcontainsprop{thepage\the\count@}{#1}{% |
| 3790 |
\ltx@space\ltx@space#1 = % |
| 3791 |
\zref@extract{thepage\the\count@}{#1}sp = % |
| 3792 |
\the\dimexpr\zref@extract{thepage\the\count@}{#1}sp\relax |
| 3793 |
\noexpand\MessageBreak |
| 3794 |
}{}% |
| 3795 |
}% |
| 3796 |
} |
| 3797 |
% \end{macrocode} |
| 3798 |
% \end{macro} |
| 3799 |
% \begin{macrocode} |
| 3800 |
\AddToHook {enddocument/afterlastpage}{% |
| 3801 |
\ZREF@pl@AfterLastShipout |
| 3802 |
} |
| 3803 |
% \end{macrocode} |
| 3804 |
% |
| 3805 |
% \begin{macrocode} |
| 3806 |
%</pagelayout> |
| 3807 |
% \end{macrocode} |
| 3808 |
% |
| 3809 |
% |
| 3810 |
% \subsection{Module \xmodule{pageattr}} |
| 3811 |
% |
| 3812 |
% \begin{macrocode} |
| 3813 |
%<*pageattr> |
| 3814 |
\NeedsTeXFormat{LaTeX2e} |
| 3815 |
\ProvidesPackage{zref-pageattr}% |
| 3816 |
[2026-03-07 v2.37 Module pageattr for zref (HO)]% |
| 3817 |
\RequirePackage{zref-base}[2019/11/29] |
| 3818 |
\ifx\ZREF@base@ok Y% |
| 3819 |
\else |
| 3820 |
\expandafter\endinput |
| 3821 |
\fi |
| 3822 |
% \end{macrocode} |
| 3823 |
% |
| 3824 |
% \begin{macrocode} |
| 3825 |
\RequirePackage{iftex}[2019/11/07]% |
| 3826 |
% \end{macrocode} |
| 3827 |
% |
| 3828 |
% |
| 3829 |
% \begin{macrocode} |
| 3830 |
\let\ZREF@temp=N% |
| 3831 |
\ifluatex |
| 3832 |
\expandafter\@firstoftwo |
| 3833 |
\else |
| 3834 |
\expandafter\@secondoftwo |
| 3835 |
\fi |
| 3836 |
{%luatex |
| 3837 |
\RequirePackage{zref-thepage}[2019/11/29] |
| 3838 |
\RequirePackage{zref-lastpage}[2019/11/29]% |
| 3839 |
\zref@newprop*{pdfpageattr}[]{\zref@hex{\the\pdfvariable pageattr}}% |
| 3840 |
\zref@addprop{thepage}{pdfpageattr}% |
| 3841 |
\zref@newprop*{pdfpagesattr}[]{\zref@hex{\the\pdfvariable pagesattr}}% |
| 3842 |
\zref@addprop{LastPage}{pdfpagesattr}% |
| 3843 |
\let\ZREF@temp=Y% |
| 3844 |
} |
| 3845 |
{%other |
| 3846 |
\ltx@IfUndefined{pdfpageattr}{% |
| 3847 |
\@PackageInfoNoLine{zref-pageattr}{% |
| 3848 |
\string\pdfpageattr\space is not available% |
| 3849 |
}% |
| 3850 |
\def\zref@pdfpageattr#1{}% |
| 3851 |
\def\zref@pdfpageattr@used#1{}% |
| 3852 |
}{% |
| 3853 |
\RequirePackage{zref-thepage}[2019/11/29]% |
| 3854 |
\zref@newprop*{pdfpageattr}[]{\zref@hex{\the\pdfpageattr}}% |
| 3855 |
\zref@addprop{thepage}{pdfpageattr}% |
| 3856 |
\let\ZREF@temp=Y% |
| 3857 |
} |
| 3858 |
\ltx@IfUndefined{pdfpagesattr}{% |
| 3859 |
\@PackageInfoNoLine{zref-pageattr}{% |
| 3860 |
\string\pdfpagesattr\space is not available% |
| 3861 |
}% |
| 3862 |
\def\zref@pdfpagesattr{}% |
| 3863 |
\def\zref@pdfpagesattr@used{}% |
| 3864 |
}{% |
| 3865 |
\RequirePackage{zref-lastpage}[2019/11/29]% |
| 3866 |
\zref@newprop*{pdfpagesattr}[]{\zref@hex{\the\pdfpagesattr}}% |
| 3867 |
\zref@addprop{LastPage}{pdfpagesattr}% |
| 3868 |
\let\ZREF@temp=Y% |
| 3869 |
}% |
| 3870 |
}% |
| 3871 |
% \end{macrocode} |
| 3872 |
% \begin{macrocode} |
| 3873 |
\ifx\ZREF@temp N% |
| 3874 |
\expandafter\endinput |
| 3875 |
\fi |
| 3876 |
% \end{macrocode} |
| 3877 |
% \begin{macrocode} |
| 3878 |
\RequirePackage{zref-abspage}[2019/11/29] |
| 3879 |
\RequirePackage{pdftexcmds}[2010/04/01] |
| 3880 |
\let\ZREF@temp=Y% |
| 3881 |
\ltx@IfUndefined{pdf@escapehex}{\let\ZREF@temp=N}{} |
| 3882 |
\ltx@IfUndefined{pdf@unescapehex}{\let\ZREF@temp=N}{} |
| 3883 |
\ifx\ZREF@temp N% |
| 3884 |
\let\zref@hex\ltx@firstofone |
| 3885 |
\let\zref@unhex\ltx@firstofone |
| 3886 |
\else |
| 3887 |
\let\zref@hex\pdf@escapehex |
| 3888 |
\let\zref@unhex\pdf@unescapehex |
| 3889 |
\fi |
| 3890 |
% \end{macrocode} |
| 3891 |
% |
| 3892 |
% \begin{macro}{\ifZREF@pa@list} |
| 3893 |
% \begin{macrocode} |
| 3894 |
\ltx@newif\ifZREF@pa@list |
| 3895 |
% \end{macrocode} |
| 3896 |
% \end{macro} |
| 3897 |
% \begin{macro}{\zref@listpageattr} |
| 3898 |
% \begin{macrocode} |
| 3899 |
\ZREF@IfDefinable\zlistpageattr\def{% |
| 3900 |
{\ZREF@pa@listtrue}% |
| 3901 |
} |
| 3902 |
% \end{macrocode} |
| 3903 |
% \end{macro} |
| 3904 |
% \begin{macro}{\ZREF@pa@AfterLastShipout} |
| 3905 |
% \begin{macrocode} |
| 3906 |
\def\ZREF@pa@AfterLastShipout{% |
| 3907 |
\ifZREF@pa@list |
| 3908 |
\edef\ZREF@page@max{\the\value{abspage}}% |
| 3909 |
\ltx@ifundefined{ZREF@org@testdef}{% |
| 3910 |
\let\ZREF@org@testdef\@testdef |
| 3911 |
\def\@testdef##1##2##3{% |
| 3912 |
\ZREF@org@testdef{##1}{##2}{##3}% |
| 3913 |
\def\ZREF@temp{##1}% |
| 3914 |
\ifx\ZREF@temp\ZREF@RefPrefix |
| 3915 |
\expandafter\xdef\csname##1@##2\endcsname{##3}% |
| 3916 |
\fi |
| 3917 |
}% |
| 3918 |
}{}% |
| 3919 |
\AddToHook{enddocument/afteraux}{\ZREF@pa@AtVeryEnd}% |
| 3920 |
\fi |
| 3921 |
} |
| 3922 |
% \end{macrocode} |
| 3923 |
% \end{macro} |
| 3924 |
% \begin{macro}{\ZREF@pa@AtVeryEnd} |
| 3925 |
% \begin{macrocode} |
| 3926 |
\let\ZREF@temp=Y% |
| 3927 |
\ltx@IfUndefined{pdfpageattr}{}{\let\ZREF@temp=N} |
| 3928 |
\ifluatex \let\ZREF@temp=N \fi |
| 3929 |
\ifx\ZREF@temp Y |
| 3930 |
\expandafter\@firstoftwo |
| 3931 |
\else |
| 3932 |
\expandafter\@secondoftwo |
| 3933 |
\fi |
| 3934 |
{% |
| 3935 |
\def\ZREF@pa@AtVeryEnd{}% |
| 3936 |
} |
| 3937 |
{% |
| 3938 |
\def\ZREF@pa@AtVeryEnd{% |
| 3939 |
\begingroup |
| 3940 |
\toks@{List of \ltx@backslashchar |
| 3941 |
\ifluatex pdfvariable\else pdf\fi |
| 3942 |
pdfpageattr:\MessageBreak}% |
| 3943 |
\count@=1 % |
| 3944 |
\ZREF@pa@ListPage |
| 3945 |
\edef\x{\endgroup |
| 3946 |
\noexpand\@PackageInfoNoLine{zref-pageattr}{% |
| 3947 |
\the\toks@ |
| 3948 |
}% |
| 3949 |
}% |
| 3950 |
\x |
| 3951 |
}% |
| 3952 |
% \end{macrocode} |
| 3953 |
% \end{macro} |
| 3954 |
% \begin{macro}{\zref@pageattr} |
| 3955 |
% \begin{macrocode} |
| 3956 |
\def\zref@pdfpageattr#1{% |
| 3957 |
\zref@unhex{% |
| 3958 |
\zref@extract{thepage\ZREF@number{#1}}{pdfpageattr}% |
| 3959 |
}% |
| 3960 |
} |
| 3961 |
% compatibility, \zref@pageattr was defined in older versions |
| 3962 |
\let\zref@pageattr\zref@pdfpageattr |
| 3963 |
% \end{macrocode} |
| 3964 |
% \end{macro} |
| 3965 |
% \begin{macro}{\zref@pageattr@used} |
| 3966 |
% \begin{macrocode} |
| 3967 |
\ZREF@Robust\def\zref@pageattr@used#1{% |
| 3968 |
\zref@refused{thepage\ZREF@number{#1}}% |
| 3969 |
} |
| 3970 |
% \end{macrocode} |
| 3971 |
% \end{macro} |
| 3972 |
% \begin{macro}{\ZREF@pa@ListPage} |
| 3973 |
% \begin{macrocode} |
| 3974 |
\def\ZREF@pa@ListPage{% |
| 3975 |
\edef\x{% |
| 3976 |
\toks@={% |
| 3977 |
\the\toks@ |
| 3978 |
Page \the\count@:% |
| 3979 |
\noexpand\MessageBreak |
| 3980 |
\zref@ifrefundefined{thepage\the\count@}{}{% |
| 3981 |
<<\zref@pdfpageattr\count@>>% |
| 3982 |
\noexpand\MessageBreak |
| 3983 |
}% |
| 3984 |
}% |
| 3985 |
}\x |
| 3986 |
\ifnum\ZREF@page@max>\count@ |
| 3987 |
\advance\count@ by\ltx@one |
| 3988 |
\else |
| 3989 |
\expandafter\ltx@gobble |
| 3990 |
\fi |
| 3991 |
\ZREF@pa@ListPage |
| 3992 |
}% |
| 3993 |
} |
| 3994 |
% \end{macrocode} |
| 3995 |
% \end{macro} |
| 3996 |
% \begin{macrocode} |
| 3997 |
\let\ZREF@temp=Y% |
| 3998 |
\ltx@IfUndefined{pdfpagesattr}{}{\let\ZREF@temp=N} |
| 3999 |
\ifluatex \let\ZREF@temp=N \fi |
| 4000 |
\ifx\ZREF@temp N |
| 4001 |
\expandafter\@firstofone |
| 4002 |
\fi |
| 4003 |
{% |
| 4004 |
% \end{macrocode} |
| 4005 |
% \begin{macro}{\zref@pdfpagesattr} |
| 4006 |
% \begin{macrocode} |
| 4007 |
\def\zref@pdfpagesattr{% |
| 4008 |
\zref@unhex{% |
| 4009 |
\zref@extract{LastPage}{pdfpagesattr}% |
| 4010 |
}% |
| 4011 |
}% |
| 4012 |
% \end{macrocode} |
| 4013 |
% \end{macro} |
| 4014 |
% \begin{macro}{\zref@pdfpagesattr@used} |
| 4015 |
% \begin{macrocode} |
| 4016 |
\ZREF@Robust\def\zref@pdfpagesattr@used{% |
| 4017 |
\zref@refused{LastPage}% |
| 4018 |
}% |
| 4019 |
% \end{macrocode} |
| 4020 |
% \end{macro} |
| 4021 |
% \begin{macrocode} |
| 4022 |
\ltx@LocalAppendToMacro\ZREF@pa@AtVeryEnd{% |
| 4023 |
\@PackageInfoNoLine{zref-pageattr}{% |
| 4024 |
\ltx@backslashchar |
| 4025 |
\ifluatex pdfvariable\else pdf\fi |
| 4026 |
pagesattr:\MessageBreak |
| 4027 |
<<\zref@pdfpagesattr>>% |
| 4028 |
\MessageBreak |
| 4029 |
}% |
| 4030 |
}% |
| 4031 |
} |
| 4032 |
\AddToHook {enddocument/afterlastpage}{% |
| 4033 |
\ZREF@pa@AfterLastShipout |
| 4034 |
} |
| 4035 |
% \end{macrocode} |
| 4036 |
% \begin{macrocode} |
| 4037 |
%</pageattr> |
| 4038 |
% \end{macrocode} |
| 4039 |
% |
| 4040 |
% |
| 4041 |
% \subsection{Module \xmodule{marks}} |
| 4042 |
% |
| 4043 |
% \begin{macrocode} |
| 4044 |
%<*marks> |
| 4045 |
\NeedsTeXFormat{LaTeX2e} |
| 4046 |
\ProvidesPackage{zref-marks}% |
| 4047 |
[2026-03-07 v2.37 Module marks for zref (HO)]% |
| 4048 |
\RequirePackage{zref-base}[2019/11/29] |
| 4049 |
\ifx\ZREF@base@ok Y% |
| 4050 |
\else |
| 4051 |
\expandafter\endinput |
| 4052 |
\fi |
| 4053 |
% \end{macrocode} |
| 4054 |
% |
| 4055 |
% \begin{macrocode} |
| 4056 |
\newcommand*{\zref@marks@register}[3][]{% |
| 4057 |
\edef\ZREF@TempName{#1}% |
| 4058 |
\edef\ZREF@TempNum{\ZREF@number{#2}}% |
| 4059 |
\ifnum\ZREF@TempNum<\ltx@zero % |
| 4060 |
\PackageError\ZREF@name{% |
| 4061 |
\string\zref@marks@register\ltx@space is called with invalid% |
| 4062 |
\MessageBreak |
| 4063 |
marks register number (\ZREF@TempNum)% |
| 4064 |
}{% |
| 4065 |
Use `0' or the command, defined by \string\newmarks.\MessageBreak |
| 4066 |
\@ehc |
| 4067 |
}% |
| 4068 |
\else |
| 4069 |
\ifx\ZREF@TempName\ltx@empty |
| 4070 |
\edef\ZREF@TempName{mark\romannumeral\ZREF@TempNum}% |
| 4071 |
\else |
| 4072 |
\edef\ZREF@TempName{marks\ZREF@TempName}% |
| 4073 |
\fi |
| 4074 |
\ZREF@MARKS@DefineProp{top}% |
| 4075 |
\ZREF@MARKS@DefineProp{first}% |
| 4076 |
\ZREF@MARKS@DefineProp{bot}% |
| 4077 |
\kv@parse{#3}{% |
| 4078 |
\ifx\kv@value\relax |
| 4079 |
\def\kv@value{top,first,bot}% |
| 4080 |
\fi |
| 4081 |
\edef\ZREF@temp{\expandafter\ltx@car\kv@key X\@nil}% |
| 4082 |
\ifx\ZREF@temp\ZREF@STAR |
| 4083 |
\edef\kv@key{\expandafter\ltx@cdr\kv@key\@nil}% |
| 4084 |
\zref@newlist\kv@key |
| 4085 |
\fi |
| 4086 |
\expandafter\comma@parse\expandafter{\kv@value}{% |
| 4087 |
\ifcase0\ifx\comma@entry\ZREF@NAME@top 1\else |
| 4088 |
\ifx\comma@entry\ZREF@NAME@first 1\else |
| 4089 |
\ifx\comma@entry\ZREF@NAME@bot 1\fi\fi\fi\ltx@space |
| 4090 |
\PackageWarning{zref-marks}{% |
| 4091 |
Use `top', `first' or `bot' for the list values% |
| 4092 |
\MessageBreak |
| 4093 |
in the third argument of \string\zref@marks@register.% |
| 4094 |
\MessageBreak |
| 4095 |
Ignoring unknown value `\comma@entry'% |
| 4096 |
}% |
| 4097 |
\else |
| 4098 |
\zref@addprop{\kv@key}{\comma@entry\ZREF@TempName}% |
| 4099 |
\fi |
| 4100 |
\ltx@gobble |
| 4101 |
}% |
| 4102 |
\ltx@gobbletwo |
| 4103 |
}% |
| 4104 |
\fi |
| 4105 |
} |
| 4106 |
\def\ZREF@STAR{*} |
| 4107 |
\def\ZREF@NAME@top{top} |
| 4108 |
\def\ZREF@NAME@first{first} |
| 4109 |
\def\ZREF@NAME@bot{bot} |
| 4110 |
\def\ZREF@MARKS@DefineProp#1{% |
| 4111 |
\zref@ifpropundefined{#1\ZREF@TempName}{% |
| 4112 |
\ifnum\ZREF@TempNum=\ltx@zero |
| 4113 |
\begingroup |
| 4114 |
\edef\x{\endgroup |
| 4115 |
\noexpand\zref@newprop*{#1\ZREF@TempName}[]{% |
| 4116 |
\expandafter\noexpand\csname#1mark\endcsname |
| 4117 |
}% |
| 4118 |
}% |
| 4119 |
\x |
| 4120 |
\else |
| 4121 |
\begingroup |
| 4122 |
\edef\x{\endgroup |
| 4123 |
\noexpand\zref@newprop*{#1\ZREF@TempName}[]{% |
| 4124 |
\expandafter\noexpand\csname#1marks\endcsname |
| 4125 |
\ZREF@TempNum |
| 4126 |
}% |
| 4127 |
}% |
| 4128 |
\x |
| 4129 |
\fi |
| 4130 |
}{% |
| 4131 |
\PackageWarning{zref-marks}{% |
| 4132 |
\string\zref@marks@register\ltx@space does not generate the% |
| 4133 |
\MessageBreak |
| 4134 |
new property `#1\ZREF@TempName', because\MessageBreak |
| 4135 |
it is already defined% |
| 4136 |
}% |
| 4137 |
}% |
| 4138 |
} |
| 4139 |
% \end{macrocode} |
| 4140 |
% \begin{macrocode} |
| 4141 |
%</marks> |
| 4142 |
% \end{macrocode} |
| 4143 |
% |
| 4144 |
% \subsection{Module \xmodule{runs}} |
| 4145 |
% |
| 4146 |
% This module does not use the label-reference-system. |
| 4147 |
% The reference changes with each \hologo{LaTeX}~run and would |
| 4148 |
% force a rerun warning always. |
| 4149 |
% \begin{macrocode} |
| 4150 |
%<*runs> |
| 4151 |
\NeedsTeXFormat{LaTeX2e} |
| 4152 |
\ProvidesPackage{zref-runs}% |
| 4153 |
[2026-03-07 v2.37 Module runs for zref (HO)]% |
| 4154 |
% \end{macrocode} |
| 4155 |
% |
| 4156 |
% \begin{macro}{\zruns} |
| 4157 |
% \begin{macrocode} |
| 4158 |
\providecommand*{\zruns}{0}% |
| 4159 |
\AtBeginDocument{% |
| 4160 |
\edef\zruns{\number\numexpr\zruns+1}% |
| 4161 |
\begingroup |
| 4162 |
\def\on@line{}% |
| 4163 |
\PackageInfo{zref-runs}{LaTeX runs: \zruns}% |
| 4164 |
\if@filesw |
| 4165 |
\immediate\write\@mainaux{% |
| 4166 |
\string\gdef\string\zruns{\zruns}% |
| 4167 |
}% |
| 4168 |
\fi |
| 4169 |
\endgroup |
| 4170 |
} |
| 4171 |
% \end{macrocode} |
| 4172 |
% \end{macro} |
| 4173 |
% |
| 4174 |
% \begin{macrocode} |
| 4175 |
%</runs> |
| 4176 |
% \end{macrocode} |
| 4177 |
% |
| 4178 |
% |
| 4179 |
% \subsection{Module \xmodule{perpage}} |
| 4180 |
% |
| 4181 |
% \begin{macrocode} |
| 4182 |
%<*perpage> |
| 4183 |
\NeedsTeXFormat{LaTeX2e} |
| 4184 |
\ProvidesPackage{zref-perpage}% |
| 4185 |
[2026-03-07 v2.37 Module perpage for zref (HO)]% |
| 4186 |
\RequirePackage{zref-base}[2019/11/29] |
| 4187 |
\ifx\ZREF@base@ok Y% |
| 4188 |
\else |
| 4189 |
\expandafter\endinput |
| 4190 |
\fi |
| 4191 |
% \end{macrocode} |
| 4192 |
% |
| 4193 |
% This module resets a counter at page boundaries. |
| 4194 |
% Because of the asynchronous output routine |
| 4195 |
% page counter properties cannot be asked directly, |
| 4196 |
% references are necessary. |
| 4197 |
% |
| 4198 |
% For detecting changed pages module \xmodule{abspage} |
| 4199 |
% is loaded. |
| 4200 |
% \begin{macrocode} |
| 4201 |
\RequirePackage{zref-abspage}[2019/11/29] |
| 4202 |
% \end{macrocode} |
| 4203 |
% |
| 4204 |
% We group the properties for the needed references |
| 4205 |
% in the property list |perpage|. The property |pagevalue| |
| 4206 |
% records the correct value of the page counter. |
| 4207 |
% \begin{macrocode} |
| 4208 |
\ZREF@NewPropPageValue |
| 4209 |
\zref@newlist{perpage} |
| 4210 |
\zref@addprops{perpage}{abspage,page,pagevalue} |
| 4211 |
% \end{macrocode} |
| 4212 |
% The page value, known by the reference mechanism, will be |
| 4213 |
% stored in counter |zpage|. |
| 4214 |
% \begin{macrocode} |
| 4215 |
\newcounter{zpage} |
| 4216 |
% \end{macrocode} |
| 4217 |
% Counter |zref@unique| helps in generating unique reference |
| 4218 |
% names. |
| 4219 |
% \begin{macrocode} |
| 4220 |
\zref@require@unique |
| 4221 |
% \end{macrocode} |
| 4222 |
% In order to be able to reset the counter, we hook here |
| 4223 |
% into \cs{stepcounter}. In fact two nested hooks are used |
| 4224 |
% to allow other packages to use the first hook at the beginning |
| 4225 |
% of \cs{stepcounter}. |
| 4226 |
% \begin{macrocode} |
| 4227 |
\let\ZREF@org@stepcounter\stepcounter |
| 4228 |
\def\stepcounter#1{% |
| 4229 |
\ifcsname @stepcounterhook@#1\endcsname |
| 4230 |
\csname @stepcounterhook@#1\endcsname |
| 4231 |
\fi |
| 4232 |
\ZREF@org@stepcounter{#1}% |
| 4233 |
} |
| 4234 |
% \end{macrocode} |
| 4235 |
% |
| 4236 |
% If amstext is loaded it overwrites the definition (or we overwrite their definition) |
| 4237 |
% so we account for this by using a package hook, see |
| 4238 |
% https://github.com/ho-tex/zref/issues/11. |
| 4239 |
% \begin{macrocode} |
| 4240 |
\IfFormatAtLeastTF{2020/10/01} |
| 4241 |
{ |
| 4242 |
\AddToHook{package/amstext/after} |
| 4243 |
{\def\stepcounter#1{% |
| 4244 |
\iffirstchoice@ |
| 4245 |
\ifcsname @stepcounterhook@#1\endcsname |
| 4246 |
\csname @stepcounterhook@#1\endcsname |
| 4247 |
\fi |
| 4248 |
\addtocounter{#1}\@ne |
| 4249 |
\begingroup \let\@elt\@stpelt \csname cl@#1\endcsname \endgroup |
| 4250 |
\fi |
| 4251 |
}} |
| 4252 |
}{} |
| 4253 |
% \end{macrocode} |
| 4254 |
% |
| 4255 |
% |
| 4256 |
% \cs{@stpelt} must be adapted due to the change in latex |
| 4257 |
% 2015-01, see https://github.com/ho-tex/zref/issues/26 |
| 4258 |
% \begin{macrocode} |
| 4259 |
\let\ZREF@org@@stpelt\@stpelt |
| 4260 |
\def\@stpelt#1{% |
| 4261 |
\ifcsname ZREF@perpage@#1\endcsname |
| 4262 |
\begingroup |
| 4263 |
\let\stepcounter\ZREF@org@stepcounter |
| 4264 |
\ZREF@org@@stpelt{#1}% |
| 4265 |
\endgroup |
| 4266 |
\expandafter\ltx@gobbletwo |
| 4267 |
\fi |
| 4268 |
\ZREF@org@@stpelt{#1}% |
| 4269 |
} |
| 4270 |
% \end{macrocode} |
| 4271 |
% |
| 4272 |
% \begin{macro}{\zmakeperpage} |
| 4273 |
% Macro \cs{zmakeperpage} resets a counter at each page |
| 4274 |
% break. It uses the same syntax and semantics as |
| 4275 |
% \cs{MakePerPage} from package \xpackage{perpage} \cite{perpage}. |
| 4276 |
% The initial start value can be given by the optional |
| 4277 |
% argument. Default is one that means after the first |
| 4278 |
% \cs{stepcounter} on a new page the counter starts with |
| 4279 |
% one. |
| 4280 |
% \begin{macrocode} |
| 4281 |
\ZREF@IfDefinable\zmakeperpage\def{% |
| 4282 |
{% |
| 4283 |
\@ifnextchar[\ZREF@makeperpage@opt{\ZREF@@makeperpage[\ltx@zero]}% |
| 4284 |
}% |
| 4285 |
} |
| 4286 |
% \end{macrocode} |
| 4287 |
% \end{macro} |
| 4288 |
% We hook before the counter is incremented in \cs{stepcounter}, |
| 4289 |
% package \xpackage{perpage} afterwards. Thus a little |
| 4290 |
% calculation is necessary. |
| 4291 |
% \begin{macrocode} |
| 4292 |
\def\ZREF@makeperpage@opt[#1]{% |
| 4293 |
\begingroup |
| 4294 |
\edef\x{\endgroup |
| 4295 |
\noexpand\ZREF@@makeperpage[\number\numexpr#1-1\relax]% |
| 4296 |
}% |
| 4297 |
\x |
| 4298 |
} |
| 4299 |
% \end{macrocode} |
| 4300 |
% \begin{macrocode} |
| 4301 |
\def\ZREF@@makeperpage[#1]#2{% |
| 4302 |
\@ifundefined{@stepcounterhook@#2}{% |
| 4303 |
\expandafter\gdef\csname @stepcounterhook@#2\endcsname{}% |
| 4304 |
}{}% |
| 4305 |
\expandafter\gdef\csname ZREF@perpage@#2\endcsname{% |
| 4306 |
\ZREF@@perpage@step{#2}{#1}% |
| 4307 |
}% |
| 4308 |
\expandafter\g@addto@macro\csname @stepcounterhook@#2\endcsname{% |
| 4309 |
\ifcsname ZREF@perpage@#2\endcsname |
| 4310 |
\csname ZREF@perpage@#2\endcsname |
| 4311 |
\fi |
| 4312 |
}% |
| 4313 |
} |
| 4314 |
% \end{macrocode} |
| 4315 |
% \begin{macro}{\ZREF@@perpage@step} |
| 4316 |
% The heart of this module follows. |
| 4317 |
% \begin{macrocode} |
| 4318 |
\def\ZREF@@perpage@step#1#2{% |
| 4319 |
% \end{macrocode} |
| 4320 |
% First the reference is generated. |
| 4321 |
% \begin{macrocode} |
| 4322 |
\global\advance\c@zref@unique\ltx@one |
| 4323 |
\begingroup |
| 4324 |
\expandafter |
| 4325 |
\zref@labelbylist\expandafter{\thezref@unique}{perpage}% |
| 4326 |
% \end{macrocode} |
| 4327 |
% The \cs{expandafter} commands are necessary, because \cs{ZREF@temp} |
| 4328 |
% is also used inside of \cs{zref@labelbylist}. |
| 4329 |
% |
| 4330 |
% The evaluation of the reference follows. If the reference |
| 4331 |
% is not yet kwown, we use the page counter as approximation. |
| 4332 |
% \begin{macrocode} |
| 4333 |
\zref@ifrefundefined\thezref@unique{% |
| 4334 |
\global\c@zpage=\c@page |
| 4335 |
\global\let\thezpage\thepage |
| 4336 |
\expandafter\xdef\csname ZREF@abspage@#1\endcsname{% |
| 4337 |
\number\c@abspage |
| 4338 |
}% |
| 4339 |
}{% |
| 4340 |
% \end{macrocode} |
| 4341 |
% The reference is used to set \cs{thezpage} and counter |zpage|. |
| 4342 |
% \begin{macrocode} |
| 4343 |
\global\c@zpage=\zref@extract\thezref@unique{pagevalue}\relax |
| 4344 |
\xdef\thezpage{\noexpand\zref@extract{\thezref@unique}{page}}% |
| 4345 |
\expandafter\xdef\csname ZREF@abspage@#1\endcsname{% |
| 4346 |
\zref@extractdefault\thezref@unique |
| 4347 |
{abspage}{\number\c@abspage}% |
| 4348 |
}% |
| 4349 |
}% |
| 4350 |
% \end{macrocode} |
| 4351 |
% Page changes are detected by a changed absolute page number. |
| 4352 |
% \begin{macrocode} |
| 4353 |
\expandafter\ifx\csname ZREF@abspage@#1\expandafter\endcsname |
| 4354 |
\csname ZREF@currentabspage@#1\endcsname |
| 4355 |
\else |
| 4356 |
\global\csname c@#1\endcsname=#2\relax |
| 4357 |
\global\expandafter\let |
| 4358 |
\csname ZREF@currentabspage@#1\expandafter\endcsname |
| 4359 |
\csname ZREF@abspage@#1\endcsname |
| 4360 |
\fi |
| 4361 |
\endgroup |
| 4362 |
} |
| 4363 |
% \end{macrocode} |
| 4364 |
% \end{macro} |
| 4365 |
% \begin{macro}{\zunmakeperpage} |
| 4366 |
% Macro \cs{zunmakeperpage} cancels the effect of \cs{zmakeperpage}. |
| 4367 |
% \begin{macrocode} |
| 4368 |
\ZREF@IfDefinable\zunmakeperpage\def{% |
| 4369 |
#1{% |
| 4370 |
\global\expandafter |
| 4371 |
\let\csname ZREF@perpage@#1\endcsname\@undefined |
| 4372 |
}% |
| 4373 |
} |
| 4374 |
% \end{macrocode} |
| 4375 |
% \end{macro} |
| 4376 |
% |
| 4377 |
% \begin{macrocode} |
| 4378 |
%</perpage> |
| 4379 |
% \end{macrocode} |
| 4380 |
% |
| 4381 |
% |
| 4382 |
% \subsection{Module \xmodule{titleref}} |
| 4383 |
% |
| 4384 |
% \begin{macrocode} |
| 4385 |
%<*titleref> |
| 4386 |
\NeedsTeXFormat{LaTeX2e} |
| 4387 |
\ProvidesPackage{zref-titleref}% |
| 4388 |
[2026-03-07 v2.37 Module titleref for zref (HO)]% |
| 4389 |
\RequirePackage{zref-base}[2019/11/29] |
| 4390 |
\ifx\ZREF@base@ok Y% |
| 4391 |
\else |
| 4392 |
\expandafter\endinput |
| 4393 |
\fi |
| 4394 |
\RequirePackage{gettitlestring}[2009/12/08] |
| 4395 |
% \end{macrocode} |
| 4396 |
% |
| 4397 |
% \subsubsection{Implementation} |
| 4398 |
% \begin{macrocode} |
| 4399 |
\RequirePackage{keyval} |
| 4400 |
% \end{macrocode} |
| 4401 |
% |
| 4402 |
% This module makes section and caption titles available |
| 4403 |
% for the reference system. It uses some of the ideas |
| 4404 |
% of package \xpackage{nameref} and \xpackage{titleref}. |
| 4405 |
% |
| 4406 |
% Now we can add the property \verb|title| is added to |
| 4407 |
% the main property list. |
| 4408 |
% \begin{macrocode} |
| 4409 |
\ZREF@NewPropTitle |
| 4410 |
\zref@addprop\ZREF@mainlist{title}% |
| 4411 |
% \end{macrocode} |
| 4412 |
% |
| 4413 |
% The title strings go into the \xfile{.aux} file, thus |
| 4414 |
% they need some kind of protection. |
| 4415 |
% Package \xpackage{titleref} uses a protected expansion |
| 4416 |
% method. The advantage is that this can be used to |
| 4417 |
% cleanup the string and to remove \cs{label}, \cs{index} |
| 4418 |
% and other macros unwanted for referencing. |
| 4419 |
% But there is the risk that fragile stuff can break. |
| 4420 |
% |
| 4421 |
% Therefore package \xpackage{nameref} does not expand |
| 4422 |
% the string. Thus the entries can safely be written to |
| 4423 |
% the \xfile{.aux} file. But potentially dangerous |
| 4424 |
% macros such as \cs{label} remain in the string and |
| 4425 |
% can cause problems when using the string in references. |
| 4426 |
% |
| 4427 |
% \begin{macro}{\ifzref@titleref@expand} |
| 4428 |
% The switch \cs{ifzref@titleref@expand} distinguishes |
| 4429 |
% between the both methods. Package \xpackage{nameref}'s |
| 4430 |
% behaviour is achieved by setting the switch to false, |
| 4431 |
% otherwise \xpackage{titleref}'s expansion is used. |
| 4432 |
% Default is false. |
| 4433 |
% \begin{macrocode} |
| 4434 |
\newif\ifzref@titleref@expand |
| 4435 |
% \end{macrocode} |
| 4436 |
% \end{macro} |
| 4437 |
% |
| 4438 |
% \begin{macro}{\ZREF@titleref@hook} |
| 4439 |
% The hook \cs{ZREF@titleref@hook} allows to extend |
| 4440 |
% the cleanup for the expansion method. Thus |
| 4441 |
% unnecessary macros can be removed or dangerous commands |
| 4442 |
% removed. The hook is executed before the expansion of |
| 4443 |
% \cs{zref@titleref@current}. |
| 4444 |
% \begin{macrocode} |
| 4445 |
\let\ZREF@titleref@hook\ltx@empty |
| 4446 |
% \end{macrocode} |
| 4447 |
% \end{macro} |
| 4448 |
% \begin{macro}{\zref@titleref@cleanup} |
| 4449 |
% The hook should not be used directly, instead we provide the |
| 4450 |
% macro \cs{zref@titleref@cleanup} to add stuff to the hook |
| 4451 |
% and prevents that a previous non-empty content is not discarded |
| 4452 |
% accidentally. |
| 4453 |
% \begin{macrocode} |
| 4454 |
\ZREF@Robust\def\zref@titleref@cleanup#1{% |
| 4455 |
\begingroup |
| 4456 |
\toks@\expandafter{% |
| 4457 |
\ZREF@titleref@hook |
| 4458 |
#1% |
| 4459 |
}% |
| 4460 |
\expandafter\endgroup |
| 4461 |
\expandafter\def\expandafter\ZREF@titleref@hook\expandafter{% |
| 4462 |
\the\toks@ |
| 4463 |
}% |
| 4464 |
}% |
| 4465 |
% \end{macrocode} |
| 4466 |
% \end{macro} |
| 4467 |
% |
| 4468 |
% \begin{macro}{\ifzref@titleref@stripperiod} |
| 4469 |
% Sometimes a title contains a period at the end. |
| 4470 |
% Package \xpackage{nameref} removes this. This behaviour |
| 4471 |
% is controlled by the switch \cs{ifzref@titleref@stripperiod} |
| 4472 |
% and works regardless of the setting of option \xoption{expand}. |
| 4473 |
% Period stripping is the default. |
| 4474 |
% \begin{macrocode} |
| 4475 |
\newif\ifzref@titleref@stripperiod |
| 4476 |
\zref@titleref@stripperiodtrue |
| 4477 |
% \end{macrocode} |
| 4478 |
% \end{macro} |
| 4479 |
% |
| 4480 |
% \begin{macro}{\zref@titleref@setcurrent} |
| 4481 |
% Macro \cs{zref@titleref@setcurrent} sets a new current title |
| 4482 |
% stored in \cs{zref@titleref@current}. Some cleanup and |
| 4483 |
% expansion is performed that can be controlled by the |
| 4484 |
% previous switches. |
| 4485 |
% \begin{macrocode} |
| 4486 |
\ZREF@Robust\def\zref@titleref@setcurrent#1{% |
| 4487 |
\ifzref@titleref@expand |
| 4488 |
\GetTitleStringExpand{#1}% |
| 4489 |
\else |
| 4490 |
\GetTitleStringNonExpand{#1}% |
| 4491 |
\fi |
| 4492 |
\edef\zref@titleref@current{% |
| 4493 |
\detokenize\expandafter{\GetTitleStringResult}% |
| 4494 |
}% |
| 4495 |
\ifzref@titleref@stripperiod |
| 4496 |
\edef\zref@titleref@current{% |
| 4497 |
\expandafter\ZREF@stripperiod\zref@titleref@current |
| 4498 |
\ltx@empty.\ltx@empty\@nil |
| 4499 |
}% |
| 4500 |
\fi |
| 4501 |
}% |
| 4502 |
\GetTitleStringDisableCommands{% |
| 4503 |
\ZREF@titleref@hook |
| 4504 |
} |
| 4505 |
% \end{macrocode} |
| 4506 |
% \end{macro} |
| 4507 |
% \begin{macro}{\ZREF@stripperiod} |
| 4508 |
% If \cs{ZREF@stripperiod} is called, the argument consists of |
| 4509 |
% space tokens and tokens with catcode 12 (other), because |
| 4510 |
% of \hologo{eTeX}'s \cs{detokenize}. |
| 4511 |
% \begin{macrocode} |
| 4512 |
\def\ZREF@stripperiod#1.\ltx@empty#2\@nil{#1}% |
| 4513 |
% \end{macrocode} |
| 4514 |
% \end{macro} |
| 4515 |
% |
| 4516 |
% \subsubsection{User interface} |
| 4517 |
% |
| 4518 |
% \begin{macro}{\ztitlerefsetup} |
| 4519 |
% The behaviour of module \xmodule{titleref} is controlled |
| 4520 |
% by switches and a hook. They can be set by \cs{ztitlerefsetup} |
| 4521 |
% with a key value interface, provided by package \xpackage{keyval}. |
| 4522 |
% Also the current title can be given explicitly by the key |
| 4523 |
% \verb|title|. |
| 4524 |
% \begin{macrocode} |
| 4525 |
\define@key{ZREF@TR}{expand}[true]{% |
| 4526 |
\csname zref@titleref@expand#1\endcsname |
| 4527 |
}% |
| 4528 |
\define@key{ZREF@TR}{stripperiod}[true]{% |
| 4529 |
\csname zref@titleref@stripperiod#1\endcsname |
| 4530 |
}% |
| 4531 |
\define@key{ZREF@TR}{cleanup}{% |
| 4532 |
\zref@titleref@cleanup{#1}% |
| 4533 |
}% |
| 4534 |
\define@key{ZREF@TR}{title}{% |
| 4535 |
\def\zref@titleref@current{#1}% |
| 4536 |
}% |
| 4537 |
\ZREF@IfDefinable\ztitlerefsetup\def{% |
| 4538 |
{\kvsetkeys{ZREF@TR}}% |
| 4539 |
}% |
| 4540 |
% \end{macrocode} |
| 4541 |
% \end{macro} |
| 4542 |
% |
| 4543 |
% \begin{macro}{\ztitleref} |
| 4544 |
% The user command \cs{ztitleref} references the title. |
| 4545 |
% For safety \cs{label} is disabled to prevent multiply |
| 4546 |
% defined references. |
| 4547 |
% \begin{macrocode} |
| 4548 |
\ZREF@IfDefinable\ztitleref\def{% |
| 4549 |
{\zref@wrapper@babel\ZREF@titleref}% |
| 4550 |
}% |
| 4551 |
\def\ZREF@titleref#1{% |
| 4552 |
\begingroup |
| 4553 |
\zref@refused{#1}% |
| 4554 |
\let\label\ltx@gobble |
| 4555 |
\zref@extract{#1}{title}% |
| 4556 |
\endgroup |
| 4557 |
}% |
| 4558 |
% \end{macrocode} |
| 4559 |
% \end{macro} |
| 4560 |
% |
| 4561 |
% \subsubsection{Patches for section and caption commands} |
| 4562 |
% |
| 4563 |
% The section and caption macros are patched to extract the |
| 4564 |
% title data. |
| 4565 |
% |
| 4566 |
% Captions of figures and tables. |
| 4567 |
% \begin{macrocode} |
| 4568 |
\AtBeginDocument{% |
| 4569 |
\ZREF@patch{@caption}{% |
| 4570 |
\long\def\@caption#1[#2]{% |
| 4571 |
\zref@titleref@setcurrent{#2}% |
| 4572 |
\ZREF@org@@caption{#1}[{#2}]% |
| 4573 |
}% |
| 4574 |
}% |
| 4575 |
% \end{macrocode} |
| 4576 |
% |
| 4577 |
% Section commands without star. The title version for the |
| 4578 |
% table of contents is used because it is usually shorter and |
| 4579 |
% more robust. |
| 4580 |
% \begin{macrocode} |
| 4581 |
\ZREF@patch{@part}{% |
| 4582 |
\def\@part[#1]{% |
| 4583 |
\zref@titleref@setcurrent{#1}% |
| 4584 |
\ZREF@org@@part[{#1}]% |
| 4585 |
}% |
| 4586 |
}% |
| 4587 |
\ZREF@patch{@chapter}{% |
| 4588 |
\def\@chapter[#1]{% |
| 4589 |
\zref@titleref@setcurrent{#1}% |
| 4590 |
\ZREF@org@@chapter[{#1}]% |
| 4591 |
}% |
| 4592 |
}% |
| 4593 |
\ZREF@patch{@sect}{% |
| 4594 |
\def\@sect#1#2#3#4#5#6[#7]{% |
| 4595 |
\zref@titleref@setcurrent{#7}% |
| 4596 |
\ZREF@org@@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]% |
| 4597 |
}% |
| 4598 |
}% |
| 4599 |
% \end{macrocode} |
| 4600 |
% The star versions of the section commands. |
| 4601 |
% \begin{macrocode} |
| 4602 |
\ZREF@patch{@spart}{% |
| 4603 |
\def\@spart#1{% |
| 4604 |
\zref@titleref@setcurrent{#1}% |
| 4605 |
\ZREF@org@@spart{#1}% |
| 4606 |
}% |
| 4607 |
}% |
| 4608 |
\ZREF@patch{@schapter}{% |
| 4609 |
\def\@schapter#1{% |
| 4610 |
\zref@titleref@setcurrent{#1}% |
| 4611 |
\ZREF@org@@schapter{#1}% |
| 4612 |
}% |
| 4613 |
}% |
| 4614 |
\ZREF@patch{@ssect}{% |
| 4615 |
\def\@ssect#1#2#3#4#5{% |
| 4616 |
\zref@titleref@setcurrent{#5}% |
| 4617 |
\ZREF@org@@ssect{#1}{#2}{#3}{#4}{#5}% |
| 4618 |
}% |
| 4619 |
}% |
| 4620 |
% \end{macrocode} |
| 4621 |
% |
| 4622 |
% \subsubsection{Environment \textsf{description}} |
| 4623 |
% |
| 4624 |
% \begin{macrocode} |
| 4625 |
\ZREF@patch{descriptionlabel}{% |
| 4626 |
\def\descriptionlabel#1{% |
| 4627 |
\zref@titleref@setcurrent{#1}% |
| 4628 |
\ZREF@org@descriptionlabel{#1}% |
| 4629 |
}% |
| 4630 |
}% |
| 4631 |
% \end{macrocode} |
| 4632 |
% |
| 4633 |
% \subsubsection{Class \xclass{memoir}} |
| 4634 |
% |
| 4635 |
% \begin{macrocode} |
| 4636 |
\@ifclassloaded{memoir}{% |
| 4637 |
\ltx@IfUndefined{ifheadnameref}{}{% |
| 4638 |
\def\@chapter[#1]#2{% |
| 4639 |
\ltx@IfUndefined{ch@pt@c}{% |
| 4640 |
\zref@titleref@setcurrent{#1}% |
| 4641 |
}{% |
| 4642 |
\ifx\ch@pt@c\ltx@empty |
| 4643 |
\zref@titleref@setcurrent{#2}% |
| 4644 |
\else |
| 4645 |
\def\NR@temp{#1}% |
| 4646 |
\ifx\NR@temp\ltx@empty |
| 4647 |
\expandafter\zref@titleref@setcurrent |
| 4648 |
\expandafter{\ch@pt@c}% |
| 4649 |
\else |
| 4650 |
\ifheadnameref |
| 4651 |
\zref@titleref@setcurrent{#1}% |
| 4652 |
\else |
| 4653 |
\expandafter\zref@titleref@setcurrent |
| 4654 |
\expandafter{\ch@pt@c}% |
| 4655 |
\fi |
| 4656 |
\fi |
| 4657 |
\fi |
| 4658 |
}% |
| 4659 |
\ZREF@org@@chapter[{#1}]{#2}% |
| 4660 |
}% |
| 4661 |
\ZREF@patch{M@sect}{% |
| 4662 |
\def\M@sect#1#2#3#4#5#6[#7][#8]{% |
| 4663 |
\ifheadnameref |
| 4664 |
\zref@titleref@setcurrent{#8}% |
| 4665 |
\else |
| 4666 |
\zref@titleref@setcurrent{#7}% |
| 4667 |
\fi |
| 4668 |
\ZREF@org@M@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}][{#8}]% |
| 4669 |
}% |
| 4670 |
}% |
| 4671 |
}% |
| 4672 |
}{}% |
| 4673 |
% \end{macrocode} |
| 4674 |
% |
| 4675 |
% \subsubsection{Class \xclass{beamer}} |
| 4676 |
% |
| 4677 |
% \begin{macrocode} |
| 4678 |
\@ifclassloaded{beamer}{% |
| 4679 |
\ZREF@patch{beamer@section}{% |
| 4680 |
\long\def\beamer@section[#1]{% |
| 4681 |
\zref@titleref@setcurrent{#1}% |
| 4682 |
\ZREF@org@beamer@section[{#1}]% |
| 4683 |
}% |
| 4684 |
}% |
| 4685 |
\ZREF@patch{beamer@subsection}{% |
| 4686 |
\long\def\beamer@subsection[#1]{% |
| 4687 |
\zref@titleref@setcurrent{#1}% |
| 4688 |
\ZREF@org@beamer@subsection[{#1}]% |
| 4689 |
}% |
| 4690 |
}% |
| 4691 |
\ZREF@patch{beamer@subsubsection}{% |
| 4692 |
\long\def\beamer@subsubsection[#1]{% |
| 4693 |
\zref@titleref@setcurrent{#1}% |
| 4694 |
\ZREF@org@beamer@subsubsection[{#1}]% |
| 4695 |
}% |
| 4696 |
}% |
| 4697 |
}{}% |
| 4698 |
% \end{macrocode} |
| 4699 |
% |
| 4700 |
% \subsubsection{Package \xpackage{titlesec}} |
| 4701 |
% |
| 4702 |
% \begin{macrocode} |
| 4703 |
\@ifpackageloaded{titlesec}{% |
| 4704 |
\ZREF@patch{ttl@sect@i}{% |
| 4705 |
\def\ttl@sect@i#1#2[#3]#4{% |
| 4706 |
\zref@titleref@setcurrent{#4}% |
| 4707 |
\ZREF@org@ttl@sect@i{#1}{#2}[{#3}]{#4}% |
| 4708 |
}% |
| 4709 |
}% |
| 4710 |
\ZREF@patch{ttl@straight@i}{% |
| 4711 |
\def\ttl@straight@i#1[#2]#3{% |
| 4712 |
\def\ZREF@temp{#2}% |
| 4713 |
\ifx\ZREF@temp\ltx@empty |
| 4714 |
\zref@titleref@setcurrent{#3}% |
| 4715 |
\else |
| 4716 |
\zref@titleref@setcurrent{#2}% |
| 4717 |
\fi |
| 4718 |
\ZREF@org@ttl@straight@i{#1}[{#2}]{#3}% |
| 4719 |
}% |
| 4720 |
}% |
| 4721 |
}{}% |
| 4722 |
% \end{macrocode} |
| 4723 |
% |
| 4724 |
% \subsubsection{Package \xpackage{longtable}} |
| 4725 |
% |
| 4726 |
% Package \xpackage{longtable}: some support for its \cs{caption}. |
| 4727 |
% However \cs{label} inside the caption is not supported. |
| 4728 |
% \begin{macrocode} |
| 4729 |
\@ifpackageloaded{longtable}{% |
| 4730 |
\ZREF@patch{LT@c@ption}{% |
| 4731 |
\def\LT@c@ption#1[#2]#3{% |
| 4732 |
\ZREF@org@LT@c@ption{#1}[{#2}]{#3}% |
| 4733 |
\zref@titleref@setcurrent{#2}% |
| 4734 |
}% |
| 4735 |
}% |
| 4736 |
}{}% |
| 4737 |
% \end{macrocode} |
| 4738 |
% |
| 4739 |
% \subsubsection{Package \xpackage{listings}} |
| 4740 |
% |
| 4741 |
% Package \xpackage{listings}: support for its caption. |
| 4742 |
% \begin{macrocode} |
| 4743 |
\@ifpackageloaded{listings}{% |
| 4744 |
\ZREF@patch{lst@MakeCaption}{% |
| 4745 |
\def\lst@MakeCaption{% |
| 4746 |
\ifx\lst@label\ltx@empty |
| 4747 |
\else |
| 4748 |
\expandafter\zref@titleref@setcurrent\expandafter{% |
| 4749 |
\lst@@caption |
| 4750 |
}% |
| 4751 |
\fi |
| 4752 |
\ZREF@org@lst@MakeCaption |
| 4753 |
}% |
| 4754 |
}% |
| 4755 |
}{}% |
| 4756 |
% \end{macrocode} |
| 4757 |
% |
| 4758 |
% \subsubsection{Theorems} |
| 4759 |
% |
| 4760 |
% \begin{macrocode} |
| 4761 |
\ZREF@patch{@opargbegintheorem}{% |
| 4762 |
\def\@opargbegintheorem#1#2#3{% |
| 4763 |
\zref@titleref@setcurrent{#3}% |
| 4764 |
\ZREF@org@@opargbegintheorem{#1}{#2}{#3}% |
| 4765 |
}% |
| 4766 |
}% |
| 4767 |
\@ifpackageloaded{amsthm}{% |
| 4768 |
\begingroup |
| 4769 |
\edef\x{macro:\string#1\string#2[\string#3]}% |
| 4770 |
\@onelevel@sanitize\x |
| 4771 |
\def\y#1->#2\@nil{#1}% |
| 4772 |
\edef\z{\expandafter\y\meaning\@begintheorem->\@nil}% |
| 4773 |
\@onelevel@sanitize\z |
| 4774 |
\expandafter\endgroup |
| 4775 |
\ifx\x\z |
| 4776 |
\ZREF@patch{@begintheorem}{% |
| 4777 |
\def\@begintheorem#1#2[#3]{% |
| 4778 |
\zref@titleref@setcurrent{#3}% |
| 4779 |
\ZREF@org@@begintheorem{#1}{#2}[{#3}]% |
| 4780 |
}% |
| 4781 |
}% |
| 4782 |
\fi |
| 4783 |
}{}% |
| 4784 |
% \end{macrocode} |
| 4785 |
% |
| 4786 |
% \begin{macrocode} |
| 4787 |
} |
| 4788 |
% \end{macrocode} |
| 4789 |
% |
| 4790 |
% \begin{macrocode} |
| 4791 |
%</titleref> |
| 4792 |
% \end{macrocode} |
| 4793 |
% |
| 4794 |
% |
| 4795 |
% \subsection{Module \xmodule{xr}} |
| 4796 |
% |
| 4797 |
% \begin{macrocode} |
| 4798 |
%<*xr> |
| 4799 |
\NeedsTeXFormat{LaTeX2e} |
| 4800 |
\ProvidesPackage{zref-xr}% |
| 4801 |
[2026-03-07 v2.37 Module xr for zref (HO)]% |
| 4802 |
\RequirePackage{zref-base}[2019/11/29] |
| 4803 |
\ifx\ZREF@base@ok Y% |
| 4804 |
\else |
| 4805 |
\expandafter\endinput |
| 4806 |
\fi |
| 4807 |
% \end{macrocode} |
| 4808 |
% \begin{macrocode} |
| 4809 |
\RequirePackage{keyval} |
| 4810 |
\RequirePackage{kvoptions}[2010/02/22] |
| 4811 |
% \end{macrocode} |
| 4812 |
% |
| 4813 |
% We declare property |url|, because this is added, |
| 4814 |
% if a reference is imported and has not already set this field. |
| 4815 |
% Or if |hyperref| is used, then this property can be asked. |
| 4816 |
% \begin{macrocode} |
| 4817 |
\zref@newprop{url}{}% |
| 4818 |
\zref@newprop{urluse}{}% |
| 4819 |
% \end{macrocode} |
| 4820 |
% \begin{macrocode} |
| 4821 |
\zref@newprop{externaldocument}{}% |
| 4822 |
% \end{macrocode} |
| 4823 |
% |
| 4824 |
% Most code, especially the handling of the \xfile{.aux} |
| 4825 |
% files are taken from David Carlisle's \xpackage{xr} package. |
| 4826 |
% Therefore I drop the documentation for these macros here. |
| 4827 |
% |
| 4828 |
% \begin{macro}{\zref@xr@ext} |
| 4829 |
% If the URL is not specified, then assume |
| 4830 |
% processed file with a guessed extension. |
| 4831 |
% Use the setting of \xpackage{hyperref} if available. |
| 4832 |
% \begin{macrocode} |
| 4833 |
\providecommand*{\zref@xr@ext}{% |
| 4834 |
\ltx@ifundefined{XR@ext}{pdf}{\XR@ext}% |
| 4835 |
}% |
| 4836 |
% \end{macrocode} |
| 4837 |
% \end{macro} |
| 4838 |
% \begin{macro}{\ifZREF@xr@zreflabel} |
| 4839 |
% The use of the star form of \cs{zexternaldocument} |
| 4840 |
% is remembered in the switch \cs{ifZREF@xr@zreflabel}. |
| 4841 |
% \begin{macrocode} |
| 4842 |
\newif\ifZREF@xr@zreflabel |
| 4843 |
% \end{macrocode} |
| 4844 |
% \end{macro} |
| 4845 |
% \begin{macrocode} |
| 4846 |
\SetupKeyvalOptions{% |
| 4847 |
family=ZREF@XR,% |
| 4848 |
prefix=ZREF@xr@% |
| 4849 |
} |
| 4850 |
\DeclareBoolOption[true]{tozreflabel} |
| 4851 |
\DeclareBoolOption[false]{toltxlabel} |
| 4852 |
\DeclareBoolOption{verbose} |
| 4853 |
\define@key{ZREF@XR}{ext}{% |
| 4854 |
\def\zref@xr@{#1}% |
| 4855 |
} |
| 4856 |
\DeclareBoolOption[false]{urluse} |
| 4857 |
% \end{macrocode} |
| 4858 |
% \begin{macro}{\zxrsetup} |
| 4859 |
% \begin{macrocode} |
| 4860 |
\newcommand*{\zxrsetup}{% |
| 4861 |
\kvsetkeys{ZREF@XR}% |
| 4862 |
}% |
| 4863 |
% \end{macrocode} |
| 4864 |
% \end{macro} |
| 4865 |
% |
| 4866 |
% \begin{macro}{\ZREF@xr@URL} |
| 4867 |
% \begin{macrocode} |
| 4868 |
\newcount\ZREF@xr@URL |
| 4869 |
\ZREF@xr@URL=\ltx@zero |
| 4870 |
% \end{macrocode} |
| 4871 |
% \end{macro} |
| 4872 |
% \begin{macro}{\ZREF@xr@AddURL} |
| 4873 |
% \begin{macrocode} |
| 4874 |
\def\ZREF@xr@AddURL#1{% |
| 4875 |
\begingroup |
| 4876 |
\def\ZREF@temp{#1}% |
| 4877 |
\count@=\ltx@one |
| 4878 |
\ZREF@xr@@AddUrl |
| 4879 |
\endgroup |
| 4880 |
} |
| 4881 |
% \end{macrocode} |
| 4882 |
% \end{macro} |
| 4883 |
% \begin{macro}{\ZREF@xr@@AddUrl} |
| 4884 |
% \begin{macrocode} |
| 4885 |
\def\ZREF@xr@@AddUrl{% |
| 4886 |
\ifnum\count@>\ZREF@xr@URL |
| 4887 |
\global\advance\ZREF@xr@URL by\ltx@one |
| 4888 |
\xdef\ZREF@xr@theURL{\romannumeral\ZREF@xr@URL}% |
| 4889 |
\global\expandafter\let |
| 4890 |
\csname Z@U@\ZREF@xr@theURL\endcsname\ZREF@temp |
| 4891 |
\@PackageInfo{zref-xr}{% |
| 4892 |
\ltx@backslashchar Z@U@\ZREF@xr@theURL:\MessageBreak |
| 4893 |
\ZREF@temp\MessageBreak |
| 4894 |
}% |
| 4895 |
\else |
| 4896 |
\expandafter |
| 4897 |
\ifx\csname Z@U@\romannumeral\count@\endcsname\ZREF@temp |
| 4898 |
\xdef\ZREF@xr@theURL{\romannumeral\count@}% |
| 4899 |
\else |
| 4900 |
\expandafter\expandafter\expandafter\ZREF@xr@@AddUrl |
| 4901 |
\fi |
| 4902 |
\fi |
| 4903 |
} |
| 4904 |
% \end{macrocode} |
| 4905 |
% \end{macro} |
| 4906 |
% |
| 4907 |
% \begin{macro}{\zexternaldocument} |
| 4908 |
% In its star form it looks for \cs{newlabel}, |
| 4909 |
% otherwise for \cs{zref@newlabel}. |
| 4910 |
% Later we |
| 4911 |
% will read \xfile{.aux} files that expects |
| 4912 |
% |@| to have catcode 11 (letter). |
| 4913 |
% \begin{macrocode} |
| 4914 |
\ZREF@IfDefinable\zexternaldocument\def{% |
| 4915 |
{% |
| 4916 |
\ZREF@NewPropAnchor |
| 4917 |
\ZREF@NewPropTitle |
| 4918 |
\begingroup |
| 4919 |
\csname @safe@actives@true\endcsname |
| 4920 |
\makeatletter |
| 4921 |
\@ifstar{% |
| 4922 |
\ZREF@xr@zreflabelfalse |
| 4923 |
\@testopt\ZREF@xr@externaldocument{}% |
| 4924 |
}{% |
| 4925 |
\ZREF@xr@zreflabeltrue |
| 4926 |
\@testopt\ZREF@xr@externaldocument{}% |
| 4927 |
}% |
| 4928 |
}% |
| 4929 |
}% |
| 4930 |
% \end{macrocode} |
| 4931 |
% \end{macro} |
| 4932 |
% |
| 4933 |
% If the \cs{include} feature was used, there can be |
| 4934 |
% several \xfile{.aux} files. These files are read |
| 4935 |
% one after another, especially they are not recursively |
| 4936 |
% read in order to save read registers. Thus it can |
| 4937 |
% happen that the read order of the newlabel commands |
| 4938 |
% differs from \hologo{LaTeX}'s order using \cs{input}. |
| 4939 |
% |
| 4940 |
% \begin{macro}{\ZREF@xr@externaldocument} |
| 4941 |
% It reads the remaining arguments. \cs{newcommand} |
| 4942 |
% comes in handy for the optional argument. |
| 4943 |
% \begin{macrocode} |
| 4944 |
\def\ZREF@xr@externaldocument[#1]#2{% |
| 4945 |
\def\ZREF@xr@prefix{#1}% |
| 4946 |
\let\ZREF@xr@filelist\ltx@empty |
| 4947 |
\edef\ZREF@xr@externalfile{#2}% |
| 4948 |
\edef\ZREF@xr@file{\ZREF@[email protected]}% |
| 4949 |
\filename@parse{#2}% |
| 4950 |
\@testopt\ZREF@xr@graburl{#2.\zref@xr@ext}% |
| 4951 |
}% |
| 4952 |
\def\ZREF@xr@graburl[#1]{% |
| 4953 |
\edef\ZREF@xr@url{#1}% |
| 4954 |
\ifZREF@xr@urluse |
| 4955 |
\expandafter\ZREF@xr@AddURL\expandafter{\ZREF@xr@url}% |
| 4956 |
\expandafter\def\expandafter\ZREF@xr@url |
| 4957 |
\expandafter{\csname Z@U@\ZREF@xr@theURL\endcsname}% |
| 4958 |
\fi |
| 4959 |
\ZREF@xr@checkfile |
| 4960 |
\endgroup |
| 4961 |
}% |
| 4962 |
% \end{macrocode} |
| 4963 |
% \end{macro} |
| 4964 |
% \begin{macro}{\ZREF@xr@processfile} |
| 4965 |
% We follow \xpackage{xr} here, \cs{IfFileExists} offers |
| 4966 |
% a nicer test, but we have to open the file anyway. |
| 4967 |
% \begin{macrocode} |
| 4968 |
\def\ZREF@xr@checkfile{% |
| 4969 |
\openin\@inputcheck\ZREF@xr@file\relax |
| 4970 |
\ifeof\@inputcheck |
| 4971 |
\PackageWarning{zref-xr}{% |
| 4972 |
File `\ZREF@xr@file' not found or empty,\MessageBreak |
| 4973 |
labels not imported% |
| 4974 |
}% |
| 4975 |
\else |
| 4976 |
\PackageInfo{zref-xr}{% |
| 4977 |
Label \ifZREF@xr@zreflabel (zref) \fi |
| 4978 |
import from `\ZREF@xr@file'% |
| 4979 |
}% |
| 4980 |
\def\ZREF@xr@found{0}% |
| 4981 |
\def\ZREF@xr@ignored@empty{0}% |
| 4982 |
\def\ZREF@xr@ignored@zref{0}% |
| 4983 |
\def\ZREF@xr@ignored@ltx{0}% |
| 4984 |
\ZREF@xr@processfile |
| 4985 |
\closein\@inputcheck |
| 4986 |
\begingroup |
| 4987 |
\let\on@line\ltx@empty |
| 4988 |
\PackageInfo{zref-xr}{% |
| 4989 |
Statistics for `\ZREF@xr@file':\MessageBreak |
| 4990 |
\ZREF@xr@found\space |
| 4991 |
\ifZREF@xr@zreflabel zref\else LaTeX\fi\space |
| 4992 |
label(s) found% |
| 4993 |
\ifnum\ZREF@xr@ignored@empty>0 % |
| 4994 |
,\MessageBreak |
| 4995 |
\ZREF@xr@ignored@empty\space empty label(s) ignored% |
| 4996 |
\fi |
| 4997 |
\ifnum\ZREF@xr@ignored@zref>0 % |
| 4998 |
,\MessageBreak |
| 4999 |
\ZREF@xr@ignored@zref\space |
| 5000 |
duplicated zref label(s) ignored% |
| 5001 |
\fi |
| 5002 |
\ifnum\ZREF@xr@ignored@ltx>0 % |
| 5003 |
,\MessageBreak |
| 5004 |
\ZREF@xr@ignored@ltx\space |
| 5005 |
duplicated latex label(s) ignored% |
| 5006 |
\fi |
| 5007 |
}% |
| 5008 |
\endgroup |
| 5009 |
\fi |
| 5010 |
\ifx\ZREF@xr@filelist\ltx@empty |
| 5011 |
\else |
| 5012 |
\edef\ZREF@xr@file{% |
| 5013 |
\expandafter\ltx@car\ZREF@xr@filelist\@nil |
| 5014 |
}% |
| 5015 |
\edef\ZREF@xr@filelist{% |
| 5016 |
\expandafter\ltx@cdr\ZREF@xr@filelist\ltx@empty\@nil |
| 5017 |
}% |
| 5018 |
\expandafter\ZREF@xr@checkfile |
| 5019 |
\fi |
| 5020 |
}% |
| 5021 |
% \end{macrocode} |
| 5022 |
% \end{macro} |
| 5023 |
% |
| 5024 |
% \begin{macro}{\ZREF@xr@processfile} |
| 5025 |
% \begin{macrocode} |
| 5026 |
\def\ZREF@xr@processfile{% |
| 5027 |
\read\@inputcheck to\ZREF@xr@line |
| 5028 |
\expandafter\ZREF@xr@processline\ZREF@xr@line..\ZREF@nil |
| 5029 |
\ifeof\@inputcheck |
| 5030 |
\else |
| 5031 |
\expandafter\ZREF@xr@processfile |
| 5032 |
\fi |
| 5033 |
}% |
| 5034 |
% \end{macrocode} |
| 5035 |
% \end{macro} |
| 5036 |
% \begin{macro}{\ZREF@xr@processline} |
| 5037 |
% The most work must be done for analyzing the |
| 5038 |
% arguments of \cs{newlabel}. |
| 5039 |
% \begin{macrocode} |
| 5040 |
\long\def\ZREF@xr@processline#1#2#3\ZREF@nil{% |
| 5041 |
\def\x{#1}% |
| 5042 |
\toks@{#2}% |
| 5043 |
\ifZREF@xr@zreflabel |
| 5044 |
\ifx\x\ZREF@xr@zref@newlabel |
| 5045 |
\expandafter |
| 5046 |
\ZREF@xr@process@zreflabel\ZREF@xr@line...\ZREF@nil |
| 5047 |
\fi |
| 5048 |
\else |
| 5049 |
\ifx\x\ZREF@xr@newlabel |
| 5050 |
\expandafter |
| 5051 |
\ZREF@xr@process@label\ZREF@xr@line...[]\ZREF@nil |
| 5052 |
\fi |
| 5053 |
\fi |
| 5054 |
\ifx\x\ZREF@xr@@input |
| 5055 |
\edef\ZREF@xr@filelist{% |
| 5056 |
\etex@unexpanded\expandafter{\ZREF@xr@filelist}% |
| 5057 |
{\filename@area\the\toks@}% |
| 5058 |
}% |
| 5059 |
\fi |
| 5060 |
}% |
| 5061 |
\def\ZREF@xr@process@zreflabel\zref@newlabel#1#2#3\ZREF@nil{% |
| 5062 |
\edef\ZREF@xr@refname{Z@R@\ZREF@xr@prefix#1}% |
| 5063 |
\edef\ZREF@xr@found{\the\numexpr\ZREF@xr@found+1\relax}% |
| 5064 |
\def\x{#2}% |
| 5065 |
\edef\ZREF@xr@tempname{$temp$}% |
| 5066 |
\edef\ZREF@xr@temprefname{Z@R@\ZREF@xr@tempname}% |
| 5067 |
\let\ZREF@xr@list\x |
| 5068 |
\ifx\ZREF@xr@list\ltx@empty |
| 5069 |
\PackageWarningNoLine{zref-xr}{% |
| 5070 |
Label `#1' without properties ignored\MessageBreak |
| 5071 |
in file `\ZREF@xr@file'% |
| 5072 |
}% |
| 5073 |
\edef\ZREF@xr@ignored@empty{% |
| 5074 |
\the\numexpr\ZREF@xr@ignored@empty+1\relax |
| 5075 |
}% |
| 5076 |
\else |
| 5077 |
\expandafter\ZREF@xr@checklist\x\ZREF@nil |
| 5078 |
\expandafter\let\csname\ZREF@xr@temprefname\endcsname\x |
| 5079 |
\expandafter\ltx@LocalAppendToMacro |
| 5080 |
\csname\ZREF@xr@temprefname\expandafter\endcsname |
| 5081 |
\expandafter{% |
| 5082 |
\expandafter\externaldocument\expandafter{% |
| 5083 |
\ZREF@xr@externalfile |
| 5084 |
}% |
| 5085 |
}% |
| 5086 |
\ZREF@xr@urlcheck\ZREF@xr@tempname |
| 5087 |
\ifZREF@xr@tozreflabel |
| 5088 |
\@ifundefined{\ZREF@xr@refname}{% |
| 5089 |
\ifZREF@xr@verbose |
| 5090 |
\PackageInfo{zref-xr}{% |
| 5091 |
Import to zref label `\ZREF@xr@tempname#1'% |
| 5092 |
}% |
| 5093 |
\fi |
| 5094 |
\global\expandafter |
| 5095 |
\let\csname\ZREF@xr@refname\expandafter\endcsname |
| 5096 |
\csname\ZREF@xr@temprefname\endcsname |
| 5097 |
}{% |
| 5098 |
\ZREF@xr@zref@ignorewarning{\ZREF@xr@prefix#1}% |
| 5099 |
}% |
| 5100 |
\fi |
| 5101 |
\ifZREF@xr@toltxlabel |
| 5102 |
\ZREF@xr@tolabel{\ZREF@xr@tempname}{\ZREF@xr@prefix#1}% |
| 5103 |
\fi |
| 5104 |
\fi |
| 5105 |
}% |
| 5106 |
\def\ZREF@xr@process@label\newlabel#1#2#3[#4]#5\ZREF@nil{% |
| 5107 |
\def\ZREF@xr@refname{Z@R@\ZREF@xr@prefix#1}% |
| 5108 |
\edef\ZREF@xr@found{\the\numexpr\ZREF@xr@found+1\relax}% |
| 5109 |
\def\x{#2}% |
| 5110 |
\edef\ZREF@xr@tempname{$temp$}% |
| 5111 |
\edef\ZREF@xr@temprefname{Z@R@\ZREF@xr@tempname}% |
| 5112 |
\expandafter\ZREF@xr@scanparams |
| 5113 |
\csname\ZREF@xr@temprefname\expandafter\endcsname |
| 5114 |
\x{}{}{}{}{}\ZREF@nil |
| 5115 |
\ifx\\#4\\% |
| 5116 |
\else |
| 5117 |
% ntheorem knows an optional argument at the end of \newlabel |
| 5118 |
\ZREF@NewPropTheotype |
| 5119 |
\expandafter\ltx@LocalAppendToMacro |
| 5120 |
\csname\ZREF@xr@temprefname\endcsname{\theotype{#4}}% |
| 5121 |
\fi |
| 5122 |
\expandafter\ltx@LocalAppendToMacro |
| 5123 |
\csname\ZREF@xr@temprefname\expandafter\endcsname\expandafter{% |
| 5124 |
\expandafter\externaldocument\expandafter{% |
| 5125 |
\ZREF@xr@externalfile |
| 5126 |
}% |
| 5127 |
}% |
| 5128 |
\ZREF@xr@urlcheck\ZREF@xr@tempname |
| 5129 |
\ifZREF@xr@tozreflabel |
| 5130 |
\@ifundefined{\ZREF@xr@refname}{% |
| 5131 |
\ifZREF@xr@verbose |
| 5132 |
\PackageInfo{zref-xr}{% |
| 5133 |
Import to zref label `\ZREF@xr@prefix#1'% |
| 5134 |
}% |
| 5135 |
\fi |
| 5136 |
\global\expandafter |
| 5137 |
\let\csname\ZREF@xr@refname\expandafter\endcsname |
| 5138 |
\csname\ZREF@xr@temprefname\endcsname |
| 5139 |
}{% |
| 5140 |
\ZREF@xr@zref@ignorewarning{\ZREF@xr@prefix#1}% |
| 5141 |
}% |
| 5142 |
\fi |
| 5143 |
\ifZREF@xr@toltxlabel |
| 5144 |
\ZREF@xr@tolabel{\ZREF@xr@tempname}{\ZREF@xr@prefix#1}% |
| 5145 |
\fi |
| 5146 |
} |
| 5147 |
\def\ZREF@xr@zref@newlabel{\zref@newlabel}% |
| 5148 |
\def\ZREF@xr@newlabel{\newlabel}% |
| 5149 |
\def\ZREF@xr@@input{\@input}% |
| 5150 |
\def\ZREF@xr@relax{\relax}% |
| 5151 |
% \end{macrocode} |
| 5152 |
% \end{macro} |
| 5153 |
% \begin{macro}{\ZREF@xr@tolabel} |
| 5154 |
% \begin{macrocode} |
| 5155 |
\def\ZREF@xr@tolabel#1#2{% |
| 5156 |
\ifZREF@xr@verbose |
| 5157 |
\PackageInfo{zref-xr}{% |
| 5158 |
Import to LaTeX label `#2'% |
| 5159 |
}% |
| 5160 |
\fi |
| 5161 |
\zref@wrapper@unexpanded{% |
| 5162 |
\expandafter\xdef\csname r@#2\endcsname{% |
| 5163 |
{% |
| 5164 |
\ltx@ifundefined{M@TitleReference}{% |
| 5165 |
\ltx@ifundefined{TR@TitleReference}{% |
| 5166 |
\zref@extractdefault{#1}{default}{}% |
| 5167 |
}{% |
| 5168 |
\noexpand\TR@TitleReference |
| 5169 |
{\zref@extractdefault{#1}{default}{}}% |
| 5170 |
{\zref@extractdefault{#1}{title}{}}% |
| 5171 |
}% |
| 5172 |
}{% |
| 5173 |
\noexpand\M@TitleReference |
| 5174 |
{\zref@extractdefault{#1}{default}{}}% |
| 5175 |
{\zref@extractdefault{#1}{title}{}}% |
| 5176 |
}% |
| 5177 |
}% |
| 5178 |
{\zref@extractdefault{#1}{page}{}}% |
| 5179 |
\ltx@ifpackageloaded{nameref}{% |
| 5180 |
{\zref@extractdefault{#1}{title}{}}% |
| 5181 |
{\zref@extractdefault{#1}{anchor}{}}% |
| 5182 |
\zref@ifrefcontainsprop{#1}{urluse}{% |
| 5183 |
{\zref@extractdefault{#1}{urluse}{}}% |
| 5184 |
}{% |
| 5185 |
{\zref@extractdefault{#1}{url}{}}% |
| 5186 |
}% |
| 5187 |
}{}% |
| 5188 |
}% |
| 5189 |
}% |
| 5190 |
} |
| 5191 |
% \end{macrocode} |
| 5192 |
% \end{macro} |
| 5193 |
% |
| 5194 |
% \begin{macro}{\ZREF@xr@zref@ignorewarning} |
| 5195 |
% \begin{macrocode} |
| 5196 |
\def\ZREF@xr@zref@ignorewarning#1{% |
| 5197 |
\PackageWarningNoLine{zref-xr}{% |
| 5198 |
Zref label `#1' is already in use\MessageBreak |
| 5199 |
in file `\ZREF@xr@file'% |
| 5200 |
}% |
| 5201 |
\edef\ZREF@xr@ignored@zref{% |
| 5202 |
\the\numexpr\ZREF@xr@ignored@zref+1% |
| 5203 |
}% |
| 5204 |
}% |
| 5205 |
% \end{macrocode} |
| 5206 |
% \end{macro} |
| 5207 |
% |
| 5208 |
% \begin{macro}{\ZREF@xr@ltx@ignorewarning} |
| 5209 |
% \begin{macrocode} |
| 5210 |
\def\ZREF@xr@ltx@ignorewarning#1{% |
| 5211 |
\PackageWarningNoLine{zref-xr}{% |
| 5212 |
LaTeX label `#1' is already in use\MessageBreak |
| 5213 |
in file `\ZREF@xr@file'% |
| 5214 |
}% |
| 5215 |
\edef\ZREF@xr@ignored@ltx{% |
| 5216 |
\the\numexpr\ZREF@xr@ignored@ltx+1% |
| 5217 |
}% |
| 5218 |
}% |
| 5219 |
% \end{macrocode} |
| 5220 |
% \end{macro} |
| 5221 |
% |
| 5222 |
% \begin{macro}{\ZREF@xr@checklist} |
| 5223 |
% \begin{macrocode} |
| 5224 |
\def\ZREF@xr@checklist#1#2#3\ZREF@nil{% |
| 5225 |
\ifx\@undefined#1\relax |
| 5226 |
\expandafter\ZREF@xr@checkkey\string#1\@nil |
| 5227 |
\fi |
| 5228 |
\ifx\\#3\\% |
| 5229 |
\else |
| 5230 |
\ltx@ReturnAfterFi{% |
| 5231 |
\ZREF@xr@checklist#3\ZREF@nil |
| 5232 |
}% |
| 5233 |
\fi |
| 5234 |
}% |
| 5235 |
\def\ZREF@xr@checkkey#1#2\@nil{% |
| 5236 |
\zref@ifpropundefined{#2}{% |
| 5237 |
\zref@newprop{#2}{}% |
| 5238 |
}{}% |
| 5239 |
}% |
| 5240 |
% \end{macrocode} |
| 5241 |
% \end{macro} |
| 5242 |
% |
| 5243 |
% \begin{macro}{\ZREF@xr@scanparams} |
| 5244 |
% \begin{macrocode} |
| 5245 |
\def\ZREF@xr@scanparams#1#2#3#4#5#6#7\ZREF@nil{% |
| 5246 |
\let#1\ltx@empty |
| 5247 |
\ZREF@foundfalse |
| 5248 |
\ZREF@xr@scantitleref#1#2\TR@TitleReference{}{}\ZREF@nil |
| 5249 |
\ifZREF@found |
| 5250 |
\else |
| 5251 |
\ltx@LocalAppendToMacro#1{\default{#2}}% |
| 5252 |
\fi |
| 5253 |
% page |
| 5254 |
\ltx@LocalAppendToMacro#1{\page{#3}}% |
| 5255 |
% nameref title |
| 5256 |
\ifZREF@found |
| 5257 |
\else |
| 5258 |
\ifx\\#4\\% |
| 5259 |
\else |
| 5260 |
\def\ZREF@xr@temp{#4}% |
| 5261 |
\ifx\ZREF@xr@temp\ZREF@xr@relax |
| 5262 |
\else |
| 5263 |
\ltx@LocalAppendToMacro#1{\title{#4}}% |
| 5264 |
\fi |
| 5265 |
\fi |
| 5266 |
\fi |
| 5267 |
% anchor |
| 5268 |
\ifx\\#5\\% |
| 5269 |
\else |
| 5270 |
\ltx@LocalAppendToMacro#1{\anchor{#5}}% |
| 5271 |
\fi |
| 5272 |
\ifx\\#6\\% |
| 5273 |
\else |
| 5274 |
\ifZREF@xr@urluse |
| 5275 |
\ZREF@xr@AddURL{#6}% |
| 5276 |
\expandafter\ltx@LocalAppendToMacro\expandafter#1% |
| 5277 |
\expandafter{% |
| 5278 |
\expandafter\urluse\expandafter{% |
| 5279 |
\csname Z@U@\ZREF@xr@theURL\endcsname |
| 5280 |
}% |
| 5281 |
}% |
| 5282 |
\else |
| 5283 |
\ltx@LocalAppendToMacro#1{\url{#6}}% |
| 5284 |
\fi |
| 5285 |
\fi |
| 5286 |
}% |
| 5287 |
% \end{macrocode} |
| 5288 |
% \end{macro} |
| 5289 |
% |
| 5290 |
% \begin{macro}{\ZREF@xr@scantitleref} |
| 5291 |
% \begin{macrocode} |
| 5292 |
\def\ZREF@xr@scantitleref#1#2\TR@TitleReference#3#4#5\ZREF@nil{% |
| 5293 |
\ifx\\#5\\% |
| 5294 |
\else |
| 5295 |
\ltx@LocalAppendToMacro#1{% |
| 5296 |
\default{#3}% |
| 5297 |
\title{#4}% |
| 5298 |
}% |
| 5299 |
\ZREF@foundtrue |
| 5300 |
\fi |
| 5301 |
}% |
| 5302 |
% \end{macrocode} |
| 5303 |
% \end{macro} |
| 5304 |
% |
| 5305 |
% \begin{macro}{\ZREF@xr@urlcheck}% |
| 5306 |
% \begin{macrocode} |
| 5307 |
\def\ZREF@xr@urlcheck#1{% |
| 5308 |
\zref@ifrefcontainsprop{#1}{anchor}{% |
| 5309 |
\zref@ifrefcontainsprop{#1}{url}{% |
| 5310 |
}{% |
| 5311 |
\expandafter |
| 5312 |
\ltx@LocalAppendToMacro\csname Z@R@#1\expandafter\endcsname |
| 5313 |
\expandafter{% |
| 5314 |
\csname url\ifZREF@xr@urluse use\fi |
| 5315 |
\expandafter\endcsname\expandafter{\ZREF@xr@url}% |
| 5316 |
}% |
| 5317 |
}% |
| 5318 |
}{% |
| 5319 |
}% |
| 5320 |
}% |
| 5321 |
% \end{macrocode} |
| 5322 |
% \end{macro} |
| 5323 |
% |
| 5324 |
% \begin{macrocode} |
| 5325 |
%</xr> |
| 5326 |
% \end{macrocode} |
| 5327 |
% |
| 5328 |
% |
| 5329 |
% \subsection{Module \xmodule{hyperref}} |
| 5330 |
% |
| 5331 |
% UNFINISHED :-( |
| 5332 |
% |
| 5333 |
% \begin{macrocode} |
| 5334 |
%<*hyperref> |
| 5335 |
\NeedsTeXFormat{LaTeX2e} |
| 5336 |
\ProvidesPackage{zref-hyperref}% |
| 5337 |
[2026-03-07 v2.37 Module hyperref for zref (HO)]% |
| 5338 |
\RequirePackage{zref-base}[2019/11/29] |
| 5339 |
\ifx\ZREF@base@ok Y% |
| 5340 |
\else |
| 5341 |
\expandafter\endinput |
| 5342 |
\fi |
| 5343 |
% \end{macrocode} |
| 5344 |
% |
| 5345 |
% \begin{macrocode} |
| 5346 |
\ZREF@NewPropAnchor |
| 5347 |
\zref@addprop\ZREF@mainlist{anchor}% |
| 5348 |
% \end{macrocode} |
| 5349 |
% |
| 5350 |
% \begin{macrocode} |
| 5351 |
%</hyperref> |
| 5352 |
% \end{macrocode} |
| 5353 |
% |
| 5354 |
% |
| 5355 |
% \subsection{Module \xmodule{savepos}} |
| 5356 |
% |
| 5357 |
% Module \xmodule{savepos} provides an interface for |
| 5358 |
% \pdfTeX's \cmd{\pdfsavepos} and similar commands from |
| 5359 |
% the other engines, see the manual for |
| 5360 |
% \pdfTeX. |
| 5361 |
% |
| 5362 |
% \subsubsection{Identification} |
| 5363 |
% |
| 5364 |
% \begin{macrocode} |
| 5365 |
%<*savepos> |
| 5366 |
\NeedsTeXFormat{LaTeX2e} |
| 5367 |
\ProvidesPackage{zref-savepos}% |
| 5368 |
[2026-03-07 v2.37 Module savepos for zref (HO)]% |
| 5369 |
\RequirePackage{zref-base}[2019/11/29] |
| 5370 |
\ifx\ZREF@base@ok Y% |
| 5371 |
\else |
| 5372 |
\expandafter\endinput |
| 5373 |
\fi |
| 5374 |
% \end{macrocode} |
| 5375 |
% |
| 5376 |
% \subsubsection{Availability} |
| 5377 |
% |
| 5378 |
% We now assume that it is available always. |
| 5379 |
% |
| 5380 |
% \subsubsection{Setup} |
| 5381 |
% |
| 5382 |
% \begin{macrocode} |
| 5383 |
\zref@newlist{savepos} |
| 5384 |
\ExplSyntaxOn |
| 5385 |
\zref@newprop*{posx}[0]{\int_use:N \tex_lastxpos:D} |
| 5386 |
\zref@newprop*{posy}[0]{\int_use:N \tex_lastypos:D} |
| 5387 |
\zref@addprops{savepos}{posx,posy} |
| 5388 |
% \end{macrocode} |
| 5389 |
% |
| 5390 |
% \subsubsection{User macros} |
| 5391 |
% |
| 5392 |
% \begin{macro}{\zref@savepos} |
| 5393 |
% \begin{macrocode} |
| 5394 |
\def\zref@savepos{% |
| 5395 |
\if@filesw |
| 5396 |
\tex_savepos:D |
| 5397 |
\fi} |
| 5398 |
\ExplSyntaxOff |
| 5399 |
% \end{macrocode} |
| 5400 |
% \end{macro} |
| 5401 |
% |
| 5402 |
% \begin{macro}{\ZREF@zsavepos} |
| 5403 |
% \begin{macrocode} |
| 5404 |
\def\ZREF@zsavepos#1#2#3{% |
| 5405 |
\@bsphack |
| 5406 |
\if@filesw |
| 5407 |
\zref@savepos |
| 5408 |
#1{#3}{#2}% |
| 5409 |
\zref@savepos |
| 5410 |
\fi |
| 5411 |
\@esphack |
| 5412 |
} |
| 5413 |
% \end{macrocode} |
| 5414 |
% \end{macro} |
| 5415 |
% |
| 5416 |
% \begin{macro}{\zsavepos} |
| 5417 |
% The current location is stored in a reference with the |
| 5418 |
% given name. |
| 5419 |
% \begin{macrocode} |
| 5420 |
\ZREF@IfDefinable\zsavepos\def{% |
| 5421 |
{% |
| 5422 |
\ZREF@zsavepos\zref@labelbylist{savepos}% |
| 5423 |
}% |
| 5424 |
} |
| 5425 |
% \end{macrocode} |
| 5426 |
% \end{macro} |
| 5427 |
% |
| 5428 |
% \begin{macro}{\zsaveposx} |
| 5429 |
% \begin{macrocode} |
| 5430 |
\ZREF@IfDefinable\zsaveposx\def{% |
| 5431 |
{% |
| 5432 |
\ZREF@zsavepos\zref@labelbyprops{posx}% |
| 5433 |
}% |
| 5434 |
} |
| 5435 |
% \end{macrocode} |
| 5436 |
% \end{macro} |
| 5437 |
% \begin{macro}{\zsaveposy} |
| 5438 |
% \begin{macrocode} |
| 5439 |
\ZREF@IfDefinable\zsaveposy\def{% |
| 5440 |
{% |
| 5441 |
\ZREF@zsavepos\zref@labelbyprops{posy}% |
| 5442 |
}% |
| 5443 |
} |
| 5444 |
% \end{macrocode} |
| 5445 |
% \end{macro} |
| 5446 |
% |
| 5447 |
% \begin{macro}{\zposx} |
| 5448 |
% \begin{macro}{\zposy} |
| 5449 |
% The horizontal and vertical position are available by |
| 5450 |
% \cs{zposx} and \cs{zposy}. Do not rely on absolute |
| 5451 |
% positions. They differ in DVI and PDF mode of \pdfTeX. |
| 5452 |
% Use differences instead. The unit of the position numbers |
| 5453 |
% is sp. |
| 5454 |
% \begin{macrocode} |
| 5455 |
\newcommand*{\zposx}[1]{% |
| 5456 |
\zref@extract{#1}{posx}% |
| 5457 |
}% |
| 5458 |
\newcommand*{\zposy}[1]{% |
| 5459 |
\zref@extract{#1}{posy}% |
| 5460 |
}% |
| 5461 |
% \end{macrocode} |
| 5462 |
% \end{macro} |
| 5463 |
% \end{macro} |
| 5464 |
% |
| 5465 |
% Typically horizontal and vertical positions are used |
| 5466 |
% inside calculations. Therefore the extracting macros |
| 5467 |
% should be expandable and babel's patch is not applicable. |
| 5468 |
% |
| 5469 |
% Also it is in the responsibility of the user to marked |
| 5470 |
% used positions by \cs{zrefused} |
| 5471 |
% in order to notify \hologo{LaTeX} about undefined references. |
| 5472 |
% |
| 5473 |
% \begin{macro}{\ZREF@savepos@ok} |
| 5474 |
% \begin{macrocode} |
| 5475 |
\let\ZREF@savepos@ok=Y |
| 5476 |
% \end{macrocode} |
| 5477 |
% \end{macro} |
| 5478 |
% |
| 5479 |
% \begin{macrocode} |
| 5480 |
%</savepos> |
| 5481 |
% \end{macrocode} |
| 5482 |
% |
| 5483 |
% |
| 5484 |
% \subsection{Module \xmodule{abspos}} |
| 5485 |
% |
| 5486 |
% \subsubsection{Identification} |
| 5487 |
% |
| 5488 |
% \begin{macrocode} |
| 5489 |
%<*abspos> |
| 5490 |
\NeedsTeXFormat{LaTeX2e} |
| 5491 |
\ProvidesPackage{zref-abspos}% |
| 5492 |
[2026-03-07 v2.37 Module abspos for zref (HO)]% |
| 5493 |
\RequirePackage{zref-base}[2019/11/29] |
| 5494 |
\ifx\ZREF@base@ok Y% |
| 5495 |
\else |
| 5496 |
\expandafter\endinput |
| 5497 |
\fi |
| 5498 |
% \end{macrocode} |
| 5499 |
% |
| 5500 |
% \begin{macrocode} |
| 5501 |
\RequirePackage{zref-savepos}[2019/11/29] |
| 5502 |
\ifx\ZREF@savepos@ok Y% |
| 5503 |
\else |
| 5504 |
\expandafter\endinput |
| 5505 |
\fi |
| 5506 |
% \end{macrocode} |
| 5507 |
% \begin{macrocode} |
| 5508 |
\RequirePackage{zref-pagelayout}[2019/11/29] |
| 5509 |
\zref@addprop{savepos}{abspage} |
| 5510 |
\zref@addprop{savepos}{pagevalue} |
| 5511 |
% \end{macrocode} |
| 5512 |
% |
| 5513 |
% \begin{macro}{\zref@absposx} |
| 5514 |
% \begin{macrocode} |
| 5515 |
\newcommand*{\zref@absposx}[3]{% |
| 5516 |
\number |
| 5517 |
\expandafter\zref@absposnumx\expandafter{% |
| 5518 |
\number\zref@extractdefault{#1}{abspage}{0}% |
| 5519 |
}{#2}{#3}% |
| 5520 |
\ltx@space |
| 5521 |
} |
| 5522 |
% \end{macrocode} |
| 5523 |
% \end{macro} |
| 5524 |
% |
| 5525 |
% \begin{macro}{\zref@absposy} |
| 5526 |
% \begin{macrocode} |
| 5527 |
\newcommand*{\zref@absposy}[3]{% |
| 5528 |
\number |
| 5529 |
\expandafter\zref@absposnumy\expandafter{% |
| 5530 |
\number\zref@extractdefault{#1}{abspage}{0}% |
| 5531 |
}{#2}{#3}% |
| 5532 |
\ltx@space |
| 5533 |
} |
| 5534 |
% \end{macrocode} |
| 5535 |
% \end{macro} |
| 5536 |
% |
| 5537 |
% \begin{macro}{\zref@absposnumx} |
| 5538 |
% \begin{macrocode} |
| 5539 |
\newcommand*{\zref@absposnumx}[3]{% |
| 5540 |
\number |
| 5541 |
\numexpr\ZREF@absposnum{thepage#1}{#2}{x}{#3}\relax |
| 5542 |
} |
| 5543 |
% \end{macrocode} |
| 5544 |
% \end{macro} |
| 5545 |
% |
| 5546 |
% \begin{macro}{\zref@absposnumy} |
| 5547 |
% \begin{macrocode} |
| 5548 |
\newcommand*{\zref@absposnumy}[3]{% |
| 5549 |
\number |
| 5550 |
\numexpr\ZREF@absposnum{thepage#1}{#2}{y}{#3}\relax |
| 5551 |
} |
| 5552 |
% \end{macrocode} |
| 5553 |
% \end{macro} |
| 5554 |
% |
| 5555 |
% \begin{macro}{\ZREF@absposnum} |
| 5556 |
% \begin{macrocode} |
| 5557 |
\def\ZREF@absposnum#1#2#3#4{% |
| 5558 |
\ltx@ifundefined{ZREF@abspos@#2@#3@#4}{% |
| 5559 |
0% |
| 5560 |
}{% |
| 5561 |
\csname ZREF@abspos@#2@#3@#4\endcsname{#1}% |
| 5562 |
}% |
| 5563 |
} |
| 5564 |
% \end{macrocode} |
| 5565 |
% \end{macro} |
| 5566 |
% |
| 5567 |
% \begin{macro}{\zref@def@absposx} |
| 5568 |
% \begin{macrocode} |
| 5569 |
\ZREF@Robust\def\zref@def@absposx#1{% |
| 5570 |
\zref@wrapper@babel{\ZREF@def@abspos{#1}\zref@absposx}% |
| 5571 |
} |
| 5572 |
% \end{macrocode} |
| 5573 |
% \end{macro} |
| 5574 |
% |
| 5575 |
% \begin{macro}{\zref@def@absposy} |
| 5576 |
% \begin{macrocode} |
| 5577 |
\ZREF@Robust\def\zref@def@absposy#1{% |
| 5578 |
\zref@wrapper@babel{\ZREF@def@abspos{#1}\zref@absposy}% |
| 5579 |
} |
| 5580 |
% \end{macrocode} |
| 5581 |
% \end{macro} |
| 5582 |
% |
| 5583 |
% \begin{macro}{\zref@def@absposnumx} |
| 5584 |
% \begin{macrocode} |
| 5585 |
\ZREF@Robust\def\zref@def@absposnumx#1{% |
| 5586 |
\zref@wrapper@babel{\ZREF@def@abspos{#1}\zref@absposnumx}% |
| 5587 |
} |
| 5588 |
% \end{macrocode} |
| 5589 |
% \end{macro} |
| 5590 |
% |
| 5591 |
% \begin{macro}{\zref@def@absposnumy} |
| 5592 |
% \begin{macrocode} |
| 5593 |
\ZREF@Robust\def\zref@def@absposnumy#1{% |
| 5594 |
\zref@wrapper@babel{\ZREF@def@abspos{#1}\zref@absposnumy}% |
| 5595 |
} |
| 5596 |
% \end{macrocode} |
| 5597 |
% \end{macro} |
| 5598 |
% \begin{macro}{\ZREF@def@abspos} |
| 5599 |
% \begin{macrocode} |
| 5600 |
\def\ZREF@def@absposnumy#1#2#3#4#5{% |
| 5601 |
\edef#1{#2{#3}{#4}{#5}}% |
| 5602 |
} |
| 5603 |
% \end{macrocode} |
| 5604 |
% \end{macro} |
| 5605 |
% |
| 5606 |
% \begin{macro}{\zref@absposused} |
| 5607 |
% \begin{macrocode} |
| 5608 |
\ZREF@Robust\def\zref@absposused{% |
| 5609 |
\zref@wrapper@babel\ZREF@abspos@used |
| 5610 |
} |
| 5611 |
% \end{macrocode} |
| 5612 |
% \end{macro} |
| 5613 |
% \begin{macro}{\ZREF@abspos@used} |
| 5614 |
% \begin{macrocode} |
| 5615 |
\def\ZREF@abspos@used#1{% |
| 5616 |
\zref@refused{#1}% |
| 5617 |
\zref@ifrefundefined{#1}{% |
| 5618 |
}{% |
| 5619 |
\begingroup |
| 5620 |
\edef\ZREF@temp{% |
| 5621 |
\zref@extractdefault{#1}{abspage}{0}% |
| 5622 |
}% |
| 5623 |
\ifnum\ZREF@temp>\ltx@zero |
| 5624 |
\zref@refused{thepage\ZREF@temp}% |
| 5625 |
\else |
| 5626 |
\@PackageError{zref-abspos}{% |
| 5627 |
\string\zref@pos@label@used\ltx@space |
| 5628 |
needs property `abspage'\MessageBreak |
| 5629 |
in label `#1'% |
| 5630 |
}\@ehc |
| 5631 |
\fi |
| 5632 |
\endgroup |
| 5633 |
}% |
| 5634 |
} |
| 5635 |
% \end{macrocode} |
| 5636 |
% \end{macro} |
| 5637 |
% |
| 5638 |
% \begin{macro}{\zref@absposnumused} |
| 5639 |
% \begin{macrocode} |
| 5640 |
\newcommand*{\zref@absposnumused}[1]{% |
| 5641 |
\ifnum#1>\ltx@zero |
| 5642 |
\zref@refused{thepage\number#1}% |
| 5643 |
\else |
| 5644 |
\@PackageError{zref-abspos}{% |
| 5645 |
Invalid absolute page number (#1)\MessageBreak |
| 5646 |
for \string\zref@pos@num@used.\MessageBreak |
| 5647 |
A positive integer is expected% |
| 5648 |
}\@ehc |
| 5649 |
\fi |
| 5650 |
} |
| 5651 |
% \end{macrocode} |
| 5652 |
% \end{macro} |
| 5653 |
% |
| 5654 |
% \begin{macro}{\zref@ifabsposundefined} |
| 5655 |
% \begin{macrocode} |
| 5656 |
\def\zref@ifabsposundefined#1{% |
| 5657 |
\zref@ifrefundefined{#1}\ltx@firsttwo{% |
| 5658 |
\expandafter\zref@ifabsposnumundefined\expandafter{% |
| 5659 |
\number\zref@extractdefault{#1}{abspage}{0}% |
| 5660 |
}% |
| 5661 |
}% |
| 5662 |
} |
| 5663 |
% \end{macrocode} |
| 5664 |
% \end{macro} |
| 5665 |
% |
| 5666 |
% \begin{macro}{\zref@ifabsposnumundefined} |
| 5667 |
% \begin{macrocode} |
| 5668 |
\def\zref@ifabsposnumundefined#1{% |
| 5669 |
\ifnum\ZREF@number{#1}>\ltx@zero |
| 5670 |
\zref@ifrefundefined{thepage#1}% |
| 5671 |
\ltx@firstoftwo\ltx@secondoftwo |
| 5672 |
\else |
| 5673 |
\expandafter\ltx@firstoftwo |
| 5674 |
\fi |
| 5675 |
} |
| 5676 |
% \end{macrocode} |
| 5677 |
% \end{macro} |
| 5678 |
% |
| 5679 |
% \subsubsection{Media} |
| 5680 |
% |
| 5681 |
% Ensure that |\stockwidth| and |\stockheight| are defined |
| 5682 |
% \begin{macrocode} |
| 5683 |
\@ifundefined{stockwidth}{\newdimen\stockwidth}{} |
| 5684 |
\@ifundefined{stockheight}{\newdimen\stockheight}{} |
| 5685 |
% \end{macrocode} |
| 5686 |
% |
| 5687 |
% \begin{macro}{\ZREF@abspos@media@width} |
| 5688 |
% \begin{macrocode} |
| 5689 |
\edef\ZREF@abspos@media@width{% |
| 5690 |
\ltx@ifundefined{pdfpagewidth}{% |
| 5691 |
\ltx@ifundefined{mediawidth}{% |
| 5692 |
\ifdim\stockwidth > \z@ |
| 5693 |
stockwidth% |
| 5694 |
\else |
| 5695 |
paperwidth% |
| 5696 |
\fi |
| 5697 |
}{% |
| 5698 |
mediawidth% |
| 5699 |
}% |
| 5700 |
}{% |
| 5701 |
pdfpagewidth% |
| 5702 |
}% |
| 5703 |
} |
| 5704 |
\ifluatex |
| 5705 |
\def\ZREF@abspos@media@width{pdfpagewidth}% |
| 5706 |
\fi |
| 5707 |
% \end{macrocode} |
| 5708 |
% \end{macro} |
| 5709 |
% \begin{macro}{\ZREF@abspos@media@height} |
| 5710 |
% \begin{macrocode} |
| 5711 |
\edef\ZREF@abspos@media@height{% |
| 5712 |
\ltx@ifundefined{pdfpageheight}{% |
| 5713 |
\ltx@ifundefined{mediaheight}{% |
| 5714 |
\ifdim\stockwidth > \z@ |
| 5715 |
stockheight% |
| 5716 |
\else |
| 5717 |
paperheight% |
| 5718 |
\fi |
| 5719 |
}{% |
| 5720 |
mediaheight% |
| 5721 |
}% |
| 5722 |
}{% |
| 5723 |
\noexpand\ifcase\pdfpageheight |
| 5724 |
\ifdim\stockwidth > \z@ |
| 5725 |
stockheight% |
| 5726 |
\else |
| 5727 |
paperheight% |
| 5728 |
\fi |
| 5729 |
\noexpand\else |
| 5730 |
pdfpageheight% |
| 5731 |
\noexpand\fi |
| 5732 |
}% |
| 5733 |
} |
| 5734 |
\ifluatex |
| 5735 |
\edef\ZREF@abspos@media@height{% |
| 5736 |
\noexpand\ifcase\pageheight |
| 5737 |
\ifdim\stockwidth > \z@ |
| 5738 |
stockheight% |
| 5739 |
\else |
| 5740 |
paperheight% |
| 5741 |
\fi |
| 5742 |
\noexpand\else |
| 5743 |
pdfpageheight% |
| 5744 |
\noexpand\fi}% |
| 5745 |
\fi |
| 5746 |
% \end{macrocode} |
| 5747 |
% \end{macro} |
| 5748 |
% |
| 5749 |
% \begin{macro}{\ZREF@abspos@media@x@left} |
| 5750 |
% \begin{macrocode} |
| 5751 |
\def\ZREF@abspos@media@x@left#1{% |
| 5752 |
0% |
| 5753 |
} |
| 5754 |
% \end{macrocode} |
| 5755 |
% \end{macro} |
| 5756 |
% \begin{macro}{\ZREF@abspos@media@x@right} |
| 5757 |
% \begin{macrocode} |
| 5758 |
\def\ZREF@abspos@media@x@right#1{% |
| 5759 |
\zref@extract{#1}\ZREF@abspos@media@width |
| 5760 |
} |
| 5761 |
% \end{macrocode} |
| 5762 |
% \end{macro} |
| 5763 |
% \begin{macro}{\ZREF@abspos@media@x@center} |
| 5764 |
% \begin{macrocode} |
| 5765 |
\def\ZREF@abspos@media@x@center#1{% |
| 5766 |
\ZREF@abspos@media@x@left{#1}% |
| 5767 |
+\zref@extract{#1}\ZREF@abspos@media@width/2% |
| 5768 |
} |
| 5769 |
% \end{macrocode} |
| 5770 |
% \end{macro} |
| 5771 |
% |
| 5772 |
% \begin{macro}{\ZREF@abspos@media@y@top} |
| 5773 |
% \begin{macrocode} |
| 5774 |
\def\ZREF@abspos@media@y@top#1{% |
| 5775 |
\zref@extract{#1}\ZREF@abspos@media@height |
| 5776 |
} |
| 5777 |
% \end{macrocode} |
| 5778 |
% \end{macro} |
| 5779 |
% \begin{macro}{\ZREF@abspos@media@y@bottom} |
| 5780 |
% \begin{macrocode} |
| 5781 |
\def\ZREF@abspos@media@y@bottom#1{% |
| 5782 |
0% |
| 5783 |
} |
| 5784 |
% \end{macrocode} |
| 5785 |
% \end{macro} |
| 5786 |
% \begin{macro}{\ZREF@abspos@media@y@center} |
| 5787 |
% \begin{macrocode} |
| 5788 |
\def\ZREF@abspos@media@y@center#1{% |
| 5789 |
\zref@extract{#1}\ZREF@abspos@media@height/2% |
| 5790 |
} |
| 5791 |
% \end{macrocode} |
| 5792 |
% \end{macro} |
| 5793 |
% |
| 5794 |
% \subsubsection{Paper} |
| 5795 |
% |
| 5796 |
% \begin{macro}{\ZREF@abspos@paper@x@left} |
| 5797 |
% \begin{macrocode} |
| 5798 |
\def\ZREF@abspos@paper@x@left#1{% |
| 5799 |
0% |
| 5800 |
} |
| 5801 |
% \end{macrocode} |
| 5802 |
% \end{macro} |
| 5803 |
% \begin{macro}{\ZREF@abspos@paper@x@right} |
| 5804 |
% \begin{macrocode} |
| 5805 |
\def\ZREF@abspos@paper@x@right#1{% |
| 5806 |
\zref@extract{#1}{paperwidth}% |
| 5807 |
} |
| 5808 |
% \end{macrocode} |
| 5809 |
% \end{macro} |
| 5810 |
% \begin{macro}{\ZREF@abspos@paper@x@center} |
| 5811 |
% \begin{macrocode} |
| 5812 |
\def\ZREF@abspos@paper@x@center#1{% |
| 5813 |
\zref@extract{#1}{paperwidth}/2% |
| 5814 |
} |
| 5815 |
% \end{macrocode} |
| 5816 |
% \end{macro} |
| 5817 |
% |
| 5818 |
% \begin{macro}{\ZREF@abspos@paper@y@top} |
| 5819 |
% \begin{macrocode} |
| 5820 |
\let\ZREF@abspos@paper@y@top\ZREF@abspos@media@y@top |
| 5821 |
% \end{macrocode} |
| 5822 |
% \end{macro} |
| 5823 |
% \begin{macro}{\ZREF@abspos@paper@y@bottom} |
| 5824 |
% \begin{macrocode} |
| 5825 |
\def\ZREF@abspos@paper@y@bottom#1{% |
| 5826 |
\ZREF@abspos@paper@y@top{#1}% |
| 5827 |
-\zref@extract{#1}{paperheight}% |
| 5828 |
} |
| 5829 |
% \end{macrocode} |
| 5830 |
% \end{macro} |
| 5831 |
% \begin{macro}{\ZREF@abspos@paper@y@center} |
| 5832 |
% \begin{macrocode} |
| 5833 |
\def\ZREF@abspos@paper@y@center#1{% |
| 5834 |
\ZREF@abspos@paper@y@top{#1}% |
| 5835 |
-\zref@extract{#1}{paperheight}/2% |
| 5836 |
} |
| 5837 |
% \end{macrocode} |
| 5838 |
% \end{macro} |
| 5839 |
% |
| 5840 |
% \subsubsection{Origin} |
| 5841 |
% |
| 5842 |
% There doesn't seem a good reason to make these tests depend on pdf mode |
| 5843 |
% in current engines, so comment out the \verb|\ifpdf| tests. |
| 5844 |
% \begin{macro}{\ZREF@abspos@origin@x} |
| 5845 |
% \begin{macrocode} |
| 5846 |
\let\ZREF@temp\ltx@two |
| 5847 |
\ltx@IfUndefined{pdfhorigin}{}{% |
| 5848 |
% \ifpdf |
| 5849 |
\let\ZREF@temp\ltx@zero |
| 5850 |
% \fi |
| 5851 |
} |
| 5852 |
\ifluatex |
| 5853 |
% \ifpdf |
| 5854 |
\let\ZREF@temp\ltx@zero |
| 5855 |
% \fi |
| 5856 |
\fi |
| 5857 |
|
| 5858 |
\ifx\ZREF@temp\ltx@two |
| 5859 |
\ifnum\mag=1000 % |
| 5860 |
\let\ZREF@temp\ltx@one |
| 5861 |
\fi |
| 5862 |
\fi |
| 5863 |
\ifcase\ZREF@temp |
| 5864 |
\def\ZREF@abspos@origin@x#1{% |
| 5865 |
\zref@extract{#1}{pdfhorigin}% |
| 5866 |
}% |
| 5867 |
\or |
| 5868 |
\def\ZREF@abspos@origin@x#1{% |
| 5869 |
4736286% |
| 5870 |
}% |
| 5871 |
\or |
| 5872 |
\def\ZREF@abspos@origin@x#1{% |
| 5873 |
\numexpr\mag/1000*\dimexpr 1truein\relax\relax |
| 5874 |
}% |
| 5875 |
\fi |
| 5876 |
% \end{macrocode} |
| 5877 |
% \end{macro} |
| 5878 |
% \begin{macro}{\ZREF@abspos@origin@y} |
| 5879 |
% \begin{macrocode} |
| 5880 |
\let\ZREF@temp\ltx@two |
| 5881 |
\ltx@IfUndefined{pdfvorigin}{}{% |
| 5882 |
% \ifpdf |
| 5883 |
\let\ZREF@temp\ltx@zero |
| 5884 |
% \fi |
| 5885 |
} |
| 5886 |
\ifluatex |
| 5887 |
% \ifpdf |
| 5888 |
\let\ZREF@temp\ltx@zero |
| 5889 |
% \fi |
| 5890 |
\fi |
| 5891 |
\ifx\ZREF@temp\ltx@two |
| 5892 |
\ifnum\mag=1000 % |
| 5893 |
\let\ZREF@temp\ltx@one |
| 5894 |
\fi |
| 5895 |
\fi |
| 5896 |
\ifcase\ZREF@temp |
| 5897 |
\def\ZREF@abspos@origin@y#1{% |
| 5898 |
\zref@extract{#1}{pdfvorigin}% |
| 5899 |
}% |
| 5900 |
\or |
| 5901 |
\def\ZREF@abspos@origin@y#1{% |
| 5902 |
4736286% |
| 5903 |
}% |
| 5904 |
\or |
| 5905 |
\def\ZREF@abspos@origin@y#1{% |
| 5906 |
\numexpr\mag/1000*\dimexpr 1truein\relax\relax |
| 5907 |
}% |
| 5908 |
\fi |
| 5909 |
% \end{macrocode} |
| 5910 |
% \end{macro} |
| 5911 |
% |
| 5912 |
% \subsubsection{Header} |
| 5913 |
% |
| 5914 |
% \begin{macro}{\ZREF@abspos@head@x@left} |
| 5915 |
% \begin{macrocode} |
| 5916 |
\def\ZREF@abspos@head@x@left#1{% |
| 5917 |
\ZREF@abspos@paper@x@left{#1}% |
| 5918 |
+\ZREF@abspos@origin@x{#1}% |
| 5919 |
+\zref@extract{#1}{hoffset}% |
| 5920 |
+\ifodd\zref@extractdefault{#1}{pagevalue}{\number\c@page} % |
| 5921 |
\zref@extract{#1}{oddsidemargin}% |
| 5922 |
\else |
| 5923 |
\zref@extract{#1}{evensidemargin}% |
| 5924 |
\fi |
| 5925 |
} |
| 5926 |
% \end{macrocode} |
| 5927 |
% \end{macro} |
| 5928 |
% \begin{macro}{\ZREF@abspos@head@x@right} |
| 5929 |
% \begin{macrocode} |
| 5930 |
\def\ZREF@abspos@head@x@right#1{% |
| 5931 |
\ZREF@abspos@head@x@left{#1}% |
| 5932 |
+\zref@extract{#1}{textwidth}% |
| 5933 |
} |
| 5934 |
% \end{macrocode} |
| 5935 |
% \end{macro} |
| 5936 |
% \begin{macro}{\ZREF@abspos@head@x@center} |
| 5937 |
% \begin{macrocode} |
| 5938 |
\def\ZREF@abspos@head@x@center#1{% |
| 5939 |
\ZREF@abspos@head@x@left{#1}% |
| 5940 |
+\zref@extract{#1}{textwidth}/2% |
| 5941 |
} |
| 5942 |
% \end{macrocode} |
| 5943 |
% \end{macro} |
| 5944 |
% |
| 5945 |
% \begin{macro}{\ZREF@abspos@head@y@top} |
| 5946 |
% \begin{macrocode} |
| 5947 |
\def\ZREF@abspos@head@y@top#1{% |
| 5948 |
\ZREF@abspos@paper@y@top{#1}% |
| 5949 |
-\ZREF@abspos@origin@y{#1}% |
| 5950 |
-\zref@extract{#1}{voffset}% |
| 5951 |
-\zref@extract{#1}{topmargin}% |
| 5952 |
} |
| 5953 |
% \end{macrocode} |
| 5954 |
% \end{macro} |
| 5955 |
% \begin{macro}{\ZREF@abspos@head@y@bottom} |
| 5956 |
% \begin{macrocode} |
| 5957 |
\def\ZREF@abspos@head@y@bottom#1{% |
| 5958 |
\ZREF@abspos@head@y@top{#1}% |
| 5959 |
-\zref@extract{#1}{headheight}% |
| 5960 |
} |
| 5961 |
% \end{macrocode} |
| 5962 |
% \end{macro} |
| 5963 |
% \begin{macro}{\ZREF@abspos@head@y@center} |
| 5964 |
% \begin{macrocode} |
| 5965 |
\def\ZREF@abspos@head@y@center#1{% |
| 5966 |
\ZREF@abspos@head@y@top{#1}% |
| 5967 |
-\zref@extract{#1}{headheight}/2% |
| 5968 |
} |
| 5969 |
% \end{macrocode} |
| 5970 |
% \end{macro} |
| 5971 |
% |
| 5972 |
% \subsubsection{Body} |
| 5973 |
% |
| 5974 |
% \begin{macro}{\ZREF@abspos@body@x@left} |
| 5975 |
% \begin{macrocode} |
| 5976 |
\let\ZREF@abspos@body@x@left\ZREF@abspos@head@x@left |
| 5977 |
% \end{macrocode} |
| 5978 |
% \end{macro} |
| 5979 |
% \begin{macro}{\ZREF@abspos@body@x@right} |
| 5980 |
% \begin{macrocode} |
| 5981 |
\let\ZREF@abspos@body@x@right\ZREF@abspos@head@x@right |
| 5982 |
% \end{macrocode} |
| 5983 |
% \end{macro} |
| 5984 |
% \begin{macro}{\ZREF@abspos@body@x@center} |
| 5985 |
% \begin{macrocode} |
| 5986 |
\let\ZREF@abspos@body@x@center\ZREF@abspos@head@x@center |
| 5987 |
% \end{macrocode} |
| 5988 |
% \end{macro} |
| 5989 |
% |
| 5990 |
% \begin{macro}{\ZREF@abspos@body@y@top} |
| 5991 |
% \begin{macrocode} |
| 5992 |
\def\ZREF@abspos@body@y@top#1{% |
| 5993 |
\ZREF@abspos@head@y@bottom{#1}% |
| 5994 |
-\zref@extract{#1}{headsep}% |
| 5995 |
} |
| 5996 |
% \end{macrocode} |
| 5997 |
% \end{macro} |
| 5998 |
% \begin{macro}{\ZREF@abspos@body@y@bottom} |
| 5999 |
% \begin{macrocode} |
| 6000 |
\def\ZREF@abspos@body@y@bottom#1{% |
| 6001 |
\ZREF@abspos@body@y@top{#1}% |
| 6002 |
-\zref@extract{#1}{textheight}% |
| 6003 |
} |
| 6004 |
% \end{macrocode} |
| 6005 |
% \end{macro} |
| 6006 |
% \begin{macro}{\ZREF@abspos@body@y@center} |
| 6007 |
% \begin{macrocode} |
| 6008 |
\def\ZREF@abspos@body@y@center#1{% |
| 6009 |
\ZREF@abspos@body@y@top{#1}% |
| 6010 |
-\zref@extract{#1}{textheight}/2% |
| 6011 |
} |
| 6012 |
% \end{macrocode} |
| 6013 |
% \end{macro} |
| 6014 |
% |
| 6015 |
% \subsubsection{Footer} |
| 6016 |
% |
| 6017 |
% \begin{macro}{\ZREF@abspos@foot@x@left} |
| 6018 |
% \begin{macrocode} |
| 6019 |
\let\ZREF@abspos@foot@x@left\ZREF@abspos@head@x@left |
| 6020 |
% \end{macrocode} |
| 6021 |
% \end{macro} |
| 6022 |
% \begin{macro}{\ZREF@abspos@foot@x@right} |
| 6023 |
% \begin{macrocode} |
| 6024 |
\let\ZREF@abspos@foot@x@right\ZREF@abspos@head@x@right |
| 6025 |
% \end{macrocode} |
| 6026 |
% \end{macro} |
| 6027 |
% \begin{macro}{\ZREF@abspos@foot@x@center} |
| 6028 |
% \begin{macrocode} |
| 6029 |
\let\ZREF@abspos@foot@x@center\ZREF@abspos@head@x@center |
| 6030 |
% \end{macrocode} |
| 6031 |
% \end{macro} |
| 6032 |
% |
| 6033 |
% \begin{macro}{\ZREF@abspos@foot@y@bottom} |
| 6034 |
% \begin{macrocode} |
| 6035 |
\def\ZREF@abspos@foot@y@bottom#1{% |
| 6036 |
\ZREF@abspos@body@y@bottom{#1}% |
| 6037 |
-\zref@extract{#1}{footskip}% |
| 6038 |
} |
| 6039 |
% \end{macrocode} |
| 6040 |
% \end{macro} |
| 6041 |
% |
| 6042 |
% \subsubsection{Marginal notes} |
| 6043 |
% |
| 6044 |
% \begin{macro}{\ZREF@abspos@marginpar@x@left} |
| 6045 |
% \begin{macrocode} |
| 6046 |
\def\ZREF@abspos@marginpar@x@left#1{% |
| 6047 |
\ifodd\zref@extractdefault{#1}{pagevalue}{\number\c@page} % |
| 6048 |
\ZREF@abspos@body@x@right{#1}% |
| 6049 |
+\zref@extract{#1}{marginparsep}% |
| 6050 |
\else |
| 6051 |
\ZREF@abspos@body@x@left{#1}% |
| 6052 |
-\zref@extract{#1}{marginparsep}% |
| 6053 |
-\zref@extract{#1}{marginparwidth}% |
| 6054 |
\fi |
| 6055 |
} |
| 6056 |
% \end{macrocode} |
| 6057 |
% \end{macro} |
| 6058 |
% \begin{macro}{\ZREF@abspos@marginpar@x@right} |
| 6059 |
% \begin{macrocode} |
| 6060 |
\def\ZREF@abspos@marginpar@x@right#1{% |
| 6061 |
\ZREF@abspos@marginpar@x@left{#1}% |
| 6062 |
+\zref@extract{#1}{marginparwidth}% |
| 6063 |
} |
| 6064 |
% \end{macrocode} |
| 6065 |
% \end{macro} |
| 6066 |
% \begin{macro}{\ZREF@abspos@marginpar@x@center} |
| 6067 |
% \begin{macrocode} |
| 6068 |
\def\ZREF@abspos@marginpar@x@center#1{% |
| 6069 |
\ZREF@abspos@marginpar@x@left{#1}% |
| 6070 |
+\zref@extract{#1}{marginparwidth}/2% |
| 6071 |
} |
| 6072 |
% \end{macrocode} |
| 6073 |
% \end{macro} |
| 6074 |
% |
| 6075 |
% \begin{macro}{\ZREF@abspos@marginpar@y@top} |
| 6076 |
% \begin{macrocode} |
| 6077 |
\let\ZREF@abspos@marginpar@y@top\ZREF@abspos@body@y@top |
| 6078 |
% \end{macrocode} |
| 6079 |
% \end{macro} |
| 6080 |
% \begin{macro}{\ZREF@abspos@marginpar@y@bottom} |
| 6081 |
% \begin{macrocode} |
| 6082 |
\let\ZREF@abspos@marginpar@y@bottom\ZREF@abspos@body@y@bottom |
| 6083 |
% \end{macrocode} |
| 6084 |
% \end{macro} |
| 6085 |
% \begin{macro}{\ZREF@abspos@marginpar@y@center} |
| 6086 |
% \begin{macrocode} |
| 6087 |
\let\ZREF@abspos@marginpar@y@center\ZREF@abspos@body@y@center |
| 6088 |
% \end{macrocode} |
| 6089 |
% \end{macro} |
| 6090 |
% |
| 6091 |
% \subsubsection{Stock paper} |
| 6092 |
% |
| 6093 |
% \begin{macro}{\ZREF@abspos@stock@x@left} |
| 6094 |
% \begin{macrocode} |
| 6095 |
\let\ZREF@abspos@stock@x@left\ZREF@abspos@paper@x@left |
| 6096 |
% \end{macrocode} |
| 6097 |
% \end{macro} |
| 6098 |
% \begin{macro}{\ZREF@abspos@stock@x@right} |
| 6099 |
% \begin{macrocode} |
| 6100 |
\let\ZREF@abspos@stock@x@right\ZREF@abspos@paper@x@right |
| 6101 |
% \end{macrocode} |
| 6102 |
% \end{macro} |
| 6103 |
% \begin{macro}{\ZREF@abspos@stock@x@center} |
| 6104 |
% \begin{macrocode} |
| 6105 |
\let\ZREF@abspos@stock@x@center\ZREF@abspos@paper@x@center |
| 6106 |
% \end{macrocode} |
| 6107 |
% \end{macro} |
| 6108 |
% |
| 6109 |
% \begin{macro}{\ZREF@abspos@stock@y@top} |
| 6110 |
% \begin{macrocode} |
| 6111 |
\let\ZREF@abspos@stock@y@top\ZREF@abspos@paper@y@top |
| 6112 |
% \end{macrocode} |
| 6113 |
% \end{macro} |
| 6114 |
% \begin{macro}{\ZREF@abspos@stock@y@bottom} |
| 6115 |
% \begin{macrocode} |
| 6116 |
\let\ZREF@abspos@stock@y@bottom\ZREF@abspos@paper@y@bottom |
| 6117 |
% \end{macrocode} |
| 6118 |
% \end{macro} |
| 6119 |
% \begin{macro}{\ZREF@abspos@stock@y@center} |
| 6120 |
% \begin{macrocode} |
| 6121 |
\let\ZREF@abspos@stock@y@center\ZREF@abspos@paper@y@center |
| 6122 |
% \end{macrocode} |
| 6123 |
% \end{macro} |
| 6124 |
% |
| 6125 |
% \begin{macrocode} |
| 6126 |
%</abspos> |
| 6127 |
% \end{macrocode} |
| 6128 |
% |
| 6129 |
% |
| 6130 |
% \subsection{Module \xmodule{dotfill}} |
| 6131 |
% |
| 6132 |
% \begin{macrocode} |
| 6133 |
%<*dotfill> |
| 6134 |
\NeedsTeXFormat{LaTeX2e} |
| 6135 |
\ProvidesPackage{zref-dotfill}% |
| 6136 |
[2026-03-07 v2.37 Module dotfill for zref (HO)]% |
| 6137 |
\RequirePackage{zref-base}[2019/11/29] |
| 6138 |
\ifx\ZREF@base@ok Y% |
| 6139 |
\else |
| 6140 |
\expandafter\endinput |
| 6141 |
\fi |
| 6142 |
% \end{macrocode} |
| 6143 |
% |
| 6144 |
% For measuring the width of \cs{zdotfill} we use the features |
| 6145 |
% provided by module \xmodule{savepos}. |
| 6146 |
% \begin{macrocode} |
| 6147 |
\RequirePackage{zref-savepos}[2019/11/29] |
| 6148 |
% \end{macrocode} |
| 6149 |
% For automatically generated label names we use the unique |
| 6150 |
% counter of module \xmodule{base}. |
| 6151 |
% \begin{macrocode} |
| 6152 |
\zref@require@unique |
| 6153 |
% \end{macrocode} |
| 6154 |
% Configuration is done by the key value interface of package |
| 6155 |
% \xpackage{keyval}. |
| 6156 |
% \begin{macrocode} |
| 6157 |
\RequirePackage{keyval} |
| 6158 |
% \end{macrocode} |
| 6159 |
% The definitions of the keys follow. |
| 6160 |
% \begin{macrocode} |
| 6161 |
\define@key{ZREF@DF}{unit}{% |
| 6162 |
\def\ZREF@df@unit{#1}% |
| 6163 |
} |
| 6164 |
\define@key{ZREF@DF}{min}{% |
| 6165 |
\def\ZREF@df@min{#1}% |
| 6166 |
} |
| 6167 |
\define@key{ZREF@DF}{dot}{% |
| 6168 |
\def\ZREF@df@dot{#1}% |
| 6169 |
} |
| 6170 |
% \end{macrocode} |
| 6171 |
% Defaults are set, see user interface. |
| 6172 |
% \begin{macrocode} |
| 6173 |
\providecommand\ZREF@df@min{2} |
| 6174 |
\providecommand\ZREF@df@unit{.44em} |
| 6175 |
\providecommand\ZREF@df@dot{.} |
| 6176 |
% \end{macrocode} |
| 6177 |
% \begin{macro}{\zdotfillsetup} |
| 6178 |
% Configuration of \cs{zdotfill} is done by \cs{zdotfillsetup}. |
| 6179 |
% \begin{macrocode} |
| 6180 |
\newcommand*{\zdotfillsetup}{\kvsetkeys{ZREF@DF}} |
| 6181 |
% \end{macrocode} |
| 6182 |
% \end{macro} |
| 6183 |
% |
| 6184 |
% \begin{macro}{\zdotfill} |
| 6185 |
% \cs{zdotfill} sets labels at the left and the right to get |
| 6186 |
% the horizontal position. \cs{zsavepos} is not used, because |
| 6187 |
% we do not need the vertical position. |
| 6188 |
% \begin{macrocode} |
| 6189 |
\ZREF@IfDefinable\zdotfill\def{% |
| 6190 |
{% |
| 6191 |
\leavevmode |
| 6192 |
\global\advance\c@zref@unique\ltx@one |
| 6193 |
\begingroup |
| 6194 |
\def\ZREF@temp{zref@\number\c@zref@unique}% |
| 6195 |
\csname tex_savepos:D\endcsname |
| 6196 |
\zref@labelbyprops{\thezref@unique L}{posx}% |
| 6197 |
\setlength{\dimen@}{\ZREF@df@unit}% |
| 6198 |
\zref@ifrefundefined{\thezref@unique R}{% |
| 6199 |
\ZREF@dotfill |
| 6200 |
}{% |
| 6201 |
\ifnum\numexpr\zposx{\thezref@unique R}% |
| 6202 |
-\zposx{\thezref@unique L}\relax |
| 6203 |
<\dimexpr\ZREF@df@min\dimen@\relax |
| 6204 |
\hfill |
| 6205 |
\else |
| 6206 |
\ZREF@dotfill |
| 6207 |
\fi |
| 6208 |
}% |
| 6209 |
\csname tex_savepos:D\endcsname |
| 6210 |
\zref@labelbyprops{\thezref@unique R}{posx}% |
| 6211 |
\endgroup |
| 6212 |
\kern\z@ |
| 6213 |
}% |
| 6214 |
} |
| 6215 |
% \end{macrocode} |
| 6216 |
% \end{macro} |
| 6217 |
% \begin{macro}{\ZREF@dotfill} |
| 6218 |
% Help macro that actually sets the dots. |
| 6219 |
% \begin{macrocode} |
| 6220 |
\def\ZREF@dotfill{% |
| 6221 |
\cleaders\hb@xt@\dimen@{\hss\ZREF@df@dot\hss}\hfill |
| 6222 |
} |
| 6223 |
% \end{macrocode} |
| 6224 |
% \end{macro} |
| 6225 |
% |
| 6226 |
% \begin{macrocode} |
| 6227 |
%</dotfill> |
| 6228 |
% \end{macrocode} |
| 6229 |
% |
| 6230 |
% \subsection{Module \xmodule{env}} |
| 6231 |
% |
| 6232 |
% \begin{macrocode} |
| 6233 |
%<*env> |
| 6234 |
\NeedsTeXFormat{LaTeX2e} |
| 6235 |
\ProvidesPackage{zref-env}% |
| 6236 |
[2026-03-07 v2.37 Module env for zref (HO)]% |
| 6237 |
\RequirePackage{zref-base}[2019/11/29] |
| 6238 |
\ifx\ZREF@base@ok Y% |
| 6239 |
\else |
| 6240 |
\expandafter\endinput |
| 6241 |
\fi |
| 6242 |
% \end{macrocode} |
| 6243 |
% |
| 6244 |
% \begin{macrocode} |
| 6245 |
\zref@newprop{envname}[]{\@currenvir} |
| 6246 |
\zref@newprop{envline}[]{\zref@env@line} |
| 6247 |
% \end{macrocode} |
| 6248 |
% |
| 6249 |
% \begin{macro}{\zref@env@line} |
| 6250 |
% Macro \cs{zref@env@line} extracts the line number |
| 6251 |
% from \cs{@currenvline}. |
| 6252 |
% \begin{macrocode} |
| 6253 |
\def\zref@env@line{% |
| 6254 |
\ifx\@currenvline\ltx@empty |
| 6255 |
\else |
| 6256 |
\expandafter |
| 6257 |
\ZREF@ENV@line\@currenvline\ltx@empty line \ltx@empty\@nil |
| 6258 |
\fi |
| 6259 |
} |
| 6260 |
% \end{macrocode} |
| 6261 |
% \end{macro} |
| 6262 |
% \begin{macro}{\ZREF@ENV@line} |
| 6263 |
% \begin{macrocode} |
| 6264 |
\def\ZREF@ENV@line#1line #2\ltx@empty#3\@nil{#2}% |
| 6265 |
% \end{macrocode} |
| 6266 |
% \end{macro} |
| 6267 |
% |
| 6268 |
% \begin{macrocode} |
| 6269 |
%</env> |
| 6270 |
% \end{macrocode} |
| 6271 |
% |
| 6272 |
% \section{Installation} |
| 6273 |
% |
| 6274 |
% \subsection{Download} |
| 6275 |
% |
| 6276 |
% \paragraph{Package.} This package is available on |
| 6277 |
% CTAN\footnote{\CTANpkg{zref}}: |
| 6278 |
% \begin{description} |
| 6279 |
% \item[\CTAN{macros/latex/contrib/zref/zref.dtx}] The source file. |
| 6280 |
% \item[\CTAN{macros/latex/contrib/zref/zref.pdf}] Documentation. |
| 6281 |
% \end{description} |
| 6282 |
% |
| 6283 |
% |
| 6284 |
% \paragraph{Bundle.} All the packages of the bundle `zref' |
| 6285 |
% are also available in a TDS compliant ZIP archive. There |
| 6286 |
% the packages are already unpacked and the documentation files |
| 6287 |
% are generated. The files and directories obey the TDS standard. |
| 6288 |
% \begin{description} |
| 6289 |
% \item[\CTANinstall{install/macros/latex/contrib/zref.tds.zip}] |
| 6290 |
% \end{description} |
| 6291 |
% \emph{TDS} refers to the standard ``A Directory Structure |
| 6292 |
% for \TeX\ Files'' (\CTANpkg{tds}). Directories |
| 6293 |
% with \xfile{texmf} in their name are usually organized this way. |
| 6294 |
% |
| 6295 |
% \subsection{Bundle installation} |
| 6296 |
% |
| 6297 |
% \paragraph{Unpacking.} Unpack the \xfile{zref.tds.zip} in the |
| 6298 |
% TDS tree (also known as \xfile{texmf} tree) of your choice. |
| 6299 |
% Example (linux): |
| 6300 |
% \begin{quote} |
| 6301 |
% |unzip zref.tds.zip -d ~/texmf| |
| 6302 |
% \end{quote} |
| 6303 |
% |
| 6304 |
% |
| 6305 |
% \subsection{Package installation} |
| 6306 |
% |
| 6307 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 6308 |
% \docstrip\ archive. The files are extracted by running the |
| 6309 |
% \xfile{.dtx} through \plainTeX: |
| 6310 |
% \begin{quote} |
| 6311 |
% \verb|tex zref.dtx| |
| 6312 |
% \end{quote} |
| 6313 |
% |
| 6314 |
% \paragraph{TDS.} Now the different files must be moved into |
| 6315 |
% the different directories in your installation TDS tree |
| 6316 |
% (also known as \xfile{texmf} tree): |
| 6317 |
% \begin{quote} |
| 6318 |
% \def\t{^^A |
| 6319 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 6320 |
% zref.sty & tex/latex/zref/zref.sty\\ |
| 6321 |
% zref-base.sty & tex/latex/zref/zref-base.sty\\ |
| 6322 |
% zref-abspage.sty & tex/latex/zref/zref-abspage.sty\\ |
| 6323 |
% zref-abspos.sty & tex/latex/zref/zref-abspos.sty\\ |
| 6324 |
% zref-counter.sty & tex/latex/zref/zref-counter.sty\\ |
| 6325 |
% zref-dotfill.sty & tex/latex/zref/zref-dotfill.sty\\ |
| 6326 |
% zref-env.sty & tex/latex/zref/zref-env.sty\\ |
| 6327 |
% zref-hyperref.sty & tex/latex/zref/zref-hyperref.sty\\ |
| 6328 |
% zref-lastpage.sty & tex/latex/zref/zref-lastpage.sty\\ |
| 6329 |
% zref-marks.sty & tex/latex/zref/zref-marks.sty\\ |
| 6330 |
% zref-nextpage.sty & tex/latex/zref/zref-nextpage.sty\\ |
| 6331 |
% zref-pageattr.sty & tex/latex/zref/zref-pageattr.sty\\ |
| 6332 |
% zref-pagelayout.sty & tex/latex/zref/zref-pagelayout.sty\\ |
| 6333 |
% zref-perpage.sty & tex/latex/zref/zref-perpage.sty\\ |
| 6334 |
% zref-runs.sty & tex/latex/zref/zref-runs.sty\\ |
| 6335 |
% zref-savepos.sty & tex/latex/zref/zref-savepos.sty\\ |
| 6336 |
% zref-thepage.sty & tex/latex/zref/zref-thepage.sty\\ |
| 6337 |
% zref-titleref.sty & tex/latex/zref/zref-titleref.sty\\ |
| 6338 |
% zref-totpages.sty & tex/latex/zref/zref-totpages.sty\\ |
| 6339 |
% zref-user.sty & tex/latex/zref/zref-user.sty\\ |
| 6340 |
% zref-xr.sty & tex/latex/zref/zref-xr.sty\\ |
| 6341 |
% zref.pdf & doc/latex/zref/zref.pdf\\ |
| 6342 |
% zref-example.tex & doc/latex/zref/zref-example.tex\\ |
| 6343 |
% zref-example-lastpage.tex & doc/latex/zref/zref-example-lastpage.tex\\ |
| 6344 |
% zref-example-nextpage.tex & doc/latex/zref/zref-example-nextpage.tex\\ |
| 6345 |
% zref.dtx & source/latex/zref/zref.dtx\\ |
| 6346 |
% \end{tabular}^^A |
| 6347 |
% }^^A |
| 6348 |
% \sbox0{\t}^^A |
| 6349 |
% \ifdim\wd0>\linewidth |
| 6350 |
% \begingroup |
| 6351 |
% \advance\linewidth by\leftmargin |
| 6352 |
% \advance\linewidth by\rightmargin |
| 6353 |
% \edef\x{\endgroup |
| 6354 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 6355 |
% }\x |
| 6356 |
% \def\lwbox{^^A |
| 6357 |
% \leavevmode |
| 6358 |
% \hbox to \linewidth{^^A |
| 6359 |
% \kern-\leftmargin\relax |
| 6360 |
% \hss |
| 6361 |
% \usebox0 |
| 6362 |
% \hss |
| 6363 |
% \kern-\rightmargin\relax |
| 6364 |
% }^^A |
| 6365 |
% }^^A |
| 6366 |
% \ifdim\wd0>\lw |
| 6367 |
% \sbox0{\small\t}^^A |
| 6368 |
% \ifdim\wd0>\linewidth |
| 6369 |
% \ifdim\wd0>\lw |
| 6370 |
% \sbox0{\footnotesize\t}^^A |
| 6371 |
% \ifdim\wd0>\linewidth |
| 6372 |
% \ifdim\wd0>\lw |
| 6373 |
% \sbox0{\scriptsize\t}^^A |
| 6374 |
% \ifdim\wd0>\linewidth |
| 6375 |
% \ifdim\wd0>\lw |
| 6376 |
% \sbox0{\tiny\t}^^A |
| 6377 |
% \ifdim\wd0>\linewidth |
| 6378 |
% \lwbox |
| 6379 |
% \else |
| 6380 |
% \usebox0 |
| 6381 |
% \fi |
| 6382 |
% \else |
| 6383 |
% \lwbox |
| 6384 |
% \fi |
| 6385 |
% \else |
| 6386 |
% \usebox0 |
| 6387 |
% \fi |
| 6388 |
% \else |
| 6389 |
% \lwbox |
| 6390 |
% \fi |
| 6391 |
% \else |
| 6392 |
% \usebox0 |
| 6393 |
% \fi |
| 6394 |
% \else |
| 6395 |
% \lwbox |
| 6396 |
% \fi |
| 6397 |
% \else |
| 6398 |
% \usebox0 |
| 6399 |
% \fi |
| 6400 |
% \else |
| 6401 |
% \lwbox |
| 6402 |
% \fi |
| 6403 |
% \else |
| 6404 |
% \usebox0 |
| 6405 |
% \fi |
| 6406 |
% \end{quote} |
| 6407 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 6408 |
% TDS installing feature, then some files can already be in the right |
| 6409 |
% place, see the documentation of \docstrip. |
| 6410 |
% |
| 6411 |
% \subsection{Refresh file name databases} |
| 6412 |
% |
| 6413 |
% If your \TeX~distribution |
| 6414 |
% (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh |
| 6415 |
% these. For example, \TeX\,Live\ users run \verb|texhash| or |
| 6416 |
% \verb|mktexlsr|. |
| 6417 |
% |
| 6418 |
% \subsection{Some details for the interested} |
| 6419 |
% |
| 6420 |
% \paragraph{Unpacking with \LaTeX.} |
| 6421 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 6422 |
% \begin{description} |
| 6423 |
% \item[\plainTeX:] Run \docstrip\ and extract the files. |
| 6424 |
% \item[\LaTeX:] Generate the documentation. |
| 6425 |
% \end{description} |
| 6426 |
% If you insist on using \LaTeX\ for \docstrip\ (really, |
| 6427 |
% \docstrip\ does not need \LaTeX), then inform the autodetect routine |
| 6428 |
% about your intention: |
| 6429 |
% \begin{quote} |
| 6430 |
% \verb|latex \let\install=y\input{zref.dtx}| |
| 6431 |
% \end{quote} |
| 6432 |
% Do not forget to quote the argument according to the demands |
| 6433 |
% of your shell. |
| 6434 |
% |
| 6435 |
% \paragraph{Generating the documentation.} |
| 6436 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 6437 |
% the documentation. The process can be configured by the |
| 6438 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put this |
| 6439 |
% line into this file, if you want to have A4 as paper format: |
| 6440 |
% \begin{quote} |
| 6441 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 6442 |
% \end{quote} |
| 6443 |
% An example follows how to generate the |
| 6444 |
% documentation with pdf\LaTeX: |
| 6445 |
% \begin{quote} |
| 6446 |
%\begin{verbatim} |
| 6447 |
%pdflatex zref.dtx |
| 6448 |
%makeindex -s gind.ist zref.idx |
| 6449 |
%pdflatex zref.dtx |
| 6450 |
%makeindex -s gind.ist zref.idx |
| 6451 |
%pdflatex zref.dtx |
| 6452 |
%\end{verbatim} |
| 6453 |
% \end{quote} |
| 6454 |
% |
| 6455 |
% \begin{thebibliography}{99} |
| 6456 |
% \bibpackage{footmisc}{Robin Fairbairns}{2004/01/23 v5.3a} |
| 6457 |
% {\CTANpkg{footmisc}} |
| 6458 |
% \bibpackage{hyperref}{Sebastian Rahtz, Heiko Oberdiek}{2006/08/16 v6.75c} |
| 6459 |
% {\CTANpkg{hyperref}} |
| 6460 |
% \bibpackage{lastpage}{Jeff Goldberg}{1994/06/25 v0.1b} |
| 6461 |
% {\CTANpkg{lastpage}} |
| 6462 |
% \bibpackage{nameref}{Sebastian Rahtz, Heiko Oberdiek}{2006/02/12 v2.24} |
| 6463 |
% {\CTANpkg{nameref}} |
| 6464 |
% \bibpackage{perpage}{David Kastrup}{2002/12/20 v1.0} |
| 6465 |
% {\CTANpkg{perpage}} |
| 6466 |
% \bibpackage{titleref}{Donald Arsenau}{2001/04/05 v3.1} |
| 6467 |
% {\CTANpkg{titleref}} |
| 6468 |
% \bibpackage{totpages}{Wilhelm M\"uller}{1999/07/14 v1.00} |
| 6469 |
% {\CTANpkg{totpages}} |
| 6470 |
% \bibpackage{xr}{David Carlisle}{1994/05/28 v5.02} |
| 6471 |
% {\CTANpkg{xr}} |
| 6472 |
% \bibpackage{xr-hyper}{David Carlisle}{2000/03/22 v6.00beta4} |
| 6473 |
% {\CTANpkg{xr-hyper}} |
| 6474 |
% \end{thebibliography} |
| 6475 |
% |
| 6476 |
% \begin{History} |
| 6477 |
% \begin{Version}{2006/02/20 v1.0} |
| 6478 |
% \item |
| 6479 |
% First version. |
| 6480 |
% \end{Version} |
| 6481 |
% \begin{Version}{2006/05/03 v1.1} |
| 6482 |
% \item |
| 6483 |
% Module \xmodule{perpage} added. |
| 6484 |
% \item |
| 6485 |
% Module redesign as packages. |
| 6486 |
% \end{Version} |
| 6487 |
% \begin{Version}{2006/05/25 v1.2} |
| 6488 |
% \item |
| 6489 |
% Module \xmodule{dotfillmin} added. |
| 6490 |
% \item |
| 6491 |
% Module \xmodule{base}: macros \cs{zref@require@unique} |
| 6492 |
% and \cs{thezref@unique} added |
| 6493 |
% (used by modules \xmodule{titleref} and \xmodule{dotfillmin}). |
| 6494 |
% \end{Version} |
| 6495 |
% \begin{Version}{2006/09/08 v1.3} |
| 6496 |
% \item |
| 6497 |
% Typo fixes and English cleanup by Per Starback. |
| 6498 |
% \end{Version} |
| 6499 |
% \begin{Version}{2007/01/23 v1.4} |
| 6500 |
% \item |
| 6501 |
% Typo in macro name fixed in documentation. |
| 6502 |
% \end{Version} |
| 6503 |
% \begin{Version}{2007/02/18 v1.5} |
| 6504 |
% \item |
| 6505 |
% \cs{zref@getcurrent} added (suggestion of Igor Akkerman). |
| 6506 |
% \item |
| 6507 |
% Module \xmodule{savepos} also supports \hologo{XeTeX}. |
| 6508 |
% \end{Version} |
| 6509 |
% \begin{Version}{2007/04/06 v1.6} |
| 6510 |
% \item |
| 6511 |
% Fix in modules \xmodule{abspage} and \xmodule{base}: |
| 6512 |
% Now counter |abspage| and |zref@unique| |
| 6513 |
% are not remembered by \cs{include}. |
| 6514 |
% \item |
| 6515 |
% Beamer support for module \xmodule{titleref}. |
| 6516 |
% \end{Version} |
| 6517 |
% \begin{Version}{2007/04/17 v1.7} |
| 6518 |
% \item |
| 6519 |
% Package \xpackage{atbegshi} replaces \xpackage{everyshi}. |
| 6520 |
% \end{Version} |
| 6521 |
% \begin{Version}{2007/04/22 v1.8} |
| 6522 |
% \item |
| 6523 |
% \cs{zref@wrapper@babel} and \cs{zref@refused} are now expandable |
| 6524 |
% if babel is not used or \cs{if@safe@actives} is already set to true. |
| 6525 |
% (Feature request of Josselin Noirel) |
| 6526 |
% \end{Version} |
| 6527 |
% \begin{Version}{2007/05/02 v1.9} |
| 6528 |
% \item |
| 6529 |
% Module \xmodule{titleref}: Some support for \cs{caption} of package |
| 6530 |
% \xpackage{longtable}, but only if \cs{label} is given after |
| 6531 |
% \cs{caption}. |
| 6532 |
% \end{Version} |
| 6533 |
% \begin{Version}{2007/05/06 v2.0} |
| 6534 |
% \item |
| 6535 |
% Uses package \xpackage{etexcmds} for accessing \hologo{eTeX}'s \cs{unexpanded}. |
| 6536 |
% \end{Version} |
| 6537 |
% \begin{Version}{2007/05/28 v2.1} |
| 6538 |
% \item |
| 6539 |
% Module \xmodule{titleref} supports caption of package \xpackage{listings}. |
| 6540 |
% \item |
| 6541 |
% Fixes in module \xmodule{titleref} for support |
| 6542 |
% of packages \xpackage{titlesec} and \xpackage{longtable}. |
| 6543 |
% \end{Version} |
| 6544 |
% \begin{Version}{2008/09/21 v2.2} |
| 6545 |
% \item |
| 6546 |
% Module \xmodule{base}: \cs{zref@iflistcontainsprop} is documented, but |
| 6547 |
% a broken \cs{zref@listcontainsprop} implemented. Name and |
| 6548 |
% implementation fixed (thanks Ohad Kammar). |
| 6549 |
% \end{Version} |
| 6550 |
% \begin{Version}{2008/10/01 v2.3} |
| 6551 |
% \item |
| 6552 |
% \cs{zref@localaddprop} added (feature request of Ohad Kammar). |
| 6553 |
% \item |
| 6554 |
% Module \xmodule{lastpage}: list `LastPage' added. Label `LastPage' will use |
| 6555 |
% the properties of this list (default is empty) along with the |
| 6556 |
% properties of the main list. |
| 6557 |
% \end{Version} |
| 6558 |
% \begin{Version}{2009/08/07 v2.4} |
| 6559 |
% \item |
| 6560 |
% Module \xmodule{runs} added. |
| 6561 |
% \end{Version} |
| 6562 |
% \begin{Version}{2009/12/06 v2.5} |
| 6563 |
% \item |
| 6564 |
% Module \xmodule{lastpage}: Uses package \xpackage{atveryend}. |
| 6565 |
% \item |
| 6566 |
% Module \xmodule{titleref}: Further commands are disabled |
| 6567 |
% during string expansion, imported from package \xpackage{nameref}. |
| 6568 |
% \end{Version} |
| 6569 |
% \begin{Version}{2009/12/07 v2.6} |
| 6570 |
% \item |
| 6571 |
% Version date added for package \xpackage{atveryend}. |
| 6572 |
% \end{Version} |
| 6573 |
% \begin{Version}{2009/12/08 v2.7} |
| 6574 |
% \item |
| 6575 |
% Module \xmodule{titleref}: Use of package \xpackage{gettitlestring}. |
| 6576 |
% \end{Version} |
| 6577 |
% \begin{Version}{2010/03/26 v2.8} |
| 6578 |
% \item |
| 6579 |
% \cs{zifrefundefined} added. |
| 6580 |
% \item |
| 6581 |
% Module \xmodule{lastpage}: Macros \cs{zref@iflastpage} |
| 6582 |
% and \cs{ziflastpage} added. |
| 6583 |
% \item |
| 6584 |
% Module \xmodule{thepage} added. |
| 6585 |
% \item |
| 6586 |
% Module \xmodule{nextpage} added. |
| 6587 |
% \end{Version} |
| 6588 |
% \begin{Version}{2010/03/29 v2.9} |
| 6589 |
% \item |
| 6590 |
% Module \xmodule{marks} added (without documentation). |
| 6591 |
% \item |
| 6592 |
% \cs{zref@addprop} now adds expanded property to list. |
| 6593 |
% \item |
| 6594 |
% Useless \cs{ZREF@ErrorNoLine} removed. |
| 6595 |
% \end{Version} |
| 6596 |
% \begin{Version}{2010/04/08 v2.10} |
| 6597 |
% \item |
| 6598 |
% Module \xmodule{xr} remembers the external document name |
| 6599 |
% in property `externaldocument'. |
| 6600 |
% \end{Version} |
| 6601 |
% \begin{Version}{2010/04/15 v2.11} |
| 6602 |
% \item |
| 6603 |
% Module \xmodule{titleref}: Better support of class \xclass{memoir}. |
| 6604 |
% \item |
| 6605 |
% Module \xmodule{titleref}: Support of theorems. |
| 6606 |
% \end{Version} |
| 6607 |
% \begin{Version}{2010/04/17 v2.12} |
| 6608 |
% \item |
| 6609 |
% Module \xmodule{base}: \cs{zref@newprop} ensures global |
| 6610 |
% empty default. |
| 6611 |
% \item |
| 6612 |
% Module \xmodule{xr}: Setup options \xoption{tozreflabel} |
| 6613 |
% and \xoption{toltxlabel} added. |
| 6614 |
% \end{Version} |
| 6615 |
% \begin{Version}{2010/04/19 v2.13} |
| 6616 |
% \item |
| 6617 |
% \cs{zref@setcurrent} throws an error if the property |
| 6618 |
% does not exist (Florent Chervet). |
| 6619 |
% \item |
| 6620 |
% \cs{zref@getcurrent} the documentation is fixed (Florent Chervet). |
| 6621 |
% Also it returns the empty string in case of errors. |
| 6622 |
% \item |
| 6623 |
% \cs{zref@addprop} and \cs{zref@localaddprop} now take a list of |
| 6624 |
% property names (feature request of Florent Chervet). |
| 6625 |
% \item |
| 6626 |
% Example for \cs{zref@wrapper@unexpanded} corrected (Florent Chervet). |
| 6627 |
% \end{Version} |
| 6628 |
% \begin{Version}{2010/04/22 v2.14} |
| 6629 |
% \item |
| 6630 |
% Bug fix for \cs{zref@getcurrent} second argument wasn't eaten in |
| 6631 |
% case of unknown property. |
| 6632 |
% \item |
| 6633 |
% \cs{zref@getcurrent} supports \cs{zref@wrapper@unexpanded}. |
| 6634 |
% \item |
| 6635 |
% \cs{zref@wrapper@unexpanded} added for \cs{ZREF@xr@tolabel}. |
| 6636 |
% \item |
| 6637 |
% \cs{zref@extract}, \cs{zref@extractdefault}, \cs{zref@getcurrent} |
| 6638 |
% are expandable in exact two steps |
| 6639 |
% except inside \cs{zref@wrapper@unexpanded}. |
| 6640 |
% \end{Version} |
| 6641 |
% \begin{Version}{2010/04/23 v2.15} |
| 6642 |
% \item |
| 6643 |
% \cs{zexternaldocument} fixed for property `url' when |
| 6644 |
% importing \cs{new@label} (bug found by Victor Ivrii). |
| 6645 |
% \item |
| 6646 |
% Two expansion steps also in \cs{zref@wrapper@unexpanded}. |
| 6647 |
% \item |
| 6648 |
% Nested calls of \cs{zref@wrapper@unexpanded} possible. |
| 6649 |
% \end{Version} |
| 6650 |
% \begin{Version}{2010/04/28 v2.16} |
| 6651 |
% \item |
| 6652 |
% More consequent use of package `ltxcmds' and `hologo'. |
| 6653 |
% \item |
| 6654 |
% Module \xmodule{pagelayout} added. |
| 6655 |
% \item |
| 6656 |
% Module \xmodule{pageattr} added. |
| 6657 |
% \item |
| 6658 |
% Robustness introduced for non-expandable interface macros. |
| 6659 |
% \item |
| 6660 |
% Internal change of the data format of property lists |
| 6661 |
% (suggestion of Florent Chervet). |
| 6662 |
% \item |
| 6663 |
% Module \xmodule{titleref}: Support of environment \textsf{description}. |
| 6664 |
% \end{Version} |
| 6665 |
% \begin{Version}{2010/05/01 v2.17} |
| 6666 |
% \item |
| 6667 |
% \cs{zref@newprop} throws an error if the property already exists. |
| 6668 |
% \item |
| 6669 |
% Module \xmodule{xr}: Bug fix for the case of several \xext{aux} files |
| 6670 |
% (bug found by Victor Ivrii). |
| 6671 |
% \item |
| 6672 |
% Module \xmodule{xr}: Property `urluse' and option \xoption{urluse} added. |
| 6673 |
% \end{Version} |
| 6674 |
% \begin{Version}{2010/05/13 v2.18} |
| 6675 |
% \item |
| 6676 |
% Module \xmodule{env} added. |
| 6677 |
% \item |
| 6678 |
% Module \xmodule{savepos}: \cs{zref@savepos} added. |
| 6679 |
% \end{Version} |
| 6680 |
% \begin{Version}{2010/10/22 v2.19} |
| 6681 |
% \item |
| 6682 |
% \cs{zref@addprop} and \cs{zref@localaddprop} are limited |
| 6683 |
% to one property only |
| 6684 |
% (incompatibility to versions v2.13 to v2.18). |
| 6685 |
% \item |
| 6686 |
% \cs{zref@addprops} and \cs{zref@localaddprops} added. |
| 6687 |
% \item |
| 6688 |
% \cs{zref@delprop} and \cs{zref@localdelprop} added. |
| 6689 |
% \item |
| 6690 |
% \cs{zref@labelbykv} and \cs{zkvlabel} (module \xmodule{user}) |
| 6691 |
% with keys \xoption{prop}, \xoption{list}, \xoption{delprop}, |
| 6692 |
% \xoption{immediate}, \xoption{values} added. |
| 6693 |
% \end{Version} |
| 6694 |
% \begin{Version}{2011/02/12 v2.20} |
| 6695 |
% \item |
| 6696 |
% Fix for warning in \xpackage{zref-xr}. |
| 6697 |
% \end{Version} |
| 6698 |
% \begin{Version}{2011/03/18 v2.21} |
| 6699 |
% \item |
| 6700 |
% Fix in module \xmodule{pagelayout} for \cs{zlistpagelayout}. |
| 6701 |
% \item |
| 6702 |
% Fix for \cs{zref@localaddprop} (probably since v2.19). |
| 6703 |
% \end{Version} |
| 6704 |
% \begin{Version}{2011/10/05 v2.22} |
| 6705 |
% \item |
| 6706 |
% Documentation fixed for \cs{zref@(local)addprop(s)}. |
| 6707 |
% \item |
| 6708 |
% Module \xmodule{base}: \cs{zref@def@extract}, \cs{zref@def@extractdefault} |
| 6709 |
% added. |
| 6710 |
% \item |
| 6711 |
% Fix in module \xmodule{pagelayout}: Because of missing \cs{noexpand} |
| 6712 |
% commands the values of the pagelayout properties on all pages were |
| 6713 |
% the values at package loading. |
| 6714 |
% \item |
| 6715 |
% Module \xmodule{base}: \cs{zref@showprop} added. |
| 6716 |
% \end{Version} |
| 6717 |
% \begin{Version}{2011/12/05 v2.23} |
| 6718 |
% \item |
| 6719 |
% Module \xmodule{savepos}: \cs{zsaveposx} and \cs{zsaveposy} added. |
| 6720 |
% \end{Version} |
| 6721 |
% \begin{Version}{2012/04/04 v2.24} |
| 6722 |
% \item |
| 6723 |
% Module \xmodule{titleref}, package \xpackage{titlesec}: |
| 6724 |
% some support for class `straight' (\cs{ttl@straight@i}) added. |
| 6725 |
% \end{Version} |
| 6726 |
% \begin{Version}{2016/05/16 v2.25} |
| 6727 |
% \item |
| 6728 |
% Documentation updates. |
| 6729 |
% \end{Version} |
| 6730 |
% \begin{Version}{2016/05/21 v2.26} |
| 6731 |
% \item |
| 6732 |
% update zref-savepos for new luatex |
| 6733 |
% \end{Version} |
| 6734 |
% \begin{Version}{2018/11/21 v2.27} |
| 6735 |
% \item |
| 6736 |
% adapted zref-perpage, see issue https://github.com/ho-tex/zref/issues/2 |
| 6737 |
% \end{Version} |
| 6738 |
% \begin{Version}{2019/11/29 v2.28} |
| 6739 |
% \item |
| 6740 |
% Documentation updates. |
| 6741 |
% \item |
| 6742 |
% Use \xpackage{iftex} directly. |
| 6743 |
% \end{Version} |
| 6744 |
% \begin{Version}{2020-03-03 v2.29} |
| 6745 |
% \item |
| 6746 |
% adapted in module zref-pagelayout the properties pdfhorigin, pdfvorigin, |
| 6747 |
% pdfpagewidth, pdfpageheight for luatex to the right primitives. |
| 6748 |
% \item |
| 6749 |
% Removed no longer needed code for older lualatex versions. |
| 6750 |
% \item added some documentation of the abspos module. |
| 6751 |
% \item adapted the abspos module to the new luatex primitives. |
| 6752 |
% \item adapted pageattr module to the new luatex primitives. |
| 6753 |
% \item added short documentation for pageattr module |
| 6754 |
% \item use luatex command names directly in zref-savepos rather than defining pdftex compatibility names. |
| 6755 |
% \item allow zref-abspos to use \verb|\pdf[vh]origin| in dvi mode. |
| 6756 |
% \end{Version} |
| 6757 |
% \begin{Version}{2020-03-04 v2.30} |
| 6758 |
% \item |
| 6759 |
% add pagevalue property to savepos in the abspos module (issue 1) |
| 6760 |
% \end{Version} |
| 6761 |
% \begin{Version}{2020-05-28 v2.31} |
| 6762 |
% \item Adapted module zref-counter to use \cs{@currentcounter} in the next |
| 6763 |
% \LaTeX version (issue 5) |
| 6764 |
% \end{Version} |
| 6765 |
% \begin{Version}{2020-07-03 v2.32} |
| 6766 |
% \item Changed in zref-pagelayout the names of the shipout box dimensions |
| 6767 |
% to adapt to the new hook management. |
| 6768 |
% \end{Version} |
| 6769 |
% \begin{Version}{2022-03-08 v2.33} |
| 6770 |
% \item Avoid that amstext undoes the stepcounter patch in zref-perpage, |
| 6771 |
% https://github.com/ho-tex/zref/issues/11 |
| 6772 |
% \item Make the unique counter more robust when includeonly is used, |
| 6773 |
% https://github.com/ho-tex/zref/issues/10 |
| 6774 |
% \end{Version} |
| 6775 |
% \begin{Version}{2022-04-07 v2.34} |
| 6776 |
% \item use the \texttt{zref@unique} counter in the include hook only if the module needs it |
| 6777 |
% https://github.com/ho-tex/zref/issues/14 |
| 6778 |
% \end{Version} |
| 6779 |
% \begin{Version}{2023-09-14 v.2.35} |
| 6780 |
% \item Define the abspage counter only if it is undefined |
| 6781 |
% https://github.com/ho-tex/zref/issues/14 |
| 6782 |
% \item Remove dependency from atveryend. |
| 6783 |
% \end{Version} |
| 6784 |
% \begin{Version}{2025-06-08 v2.36} |
| 6785 |
% \item use |\tex_savepos:D| for better engine compability, |
| 6786 |
% https://github.com/ho-tex/zref/issues/20 |
| 6787 |
% \item adapt lastpage code to format change. |
| 6788 |
% https://github.com/ho-tex/zref/issues/22 |
| 6789 |
% \end{Version} |
| 6790 |
% \begin{Version}{2026-03-07 v2.37} |
| 6791 |
% \item Updated |\zlabel| definition to new |\label| definition. |
| 6792 |
% https://github.com/ho-tex/zref/issues/23 |
| 6793 |
% \end{Version} |
| 6794 |
% \end{History} |
| 6795 |
% |
| 6796 |
% \PrintIndex |
| 6797 |
% |
| 6798 |
% \Finale |
| 6799 |
\endinput |