diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/uspace/uspace-test.tex |
Initial commit
Diffstat (limited to 'macros/latex/contrib/uspace/uspace-test.tex')
-rw-r--r-- | macros/latex/contrib/uspace/uspace-test.tex | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/macros/latex/contrib/uspace/uspace-test.tex b/macros/latex/contrib/uspace/uspace-test.tex new file mode 100644 index 0000000000..7f1af57425 --- /dev/null +++ b/macros/latex/contrib/uspace/uspace-test.tex @@ -0,0 +1,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 `Kurremkarmerruk'. + +\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} |