Debian Codegraph @

texmf-dist/doc/latex/zref/zref-example-lastpage.tex

raw
1 %%
2 %% This is file `zref-example-lastpage.tex',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% zref.dtx (with options: `example-lastpage')
8 %%
9 %% This is a generated file.
10 %%
11 %% Project: zref
12 %% Version: 2026-03-07 v2.37
13 %%
14 %% Copyright (C)
15 %% 2006-2012 Heiko Oberdiek
16 %% 2016-2026 Oberdiek Package Support Group
17 %%
18 %% This work may be distributed and/or modified under the
19 %% conditions of the LaTeX Project Public License, either
20 %% version 1.3c of this license or (at your option) any later
21 %% version. This version of this license is in
22 %% https://www.latex-project.org/lppl/lppl-1-3c.txt
23 %% and the latest version of this license is in
24 %% https://www.latex-project.org/lppl.txt
25 %% and version 1.3 or later is part of all distributions of
26 %% LaTeX version 2005/12/01 or later.
27 %%
28 %% This work has the LPPL maintenance status "maintained".
29 %%
30 %% The Current Maintainers of this work are
31 %% Heiko Oberdiek and the Oberdiek Package Support Group
32 %% https://github.com/ho-tex/zref/issues
33 %%
34 %% This work consists of the main source file zref.dtx
35 %% and the derived files
36 %% zref.sty, zref.pdf, zref.ins, zref.drv, zref-base.sty,
37 %% zref-abspage.sty, zref-abspos.sty, zref-counter.sty,
38 %% zref-dotfill.sty, zref-env.sty, zref-hyperref.sty,
39 %% zref-lastpage.sty, zref-marks.sty, zref-nextpage.sty,
40 %% zref-pageattr.sty, zref-pagelayout.sty, zref-perpage.sty,
41 %% zref-runs.sty, zref-savepos.sty, zref-thepage.sty,
42 %% zref-titleref.sty, zref-totpages.sty, zref-user.sty,
43 %% zref-xr.sty, zref-example.tex, zref-example-lastpage.tex,
44 %% zref-example-nextpage.tex, zref-test1.tex,
45 %% zref-test-base.tex, zref-test-runs.tex,
46 %% zref-test-titleref-memoir.tex.
47 %%
48 \NeedsTeXFormat{LaTeX2e}
49 \documentclass{report}
50
51 \newcounter{foo}
52 \renewcommand*{\thefoo}{\Alph{foo}}
53
54 \usepackage{zref-lastpage,zref-user}[2019/11/29]
55
56 \makeatletter
57 \zref@newprop{thefoo}{\thefoo}
58 \zref@newprop{valuefoo}{\the\value{foo}}
59 \zref@newprop{chapter}{\thechapter}
60 \zref@addprops{LastPage}{thefoo,valuefoo,chapter}
61 \makeatother
62
63 \newcommand*{\foo}{%
64 \stepcounter{foo}%
65 [Current foo: \thefoo]%
66 }
67
68 \begin{document}
69 \chapter{First chapter}
70 Last page is \zref{LastPage}.\\
71 Last chapter is \zref[chapter]{LastPage}.\\
72 Last foo is \zref[thefoo]{LastPage}.\\
73 Last value of foo is \zref[valuefoo]{LastPage}.\\
74 \foo
75 \chapter{Second chapter}
76 \foo\foo\foo
77 \chapter{Last chapter}
78 \foo
79 \end{document}
80 \endinput
81 %%
82 %% End of file `zref-example-lastpage.tex'.