mag-0002-mkiv.tex /size: 3286 b    last modification: 2023-12-21 09:43
1% language=us
2
3% author    : Hans Hagen
4% copyright : ConTeXt Development Team
5% license   : Creative Commons Attribution ShareAlike 4.0 International
6% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
7% origin    : the ConTeXt distribution
8%
9% comment   : Because this manual is distributed with TeX distributions it comes with a rather
10%             liberal license. We try to adapt these documents to upgrades in the (sub)systems
11%             that they describe. Using parts of the content otherwise can therefore conflict
12%             with existing functionality and we cannot be held responsible for that. Many of
13%             the manuals contain characteristic graphics and personal notes or examples that
14%             make no sense when used out-of-context.
15%
16% comment   : Some chapters might have been published in TugBoat, the NTG Maps, the ConTeXt
17%             Group journal or otherwise. Thanks to the editors for corrections. Also thanks
18%             to users for testing, feedback and corrections.
19
20\usemodule[mag-01]
21
22\startbuffer[abstract]
23    Subpage numbers can save you some messing around with page references. Here
24    we show some basics.
25\stopbuffer
26
27\startdocument
28  [title={Page Ranges},
29   author=Hans Hagen,
30   affiliation=PRAGMA ADE,
31   date=Februari 2003,
32   number=2 \MKIV]
33
34This is a simple example of using subpage numbers. Subpage numbers are not
35automatically kept track of, so you first need to activate them:
36
37\startbuffer
38\setupsubpagenumber
39  [way=bychapter,
40   state=start]
41\stopbuffer
42
43\typebuffer \getbuffer
44
45After activating this mechanism, you can access the numbers as follows. The
46numbers are synchronized in during page building, which means that they are
47correct when constructing headers and footers.
48
49\startbuffer
50\setupheadertexts
51  [\firstsubpage--\lastsubpage]
52
53\setupfootertexts
54  [\pagenumber]
55\stopbuffer
56
57\typebuffer \getbuffer
58
59There are several ways to access those numbers:
60
61\starttabulate
62\NC \type{\firstsubpage} \NC first real pagenumber in range    \NC\NR
63\NC \type{\prevsubpage}  \NC previous real pagenumber in range \NC\NR
64\NC \type{\nextsubpage}  \NC next real pagenumber in range     \NC\NR
65\NC \type{\lastsubpage}  \NC last real pagenumber in range     \NC\NR
66\stoptabulate
67
68\startsetups [sub check]
69
70  \vfill
71
72  \setupbodyfont[8pt]
73
74  \startcolor[MyBlue]
75
76  \starttabulate[|l|r|]
77  \NC \type{\firstsubpage} \NC \firstsubpage       \NC\NR
78  \NC \type{\prevsubpage}  \NC \prevsubpage        \NC\NR
79  \NC \type{\nextsubpage}  \NC \nextsubpage        \NC\NR
80  \NC \type{\lastsubpage}  \NC \lastsubpage        \NC\NR
81  \NC \type{\nofsubpages}  \NC \nofsubpages        \NC\NR
82  \TB
83  \NC \type{\lastpage}     \NC \lastpage           \NC\NR
84  \TB
85  \NC \type{\subpageno}    \NC \number \subpageno  \NC\NR
86  \NC \type{\pageno}       \NC \number \pageno     \NC\NR
87  \NC \type{\realpageno}   \NC \number \realpageno \NC\NR
88  \stoptabulate
89
90  \stopcolor
91
92  \vfill \vfill
93
94\stopsetups
95
96We will now generate a bunch of fake chapters to illustrate this feature.
97
98\setuptexttexts
99  [margin]
100  [] [\vbox to \textheight{\setups[sub check]}]
101
102\chapter{Tufte} \dorecurse{15}{\input tufte }
103\chapter{Zapf}  \dorecurse{10}{\input zapf  }
104\chapter{Knuth} \dorecurse{20}{\input knuth }
105
106\stopdocument
107