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