summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/spacing/spacing-periods.tex
blob: 8d493b9a9879816f9c6cc328f5bd4c9657561ec9 (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
% language=uk

\environment spacing-style

\startcomponent spacing-periods

\startchapter[title=Periods in abbreviations]

% \enabletrackers[typesetters.periodkerns]

When you use so called non french spacing you get more spacing after punctuation
(as determined by the \type {sfcode} of the punctuation character) . However,
when you use periods as delimiters for abbreviations, that period is not the end
of a sentence and you want normal interword spacing instead. One way to achieve
this is to add a backslash after the period but in an automated workflow where
the source is not coming from \TEX\ but for instance in \XML\ format, you can't
do that. The \type {\setupspacing} command can be used to set one of:

\starttabulate[|T|p|]
\NC fixed  \NC \showglyphs \frenchspacing    bla bla e.g. some more \NC \NR
\NC packed \NC \showglyphs \newfrenchspacing bla bla e.g. some more \NC \NR
\NC broad  \NC \showglyphs \nonfrenchspacing bla bla e.g. some more \NC \NR
\stoptabulate

The \type {packed} case is similar to \type {fixed} but has slightly larger (some
5\percent) spacing after punctuation which (at least historically) avoids some
side effects with hyphenation and dashes. We default to \type {broad} anyway.

The next examples demonstrate what the \type {\setperiodkerning} does when it gets
an option passed. Its counterpart is \type {\resetperiodkerning}.

\starttabulate[|T|Tr|p|]
    \HL
    \NC                   \NC    \NC \showglyphs \nonfrenchspacing \resetperiodkerning                  bla bla e.g. some more \NC \NR
    \NC                   \NC    \NC \showglyphs \nonfrenchspacing \resetperiodkerning                  bla bla e.g. Some more \NC \NR
    \HL
    \NC zerospaceperiods  \NC 0  \NC \showglyphs \nonfrenchspacing \setperiodkerning  [zerospaceperiods]bla bla e.g. some more \NC \NR
    \NC                   \NC    \NC \showglyphs \nonfrenchspacing \setperiodkerning  [zerospaceperiods]bla bla e.g. Some more \NC \NR
    \HL
    \NC smallspaceperiods \NC .25\NC \showglyphs \nonfrenchspacing \setperiodkerning [smallspaceperiods]bla bla e.g. some more \NC \NR
    \NC                   \NC    \NC \showglyphs \nonfrenchspacing \setperiodkerning [smallspaceperiods]bla bla e.g. Some more \NC \NR
    \HL
    \NC halfspaceperiods  \NC .50 \NC \showglyphs \nonfrenchspacing \setperiodkerning  [halfspaceperiods]bla bla e.g. some more \NC \NR
    \NC                   \NC    \NC \showglyphs \nonfrenchspacing \setperiodkerning  [halfspaceperiods]bla bla e.g. Some more \NC \NR
    \HL
\stoptabulate

Next we enlarge the affected bit of text so that you can see that the last two
options also affects the space after the periods that bind the characters.

\startlinecorrection
\startcombination[4*2]
    {\scale[scale=3500]{\ruledhbox{\showglyphs \nonfrenchspacing \resetperiodkerning                  e.g. s}}} {}
    {\scale[scale=3500]{\ruledhbox{\showglyphs \nonfrenchspacing \setperiodkerning  [zerospaceperiods]e.g. s}}} {}
    {\scale[scale=3500]{\ruledhbox{\showglyphs \nonfrenchspacing \setperiodkerning [smallspaceperiods]e.g. s}}} {}
    {\scale[scale=3500]{\ruledhbox{\showglyphs \nonfrenchspacing \setperiodkerning  [halfspaceperiods]e.g. s}}} {}
    {\scale[scale=3500]{\ruledhbox{\showglyphs \nonfrenchspacing \resetperiodkerning                  e.g. S}}} {}
    {\scale[scale=3500]{\ruledhbox{\showglyphs \nonfrenchspacing \setperiodkerning  [zerospaceperiods]e.g. S}}} {\ttxx zerospaceperiods}
    {\scale[scale=3500]{\ruledhbox{\showglyphs \nonfrenchspacing \setperiodkerning [smallspaceperiods]e.g. S}}} {\ttxx smallspaceperiods}
    {\scale[scale=3500]{\ruledhbox{\showglyphs \nonfrenchspacing \setperiodkerning  [halfspaceperiods]e.g. S}}} {\ttxx halfspaceperiods}
\stopcombination
\stoplinecorrection

Defining more options is easy, we only specify the factor that determines mid
periods. When \type {factor} is zero, only the final period is looked at.

\starttyping
\defineperiodkerning [zerospaceperiods]  [factor=0]
\defineperiodkerning [smallspaceperiods] [factor=.25]
\defineperiodkerning [halfspaceperiods]  [factor=.5]
\stoptyping

This mechanism has been present for a while but I forgot about it. When cleaning
up code it was decided to add it to the core. Maybe more options and features are
needed but so far there has never been demand for this so \unknown

\stopchapter

\stopcomponent