summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/cstypo/cstypotest.tex
blob: bfdc3cfab4dfb0e6d7ac4b70ceb1bf4913b57643 (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
\documentclass{article}
\usepackage{lmodern}
\usepackage{ifluatex}
\usepackage[a6paper]{geometry}
\usepackage{parskip}
\usepackage{polyglossia}
\setmainlanguage[]{czech}
\setotherlanguage{english}
\usepackage{microtype}

\setlength{\emergencystretch}{3em}  % prevent overfull lines
\newcommand{\expl}[1]{\begin{english}\sffamily #1\end{english}}

\usepackage{cstypo}

\begin{document}
\section{Bad line breaks}
\expl{The follwing text has prepostions `O' and `k' at end of line which
  is incorrect according to Czech language typography standards:}

Mezi oblíbené dětské pohádky patří pohádky \emph{O Palečkovi, Alenka v říši
  divů} a \emph{Socialismem k lepším zítřkům.}

\expl{The follwing text is the same as above but parentheses are used to test
  that a preposition stay (or not stay, in this case) with following word
  even if the prepostion is preceeded with a parenthesis:}

Mezi oblíbené dětské pohádky patří pohádky \emph{[O Palečkovi], Alenka v říši
  divů} a \emph{Socialismem (k lepším zítřkům).}

\expl{Next line shows bad line break between number and the \% symbol.}

Se správným nastavením fontů znak \% v `na 100 \%' skončí na další řádce.

\expl{Next line is similar as the one above but tests behaviour for the ‰
  character.}

Zde, v České republice, stále není povoleno ani 1 ‰ alkoholu v krvi při
řízení automobilu.

\expl{Next line shows bad line break between degree sign `°' and number.}

Součet všech tří úhlů v trojůhelníku je vždy 180 °.

Voda taje při teplotě 0 ℃ a vypařuje se při 100 ℃.

\expl{Next line show use of ``paragraf'' symbol. It should be kept with the
  following number.}

Jak může státní zástupce věc odložit zmiňuje § 159a.

\section{Better line breaks}
\expl{And here we add Lua code to penalize single letter words. It results in
following line layout:}

\cstypoSingleLetterEnable{}
\cstypoPercentsEnable{}
\cstypoALetterEnable{}
\cstypoParagraphEnable{}
Mezi oblíbené dětské pohádky patří pohádky \emph{O Palečkovi, Alenka v říši
  divů} a \emph{Socialismem k lepším zítřkům.}

\expl{The follwing text is the same as above but parentheses are used to test
  that a preposition stay with following word even if the prepostion is
  preceeded with a parenthesis:}

Mezi oblíbené dětské pohádky patří pohádky \emph{[O Palečkovi], Alenka v říši
  divů} a \emph{Socialismem (k lepším zítřkům).}

\expl{Here, the \% symbol should be together with the number.}

Se správným nastavením fontů znak \% v `na 100 \%' skončí na další řádce.

\expl{Next line is similar as the one above but tests behaviour for the ‰
  character.}

Zde, v České republice, stále není povoleno ani 1 ‰ alkoholu v krvi při
řízení automobilu.

\expl{Next line shows line break between degree sign `°' and number. The
  degree sign should stay with the number.}

Součet všech tří úhlů v trojůhelníku je vždy 180 °.

Voda taje při teplotě 0 ℃ a vypařuje se při 100 ℃.

\expl{Next line show use of ``paragraf'' symbol. It should be kept with the
  following number.}

Jak může státní zástupce věc odložit zmiňuje § 159a.


\section{Bad line breaks because of English}
\expl{This section shows that while the hooks are still active, the actual
  Czech language text is marked as English which results in bad line breaks.}

\begin{english}
Mezi oblíbené dětské pohádky patří pohádky \emph{O Palečkovi, Alenka v říši
  divů} a \emph{Socialismem k lepším zítřkům.}

Mezi oblíbené dětské pohádky patří pohádky \emph{[O Palečkovi], Alenka v říši
  divů} a \emph{Socialismem (k lepším zítřkům).}

Se správným nastavením fontů znak \% v `na 100 \%' skončí na další řádce.

Zde, v České republice, stále není povoleno ani 1 ‰ alkoholu v krvi při
řízení automobilu.

Součet všech tří úhlů v trojůhelníku je vždy 180 °.

Voda taje při teplotě 0 ℃ a vypařuje se při 100 ℃.

Jak může státní zástupce věc odložit zmiňuje § 159a.

\end{english}


\section{Bad line breaks again}
\expl{This section shows that disabling of the hook works and that the
  prepositions are again left at the end of their line.}

\cstypoSingleLetterDisable{}
\cstypoPercentsDisable{}
\cstypoALetterDisable{}
\cstypoParagraphDisable{}

Mezi oblíbené dětské pohádky patří pohádky \emph{O Palečkovi, Alenka v říši
  divů} a \emph{Socialismem k lepším zítřkům.}

\expl{The follwing text is the same as above but parentheses are used to test
  that a preposition stay (or not stay, in this case) with following word
  even if the prepostion is preceeded with a parenthesis:}

Mezi oblíbené dětské pohádky patří pohádky \emph{[O Palečkovi], Alenka v říši
  divů} a \emph{Socialismem (k lepším zítřkům).}

\expl{And here, line break is inserted before the \% symbol again.}

Se správným nastavením fontů znak \% v `na 100 \%' skončí na další řádce.

\expl{Next line is similar as the one above but tests behaviour for the ‰
  character.}

Zde, v České republice, stále není povoleno ani 1 ‰ alkoholu v krvi při
řízení automobilu.

\expl{Next line shows bad line break between degree sign `°' and number.}

Součet všech tří úhlů v trojůhelníku je vždy 180 °.

Voda taje při teplotě 0 ℃ a vypařuje se při 100 ℃.

\expl{Next line show use of ``paragraf'' symbol. It should be kept with the
  following number.}

Jak může státní zástupce věc odložit zmiňuje § 159a.

\end{document}