summaryrefslogtreecommitdiff
path: root/doc/context/presentations/context/2021/context-2021-paragraphs.tex
blob: 7a4e566d849637447a1a005beacc6d2b48c8b910 (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
% language=us

\usemodule[present-boring,abbreviations-logos]

\definecolor[maincolor] [r=.4,g=.4]
\definecolor[extracolor][s=.1]

\startdocument
  [title={PARAGRAPHS},
   banner={a bit of an upgrade},
   location={context\enspace {\bf 2021}\enspace meeting}]

\starttitle[title=Note]

\startitemize

\startitem
    Some of the following already is present for a while and has been discussed
    at previous meetings.
\stopitem

\startitem
    But \unknown\ occasionally some minor tweak gets added so consider this to be
    an update.
\stopitem

\stopitemize

\starttitle[title=Spacing]

\startitemize

\startitem
    Spaces in \TEX\ become glue nodes (with optional stretch and shrink).
\stopitem

\startitem
    In traditional \TEX\ these glue nodes are ref counted copies of the current
    spacing related variables.
\stopitem

\startitem
    In \LUATEX\ we make real copies so that when we mess with the node list
    changes to glue don't affect other instances.
\stopitem

\stopitemize

\starttitle[title=Parameters]

\startitemize

\startitem
    In traditional \TEX\ the paragraphs bound properties that are in effect
    when \type {\par} happens are used when breaking into lines.
\stopitem

\startitem
    In \LUAMETATEX\ the paragraphs bound properties are stored with the
    paragraph and can be frozen when they are set.
\stopitem

\startitem
    This gives a more predictable (and robust) way of manipulating a
    paragraph.
\stopitem

\startitem
    We can for instance get rid of grouping side effects that interfere with
    \type {\everypar}.
\stopitem

\startitem
    Currently three dozen parameters are tracked but they are grouped in
    categories.
\stopitem

\blank[2*big] {\em (show code and examples)}

\stopitemize

\stoptitle

\starttitle[title=Wrapping]

\startitemize

\startitem
    Doing something in front of a paragraph is taken care of by good old
    \type {\everypar}.
\stopitem

\startitem
    In \LUAMETATEX\ we also have \type {\everybeforepar} but so far in \CONTEXT\
    we haven't used that.
\stopitem

\startitem
    Adding something to the end of a paragraph can be tricky so we have
    a wrapper mechanism: \type {\wrapuppar}.
\stopitem

\startitem
    The \type {\wrapuppar} primitive is similar to \type {\atendofgroup} in the
    sense that it accumulates tokens (so no \type {\endofpar}).
\stopitem

\startitem
    Normally these primitives are not used directly but managed by a more general
    system of handling paragraphs.
\stopitem

\stopitemize

\blank[2*big] {\em (show code and examples)}

\stoptitle

\starttitle[title=Normalizing]

\startitemize

\startitem
    In order to see consistent paragraphs at the \LUA\ end in \LUAMETATEX\
    we can normalize the lines that come from the paragraph builder.
\stopitem

\startitem
    Normalization results in:

    \startitemize
        \startitem
            the first line having: indent skip
        \stopitem
        \startitem
            each line having: left hang, left skip, right skip, right hang
        \stopitem
        \startitem
            the last line having: left parfill skip, right parfill skip
        \stopitem
    \stopitemize
\stopitem

\startitem
    It is controlled by \type {\normalizelinemode} which has additional flags for
    swapping hanging indentation and par shapes, breaking after dir nodes,
    removing margin kerns and clipping the line width.
\stopitem

\startitem
    The clipping options avoids the side effects of \TEX\ using shifts which has
    the side effect of unreal dimensions. This is one of the tricks|/|properties
    of the traditional engine that is perfectly fine until we open up things.
\stopitem

\stopitemize

\blank[2*big] {\em (show code and examples)}

\stoptitle

\stopdocument