Debian Codegraph @

texmf-dist/doc/lualatex/cstypo/cstypotest.tex

raw
1 \documentclass{article}
2 \usepackage{lmodern}
3 \usepackage{ifluatex}
4 \usepackage[a6paper]{geometry}
5 \usepackage{parskip}
6 \usepackage{polyglossia}
7 \setmainlanguage[]{czech}
8 \setotherlanguage{english}
9 \usepackage{microtype}
10
11 \setlength{\emergencystretch}{3em} % prevent overfull lines
12 \newcommand{\expl}[1]{\begin{english}\sffamily #1\end{english}}
13
14 \usepackage{cstypo}
15
16 \begin{document}
17 \section{Bad line breaks}
18 \expl{The follwing text has prepostions `O' and `k' at end of line which
19 is incorrect according to Czech language typography standards:}
20
21 Mezi oblíbené dětské pohádky patří pohádky \emph{O Palečkovi, Alenka v říši
22 divů} a \emph{Socialismem k lepším zítřkům.}
23
24 \expl{The follwing text is the same as above but parentheses are used to test
25 that a preposition stay (or not stay, in this case) with following word
26 even if the prepostion is preceeded with a parenthesis:}
27
28 Mezi oblíbené dětské pohádky patří pohádky \emph{[O Palečkovi], Alenka v říši
29 divů} a \emph{Socialismem (k lepším zítřkům).}
30
31 \expl{Next line shows bad line break between number and the \% symbol.}
32
33 Se správným nastavením fontů znak \% v `na 100 \%' skončí na další řádce.
34
35 \expl{Next line is similar as the one above but tests behaviour for the ‰
36 character.}
37
38 Zde, v České republice, stále není povoleno ani 1 ‰ alkoholu v krvi při
39 řízení automobilu.
40
41 \expl{Next line shows bad line break between degree sign `°' and number.}
42
43 Součet všech tří úhlů v trojůhelníku je vždy 180 °.
44
45 Voda taje při teplotě 0 ℃ a vypařuje se při 100 ℃.
46
47 \expl{Next line show use of ``paragraf'' symbol. It should be kept with the
48 following number.}
49
50 Jak může státní zástupce věc odložit zmiňuje § 159a.
51
52 \section{Better line breaks}
53 \expl{And here we add Lua code to penalize single letter words. It results in
54 following line layout:}
55
56 \cstypoSingleLetterEnable{}
57 \cstypoPercentsEnable{}
58 \cstypoALetterEnable{}
59 \cstypoParagraphEnable{}
60 Mezi oblíbené dětské pohádky patří pohádky \emph{O Palečkovi, Alenka v říši
61 divů} a \emph{Socialismem k lepším zítřkům.}
62
63 \expl{The follwing text is the same as above but parentheses are used to test
64 that a preposition stay with following word even if the prepostion is
65 preceeded with a parenthesis:}
66
67 Mezi oblíbené dětské pohádky patří pohádky \emph{[O Palečkovi], Alenka v říši
68 divů} a \emph{Socialismem (k lepším zítřkům).}
69
70 \expl{Here, the \% symbol should be together with the number.}
71
72 Se správným nastavením fontů znak \% v `na 100 \%' skončí na další řádce.
73
74 \expl{Next line is similar as the one above but tests behaviour for the ‰
75 character.}
76
77 Zde, v České republice, stále není povoleno ani 1 ‰ alkoholu v krvi při
78 řízení automobilu.
79
80 \expl{Next line shows line break between degree sign `°' and number. The
81 degree sign should stay with the number.}
82
83 Součet všech tří úhlů v trojůhelníku je vždy 180 °.
84
85 Voda taje při teplotě 0 ℃ a vypařuje se při 100 ℃.
86
87 \expl{Next line show use of ``paragraf'' symbol. It should be kept with the
88 following number.}
89
90 Jak může státní zástupce věc odložit zmiňuje § 159a.
91
92
93 \section{Bad line breaks because of English}
94 \expl{This section shows that while the hooks are still active, the actual
95 Czech language text is marked as English which results in bad line breaks.}
96
97 \begin{english}
98 Mezi oblíbené dětské pohádky patří pohádky \emph{O Palečkovi, Alenka v říši
99 divů} a \emph{Socialismem k lepším zítřkům.}
100
101 Mezi oblíbené dětské pohádky patří pohádky \emph{[O Palečkovi], Alenka v říši
102 divů} a \emph{Socialismem (k lepším zítřkům).}
103
104 Se správným nastavením fontů znak \% v `na 100 \%' skončí na další řádce.
105
106 Zde, v České republice, stále není povoleno ani 1 ‰ alkoholu v krvi při
107 řízení automobilu.
108
109 Součet všech tří úhlů v trojůhelníku je vždy 180 °.
110
111 Voda taje při teplotě 0 ℃ a vypařuje se při 100 ℃.
112
113 Jak může státní zástupce věc odložit zmiňuje § 159a.
114
115 \end{english}
116
117
118 \section{Bad line breaks again}
119 \expl{This section shows that disabling of the hook works and that the
120 prepositions are again left at the end of their line.}
121
122 \cstypoSingleLetterDisable{}
123 \cstypoPercentsDisable{}
124 \cstypoALetterDisable{}
125 \cstypoParagraphDisable{}
126
127 Mezi oblíbené dětské pohádky patří pohádky \emph{O Palečkovi, Alenka v říši
128 divů} a \emph{Socialismem k lepším zítřkům.}
129
130 \expl{The follwing text is the same as above but parentheses are used to test
131 that a preposition stay (or not stay, in this case) with following word
132 even if the prepostion is preceeded with a parenthesis:}
133
134 Mezi oblíbené dětské pohádky patří pohádky \emph{[O Palečkovi], Alenka v říši
135 divů} a \emph{Socialismem (k lepším zítřkům).}
136
137 \expl{And here, line break is inserted before the \% symbol again.}
138
139 Se správným nastavením fontů znak \% v `na 100 \%' skončí na další řádce.
140
141 \expl{Next line is similar as the one above but tests behaviour for the ‰
142 character.}
143
144 Zde, v České republice, stále není povoleno ani 1 ‰ alkoholu v krvi při
145 řízení automobilu.
146
147 \expl{Next line shows bad line break between degree sign `°' and number.}
148
149 Součet všech tří úhlů v trojůhelníku je vždy 180 °.
150
151 Voda taje při teplotě 0 ℃ a vypařuje se při 100 ℃.
152
153 \expl{Next line show use of ``paragraf'' symbol. It should be kept with the
154 following number.}
155
156 Jak může státní zástupce věc odložit zmiňuje § 159a.
157
158 \end{document}