Debian Codegraph @

texmf-dist/doc/latex/uspace/uspace-test.tex

raw
1 \documentclass{article}
2 \usepackage{lmodern}
3 \usepackage{ifluatex}
4 \ifnum 0\ifluatex 1\fi=1 % if LuaLaTeX
5 \usepackage{luatex85}
6 \fi
7 \usepackage[a6paper]{geometry}
8 \usepackage{parskip}
9 \usepackage[para,online,flushleft]{threeparttable}
10 \usepackage{array}
11 \PassOptionsToPackage{unicode}{hyperref}
12 \usepackage{bookmark}
13 \hypersetup{
14 hidelinks,
15 breaklinks}
16 \urlstyle{same} % don't use monospace font for urls
17 \usepackage{float}
18 \usepackage{uspace}
19
20
21 %\setlength{\emergencystretch}{3em} % prevent overfull lines
22 \DeclareRobustCommand{\expl}[1]{\textsf{#1}}
23 \newcommand{\zwsp}{\textsc{zero width space}}
24 \newcommand{\nnbsp}{\textsc{narrow no-break space}}
25 \newcommand{\nbsp}{\textsc{non-breaking space}}
26 \newcommand{\shy}{\textsc{soft hyphen}}
27 \newcommand{\enquad}{\textsc{en quad}}
28 \newcommand{\enspaceC}{\textsc{en space}}
29 \newcommand{\emquad}{\textsc{em quad}}
30 \newcommand{\emspaceC}{\textsc{em space}}
31 \newcommand{\threePerEm}{\textsc{three-per-em space}}
32 \newcommand{\fourPerEm}{\textsc{four-per-em space}}
33 \newcommand{\sixPerEm}{\textsc{six-per-em space}}
34 \newcommand{\figuresp}{\textsc{figure space}}
35 \newcommand{\punctsp}{\textsc{punctuation space}}
36 \newcommand{\thinsp}{\textsc{thin space}}
37 \newcommand{\hairsp}{\textsc{hair space}}
38
39 \overfullrule=0.5em
40
41 \begin{document}
42
43 \section{\zwsp{}}
44
45 \expl{\LaTeX{} does not hyphenate word after solidus (forward slash) in
46 compounds like `input/output'. Inserting \zwsp{} after the solidus in such
47 compound forces \LaTeX{} to consider the compound to be two words and thus
48 it will use the usual line breaking algorithm for the second word of the
49 compound. The following few lines are testing behaviour \emph{without}
50 \zwsp{} inserted:}
51
52 Here, we are---testing line breaking of `input/output' compound.
53
54 Here, we are--testing line breaking of `input/output' compound.
55
56 \expl{Notice how both lines cause hbox overflow because \LaTeX{} cannot find
57 good line break.}
58
59 \expl{And now \emph{with} \zwsp{} inserted:}
60
61 Here, we are---testing line breaking of `input/​output' compound.
62
63 Here, we are--testing line breaking of `input/​output' compound.
64
65 \pagebreak
66 \section{\nnbsp{}}
67
68 \expl{\nnbsp{} is used, e.g., in German and Czech typography to separate
69 multi-part abbreviations. Here is an example with `s. r. o.', which is an
70 equivalent of LLC or GmbH in Czech. It should be typeset with narrow space
71 between letters and no line break should occur between the letters:}
72
73 \begin{tabular}{l | p{0.75\textwidth}}
74 s.r.o. & \expl{without any spaces} \tabularnewline
75 s.~r.~o. & \expl{with usual \nbsp{} (\textasciitilde{})} \tabularnewline
76 s. r. o. & \expl{with \nnbsp{}} \tabularnewline
77 \end{tabular}
78
79 \expl{The following sentence is showing line breaking when ordinary space is
80 used:}
81
82 He invested all of his savings into Pyramid s. r. o. and lost all of it.
83
84 \expl{And here we use \nnbsp{} for much nicer result:}
85
86 He invested all of his savings into Pyramid s. r. o. and lost all of it.
87
88 \pagebreak
89
90 \section{\nbsp{}}
91
92 \expl{Here, we are testing the use of Unicode character \nbsp{}:}
93
94 Telephone number example for Czechia: +420 123 456 789
95
96 Telephone number example for Czechia: +420 123 456 789
97
98 \expl{The line above overflows hbox because line break cannot be inserted
99 between digits groups due to use of \nbsp{}.}
100
101 \pagebreak
102
103 \section{\shy{}}
104 \expl{Sometimes, text might come with words pre-​hyphenated using \shy{}
105 character. Let's use the name `Kurremkarmerruk', name of Master Namer from
106 Earthsea novels by Ursula K.\ Le~Guin, as an example here. Without manually
107 inserted \shy{}, it will be hyphenated but it will overflow hbox slightly:}
108
109 The name of the Master Namer is `Kurremkarmerruk'.
110
111 \expl{Here is the same with with \shy{} inserted as follows:
112 Kur-rem-kar-mer-ruk.}
113
114 The name of the Master Namer is `Kur­rem­kar­mer­ruk'.
115
116 \expl{Note: I claim no correctness of the above hyphenation of the name. This
117 is purely just an example.}
118
119 \pagebreak
120
121 \section{\figuresp{} and \punctsp{}}
122
123 \expl{\figuresp{} and \punctsp{} can be used to align numbers in tables. The
124 below table (partial table of Earth athmosphere constituents) does not use
125 either. The numbers are centered in their column.}
126
127 \begin{figure}[H]
128 \centering
129 \begin{tabular}{l | c}
130 Element & ppmv \tabularnewline
131 \hline
132 Nitrogen & 780,840\tabularnewline
133 Oxygen & 209,460\tabularnewline
134 Argon & 9,340\tabularnewline
135 Carbon dioxide & 400 \tabularnewline
136 Neon & 18.18
137 \end{tabular}
138 \end{figure}
139
140 \expl{Below is the same table as above but with addition of \figuresp{} and
141 \punctsp{} to pad the numbers so that they all seem the same width to
142 \LaTeX{}:}
143
144 \begin{figure}[H]
145 \centering
146 \begin{tabular}{l | c}
147 Element & ppmv \tabularnewline
148 \hline
149 Nitrogen & 780,840   \tabularnewline
150 Oxygen & 209,460   \tabularnewline
151 Argon &   9,340   \tabularnewline
152 Carbon dioxide &    400   \tabularnewline
153 Neon &      18.18
154 \end{tabular}
155 \end{figure}
156
157 \pagebreak
158
159 \section{en, em and other spaces}
160
161 \expl{Unicode contains several more space characters, some of which are shown in
162 the following table:}
163
164 \begin{center}
165 \begin{threeparttable}
166 \begin{tabular}[c]{l | >{\raggedright}p{0.666\textwidth}}
167 a b c & \expl{\emspaceC{}}\tabularnewline
168 a b c & \expl{\emquad{} is canonically equivalent{\tnote{i} } to \emspaceC{}}\tabularnewline
169 a b c & \expl{\enspaceC{}}\tabularnewline
170 a b c & \expl{\enquad{} is canonically equivalent{\tnote{i} } to \enspaceC{}}\tabularnewline
171 a b c & \expl{\threePerEm{}}\tabularnewline
172 a b c & \expl{\fourPerEm{}}\tabularnewline
173 a b c & \expl{\sixPerEm{}}\tabularnewline
174 a b c & \expl{\figuresp{}}\tabularnewline
175 a b c & \expl{\punctsp{}}\tabularnewline
176 a b c & \expl{\thinsp{}}\tabularnewline
177 a b c & \expl{\hairsp{}}\tabularnewline
178 abc & \expl{no spaces, for comparison}\tabularnewline
179 \end{tabular}
180 \begin{tablenotes}
181 \item[\expl{i}] \expl{\footnotesize See \url{http://unicode.org/notes/tn5/}
182 for explanation of the term.}
183 \end{tablenotes}
184 \end{threeparttable}
185 \end{center}
186
187 \end{document}