1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Page Macros Paragraph Numbering}
15
16\unprotect
17
18\installcorenamespace {paragraphnumbering}
19\installcorenamespace {paragraphnumberingvariants}
20
21\installsimplecommandhandler \??paragraphnumbering {paragraphnumbering} \??paragraphnumbering
22
23\definecounter[\v!paragraph]
24
25\let\showparagraphnumber\relax
26
27\appendtoks
28 \page_par_check_state
29\to \everysetupparagraphnumbering
30
31\unexpanded\def\page_par_check_state
32 {\rawprocesscommacommand[\paragraphnumberingparameter\c!state]\page_par_check_state_step}
33
34\def\page_par_check_state_step#1
35 {\ifcsname\??paragraphnumberingvariants#1\endcsname
36 \csname\??paragraphnumberingvariants#1\endcsname
37 \fi}
38
39\setvalue{\??paragraphnumberingvariants\v!start}
40 {\let\showparagraphnumber\page_par_show_number_normal}
41
42\setvalue{\??paragraphnumberingvariants\v!stop}
43 {\let\showparagraphnumber\relax}
44
45\setvalue{\??paragraphnumberingvariants\v!line}
46 {\let\showparagraphnumber\page_par_show_number_lines}
47
48\setvalue{\??paragraphnumberingvariants\v!reset}
49 {\strc_counters_reset\v!paragraph
50 \let\showparagraphnumber\page_par_show_number_normal}
51
52\unexpanded\def\page_par_show_number_normal
53 {\strc_counters_increment\v!paragraph
54 \inleftmargin
55 {\hfill
56 \tf
57 \useparagraphnumberingstyleandcolor\c!style\c!color
58 \convertedcounter[\v!paragraph]
59 \kern\paragraphnumberingparameter\c!distance}}
60
61\unexpanded\def\page_par_show_number_lines
62 {\ifnumberinglines
63 \page_par_show_number_normal
64 \fi}
65
66\setupparagraphnumbering
67 [\c!state=\v!stop,
68
69
70
71 \c!distance=\ifcase\c_page_lines_location2\emwidth\else\zeropoint\fi]
72
73\protect \endinput
74 |