summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/cstypo/cstypo.tex
blob: 1246e3d9566f00278f6833bd2043501a98fec9ee (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
\documentclass[paper=B5,DIV=calc,parskip=half]{scrartcl}
\usepackage{ifluatex}

\usepackage{fontspec}
%\defaultfontfeatures{Ligatures={TeX,Common},Scale=MatchLowercase}
\setmainfont[]{Charis SIL}
\setsansfont[Ligatures={TeX,Common}, Scale=MatchLowercase]{TeX Gyre Heros}
\setmonofont[Ligatures=,Scale=MatchLowercase]{DejaVu Sans Mono}

\usepackage{listings}
\usepackage{enumitem}
%\usepackage{enumitem-zref}
\usepackage{polyglossia}
\setmainlanguage[]{english}

\usepackage{newunicodechar}
\newunicodechar{℃}{{°C}}
\newunicodechar{℉}{{°F}}

\usepackage[autostyle]{csquotes}

\author{Václav Haisman\texorpdfstring{%
    \\{\small\href{mailto:vhaisman+cstypo@gmail.com?subject=[cstypo]}{vhaisman@gmail.com}}}{}}
\date{\today}
\title{\texttt{cstypo} user manual}

\PassOptionsToPackage{unicode}{hyperref}
\usepackage{bookmark}
\usepackage{xcolor}
\hypersetup{
  colorlinks,
  linkcolor={red!50!black},
  citecolor={blue!50!black},
  urlcolor={blue!80!black},
  breaklinks=true}
\urlstyle{same}  % don't use monospace font for urls

\usepackage{microtype}
\usepackage{metalogo}

\setlength{\emergencystretch}{3em}  % prevent overfull lines

\lstdefinestyle{myLatexStyle}{
  language=[LaTeX]{Tex},
  basicstyle=\ttfamily
}


\begin{document}
\begin{titlepage}
  \maketitle  
\end{titlepage}

\tableofcontents

\section{Introduction}
The \href{https://www.ctan.org/pkg/cstypo}{\texttt{cstypo}}\footnote{Source
  code is on GitHub in
  \href{https://github.com/wilx/cstypo}{\texttt{wilx/cstypo}} repository.}
package provides macros that enforce basic Czech typography rules through Lua
hooks available in \LuaTeX{}.

\begin{enumerate}%[name=rulesList]
\item\label{itm:singleletter} There should be no line break between single
  letter preprosition and single letter conjugations and word following them.
\item\label{itm:percents} There should be no line break between number and \%
  symbol.
\end{enumerate}

There are obviously more rules than these two but only the above rules are
enforcable through this package.

\section{User interface}

Czech typography rules, when enabled by the following macros, are only
enforced on text marked as Czech by \texttt{polyglossia} or \texttt{babel}.

The following two macros allow to enable and disable hook that enforces
penalization of line breaks after single letter words:
%(\refitem{rulesList{itm:singleletter}):

\begin{lstlisting}[style=myLatexStyle]
\cstypoSingleLetterEnable
\cstypoSingleLetterDisable
\end{lstlisting}

The following two macros allow to enable and disable hook that enforces the
same rule as above but for ‘a’ conjugation. The reason that this is separete
from the rest of the single letter prepositions and conjugations is that line
break after ‘a’ is tolerated for narrow column texts. It might be desirable
to have this rule enforced for all of the single letter words except for the
‘a’.

\begin{lstlisting}[style=myLatexStyle]
\cstypoALetterEnable
\cstypoALetterDisable
\end{lstlisting}

The following two macros allow to enable and disable hook that enforces
penalization of line breaks between number and \enquote*{\%} symbol and also
few more symbols: per thousand~\enquote*{‰}, degree~\enquote*{°}, degree
Celsius~\enquote*{℃} and degree Fahrenheit~\enquote*{℉}.

\begin{lstlisting}[style=myLatexStyle]
\cstypoPercentsEnable
\cstypoPercentsDisable
\end{lstlisting}

The following two macros allow to enable and disable hook that enforces
penalization of line breaks between~\enquote*{§} symbol and following number.

\begin{lstlisting}[style=myLatexStyle]
\cstypoParagraphEnable
\cstypoParagraphDisable
\end{lstlisting}


\section{History}

This package was inspired by
\texttt{\href{http://www.ctan.org/pkg/impnattypo}{impnattypo}} French
typography package. It would not be possible without help and comments from
people of
\href{http://chat.stackexchange.com/rooms/41/tex-latex-and-friends}{\TeX{},
  \LaTeX{} and Friends} StackExchange chat room and the
\href{http://tex.stackexchange.com/}{\TeX.SE} site itself.

\begin{description}[style=nextline, labelwidth=4.5em, leftmargin=!, labelindent=0em]
\item[\texttt{v0.03}] Limit Czech typography rules enforcement only to text
  marked as Czech language. Handle per thousand~\enquote*{‰},
  degree~\enquote*{°}, degree Celsius~\enquote*{℃}, degree
  Fahrenheit~\enquote*{℉} and paragraph~\enquote*{§} symbols.
\item[\texttt{v0.02}] Fixed some packaging and documentation issues found by
  CTAN submission review.
\item[\texttt{v0.01}] First published version of this package.
\end{description}

\end{document}