\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}