summaryrefslogtreecommitdiff
path: root/tex/context/base/s-pages-statistics.mkiv
blob: 375dd9949f2978c6a72693d4e5e917f104205ccf (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
%D \module
%D   [      file=s-pages-statistics, % s-otr-01,
%D        version=2012.02.02,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Page Statistics,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\unprotect

\defineframed
  [otrstatistics]
  [\c!offset=\bodyfontsize,
   \c!background=\v!color,
   \c!strut=\v!no,
   \c!backgroundcolor=white,
   \c!frame=\v!off,
   \c!align=\v!middle]

\definecombination
  [otrstatistics]
  [\c!nx=2,
   \c!ny=2,
   \c!location=\v!top]

% expansion is neeed because tabulate sets some penalties

\startsetups system:page:otr:statistics
    \normalexpanded {
        \startcombination[otrstatistics] {
                \otrstatistics {
                    \starttabulate[|Tw(10em)|Trw(8em)|]
                        \NC \string\textwidth           \NC \the\textwidth           \NC \NR
                        \NC \string\textheight          \NC \the\textheight          \NC \NR
                        \NC \string\lineheight          \NC \the\lineheight          \NC \NR
                        \NC \string\strutheight         \NC \strutheight             \NC \NR
                        \NC \string\strutdepth          \NC \strutdepth              \NC \NR
                     %  \NC \string\vsize               \NC \the\vsize               \NC \NR
                        \NC \string\topskip             \NC \the\topskip             \NC \NR
                    \stoptabulate
                }
            } {}
            {
                \otrstatistics {
                    \starttabulate[|Tw(10em)|Trw(8em)|]
                        \NC \string\pagegoal            \NC \the\pagegoal            \NC \NR
                        \NC \string\pagetotal           \NC \the\pagetotal           \NC \NR
                        \NC \string\pagedepth           \NC \the\pagedepth           \NC \NR
                        \NC \string\pageshrink          \NC \the\pageshrink          \NC \NR
                        \NC \string\pagestretch         \NC \the\pagestretch         \NC \NR
                        \NC \string\pagefilstretch      \NC \the\pagefilstretch      \NC \NR
                        \NC \string\pagefillstretch     \NC \the\pagefillstretch     \NC \NR
                        \NC \string\pagefilllstretch    \NC \the\pagefilllstretch    \NC \NR
                    \stoptabulate
                }
            } {}
            {
                \otrstatistics {
                    \starttabulate[|Tw(10em)|Trw(8em)|]
                        \NC \string\widowpenalty        \NC \the\widowpenalty        \NC \NR
                        \NC \string\clubpenalty         \NC \the\clubpenalty         \NC \NR
                        \NC \string\displaywidowpenalty \NC \the\displaywidowpenalty \NC \NR
                        \NC \string\brokenpenalty       \NC \the\brokenpenalty       \NC \NR
                        \NC \string\interlinepenalty    \NC \the\interlinepenalty    \NC \NR
                    \stoptabulate
                }
            } {}
            {
                \otrstatistics[\c!foregroundcolor=darkred] {
                    \starttabulate[|Tw(10em)|Trw(8em)|]
                        \NC page  \NC \the\realpageno        \NC \NR
                        \NC delta \NC \the\dimexpr\pagegoal-\pagetotal\relax \NC \NR
                    \stoptabulate
                }
            } {}
        \stopcombination
    }
\stopsetups

\defineoverlay
  [system:page:otr:statistics]
  [{\framed
      [\c!offset=\bodyfontsize,
       \c!background=\v!color,
       \c!strut=\v!no,
      %\c!frame=\v!off,
       \c!framecolor=white,
       \c!frameoffset=\onepoint,
       \c!rulethickness=2\onepoint,
       \c!backgroundcolor=darkblue,
       \c!align=\v!middle]
      {\forgetall
       \insidefloattrue
       \setups{system:page:otr:statistics}}}]

\unexpanded\def\page_one_command_package_show_state_indeed
  {\scratchheight\ht\b_page_one_contents
   \scratchdepth \dp\b_page_one_contents
   \setbox\b_page_one_contents\vbox\framed
     [\c!offset=\v!overlay,
      \c!framecolor=darkred,
      \c!rulethickness=\onepoint,
      \c!background={\v!foreground,system:page:otr:statistics}]
     {\lower\scratchdepth\box\b_page_one_contents}%
   \ht\b_page_one_contents\scratchheight
   \dp\b_page_one_contents\scratchdepth}

\let\page_one_command_package_show_state\relax

\unexpanded\def\showpageproperties
  {\let\page_one_command_package_show_state\page_one_command_package_show_state_indeed}

\protect

\continueifinputfile{s-pages-statistics.mkiv}

\setupbodyfont[dejavu,11pt] \dontcomplain \showpageproperties

\starttext

\dorecurse {100} { \input tufte

    \startitemize[packed,intro]
        \startitem test \stopitem \startitem test \stopitem
        \startitem test \stopitem \startitem test \stopitem
    \stopitemize
}

\stoptext