spacing-linecorrection.tex /size: 2562 b    last modification: 2021-10-28 13:50
1% language=us runpath=texruns:manuals/spacing
2
3\environment spacing-style
4
5\startcomponent spacing-linecorrection
6
7\startchapter[title=Line correction]
8
9\startsection[title=Wrapping content]
10
11\startbuffer[linecorrection]
12\typebuffer
13\blank
14\enabletrackers[linecorrection.boxes]
15\getbuffer
16\disabletrackers[linecorrection.boxes]
17\blank
18\stopbuffer
19
20We really do out best to make the spacing look as good as possible
21(or at least consistent) but sometimes \TEX\ needs a bit of help.
22An example of a helper is the following:
23
24\startbuffer
25\startlinecorrection
26    \input ward
27\stoplinecorrection
28\stopbuffer
29
30\getbuffer[linecorrection]
31
32When we use the same command with some left and/or right margins set, we get
33this:
34
35\startbuffer
36\startnarrower
37    \startlinecorrection
38        \input ward
39    \stoplinecorrection
40\stopnarrower
41\stopbuffer
42
43\getbuffer[linecorrection]
44
45Here we do obey the margins inside the correction box but the box itself is still
46as wide as the current width. A typical case where this happens is:
47
48\startbuffer
49\startitemize
50    \startitem an item:
51        \startlinecorrection
52            \input ward
53        \stoplinecorrection
54    \stopitem
55\stopitemize
56\stopbuffer
57
58\getbuffer[linecorrection]
59
60Here is a variant:
61
62\startbuffer
63\startitemize
64    \startitem a local linecorrection:
65        \startlocallinecorrection
66            \input ward
67        \stoplocallinecorrection
68    \stopitem
69\stopitemize
70\stopbuffer
71
72\getbuffer[linecorrection]
73
74Both types of correction wrap their content in a box and make sure that the
75spacing around it is visually as good as possible. The local variant uses a box
76fitting the available width taking margins into account and but resetting them
77inside the box. The normal variant applies the margins inside the box. Which one
78you use depends on the situation and content.
79
80You can pass an optional argument that indicates the amount of spacing to be
81added before and after the correction.
82
83\startbuffer
84\startlinecorrection[3*line]
85    \input ward
86\stoplinecorrection
87\stopbuffer
88
89\getbuffer[linecorrection]
90
91Normally you don't need this correction. It is mainly used for correcting spacing
92around boxed material, like \type {\framed}:
93
94\startbuffer
95before
96\startlinecorrection
97    \framed{something inbetween}
98\stoplinecorrection
99after
100\stopbuffer
101
102\getbuffer[linecorrection]
103
104Because in this document we have set the whitespace this also gets added around
105the box. So, in case your spacing around some special content looks bad, consider
106using these commands.
107
108\stopsection
109
110\stopchapter
111
112\stopcomponent
113