summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/uspace/uspace-test.tex
blob: 7f1af57425a8f470cda52fb9aa3643557a574f21 (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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
\documentclass{article}
\usepackage{lmodern}
\usepackage{ifluatex}
\ifnum 0\ifluatex 1\fi=1 % if LuaLaTeX
\usepackage{luatex85}
\fi
\usepackage[a6paper]{geometry}
\usepackage{parskip}
\usepackage[para,online,flushleft]{threeparttable}
\usepackage{array}
\PassOptionsToPackage{unicode}{hyperref}
\usepackage{bookmark}
\hypersetup{
  hidelinks,
  breaklinks}
\urlstyle{same}  % don't use monospace font for urls
\usepackage{float}
\usepackage{uspace}


%\setlength{\emergencystretch}{3em}  % prevent overfull lines
\DeclareRobustCommand{\expl}[1]{\textsf{#1}}
\newcommand{\zwsp}{\textsc{zero width space}}
\newcommand{\nnbsp}{\textsc{narrow no-break space}}
\newcommand{\nbsp}{\textsc{non-breaking space}}
\newcommand{\shy}{\textsc{soft hyphen}}
\newcommand{\enquad}{\textsc{en quad}}
\newcommand{\enspaceC}{\textsc{en space}}
\newcommand{\emquad}{\textsc{em quad}}
\newcommand{\emspaceC}{\textsc{em space}}
\newcommand{\threePerEm}{\textsc{three-per-em space}}
\newcommand{\fourPerEm}{\textsc{four-per-em space}}
\newcommand{\sixPerEm}{\textsc{six-per-em space}}
\newcommand{\figuresp}{\textsc{figure space}}
\newcommand{\punctsp}{\textsc{punctuation space}}
\newcommand{\thinsp}{\textsc{thin space}}
\newcommand{\hairsp}{\textsc{hair space}}

\overfullrule=0.5em

\begin{document}

\section{\zwsp{}}

\expl{\LaTeX{} does not hyphenate word after solidus (forward slash) in
  compounds like `input/output'. Inserting \zwsp{} after the solidus in such
  compound forces \LaTeX{} to consider the compound to be two words and thus
  it will use the usual line breaking algorithm for the second word of the
  compound. The following few lines are testing behaviour \emph{without}
  \zwsp{} inserted:}

Here, we are---testing line breaking of `input/output' compound.

Here, we are--testing line breaking of `input/output' compound.

\expl{Notice how both lines cause hbox overflow because \LaTeX{} cannot find
  good line break.}

\expl{And now \emph{with} \zwsp{} inserted:}

Here, we are---testing line breaking of `input/​output' compound.

Here, we are--testing line breaking of `input/​output' compound.

\pagebreak
\section{\nnbsp{}}

\expl{\nnbsp{} is used, e.g., in German and Czech typography to separate
  multi-part abbreviations. Here is an example with `s. r. o.', which is an
  equivalent of LLC or GmbH in Czech. It should be typeset with narrow space
  between letters and no line break should occur between the letters:}

\begin{tabular}{l | p{0.75\textwidth}}
  s.r.o. & \expl{without any spaces} \tabularnewline
  s.~r.~o. & \expl{with usual \nbsp{} (\textasciitilde{})} \tabularnewline
  s. r. o. & \expl{with \nnbsp{}} \tabularnewline
\end{tabular}

\expl{The following sentence is showing line breaking when ordinary space is
  used:}

He invested all of his savings into Pyramid s. r. o. and lost all of it.

\expl{And here we use \nnbsp{} for much nicer result:}

He invested all of his savings into Pyramid s. r. o. and lost all of it.

\pagebreak

\section{\nbsp{}}

\expl{Here, we are testing the use of Unicode character \nbsp{}:}

Telephone number example for Czechia: +420 123 456 789

Telephone number example for Czechia: +420 123 456 789

\expl{The line above overflows hbox because line break cannot be inserted
  between digits groups due to use of \nbsp{}.}

\pagebreak

\section{\shy{}}
\expl{Sometimes, text might come with words pre-​hyphenated using \shy{}
  character. Let's use the name `Kurremkarmerruk', name of Master Namer from
  Earthsea novels by Ursula K.\ Le~Guin, as an example here. Without manually
  inserted \shy{}, it will be hyphenated but it will overflow hbox slightly:}

The name of the Master Namer is `Kurremkarmerruk'.

\expl{Here is the same with with \shy{} inserted as follows:
  Kur-rem-kar-mer-ruk.}

The name of the Master Namer is `Kur­rem­kar­mer­ruk'.

\expl{Note: I claim no correctness of the above hyphenation of the name. This
  is purely just an example.}

\pagebreak

\section{\figuresp{} and \punctsp{}}

\expl{\figuresp{} and \punctsp{} can be used to align numbers in tables. The
  below table (partial table of Earth athmosphere constituents) does not use
  either. The numbers are centered in their column.}

\begin{figure}[H]
\centering
\begin{tabular}{l | c}
  Element & ppmv \tabularnewline
  \hline
  Nitrogen &     780,840\tabularnewline
  Oxygen &       209,460\tabularnewline
  Argon &          9,340\tabularnewline
  Carbon dioxide &   400 \tabularnewline
  Neon &               18.18
\end{tabular}
\end{figure}

\expl{Below is the same table as above but with addition of \figuresp{} and
  \punctsp{} to pad the numbers so that they all seem the same width to
  \LaTeX{}:}

\begin{figure}[H]
\centering
\begin{tabular}{l | c}
  Element & ppmv \tabularnewline
  \hline
  Nitrogen &      780,840   \tabularnewline
  Oxygen &        209,460   \tabularnewline
  Argon &           9,340   \tabularnewline
  Carbon dioxide &    400   \tabularnewline
  Neon &               18.18
\end{tabular}
\end{figure}

\pagebreak

\section{en, em and other spaces}

\expl{Unicode contains several more space characters, some of which are shown in
the following table:}

\begin{center}
\begin{threeparttable}
\begin{tabular}[c]{l | >{\raggedright}p{0.666\textwidth}}
  a b c & \expl{\emspaceC{}}\tabularnewline
  a b c & \expl{\emquad{} is canonically equivalent{\tnote{i} } to \emspaceC{}}\tabularnewline
  a b c & \expl{\enspaceC{}}\tabularnewline
  a b c & \expl{\enquad{} is canonically equivalent{\tnote{i} } to \enspaceC{}}\tabularnewline
  a b c & \expl{\threePerEm{}}\tabularnewline
  a b c & \expl{\fourPerEm{}}\tabularnewline
  a b c & \expl{\sixPerEm{}}\tabularnewline
  a b c & \expl{\figuresp{}}\tabularnewline
  a b c & \expl{\punctsp{}}\tabularnewline
  a b c & \expl{\thinsp{}}\tabularnewline
  a b c & \expl{\hairsp{}}\tabularnewline
  abc   & \expl{no spaces, for comparison}\tabularnewline
\end{tabular}
\begin{tablenotes}
\item[\expl{i}] \expl{\footnotesize See \url{http://unicode.org/notes/tn5/}
    for explanation of the term.}
\end{tablenotes}
\end{threeparttable}
\end{center}

\end{document}