%%
%% This is file `typog-example.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% typog.dtx  (with options: `example')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2024 by Ch. L. Spiel
%% 
%% This work may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3c of this
%% license or (at your option) any later version.  The latest version
%% of this license is in
%%     https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Ch. L. Spiel.
%% 
%% This work consists of the files typog.dtx and typog.ins
%% and the derived files typog.sty, slant-angle.mp,
%% crooked-paragraphs.mp, smooth-parshapes.mp, title.mp,
%% typog-example.tex, typog-minimal-test.tex,
%% typog-without-microtype-test.tex
%% typog-grep.pl.in, typog-grep.pl,
%% typog-grep.pod, and teximan2latex.sed.
%% 
%% 
\documentclass[a4paper]{article}

\tracingonline=0

\PassOptionsToPackage{dvipsnames}{xcolor}

\usepackage{amsmath}
\usepackage[main=USenglish, german]{babel}
\usepackage{float}
\usepackage[T1]{fontenc}
\usepackage{fullwidth}
\usepackage{hyphenat}
\usepackage{mathtools}
\usepackage[activate=true, verbose=false]{microtype}
\usepackage{ragged2e}
\usepackage[nobottomtitles*]{titlesec}\renewcommand*{\bottomtitlespace}{.2\textheight}
\usepackage{trace}
\usepackage[debug,
  trackingttspacing,
  uppercaselabelitemadjustments={0pt, .1em, .15em, .1em},
  lowercaselabelitemadjustments={-.0667em, 0pt, .1em, 0pt}]{typog}
\usepackage{xcolor}

\usepackage[loosest, proportional, scaled=1.064]{erewhon}
\usepackage[erewhon]{newtxmath}
\usepackage[scaled=.95]{cabin}
\usepackage{inconsolata}
\usepackage{setspace}\setstretch{1.08333}

\def\xsfdefault{\relax}

\def\examplefont{6}

\ifcase\examplefont % 0  --  document's default sans-serif font (e.g., ecrm1000)
  \def\examplefontname{default}
  \let\xsf=\sf
  \let\xsfdefault=\sfdefault
\or % 1  --  Nunito
  \def\examplefontname{Nunito}
  \def\xsfdefault{Nunito-TOsF}
  \def\xsf{\let\sfdefault=\xsfdefault\sf}
\or % 2  --  OpenSans
  \def\examplefontname{OpenSans}
  \def\xsfdefault{opensans-TLF}
  \def\xsf{\let\sfdefault=\xsfdefault\sf}
\or % 3  --  Noto Sans
  \def\examplefontname{Noto Sans}
  \def\xsfdefault{NotoSans-TLF}
  \def\xsf{\let\sfdefault=\xsfdefault\sf}
\or % 4  --  Roboto
  \def\examplefontname{Roboto}
  \def\xsfdefault{Roboto-LF}
  \def\xsf{\let\sfdefault=\xsfdefault\sf}
\or % 5  --  Montserrat
  \def\examplefontname{Montserrat Alternates}
  \def\xsfdefault{MontserratAlternates-LF}
  \def\xsf{\let\sfdefault=\xsfdefault\sf}
\or % 6  --  Inter
  \def\examplefontname{Inter}
  \def\xsfdefault{Inter-LF}
  \def\xsf{\let\sfdefault=\xsfdefault\sf}
\else
  \SelectedUnknownExampleFont
\fi

\typeout{typog-example: font for examples: `\xsfdefault'}%

\usepackage{hyperref}
\usepackage{cleveref}

\hypersetup{
  citecolor = CadetBlue,
  colorlinks = true,
  linkcolor = Blue,
  linktocpage = true,
  pdfauthor={Dr. Christoph L. Spiel},
  pdfkeywords={Examples,
               LaTeX, typography, ligature, italic-correction, paragraph justification, sloppy, ragged},
  pdfsubject={Examples for typographic fine-tuning of LaTeX},
  pdftitle={Examples for LaTeX package typog},
  raiselinks = false,
  urlcolor = Mulberry
}

\makeatletter
\newcommand{\fs@myruled}{%
  \fs@ruled
  \def\@fs@capt##1##2{\floatc@ruled{##1\space\capitaldash*\space}{\fussy ##2}}%
  \def\@fs@pre{\hrule height.8pt depth0pt \kern4pt}%
  \def\@fs@mid{\kern3pt\hrule\kern3pt}%
  \def\@fs@post{\kern4pt\hrule\relax}%
}
\makeatother

\floatstyle{myruled}
\newfloat{exemplary}{htbp}{loe}[section]
\floatname{exemplary}{Example}
\Crefname{exemplary}{Example}{Examples}
\crefname{exemplary}{Ex.}{Ex.}

\newcommand*{\acronym}[1]{\mbox{\letterspacecapitals{\MakeUppercase{#1}}}}
\newcommand*{\bibauthor}[1]{\textsc{#1}}
\newcommand*{\bibtitle}[1]{\textit{#1}}
\newcommand*{\bottomstrut}{\rule[-.5em]{0pt}{0pt}}
\newcommand*{\code}[1]{{\ttfamily\hyphenchar\font=`\-\relax #1}}
\newcommand*{\doublequotes}[1]{\doubleguillemetright#1\doubleguillemetleft}
\newcommand*{\eTeX}{\mbox{\(\epsilon\)-\TeX}}
\newcommand*{\letterspacecapitals}[1]{\textls[30]{#1}}
\newcommand*{\metavar}[1]{\textit{#1}}
\newcommand*{\packagename}[1]{\mbox{\textsf{#1}}}
\newcommand*{\propername}[1]{\mbox{\textsc{\textls[25]{#1}}}}
\newcommand*{\sample}[1]{\mbox{`\texttt{#1}'}}
\newcommand*{\singlequotes}[1]{\singleguillemetright#1\singleguillemetleft}
\newcommand*{\topstrut}{\rule{0pt}{1.25em}}
\newcommand*{\visualpar}{\,\P\quad}

\newlength{\emreference}
\AtBeginDocument{\setlength{\emreference}{\fontdimen6\font}}
\newrobustcmd*{\milliem}[1]
              {\ifdim #1=0pt
                #1%
               \else
                 \generictextfraction{\the\numexpr\dimexpr (#1) * 1000 / \emreference}{1000}\:em%
               \fi}

\newcommand*{\generictextfraction}[2]
            {\raisebox{.4em}[0pt]{\scriptsize #1}%
             \kern-.05em\textfractionsolidus\kern-.05em
             \raisebox{-.15em}[0pt][0pt]{\scriptsize #2}}

\newcommand*{\leftmarker}{\rule{.2em}{.1pt}\rule{.1pt}{.667em}}
\newcommand*{\rightmarker}{\rule{.1pt}{.667em}\rule{.2em}{.1pt}}
\newcommand*{\indicatewidth}[1]{\mbox{\leftmarker #1\rightmarker}}

\newcommand*{\maxipagerule}{\medskip\hrule\medskip}
\newenvironment*{maxipage*}
  {\par
   \noindent
   \fullwidthsetup{leftmargin=-\marginparsep - \marginparwidth,
                   width=\textwidth + 2\marginparsep + 2\marginparwidth}
   \begin{fullwidth}%
   \vspace*{1pt}% Why is some vspace necessary?
   \parskip=.5\baselineskip}
  {\par
   \end{fullwidth}%
   \par}
\newenvironment*{maxipage}
  {\par
   \noindent
   \fullwidthsetup{leftmargin=-\marginparsep - \marginparwidth,
                   width=\textwidth + 2\marginparsep + 2\marginparwidth}
   \begin{fullwidth}%
   \maxipagerule
   \parskip=.5\baselineskip}
  {\par
   \vskip\parskip
   \maxipagerule
   \end{fullwidth}%
   \par}

\newlength{\examplewidth}
\setlength{\examplewidth}{160pt}

\newcommand*{\texbooktolerancesample}
            {If you want to avoid overfull boxes at all costs without trying to fix them manually,
             you might be tempt\-ed to set \texttt{tol\-er\-ance=\allowbreak10000}; this allows
             arbitrarily bad lines to be acceptable in  tough situations.  But infinite tolerance
             is a bad idea, because \TeX{} doesn't distinguish between terribly bad and
             preposterously horrible lines.  Indeed, a tolerance of 10000 encourages \TeX{} to
             concentrate all the badness in one place, making one truly unsightly line instead of
             two moderately bad ones, because a single ``write-off'' produces fewest total
             demerits according to the rules.}
\newcommand*{\texbooktolerancesamplecredits}
            {\medskip\noindent
             \textsl{The sample text was taken from The~\TeX{}book~\cite[p.~107]{knuth:1986}.}}

\newcommand*{\texbookparfillskipsample}
            {We still haven't discussed the special trick that allows the final line of a paragraph
             to be shorter than the others.  Just before \TeX{} begins to choose breakpoints,
             it does two important things: [\dots\itcorr{-4}]}
\newcommand*{\texbooklongparfillskipsample}
            {We still haven't discussed the special trick that allows the final line of a paragraph
             to be shorter than the others.  Just before \TeX{} begins to choose breakpoints,
             it does two important things: (1)~If the final item of the current horizontal list is glue,
             that glue is discarded.  (The reason is that a blank space often gets into a token list just
             before \code{\char92par} or just before \code{\char36\char36}, and this blank space should not be
             part of the paragraph.)  (2)~Three or more items are put at the end of the
             current horizontal list~[\dots\itcorr{-4}]}
\newcommand*{\texbookparfillskipsamplecredits}
            {\medskip\noindent
             \textsl{The sample text was taken from The~\TeX{}book~\cite[p.~99n]{knuth:1986}.}}

\newcommand*{\texbookparshapeskipsample}
            {It's possible to control the length of lines in a much more general way, if simple
             changes to \code{\string\leftskip} and \code{\string\rightskip} aren't flexible enough for your
             purposes.  For example, a semicircular hole has been cut out of the present paragraph,
             in order to make room for a circular illustration that contains some of
             Galileo's immortal words about circles; all of the line breaks in this
             paragraph and in the circular quotation were found by \TeX's line-breaking algorithm.
             You can specify a essentially arbitrary paragraph shape, by saying
             \code{parshape}=\metavar{number}, where the \metavar{number} is a positive integer~\(n\),
             followed by \(2n\)~\metavar{dimen} specifications.}
\newcommand*{\texbookparshapeskipsamplecredits}
            {\medskip\noindent
             \textsl{The sample text was taken from The~\TeX{}book~\cite[p.~101]{knuth:1986}.}}

\newcommand*{\texbookbaselineskipsample}
            {When you are typsetting a document that spans several pages, it's generally best to
             define \code{\string\baselineskip} so that it cannot stretch or shrink, because
             this will give more uniformity to the pages.  A small variation in the distance
             between the baselines---say only half a point---can make a substantial difference
             in the appearance of the type, since it significantly affects the proportion of
             white to black.  On the other hand, if you are preparing a one-page document, you
             might want to give the baselineskip some stretchability, so that \TeX{} will help
             you fit the copy on the page.}
\newcommand*{\texbookbaselineskipsamplecredits}
            {\medskip\noindent
             \textsl{The sample text was taken from The~\TeX{}book~\cite[p.~78]{knuth:1986}.}}

\newcommand*{\examplepreset}{\microtypesetup{activate=false}}
\newcommand*{\examplesetup}{\frenchspacing\xsf\small\fussy}
\newcommand*{\exampleparbox}[2][n/a]
            {\begin{typoginspect}{#1}
               \examplepreset
               \parbox[t]{\examplewidth}{\examplesetup #2}%
             \end{typoginspect}}
\newcommand*{\examplesep}{\hspace*{20pt}}
\def\fontnameandweightinfo#1{%
  {\def\projectoutfontname##1-##2-##3\relax{##1~\lowercase{##2}}%
   \global\expandafter\edef\csname#1\endcsname{\expandafter\projectoutfontname\fontname\font\relax}}}
\newcommand*{\examplefontinformation}
            {\smallskip
             \examplesetup
             \fontnameandweightinfo{exfontnameinfo}%
             \fontsizeinfo{exfontsizeinfo}%
             The font used in this example is \exfontnameinfo, \exfontsizeinfo*.}

\setcounter{tocdepth}{1}
\setlength{\overfullrule}{0pt}
\hbadness=-1

\input{ushyphex}

\hyphenation{
  Double-guillemet-left
  Double-guillemet-right
  Double-quotes
  Single-guillemet-left
  Single-guillemet-right
  Single-quotes
  adj-demerits
  allow-display-breaks
  babel-hyphenation
  base-line-skip
  break-penalty
  breakable-display
  capital-hyphen
  capital-times
  cite-dash
  club-penalties
  cref-range-conjunction
  display-break
  display-widow-penalties
  double-guillemet-right
  double-hyphen-demerits
  double-quotes
  final-hyphen-demerits
  inter-display-line-penalty
  inter-text
  kerned-hyphen
  last-line-ragged-left
  last-line-ragged-left-par
  line-width
  loose-ness
  loose-spacing
  make-at-letter
  make-at-other
  mar-gin-al
  math-italics-correction
  micro-type
  number-dash
  par-box
  par-indent
  parfillskip
  pdf-string-def-Disable-Commands
  post-display-penalty
  pre-display-penalty
  raise-capital-guillemets
  raise-capital-times
  raise-number-dash
  set-font-expand
  set-font-shrink
  set-font-stretch
  short-inter-text
  single-guillemet-left
  single-guillemet-right
  single-quotes
  slash-kern
  slightly-sloppy-par
  sloppy-par
  smooth-ragged-right-fuzz-factor
  smooth-ragged-right-par
  smooth-ragged-right-shape-quintuplet
  smooth-ragged-right-shape-septuplet
  smooth-ragged-right-shape-triplet
  space-skip
  text-italics-correction
  tight-spacing
  tracing-boxes
  tracing-para-graphs
  vtie-bot
  vtie-bot-disp
  vtie-bot-disp-par
  vtie-bot-disp-top-par
  vtie-bot-par
  vtie-top
  vtie-top-par
  widow-penalties
}

\SetExpansion[context=sloppy, stretch=30, shrink=60, step=5]{encoding={OT1, T1, TS1}}{}% p15
\SetTracking{encoding=*, shape=sc}{20}

\begin{document}
\fussy
\lastlinefit=1000
\nonfrenchspacing

\begin{center}
  \Huge\bf\sf
  TypoG Examples
\end{center}

\bigskip

\noindent
The section numbers correspond to the subsections of section~3
in the official documentation of package~\packagename{typog}.

\bigskip

\tableofcontents

\clearpage
\listof{exemplary}{Examples}

\clearpage
\noindent
Unless otherwise noted the font used in the examples is \singlequotes{\examplefontname}.

\section{Setup and Reconfiguration}

\noindent
\code{\char`\\ typogget}

\begin{list}{}{}
  \newcommand*{\expandsto}{$\mathbin{\mapsto}$}
\item \code{breakpenalty} \expandsto{} \the\typogget{breakpenalty}
\item \code{ligaturekern} \expandsto{} \milliem{\typogget{ligaturekern}}
\item \code{lowercaselabelitemadjustments} \expandsto{} \typogget{lowercaselabelitemadjustments}
\item \code{mathitalicscorrection} \expandsto{} \the\typogget{mathitalicscorrection}
\item \code{raisecapitaldash} \expandsto{} \the\typogget{raisecapitaldash}
\item \code{raisecapitalguillemets} \expandsto{} \the\typogget{raisecapitalguillemets}
\item \code{raisecapitalhyphen} \expandsto{} \the\typogget{raisecapitalhyphen}
\item \code{raisecapitaltimes} \expandsto{} \the\typogget{raisecapitaltimes}
\item \code{raisefiguredash} \expandsto{} \the\typogget{raisefiguredash}
\item \code{raiseguillemets} \expandsto{} \the\typogget{raiseguillemets}
\item \code{shrinklimits} \expandsto{} \typogget{shrinklimits}
\item \code{slashkern} \expandsto{} \the\typogget{slashkern}
\item \code{stretchlimits} \expandsto{} \typogget{stretchlimits}
\item \code{textitalicscorrection} \expandsto{} \the\typogget{textitalicscorrection}
\item \code{trackingttspacing} \expandsto{} \typogget{trackingttspacing}
\item \code{uppercaselabelitemadjustments} \expandsto{} \typogget{uppercaselabelitemadjustments}
\end{list}

\begingroup
  \dimen0=\typogget{raisecapitaldash}%
  \setbox0=\hbox to \typogget{ligaturekern} {}%
\endgroup

\noindent
\code{\char`\\ typoggetnth}

\begin{list}{}{}
\item
  Elements of \code{lowercaselabelitemadjustments}:
  (1)~\typoggetnth{\dimen0}{lowercaselabelitemadjustments}{1}\the\dimen0,
  (2)~\typoggetnth{\dimen0}{lowercaselabelitemadjustments}{2}\the\dimen0,
  (3)~\typoggetnth{\dimen0}{lowercaselabelitemadjustments}{3}\the\dimen0, and
  (4)~\typoggetnth{\dimen0}{lowercaselabelitemadjustments}{4}\the\dimen0.

  Same elements now accessed from the right-hand-side, i.\,e.~with negative indices:
  (\textminus4)~\typoggetnth{nth}{lowercaselabelitemadjustments}{-4}\nth,
  (\textminus3)~\typoggetnth{nth}{lowercaselabelitemadjustments}{-3}\nth,
  (\textminus2)~\typoggetnth{nth}{lowercaselabelitemadjustments}{-2}\nth, and
  (\textminus1)~\typoggetnth{nth}{lowercaselabelitemadjustments}{-1}\nth.

\item Elements of \code{shrinklimits}:
  (1)~\typoggetnth{nth}{shrinklimits}{1}\nth,
  (2)~\typoggetnth{nth}{shrinklimits}{2}\nth, and
  (3)~\typoggetnth{nth}{shrinklimits}{3}\nth.

\item Elements of \code{stretchlimits}:
  (1)~\typoggetnth{nth}{stretchlimits}{1}\nth,
  (2)~\typoggetnth{nth}{stretchlimits}{2}\nth, and
  (3)~\typoggetnth{nth}{stretchlimits}{3}\nth.

\item Elements of \code{trackingttspacing}:
  (1)~\typoggetnth{nth}{trackingttspacing}{1}\nth,
  (2)~\typoggetnth{nth}{trackingttspacing}{2}\nth, and
  (3)~\typoggetnth{nth}{trackingttspacing}{3}\nth.

\item Elements of \code{uppercaselabelitemadjustments}:
  (1)~\typoggetnth{\dimen0}{uppercaselabelitemadjustments}{1}\the\dimen0,
  (2)~\typoggetnth{\dimen0}{uppercaselabelitemadjustments}{2}\the\dimen0,
  (3)~\typoggetnth{\dimen0}{uppercaselabelitemadjustments}{3}\the\dimen0, and
  (4)~\typoggetnth{\dimen0}{uppercaselabelitemadjustments}{4}\the\dimen0.
\end{list}

\section{Information}

\code{\string\fontsizeinfo} --\fontsizeinfo{docsizeinfo}
At this point of the document, the font~size
and the line~spacing are \docsizeinfo*~(w/o~units).
For footnotes however, the current sizes are%
\footnote{This is the footnote where we get the sizes from.\fontsizeinfo{footsizeinfo}}
\footsizeinfo.

Next we show a comparison of different font sizes and line spacings
decorated with the results of \code{\string\fontsizeinfo}.

\medskip

\begin{maxipage}
  \setstretch{1}
  \newcommand*{\baselineskipdoc}%
              {Macro \code{\string\baselineskip} is a length command which
                specifies the minimum space between the bottom of two
                successive lines in a paragraph.  Its value may be
                automatically reset by \LaTeX, for example, by font
                changes in the text.}
  \renewcommand*{\examplefontname}{Merriweather}
  Different font sizes and line spacings exemplified with the \examplefontname~font.

  \smallskip

  \begingroup
  \fontfamily{Merriwthr-TLF}\selectfont
  \noindent
  \parbox[t]{.31\linewidth}%
         {\fontsize{8.5}{12}\selectfont
           \baselineskipdoc
           \fontsizeinfo{examplesizeinfotight}}
  \hfill
  \parbox[t]{.31\linewidth}%
         {\fontsize{10}{12}\selectfont
           \baselineskipdoc
           \fontsizeinfo{examplesizeinfo}}
  \hfill
  \parbox[t]{.31\linewidth}%
         {\fontsize{10}{13.5}\selectfont
           \baselineskipdoc
           \fontsizeinfo{examplesizeinfoloose}}
  \endgroup

  \medskip

  \noindent
  \parbox[t]{.31\linewidth}{\examplefontname~\examplesizeinfotight*}
  \hfill
  \parbox[t]{.31\linewidth}{\examplefontname~\examplesizeinfo*}
  \hfill
  \parbox[t]{.31\linewidth}{\examplefontname~\examplesizeinfoloose*}
\end{maxipage}

\noindent Starred form eats spaces?  \examplesizeinfo*   .

\section{Hyphenation}

\noindent Line-break behavior

\begin{quote}
  \setlength{\overfullrule}{0pt}
  \parbox[t]{0pt}{%
    \code{\string\mbox+\string\breakpoint*}  \\
     \mbox{(pre-)}\breakpoint*Hilbert space}
  \hspace{100pt}
  \parbox[t]{0pt}{%
    \code{\string\breakpoint*}  \\
     (pre-)\breakpoint*Hilbert space}
  \hspace{100pt}
  \parbox[t]{0pt}{%
    \code{\string\breakpoint}  \\
    (pre-)\breakpoint Hilbert space}
\end{quote}

\noindent Starred form eats spaces?  a\breakpoint*  b.  Unstarred: a\breakpoint  b.

\medskip

\begin{quote}
  \setlength{\overfullrule}{0pt}
  \parbox[t]{0pt}{%
    \begin{hyphenmin}{6}
      Set minimum hyphenation values for both \code{\string\lefthyphenmin} and
      \code{\string\righthyphenmin}: \the\lefthyphenmin{} and \the\righthyphenmin.
  \end{hyphenmin}}
  \hspace{100pt}
  \parbox[t]{0pt}{%
    \begin{hyphenmin}[4]{5}
      Set minimum hyphenation values for \code{\string\lefthyphenmin} and
      \code{\string\righthyphenmin} separately: \the\lefthyphenmin{} and \the\righthyphenmin.
  \end{hyphenmin}}
  \hspace{100pt}
  \parbox[t]{0pt}{%
    Returned to the default values for \code{\string\lefthyphenmin} and
    \code{\string\righthyphenmin}: \the\lefthyphenmin{} and \the\righthyphenmin.}
\end{quote}

\section{Disable\kernedslash*Break Ligatures}

\begin{center}
  \begin{tabular}{@{}ll@{}}
    \hline
    \multicolumn{1}{@{}l|}{Macro}  &  Result  \\
    \hline
    n/a  &
    fine affirmation of baffling flavors  \\
    \code{\string\nolig*}  &
    f\nolig*ine af\nolig*f\nolig*irmation of baf\nolig*f\nolig*ling f\nolig*lavors  \\
    \code{\string\nolig}  &
    f\nolig{}ine af\nolig{}f\nolig{}irmation of baf\nolig{}f\nolig{}ling f\nolig{}lavors  \\
    \code{\string\nolig*[75]}  &  of\nolig*[75]f\nolig*[75]ice
  \end{tabular}
\end{center}

\noindent Line-break behavior

\begin{quote}
  \setlength{\overfullrule}{0pt}
  \parbox[t]{0pt}{%
    \code{\string\nolig*}  \\
     bi\nolig*{}jection}
  \hspace{60pt}
  \parbox[t]{0pt}{%
    \code{\string\nolig}  \\
    bi\nolig{}jection}
\end{quote}

\noindent Starred form eats spaces?  f\nolig*  i, f\nolig*[0]  i.

\section{Manual Italic Correction}

\paragraph{Text Mode.}

The italic correction of the current font is \the\fontdimen1\font/pt.

We demonstrate the effect of \code{\string\itcorr} with a pair of bookends:
uncorrected italics: \indicatewidth{\it X},
\TeX-corrected (\code{\string\/}): \indicatewidth{\it X\/},
and \code{\string\itcorr\{7\}}: \indicatewidth{\it X\itcorr{7}}.

Correction~0: \indicatewidth{\itcorr*{0}};
corr.~3: \indicatewidth{\itcorr{3}}, \indicatewidth{\itcorr*{3}} (starred);
corr.~\textminus6: \indicatewidth{\itcorr{-6}}.

\paragraph{Mathematical Mode.}

Uncorrected: \([f]\),
corrected: \([\itcorr{1} f\itcorr{1}]\)

Correction~0: \indicatewidth{\(\itcorr{0}\)};
corr.~3: \indicatewidth{\(\itcorr{3}\)};
corr.~\textminus6: \indicatewidth{\(\itcorr{-6}\)}.

\section{Apply Extra Kerning}

\subsection{Slash}

The slash with some extra space around it can be helpful for certain pairs,
as for example years or names.

\begin{center}
  \begin{tabular}{@{}ll@{}}
    \hline
    \multicolumn{1}{@{}l|}{Macro}  &  Result  \\
    \hline
    n/a  &  1991/1992,
    New~York/NY, Korringa/Kohn/Rostoker  \\
    \code{\string\kernedslash}  &
    1991\kernedslash1992, New~York\kernedslash{}NY, Korringa\kernedslash{}Kohn\kernedslash{}Rostoker  \\
  \end{tabular}
\end{center}

\noindent Line-break behavior

\begin{quote}
  \setlength{\overfullrule}{0pt}
  \parbox[t]{0pt}{%
    \code{\string\kernedslash*}  \\
    1991\kernedslash*1992,
    New~York\kernedslash*NY,
    Korringa\kernedslash*Kohn\kernedslash*Rostoker}
  \hspace{120pt}
  \parbox[t]{0pt}{%
    \code{\string\kernedslash}  \\
    1991\kernedslash{}1992,
    New~York\kernedslash{}NY,
    Korringa\kernedslash{}Kohn\kernedslash{}Rostoker}
\end{quote}

\begin{quote}
  \setlength{\overfullrule}{0pt}
  \parbox[t]{0pt}{%
    \code{\string\kernedslash*}\code{\string\nobreak}  \\
    1991\kernedslash*\nobreak{}1992,
    New~York\kernedslash*\nobreak{}NY,
    Korringa\kernedslash*Kohn\kernedslash*\nobreak{}Rostoker}
  \hspace{140pt}
  \parbox[t]{0pt}{%
    \code{\string\allowhyphenation\string\kernedslash}  \\
    1991\kernedslash{}1992,
    New~York\kernedslash{}NY,
    Korringa\allowhyphenation\kernedslash{}Kohn\kernedslash{}Rostoker}
\end{quote}

\noindent Starred form eats spaces?  p\kernedslash*  q.

\subsection{Hyphen}

Uncorrected

\begin{quote}
  \(K\)-vector space, \(g\)-factor, \(f\)-function
\end{quote}

\noindent Corrected

\begin{quote}
  \typogsetup{raisecapitalhyphen=.075em, raiseguillemets=.05em}
  \(K\)\leftkernedhyphen{-75}vector space,
  \(g\)\leftkernedhyphen{-25}factor,
  \(f\)\leftkernedhyphen{-100}function
  %% \(G\)\kernedhyphen[*]{50}{-50}Wirkung,
  %% \(G\)\leftkernedhyphen{50}äquivalent,
  %% \(K\)\kernedhyphen[*]{-50}{-50}Vektorraum,
  %% \(K\)\kernedhyphen{-50}{-25}bilinear,
  %% \propername{Young}\rightkernedhyphen{-50}Tableaux,
  %% \singlequotes{Bra}\kernedhyphen[50]{50}{-50}Vektor,
  %% \singlequotes{Ket}\kernedhyphen[50]{50}{-50}Vektor,
  %% halbzahlige~\(l\)\kernedhyphen{50}{-50}Werte.
\end{quote}

\noindent Line-break behavior

\begin{quote}
  \setlength{\overfullrule}{0pt}

  \parbox[t]{0pt}{hyphen~\mbox{`\code{-}'}  \\  self-energy}
  \hspace{80pt}
  \parbox[t]{0pt}{\code{\string\hyp}  \\  self\hyp{}energy}
  \hspace{60pt}
  \parbox[t]{0pt}{\code{\string\kernedhyphen*}  \\  self\kernedhyphen*{5}{-5}energy}
  \hspace{80pt}
  \parbox[t]{0pt}{\code{\string\kernedhyphen}  \\  self\kernedhyphen{5}{-5}energy}
\end{quote}

\noindent If a \code{\string\kernedhyphen} goes astray in a math environment,
it decays to an ordinary minus with appropriate kerning:
\(G \kernedhyphen{-30}{-50} V\)\!.

\section{Raise Selected Characters}

\subsection{Capital Hyphen}

\newlength{\exemplaryraisecapitalhyphen}
\setlength{\exemplaryraisecapitalhyphen}{.6667pt}
With the standard hyphen we get

\begin{quote}
  \begin{otherlanguage}{german}
    \acronym{NMR}-Spektroskopie,
    \acronym{SI}-Einheit,
    \(G\)-Modul, and
    \(K\)-Vektorraum,
  \end{otherlanguage}
\end{quote}

\noindent whereas with raising the hyphen by \the\exemplaryraisecapitalhyphen{}
when calling \code{\string\capitalhyphen}, we arrive at

\begin{quote}
  \begin{otherlanguage}{german}
    \typogsetup{raisecapitalhyphen=.075em}

    \acronym{NMR}\capitalhyphen{}Spektroskopie,
    \acronym{SI}\capitalhyphen{}Einheit,
    \(G\)\capitalhyphen{}Modul, and
    \(K\)\capitalhyphen{}Vektorraum
    (even better with \code{\string\kernedhyphen}
    and the star-option for the correct raise-amount:
    \(K\)\leftkernedhyphen[*]{-100}Vektorraum).
  \end{otherlanguage}
\end{quote}

\noindent Line-break behavior

\begin{quote}
  \setlength{\overfullrule}{0pt}
  \begin{otherlanguage}{german}
    \parbox[t]{0pt}{%
      \code{\string\capitalhyphen*}  \\
      \acronym{NMR}\capitalhyphen*{}Spektroskopie
    }
    \hspace{120pt}
    \parbox[t]{0pt}{%
      \code{\string\capitalhyphen}  \\
      \acronym{NMR}\capitalhyphen{}Spektroskopie
    }
  \end{otherlanguage}
\end{quote}

\noindent Starred form eats spaces?
{\typogsetup{raisecapitalhyphen=.075em}
  V\capitalhyphen*  W.}

\subsection{Capital Dash}

\newlength{\exemplaryraisecapitaldash}
\setlength{\exemplaryraisecapitaldash}{.075em}

Compare the result of plain~\code{\string\textendash}

\begin{quote}
  A\textendash M, N\textendash Z,  C1\,\textendash\,C4, LEED\:\textendash\:STM
\end{quote}

\noindent with \code{\string\capitaldash}:

\begin{quote}
  \typogsetup{raisecapitaldash=\exemplaryraisecapitaldash}

  A\capitaldash{}M, N\capitaldash{}Z,  C1\,\capitaldash\,C4, LEED\:\capitaldash\:STM
\end{quote}

\noindent where the en-dash has been raised by \milliem{\exemplaryraisecapitaldash}.

Starred form eats spaces?  V\capitaldash*  W.

\subsection{Number Dash}

\newlength{\exemplaryraisefiguredash}
\setlength{\exemplaryraisefiguredash}{.6667pt}
Compare the result of plain~\code{\string\textendash}

\begin{quote}
 3--5, 81--82, 485--491
\end{quote}

\noindent with \code{\string\figuredash}:

\begin{quote}
  \typogsetup{raisefiguredash=\exemplaryraisefiguredash}
  3\figuredash 5, 81\figuredash 82, 485\figuredash 491
\end{quote}

\noindent where the en-dash has been raised by \the\exemplaryraisefiguredash.

\noindent Line-break behavior

\begin{quote}
  \setlength{\overfullrule}{0pt}
  \typogsetup{raisefiguredash=\exemplaryraisefiguredash}
  \parbox[t]{0pt}{%
    \code{\string\figuredash*}  \\
    3\figuredash*5, 81\figuredash*82, 485\figuredash*491
  }
  \hspace{80pt}
  \parbox[t]{0pt}{%
    \code{\string\figuredash}  \\
    3\figuredash 5, 81\figuredash 82, 485\figuredash 491
  }
\end{quote}

\noindent Starred form eats spaces?  44\figuredash*  55.

\subsection{Multiplication Sign \capitaldash{} Times~``\texttimes''}

\newlength{\exemplaryraisetimes}
\setlength{\exemplaryraisetimes}{.6667pt}
The problem with a too-low multiplication sign arises
for example with matrices of a given, specific size.

\noindent Uncorrected

\begin{quote}
  \acronym{LR}-mode: 2\texttimes2-matrix, \(N\)\texttimes\(M\)-matrix  \\
  Math-mode: \(2\times2\)-matrix, \(N\times M\)-matrix
\end{quote}

\noindent and corrected

\begin{quote}
  \typogsetup{raisecapitalhyphen=\exemplaryraisecapitalhyphen,
               raisecapitaltimes=\exemplaryraisetimes}
  \acronym{LR}-mode: 2\capitaltimes2-matrix, \(N\)\capitaltimes\(M\)-matrix  \\
  Math-mode: \(2\capitaltimes2\)-matrix, \(N\capitaltimes M\)-matrix.
\end{quote}

\subsection{Guillemets}

\newcommand*{\tschicholdi}
            {Use single quotes for a first quotation.}
\newcommand*{\tschicholdii}
            {Use double quotes for quotations within quotations.}

\newcommand*{\frenchsinglequotes}[1]{\singleguillemetright #1\singleguillemetleft}
\newcommand*{\Frenchsinglequotes}[1]{\Singleguillemetright #1\Singleguillemetleft}
\newcommand*{\frenchdoublequotes}[1]{\doubleguillemetright #1\doubleguillemetleft}
\newcommand*{\Frenchdoublequotes}[1]{\Doubleguillemetright #1\Doubleguillemetleft}

\newcommand*{\frenchsinglequotesFR}[1]{\singleguillemetleft\,\allowhyphenation#1\,\singleguillemetright}
\newcommand*{\FrenchsinglequotesFR}[1]{\Singleguillemetleft\,\allowhyphenation#1\,\Singleguillemetright}
\newcommand*{\frenchdoublequotesFR}[1]{\doubleguillemetleft\,\allowhyphenation#1\,\doubleguillemetright}
\newcommand*{\FrenchdoublequotesFR}[1]{\Doubleguillemetleft\,\allowhyphenation#1\,\Doubleguillemetright}

\newlength{\exemplaryraiseguillemets}
\setlength{\exemplaryraiseguillemets}{.05em}
\newlength{\exemplaryraisecapitalguillemets}
\setlength{\exemplaryraisecapitalguillemets}{.1em}

We again compare the default implementation with the adjusted one.

\begin{quote}
  \frenchsinglequotes{\tschicholdi}  \\
  \frenchdoublequotes{\tschicholdii}  \\
  \Frenchsinglequotes{1}, \Frenchsinglequotes{2}, \Frenchsinglequotes{3}.  \\
  \Frenchdoublequotes{\letterspacecapitals{ABC}},
  \Frenchdoublequotes{\letterspacecapitals{MN}},
  \Frenchdoublequotes{\letterspacecapitals{XYZ}}.
\end{quote}

\noindent Corrected by raising the glyphs by
\milliem{\exemplaryraiseguillemets} and
\milliem{\exemplaryraisecapitalguillemets}, respectively:

\begin{quote}
  \typogsetup{raiseguillemets=\exemplaryraiseguillemets,
               raisecapitalguillemets=\exemplaryraisecapitalguillemets}
  \frenchsinglequotes{\tschicholdi}  \\
  \frenchdoublequotes{\tschicholdii}  \\
  \Frenchsinglequotes{1}, \Frenchsinglequotes{2}, \Frenchsinglequotes{3}.  \\
  \Frenchdoublequotes{\letterspacecapitals{ABC}},
  \Frenchdoublequotes{\letterspacecapitals{MN}},
  \Frenchdoublequotes{\letterspacecapitals{XYZ}}.
\end{quote}

\noindent And the same using French typographic conventions:

\begin{quote}
  \typogsetup{raiseguillemets=\exemplaryraiseguillemets,
               raisecapitalguillemets=\exemplaryraisecapitalguillemets}
  \frenchsinglequotesFR{\tschicholdi}  \\
  \frenchdoublequotesFR{\tschicholdii}  \\
  \FrenchsinglequotesFR{1}, \FrenchsinglequotesFR{2}, \FrenchsinglequotesFR{3}.  \\
  \FrenchdoublequotesFR{\letterspacecapitals{ABC}},
  \FrenchdoublequotesFR{\letterspacecapitals{MN}},
  \FrenchdoublequotesFR{\letterspacecapitals{XYZ}}.
\end{quote}

\noindent Line-break behavior

\begin{quote}
  \setlength{\overfullrule}{0pt}
  \typogsetup{raiseguillemets=\exemplaryraiseguillemets,
              raisecapitalguillemets=\exemplaryraisecapitalguillemets}

  \newcommand*{\samplestring}{relation}

  \parbox[t]{0pt}{\frenchsinglequotes{\samplestring}}
  \hspace{30pt}
  \parbox[t]{0pt}{\Frenchsinglequotes{\samplestring}}
  \hspace{30pt}
  \parbox[t]{0pt}{\frenchdoublequotes{\samplestring}}
  \hspace{30pt}
  \parbox[t]{0pt}{\Frenchdoublequotes{\samplestring}}

  \smallskip

  \parbox[t]{0pt}{\frenchsinglequotesFR{\samplestring}}
  \hspace{30pt}
  \parbox[t]{0pt}{\FrenchsinglequotesFR{\samplestring}}
  \hspace{30pt}
  \parbox[t]{0pt}{\frenchdoublequotesFR{\samplestring}}
  \hspace{30pt}
  \parbox[t]{0pt}{\FrenchdoublequotesFR{\samplestring}}
\end{quote}

\section{Label Items}

The current configurations for the uppercase and lowercase adjustments are
\{\typogget{uppercaselabelitemadjustments}\} and \{\typogget{lowercaselabelitemadjustments}\},
respectively.

\begin{center}
  \makeatletter
  \noindent
  A\raisebox{\typog@adjust@uppercase@labelitemi}{\labelitemi}%
  B\raisebox{\typog@adjust@uppercase@labelitemii}{\labelitemii}%
  E\raisebox{\typog@adjust@uppercase@labelitemiii}{\labelitemiii}%
  G\raisebox{\typog@adjust@uppercase@labelitemiv}{\labelitemiv}H  \\
  a\raisebox{\typog@adjust@lowercase@labelitemi}{\labelitemi}%
  b\raisebox{\typog@adjust@lowercase@labelitemii}{\labelitemii}%
  c\raisebox{\typog@adjust@lowercase@labelitemiii}{\labelitemiii}%
  e\raisebox{\typog@adjust@lowercase@labelitemiv}{\labelitemiv}g
  \makeatother
\end{center}

For the following nested lists we adjust levels one and three for uppercase and levels two and
four for lowercase.

\begingroup
  \uppercaseadjustlabelitems{1,3}
  \lowercaseadjustlabelitems{2,4}
  \setlength{\itemsep}{0pt}
  \setlength{\parsep}{0pt}
  \setlength{\topsep}{0pt}
  \begin{itemize}
  \item A
  \item B
  \item C
    \begin{itemize}
    \item d
    \item e
    \item f
      \begin{itemize}
      \item G
      \item H
      \item I
        \begin{itemize}
        \item j
        \item k
        \item l
        \end{itemize}
      \end{itemize}
    \end{itemize}
  \end{itemize}
\endgroup
\noadjustlabelitems{*}% not necessary, but we want to exercise the macro

The left example shows the result of \code{\string\typogadjuststairs\{.25pt\}\{11\}\{ABC\}} and
the one on the right hand side just uses the same parameters except for the sample~\sample{ace},
this is, only lowercase letters.

\begin{center}
  \begin{minipage}[t]{12em}
    \centering
    \typogadjuststairs{.25pt}{11}{ABC}
  \end{minipage}
  \begin{minipage}[t]{12em}
    \centering
    \typogadjuststairs{.25pt}{11}{ace}
  \end{minipage}
\end{center}

For this document the calls
\code{\string\typoguppercaseadjustcheck\{ABC\-DEF\-GHI\-JKL\-MNO\-PQR\-STU\-VWX\-YZ\}} and
\code{\string\typoglowercaseadjustcheck\{ace\-gmn\-opq\-rsu\-vwx\-yz\}} yield
\sample{\typoguppercaseadjustcheck{ABCDEFGHIJKLMNOPQRSTUVWXYZ}} and
\sample{\typoglowercaseadjustcheck{acegmnopqrsuvwxyz}}, where the adjustments in effect are
\code{\{\typogget{uppercaselabelitemadjustments}\}} and
\code{\{\typogget{lowercaselabelitemadjustments}\}}, respectively.

\clearpage
\section{Align Last Line}

\subsection{Last Line Ragged Left/Flush Right}

\Cref{ex:lastlineraggedleftpar} is a typical use of environment~\code{lastlineraggedleftpar}:
A narrow paragraph gets typeset with full justification
and put \code{\string\flushright} against the right margin as a whole.

The layout may look more coherent if the last lines is moved to the right margin, too.

\begin{exemplary}
  \flushright
  \caption[Justified -- flushright]
          {\begin{typoginspectpar}{justified-flushright}Typeset a justified paragraph flushright and let
           macro~\code{\string\lastlineraggedleft} shift the last line
           over to the right-hand side.\label{ex:lastlineraggedleftpar}\end{typoginspectpar}}

  \setlength{\examplewidth}{220pt}
  \exampleparbox[lastlineraggedleftpar]{\lastlineraggedleftpar\texbookparfillskipsample}

  \centering
  \texbookparfillskipsamplecredits

  \examplefontinformation
\end{exemplary}

\subsection{Last Line Centered}

The situation shown in \cref{ex:lastlinecenteredpar} is
more widespread than \cref{ex:lastlineraggedleftpar}
because centered tables and figures are quite common.
Their caption parboxes are centered too,
which is where a centered last line might fortify the layout.

Another possible use of environment~\code{lastlinecenteredpar} are the final lines of chapters~--
in particular if the chapters' ends are marked with centered dingbats.

\begin{exemplary}
  \centering
  \caption[Typeset a justified paragraph that is centered.]
          {\lastlinecenteredpar
           Typeset a justified paragraph that is centered.
           This very caption uses \code{lastlinecenteredpar}
           to have its last line centered as well.
           Moreover, we put a nifty asterisk centered at the bottom of the sample text.
           \label{ex:lastlinecenteredpar}}

  \setlength{\examplewidth}{220pt}
  \exampleparbox[lastlinecenteredpar]{\lastlinecenteredpar\texbookparfillskipsample}

  \medskip\(\ast\)

  \texbookparfillskipsamplecredits

  \examplefontinformation
\end{exemplary}

\clearpage
\section{Fill Last Line}

\newcommand*{\abcsample}{abcd efgh ijkl mnop qrst uvwx yz12 3456}

\begin{exemplary}
  \def\sness{2}
  \def\exparindent{25pt}
  \setlength{\examplewidth}{235pt}

  \centering
  \caption[Plain paragraph vs.~\code{covernextindentpar}]
          {Top example: Typeset a paragraph without correction of the last line.
            Middle example: Paragraph corrected with \code{covernextindentpar}.
            We set a \code{\string\parindent} of~\exparindent{} in both parboxes
            and we \emph{must} increase the amount of glue in the paragraph
            to reduce the penalty of stretching the last line under a \code{\string\fussy}~setting.
            For the samples below, we have chosen \code{\string\slightlysloppy[\sness]}.
            The \singlequotes{Alternative}, the bottom example,
            shows the effect of \code{tightspacing};
            no extra sloppyness is required there.}

  \exampleparbox[covernextindentpar-reference]{%
    \setlength{\parindent}{\exparindent}%
    \slightlysloppy[\sness]
    \texbookparfillskipsample{} \abcsample}

  \medskip

  \exampleparbox[covernextindentpar]{%
    \setlength{\parindent}{\exparindent}%
    \slightlysloppy[\sness]
    \covernextindentpar
    \texbookparfillskipsample{} \abcsample}

  \medskip

  Alternative\dots\hfill\smallskip

  \exampleparbox[covernextindentpar-tightspacing]{%
    \setlength{\parindent}{\exparindent}%
    \begin{tightspacing}
      \texbookparfillskipsample{} \abcsample
    \end{tightspacing}}

  \texbookparfillskipsamplecredits

  \examplefontinformation
\end{exemplary}

\begin{exemplary}
  \def\sness{2}
  \def\exparindent{0pt}
  \setlength{\examplewidth}{155pt}

  \centering
  \caption[Plain paragraph vs.~\code{covernextindentpar} (narrow)]
          {Same comparison as the previous example,
           but for a small linewidth and zippo~\code{\string\parindent}.
           The left-hand side sample is uncorrected,
           the right-hand side features \code{\string\covernextindentpar}.
           The sloppyness level is~\sness{} for both samples.}

  \exampleparbox[narrow-covernextindentpar-reference]{%
    \setlength{\parindent}{\exparindent}%
    \slightlysloppy[\sness]
    \texbookparfillskipsample{} \abcsample}
  \qquad
  \exampleparbox[narrow-covernextindentpar]{%
    \setlength{\parindent}{\exparindent}%
    \slightlysloppy[\sness]
    \covernextindentpar[30pt]
    \texbookparfillskipsample{} \abcsample}

  \texbookparfillskipsamplecredits

  \examplefontinformation
\end{exemplary}

\begin{exemplary}
  \def\exparindent{10pt}
  \setlength{\examplewidth}{233pt}

  \centering
  \caption[Prevent full last line]
          {Sample~1: Typeset a paragraph without correction of the last line.
            Sample~2: Paragraph corrected with \code{\string\openlastlinepar}.~-- Disappointing!
            Sample~3: Same using macro~\code{\string\prolongpar}.
            Sample~4: Alternative solution that simply increases the tracking by
            \generictextfraction{2}{1000}\,em with~\code{setfonttracking}.
            Sample~5: Alternative solution that increases the spacing with
            \code{loosespacing}.}

  \exampleparbox[openline-reference]{%
    \setlength{\parindent}{\exparindent}
    \texbookparfillskipsample{} \abcsample}

  \medskip

  \exampleparbox[openlastlinepar]{%
    \setlength{\parindent}{\exparindent}
    \openlastlinepar
    \texbookparfillskipsample{} \abcsample}

  \medskip

  \exampleparbox[prolongpar]{%
    \setlength{\parindent}{\exparindent}
    \prolongpar
    \texbookparfillskipsample{} \abcsample}

  \medskip

  Alternatives\dots\hfill\smallskip

  \exampleparbox[openline-tracking]{%
    \setlength{\parindent}{\exparindent}%
    \setfonttracking{2}
    \texbookparfillskipsample{} \abcsample}

  \medskip

  \exampleparbox[openline-spacing]{%
    \setlength{\parindent}{\exparindent}%
    \begin{loosespacing}
      \texbookparfillskipsample{} \abcsample
    \end{loosespacing}}

  \texbookparfillskipsamplecredits

  \examplefontinformation
\end{exemplary}

\clearpage
\section{Spacing}

\subsection{Narrow\kernedslash Wide Space}

The current font's parameters are shown in \cref{tab:fontdim}.\footnote{For a concise and
understandable explanation of the plethora of font parameters
consult \propername{David Carlisle's} excellent post on \propername{StackExchange}:
\href{https://tex.stackexchange.com/questions/88991/what-do-different-fontdimennum-mean}%
     {What Do Different Fontdimennum Mean}.}

\begin{table}[htp]
  \centering
  \caption{Important \code{\string\fontdimen} values of the current text font.
    The middle column~(\#) states the number of the fontdimen.\bottomstrut}
  \label{tab:fontdim}

  \begin{tabular}{@{}lll@{}}
    \hline
    \multicolumn{1}{@{}l|}{Name}  &  \multicolumn{1}{l|}{\#}  &  Value  \\
    \hline
    Interword space  &  2  &  \the\fontdimen2\font\topstrut  \\
    Interword stretch  &  3  &  \the\fontdimen3\font  \\
    Interword shrink  &  4  &  \the\fontdimen4\font  \\
    Extra space  &  7  &  \the\fontdimen7\font
  \end{tabular}
\end{table}

\begin{center}
  \setlength{\overfullrule}{0pt}
  \newcommand*{\spacesampletext}[1]{some#1text#1with#1spaces\rule{.1pt}{1em}}
  \newsavebox{\narrowspacesample}
  \sbox{\narrowspacesample}{\spacesampletext{\narrowspace}}
  \newsavebox{\widespacesample}
  \sbox{\widespacesample}{\spacesampletext{\widespace}}

  \begin{tabular}{@{}ll@{\qquad}l@{}}
    Compare  &  \spacesampletext{\space}  &  default space, natural glue \\
    with     &  \usebox{\narrowspacesample}  &  \code{\string\narrowspace}, natural glue  \\
    {}       &  \makebox[\wd\narrowspacesample][l]{\hbox to 0pt{\spacesampletext{\narrowspace}}}  &
    \code{\string\narrowspace}, tight box  \\
    {}       &  \makebox[\wd\narrowspacesample][l]{\hbox spread 5pt{\spacesampletext{\narrowspace}}}  &
    \code{\string\narrowspace}, spread 5pt  \\
    and again  &  \spacesampletext{\space}  &  default space, natural glue \\
    with     &  \usebox{\widespacesample}  &  \code{\string\widespace}, natural glue  \\
    {}       &  \makebox[\wd\widespacesample][l]{\hbox to 0pt{\spacesampletext{\widespace}}}  &
    \code{\string\widespace}, tight box  \\
    {}       &  \makebox[\wd\widespacesample][l]{\hbox spread 5pt{\spacesampletext{\widespace}}}  &
    \code{\string\widespace}, spread 5pt
  \end{tabular}
\end{center}

\noindent Starred form eats spaces?  Narrow\narrowspace*  Space.  Wide\widespace*  Space.

\subsection{Looser\kernedslash*Tighter}

\Cref{ex:spacing-i,ex:spacing-ii} show \code{tightspacing} and \code{loosespacing} at work.

\begin{exemplary}
  \newcommand*{\sness}{3}
  \newcommand*{\tlevel}{1}
  \centering

  \caption[Looser or tighter spacing -- sloppy]
          {Both parboxes are typeset with \code{\string\slightlysloppy[\sness]},
           the left one with default spacing,
           the right one with \code{tightspacing[\tlevel]}.\label{ex:spacing-i}}

  \exampleparbox[tightspacing-reference]{\slightlysloppy[\sness]\texbooktolerancesample}
  \qquad
  \exampleparbox[tightspacing]{\slightlysloppy[\sness]\tightspacing[\tlevel]\texbooktolerancesample}

  \texbooktolerancesamplecredits

  \examplefontinformation
\end{exemplary}

\begin{exemplary}
  \newcommand*{\sness}{3}
  \newcommand*{\llevel}{2}
  \centering

  \caption[Looser or tighter spacing -- sloppy]
          {Both parboxes are typeset with \code{\string\slightlysloppy[\sness]},
           the left one with default spacing,
           the right one with \code{loosespacing[\llevel]}.\label{ex:spacing-ii}}

  \exampleparbox[loosespacing-reference]{\slightlysloppy[\sness]\texbooktolerancesample}
  \qquad
  \exampleparbox[loosespacing]{\slightlysloppy[\sness]\loosespacing[\llevel]\texbooktolerancesample}

  \texbooktolerancesamplecredits

  \examplefontinformation
\end{exemplary}

\clearpage
\section{Microtype Front\capitalhyphen End}

\subsection{Tracking}

\newcommand*{\trackingsampletext}{%
  This sentence contains an explicit call to \code{\string\textls}
  with an optional argument of \((+200)\) to \textls[200]{DEMONSTRATE}
  that this macro still works inside of \code{setfonttracking}.
  Apart from that it is just some more text to exercise the macro.
  Well, the explicit letterspacing example is particularly ugly.}

\begin{exemplary}
  \renewcommand*{\examplepreset}{\microtypesetup{activate=true}}
  \def\extratracking{7}
  \centering

  \caption[Microtype: tracking]
          {Use \packagename{microtype} to change the font tracking.
           The sample on the left-hand side shows neutral tracking.
           The one on the right-hand side received an extra tracking of
           \generictextfraction{\extratracking}{1000}\,em.}

  \exampleparbox[microtype-tracking-reference]{%
    \fussy
    \noindent
    \trackingsampletext}
  \qquad
  \exampleparbox[microtype-tracking-stretch]{%
    \begin{setfonttracking}{\extratracking}
      \fussy
      \noindent
      \trackingsampletext
    \end{setfonttracking}}

  \examplefontinformation
\end{exemplary}

\newcommand*{\trackingsamplefontchangetext}{%
  {\rm RM} {\sf SF} {\rm RM} {\tt TT} {\rm RM};
  {\rm RM} {\it IT\/} {\rm RM};
  {\rm RM} {\sc SC} {\rm RM}.
  {\rm Rm} {\sf Sf} {\rm Rm} {\tt Tt} {\rm Rm};
  {\rm Rm} {\it It\/} {\rm Rm};
  {\rm Rm} {\sc Sc} {\rm Rm}.
  {\rm rm} {\sf sf} {\rm rm} {\tt tt} {\rm rm};
  {\rm rm} {\it it\/} {\rm rm};
  {\rm rm} {\sc sc} {\rm rm}.}

\begin{exemplary}
  \renewcommand*{\examplepreset}{\microtypesetup{activate=true}}
  \def\extratracking{1}
  \centering

  \caption[Microtype: tracking -- font changes]
          {Check how font changes (serif, serif~italics, small-caps, sans~serif, typewriter)
           interfere with the interword spacing.
           The left sample has no tracking changes applied and serves as a reference,
           whereas the right sample got an extra tracking of
           \generictextfraction{\extratracking}{1000}\,em.\visualpar
           The switch from and to typewriter, i.\,e., constant-width fonts
           commonly is a source of spacing problems.}

  \exampleparbox[microtype-tracking-font-changes-reference]{\trackingsamplefontchangetext}
  \qquad
  \exampleparbox[microtype-tracking-font-changes-stretch]{%
    \begin{setfonttracking}{\extratracking}
    \trackingsamplefontchangetext
    \end{setfonttracking}}
\end{exemplary}

\noindent
No contents: \leftmarker
\begin{setfonttracking}{0}
\end{setfonttracking}\rightmarker.

\subsection{Font Expansion}

\newcommand*{\expansionsample}
  {By default, all characters of a font are allowed to be stretched or
   shrunk by the same amount.  However, it is also possible to limit
   the expansion of certain characters if they are more sensitive to
   deformation.
   This is the purpose of the \code{\string\SetExpansion}~command.}

\begin{exemplary}
  \setlength{\examplewidth}{250pt}
  \renewcommand*{\examplepreset}{\microtypesetup{activate=true}}
  \renewcommand*{\examplesetup}{\frenchspacing\small\fussy}

  \centering

  \caption[Microtype: font expansion]
          {Use \packagename{microtype} to stretch or shrink a font.
           The top sample uses \code{\string\setfontshrink} at level~3,
           the middle sample is the unchanged reference
           (which is allowed to shrink and expand),
           and the bottom sample utilizes \code{\string\setfontstretch} at level~2.}

  \exampleparbox[microtype-expansion-shrink]{%
    \begin{setfontshrink}[3]
      \noindent\expansionsample
    \end{setfontshrink}}

  \medskip

  \exampleparbox[microtype-expansion-neutral]{%
    \begin{setfontexpand}[0]
      \noindent\expansionsample
    \end{setfontexpand}}

  \medskip

  \exampleparbox[microtype-expansion-stretch]{%
    \begin{setfontstretch}[2]
      \noindent\expansionsample
    \end{setfontstretch}}

  \examplefontinformation
\end{exemplary}

\noindent
No contents -- \code{setfontshrink}: \leftmarker
\begin{setfontshrink}
\end{setfontshrink}\rightmarker.

\noindent
No contents -- \code{setfontstretch}: \leftmarker
\begin{setfontstretch}
\end{setfontstretch}\rightmarker.

\noindent
No contents -- \code{setfontexpand}: \leftmarker
\begin{setfontexpand}
\end{setfontexpand}\rightmarker.

\noindent
No contents -- \code{nofontexpansion}: \leftmarker
\begin{nofontexpansion}
\end{nofontexpansion}\rightmarker.

\subsection{Character Protrusion}

\newcommand*{\zerodepthrule}
            {\raisebox{0pt}[0pt][0pt]{\rule[-4.5\baselineskip]{.1pt}{4.25\baselineskip}}}

\newcommand*{\protrusionsampletext}{%
  \noindent
  \zerodepthrule\hfill\zerodepthrule  \\
  1\hfill 1  \\
  .2\hfill 2. \\
  --3\hfill 3--  \\
  ---4\hfill 4---}

\begin{exemplary}
  \renewcommand*{\examplepreset}{\microtypesetup{activate=true}}
  \renewcommand*{\examplesetup}{\frenchspacing\small\fussy}

  \centering

  \caption[Microtype: protrusion]
          {Comparison of the \packagename{microtype} feature ``protrusion'' (left-hand side)
           and \code{nocharprotrusion} (right-hand side).}

  \exampleparbox[microtype-protrusion-reference]{%
    \microtypesetup{protrusion=true}
    \protrusionsampletext}
  \qquad
  \exampleparbox[microtype-protrusion-off]{%
    \microtypesetup{protrusion=true}
    \nocharprotrusion
    \protrusionsampletext}

  \medskip
\end{exemplary}

\noindent
No contents -- \code{nocharprotrusion}: \leftmarker
\begin{nocharprotrusion}
\end{nocharprotrusion}\rightmarker.

\clearpage
\section{Sloppy Paragraphs}

\Cref{ex:slightlysloppy-1,ex:slightlysloppy-2} put different amounts of ``sloppiness'' face to face.

\begin{exemplary}
  \setlength{\examplewidth}{180pt}
  \def\sness{1}
  \centering
  \caption[Paragraphs typeset slightly sloppy~1]
          {Paragraphs typeset slightly sloppy: \code{\string\slightlysloppy} vs.~\code{\string\fussy}.
           The left parbox is typeset with \code{\string\slightlysloppy}
           and \(\metavar{sloppiness} = \sness\), whereas the right sample
           features the well known \code{\string\fussy} setting.
           Both parboxes have a width of \the\examplewidth.\label{ex:slightlysloppy-1}}

  \exampleparbox[fussy-vs-slightlysloppy]{\slightlysloppy[\sness]\texbooktolerancesample}
  \qquad
  \exampleparbox[fussy-vs-slightlysloppy-reference]{\fussy\texbooktolerancesample}

  \texbooktolerancesamplecredits

  \examplefontinformation
\end{exemplary}

\begin{exemplary}
  \setlength{\examplewidth}{150pt}
  \def\sness{2}
  \centering
  \caption[Paragraphs typeset slightly sloppy~2]
          {Paragraphs typeset slightly sloppy: \code{\string\slightlysloppy} vs.~\code{\string\sloppy}.
           The left sample is features \code{\string\slightlysloppy} with \(\metavar{sloppiness} = \sness\),
           the right sample is typeset with \code{\string\sloppy}.
           Both parboxes have a width of \the\examplewidth.\label{ex:slightlysloppy-2}}

  \exampleparbox[sloppy-vs-slightlysloppy]{\slightlysloppy[\sness]\texbooktolerancesample}
  \qquad
  \exampleparbox[sloppy-vs-slightlysloppy-reference]{\sloppy\texbooktolerancesample}

  \texbooktolerancesamplecredits

  \examplefontinformation
\end{exemplary}

In conclusion all renderings of the text in
\cref{ex:slightlysloppy-1} and \cref{ex:slightlysloppy-2}
have their merits and their own flaws.

\clearpage
\section{Vertically Partially-Tied Paragraphs}

\paragraph{\code{vtietoppar}}\leavevmode\par

\begin{typoginspect}{vtietoppar}
  \clubpenalty=150
  \begin{vtietoppar}[2]
    After breaking a paragraph into lines, \TeX{} computes the interline
    penalties by adding the values of: \code{\string\clubpenalty} after
    the first line of a paragraph.\footnote{Footnote of \code{vtietoppar}.}
    \eTeX{} generalizes the concept of interline, club, widow, and display widow penalty
    by allowing their replacement by arrays of penalty values.
  \end{vtietoppar}
\end{typoginspect}

\paragraph{\code{vtiebotpar}}\leavevmode\par

\begin{typoginspect}{vtiebotpar}
  \widowpenalty=150
  \begin{vtiebotpar}[2]
    After breaking a paragraph into lines, \TeX{} computes the interline
    penalties by adding the values of: \code{\string\widowpenalty}
    before the last line of the paragraph.\marginpar{A float!}
    \eTeX{} generalizes the concept of interline, club, widow, and display widow penalty
    by allowing their replacement by arrays of penalty values.
  \end{vtiebotpar}
\end{typoginspect}

\paragraph{\code{vtiebotdisp}}\leavevmode\par

\begin{typoginspect}[tracingboxes]{vtiebotdisp}
  \displaywidowpenalty=150
  \begin{vtiebotdisp}[2]
    After breaking a paragraph into lines, \TeX{} computes the interline
    penalties by adding the values of: \code{\string\displaywidowpenalty}
    before the line immediately preceding a displayed equation.
    \eTeX{} generalizes the concept of interline, club, widow, and display widow penalty
    by allowing their replacement by arrays of penalty values.
    \[g H = H g \quad \text{for all} \enspace g \in G.\]
  \end{vtiebotdisp}

  Follow-up paragraph after and outside of the \code{vtiebotdisp}-environment.
\end{typoginspect}

\paragraph{\code{vtiebotdisptoppar}}\leavevmode\par

\begin{typoginspect}{vtiebotdisptoppar}
  \displaywidowpenalty=150
  \begin{vtiebotdisptoppar}[2]
    After breaking a paragraph into lines, \TeX{} computes the interline
    penalties by adding the values of: \code{\string\displaywidowpenalty}
    before the line immediately preceding a displayed equation.
    \eTeX{} generalizes the concept of interline, club, widow, and display widow penalty
    by allowing their replacement by arrays of penalty values.
    \begin{breakabledisplay}
      \begin{displaymath}
        g H = H g \quad \text{for all} \enspace g \in G.
      \end{displaymath}
    \end{breakabledisplay}

    In this example we need a paragraph that follows the displayed math.
    So, we have to type some more text here
    to be able to demonstrate the action of the environment.
  \end{vtiebotdisptoppar}
\end{typoginspect}

\clearpage
\section{Breakable Displayed Equations}

\newcommand*{\binaryminus}{\mathbin{-}}
\newcommand*{\diracadj}[1]{\overline{#1}}
\newcommand*{\unaryminus}{{-}}

\begin{typoginspect}{breakabledisplay}
  \begin{breakabledisplay}
    \begin{align*}
      \diracadj{\psi}(x) \mathop{\partial_\mu} \psi(x)
      \mapsto \diracadj{\psi'}(x) \mathop{\partial_\mu} \psi'(x)
      &=  e^{i \alpha(x)} \diracadj{\psi}(x) \mathop{\partial_\mu} \bigl( e^{\unaryminus i \alpha(x)} \psi(x) \bigr)  \\
      &=  \underbrace{\diracadj{\psi}(x) \mathop{\partial_\mu} \psi(x)}_{\text{free particle}}
      \mskip\medmuskip \binaryminus \mskip\medmuskip i \, \diracadj{\psi}(x)
      \underbrace{\mathop{\partial_\mu} \bigl( \alpha(x) \bigr)}_{\mathclap{\text{vector field}}} \psi(x).
    \end{align*}
  \end{breakabledisplay}
\end{typoginspect}

\clearpage
\section{\packagename{Setspace} Front-End}

\fontsizeinfo{defaultsize}
Current settings are \defaultsize{}
and \code{\string\typogfontsize} is \the\typogfontsize.

\newcommand*{\absbls}{12pt plus 1pt minus .5pt}
\paragraph{\code{\string\setbaselineskip\{\absbls\}}}
\resetbaselineskip
\setbaselineskip{10pt + 2.75pt}% addition
\setbaselineskip{10.5pt * 100 / 105}% scaling
\setbaselineskip{11.8pt * 85 / 100}% scaling
\setbaselineskip{\absbls}
\fontsizeinfo{baselinesetsize}
New settings: \baselinesetsize.

\texbookbaselineskipsample

\newcommand*{\relbls}{130}
\paragraph{\code{\string\setbaselineskippercentage\{\relbls\}}}
\setbaselineskippercentage{1 + 2 + .3333 * 100 + 100 * .6667}% float expression
\setbaselineskippercentage{\relbls}
\fontsizeinfo{baselinesetsize}
New settings: \baselinesetsize.

\texbookbaselineskipsample

\newcommand*{\absled}{1.5pt}
\paragraph{\code{\string\setleading\{\absled\}}}
\setleading{1pt / -2.0}% negative leading
\setleading{\absled}
\fontsizeinfo{baselinesetsize}
New settings: \baselinesetsize.

\texbookbaselineskipsample

\newcommand*{\relled}{30}
\paragraph{\code{\string\setleadingpercentage\{\relled\}}}
\setleadingpercentage{10 - 25 / 2}% negative leading
\setleadingpercentage{\relled}
\fontsizeinfo{baselinesetsize}
New settings: \baselinesetsize.

\texbookbaselineskipsample

\medskip

\setstretch{1}
\texbookbaselineskipsamplecredits

\clearpage
\section{Smooth Ragged}

\begin{exemplary}
  \newcommand*{\ragwidth}{10pt}
  \centering
  \caption[Comparison of ragged right typesetting]
          {Comparison of ragged right typesetting.
           The first example uses \code{RaggedRight} of \packagename{ragged2e}
           the second \code{smoothraggedrightpar} of \packagename{typog}.
           Both examples share a \code{\string\fussy}~setting and
           a \ragwidth~wide ragged right margin.\label{ex:smoothraggedright}}

  \setlength{\RaggedRightRightskip}{0pt plus \ragwidth}

  %\def\smoothraggedrightgenerator{quintuplet}
  %\def\smoothraggedrightgenerator{septuplet}
  \setlength{\smoothraggedrightragwidth}{\ragwidth}
  %\def\smoothraggedrightfuzzfactor{.667}

  \iffalse
    \begin{quote}
      \begin{RaggedRight}\examplesetup
        \texbookparshapeskipsample
      \end{RaggedRight}
    \end{quote}

    \begin{quote}
      \begin{smoothraggedrightpar}\examplesetup
        \texbookparshapeskipsample
      \end{smoothraggedrightpar}
    \end{quote}
  \else
    \exampleparbox[RaggedRight-reference]{\RaggedRight\texbooktolerancesample}
    \qquad
    \exampleparbox[smoothraggedrightpar]{\smoothraggedrightpar\texbooktolerancesample}
  \fi

  \texbookparshapeskipsamplecredits

  \examplefontinformation
\end{exemplary}

  %--\setlength{\smoothraggedrightparindent}{25pt}
  %--\setlength{\parindent}{0pt}

\noindent
\code{\string\parindent}=\the\parindent,
visually: \rule{.1pt}{.8em}\kern\parindent\rule{.1pt}{.8em};

\noindent
\code{\string\smoothraggedrightleftskip}=\the\smoothraggedrightleftskip.
\code{\string\smoothraggedrightparindent}=\the\smoothraggedrightparindent.
\smallskip

{
  %--\setlength{\smoothraggedrightragwidth}{8pt}
  \begin{smoothraggedright}
    \texbooktolerancesample

    \texbooktolerancesample
  \end{smoothraggedright}
}

\medskip

{
  \setlength{\smoothraggedrightragwidth}{15pt}

  \newcommand*{\definitionnilpotent}{%
    Eine Abbildung oder ein Operator~\(A\)
    heißen nilpotent vom Grad~\(k\), falls \(k \in N\)
    die kleinste Zahl ist, für die gilt: \(A^k = 0\).}

  \begin{otherlanguage}{german}
    \parbox[t]{60pt}{\fussy\RaggedRight\definitionnilpotent}
    \hspace{40pt}
    \parbox[t]{60pt}{\fussy\smoothraggedright\definitionnilpotent}
  \end{otherlanguage}
}

\clearpage
\begin{RaggedRight}
  \begin{thebibliography}{0}
  \bibitem{knuth:1986}
          \bibauthor{Knuth, D.~E.},
          \bibtitle{The \TeX{}book},
          Vol.~A of Computers\&Typesetting,
          Addison Wesley, Reading\kernedslash*MA,
          1986.
  \end{thebibliography}
\end{RaggedRight}
\end{document}
\endinput
%%
%% End of file `typog-example.tex'.
