diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/typog/typog.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/typog/typog.dtx | 3217 |
1 files changed, 2567 insertions, 650 deletions
diff --git a/Master/texmf-dist/source/latex/typog/typog.dtx b/Master/texmf-dist/source/latex/typog/typog.dtx index 0f2176206a2..3037f502fad 100644 --- a/Master/texmf-dist/source/latex/typog/typog.dtx +++ b/Master/texmf-dist/source/latex/typog/typog.dtx @@ -3,11 +3,11 @@ % 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.3 of this +% 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 -% http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of LaTeX +% 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. % % \fi @@ -26,7 +26,6 @@ \PassOptionsToClass{a4paper}{article} \PassOptionsToPackage{hyperfootnotes=false}{hyperref} -\PassOptionsToPackage{charter, scale=1.06}{newtxmath} \PassOptionsToPackage{dvipsnames}{xcolor} \usepackage{amsmath} @@ -42,40 +41,43 @@ \usepackage{fullwidth} \usepackage{hypdoc} \usepackage{hyphenat} -\usepackage[shrink=10, stretch=10]{microtype} +\usepackage[kerning=true, shrink=10, stretch=10, verbose=true]{microtype} \usepackage{multirow} \usepackage{needspace} -\usepackage{placeins} +\usepackage[section]{placeins} \usepackage{ragged2e} \usepackage{setspace} \usepackage{sidecap} \usepackage{tabularx} \usepackage{tcolorbox} \usepackage{titlesec}\renewcommand*{\bottomtitlespace}{.15\textheight}%nobottomtitles* -\usepackage[debug, raise*=.05em]{typog} +\usepackage[debug, raise*=.05em, + uppercaselabelitemadjustments={.0125em, .075em, -.1em, .0125em}, + lowercaselabelitemadjustments={-.075em, 0pt, -.2em, -.075em}]{typog} \usepackage{xcolor} \usepackage[default, lining, proportional, regular, semibold]{sourceserifpro} \usepackage[lining, proportional, regular, semibold]{sourcesanspro} \usepackage[lining, regular]{sourcecodepro} -\usepackage[xcharter]{newtxmath} +\usepackage[scaled=1.08, uprightscript, xcharter]{newtxmath} \setbaselineskip{12.5pt} + \makeatletter \def\@get@fontclan#1-#2\relax{#1} \newcommand*{\fontclan}{\expandafter\@get@fontclan\f@family\relax} \makeatother -\newcommand*{\proportionalliningfigures}{\fontfamily{\fontclan-LF}\selectfont} -\newcommand*{\proportionaloldstylefigures}{\fontfamily{\fontclan-OsF}\selectfont} -\newcommand*{\tabularliningfigures}{\fontfamily{\fontclan-TLF}\selectfont} -\newcommand*{\tabularoldstylefigures}{\fontfamily{\fontclan-TOsF}\selectfont} +\DeclareRobustCommand{\proportionalliningfigures}{\fontfamily{\fontclan-LF}\selectfont} +\DeclareRobustCommand{\proportionaloldstylefigures}{\fontfamily{\fontclan-OsF}\selectfont} +\DeclareRobustCommand{\tabularliningfigures}{\fontfamily{\fontclan-TLF}\selectfont} +\DeclareRobustCommand{\tabularoldstylefigures}{\fontfamily{\fontclan-TOsF}\selectfont} -\newcommand*{\textdenominator}[1]{{\fontfamily{\fontclan-Dnom}\selectfont #1}} -\newcommand*{\textinferior}[1]{{\fontfamily{\fontclan-Inf}\selectfont #1}} -\newcommand*{\textnumerator}[1]{{\fontfamily{\fontclan-Numr}\selectfont #1}} -\newcommand*{\textsuperior}[1]{{\fontfamily{\fontclan-Sup}\selectfont #1}} +\DeclareRobustCommand{\textdenominator}[1]{{\fontfamily{\fontclan-Dnom}\selectfont #1}} +\DeclareRobustCommand{\textinferior}[1]{{\fontfamily{\fontclan-Inf}\selectfont #1}} +\DeclareRobustCommand{\textnumerator}[1]{{\fontfamily{\fontclan-Numr}\selectfont #1}} +\DeclareRobustCommand{\textsuperior}[1]{{\fontfamily{\fontclan-Sup}\selectfont #1}} \newcommand*{\nativetextfraction}[2] {\mbox{\textnumerator{#1}\textfractionsolidus\textdenominator{#2}}} @@ -85,21 +87,23 @@ \newenvironment*{tabfigures} {\edef\rmdefault{\fontclan-T\sourceserifpro@figurestyle}\rm\ignorespaces} {\ignorespacesafterend} - -\newcommand*{\elseries}{\def\mdseries@rm{el}\def\mdseries@sf{el}\def\mdseries@tt{el}} -\newcommand*{\textel}[1]{{\elseries\textmd{#1}}} -\newcommand*{\lseries}{\def\mdseries@rm{l}\def\mdseries@sf{l}\def\mdseries@tt{l}} -\newcommand*{\textl}[1]{{\lseries\textmd{#1}}} -%%--\newcommand*{\mdseries}{\def\mdseries@rm{m}\def\mdseries@sf{m}\def\mdseries@tt{m}} -%%--\newcommand*{\textmd}[1]{{\mdseries\textmd{#1}}} -\newcommand*{\sbseries}{\def\bfseries@rm{sb}\def\bfseries@sf{sb}\def\bfseries@tt{sb}} -\newcommand*{\textsb}[1]{{\sbseries\textbf{#1}}} -\newcommand*{\bseries}{\def\bfseries@rm{b}\def\bfseries@sf{b}\def\bfseries@tt{b}} -\newcommand*{\textb}[1]{{\bseries\textbf{#1}}} -\newcommand*{\ebseries}{\def\bfseries@rm{k}\def\bfseries@sf{eb}\def\bfseries@tt{k}} -\newcommand*{\texteb}[1]{{\ebseries\textbf{#1}}} \makeatother +\DeclareRobustCommand{\elseries}{\fontseries{el}\selectfont} +\DeclareTextFontCommand{\textel}{\elseries} +\DeclareRobustCommand{\lseries}{\fontseries{l}\selectfont} +\DeclareTextFontCommand{\textl}{\lseries} +%%--\DeclareRobustCommand{\mdseries}{\fontseries{m}\selectfont} +%%--\DeclareTextFontCommand{\textmd}{\mdseries} +\DeclareRobustCommand{\sbseries}{\fontseries{sb}\selectfont} +\DeclareTextFontCommand{\textsb}{\sbseries} +\DeclareRobustCommand{\bseries}{\fontseries{b}\selectfont} +\DeclareTextFontCommand{\textb}{\bseries} +\DeclareRobustCommand{\ebseries}{\fontseries{eb}\selectfont} +\DeclareTextFontCommand{\texteb}{\ebseries} +\DeclareRobustCommand{\ubseries}{\fontseries{k}\selectfont} +\DeclareTextFontCommand{\textub}{\ubseries} + \usepackage{cleveref} @@ -112,7 +116,7 @@ citecolor = blue, colorlinks = true, linkcolor = blue, - linktocpage = false, + linktocpage = true, pdfauthor={Dr. Christoph L. Spiel}, pdfcreationdate={\pdffiledate}, pdfkeywords={LaTeX, typography, ligature, italic-correction, paragraph justification, baselineskip, sloppy, ragged}, @@ -124,9 +128,94 @@ } +\SetExtraKerning[context=drop-left-sidebearing, name=source-code-normal, unit=space] + {font={T1/SourceCodePro-LF/m/n/44, T1/SourceCodePro-TLF/m/n/44}} + { + 1={-150,}, + 2={-120,}, + 3={-120,}, + 4={-40,}, + A={-100,}, + B={-170,} + } + +\newlength{\sectiontocindent} +\newlength{\sectionnumberwidth} +\newlength{\subsectiontocindent} +\newlength{\subsectionnumberwidth} +\newlength{\subsubsectiontocindent} +\newlength{\subsubsectionnumberwidth} + +\setlength{\sectiontocindent}{0pt} +\setlength{\sectionnumberwidth}{40pt} +\setlength{\subsectiontocindent}{40pt} +\setlength{\subsectionnumberwidth}{25pt} +\setlength{\subsubsectiontocindent}{65pt} +\setlength{\subsubsectionnumberwidth}{30pt} + \makeatletter -\renewcommand*{\@dotsep}{10000} % suppress leaders -\patchcmd{\@dottedtocline}{\normalfont}{\bfseries}{\relax}{\PatchingFailed} +\renewcommand*{\l@section}[2] + {\ifnum \c@tocdepth >\z@ + \addpenalty\@secpenalty + \addvspace{1.0em \@plus\p@}% + \setlength{\@tempdima}{\sectionnumberwidth}% + \begingroup + \def\numberline##1{\hb@xt@\@tempdima{% + \tt\lseries + \fontsize{44}{0}\selectfont + \microtypecontext{kerning=drop-left-sidebearing}% + \iffalse\raisebox{-30pt}[0pt][0pt]{\rule{0.1pt}{40pt}}\fi + \textcolor{customred3}{##1}% + \hfil}}% + \parindent \z@ + \rightskip \@pnumwidth + \parfillskip -\@pnumwidth + \leavevmode + \advance\leftskip\@tempdima + \hskip -\leftskip + \bfseries + \iffalse + \nobreak\hfil + \nobreak\hb@xt@\@pnumwidth{\hss #2\kern-\p@\kern\p@}% + \else + {\sffamily\large #1}\quad + {#2}\hfil\hbox{} + \fi + \par + \endgroup + \fi} + +\renewcommand*{\@dottedtocline}[5] + {\ifnum #1>\c@tocdepth + \else + \vskip \z@ \@plus.2\p@ + \begingroup + \leftskip #2\relax + \rightskip \@tocrmarg + \parfillskip -\rightskip + \parindent #2\relax\@afterindenttrue + \interlinepenalty\@M + \leavevmode + \@tempdima #3\relax + \advance\leftskip \@tempdima + \null\nobreak + \hskip -\leftskip + {#4}\nobreak + \iffalse + \leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill + \nobreak\hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5\kern-\p@\kern\p@}% + \else + \hbox{\quad\normalfont\bfseries #5}\nobreak\hfill\hbox{}% + \fi + \par + \endgroup + \fi} + +\renewcommand*{\l@subsection}{\@dottedtocline{2}{\subsectiontocindent}{\subsectionnumberwidth}} +\renewcommand*{\l@subsubsection}{\@dottedtocline{3}{\subsubsectiontocindent}{\subsubsectionnumberwidth}} +\newrobustcmd*{\tocsquashedsubsections} + {\def\l@subsection{\@dottedtocline{2}{0pt}{\subsectionnumberwidth}}% + \def\l@subsubsection{\@dottedtocline{3}{0pt}{\subsubsectionnumberwidth}}} \makeatother @@ -171,7 +260,6 @@ leftmargin=! } - \SetEnumitemKey{nestedinspecialsection}{ leftmargin=10pt } @@ -191,13 +279,15 @@ \fancypagestyle{pagenumberonly}{ + \fancyhf{} \fancyhead[L]{} \fancyhead[R]{\thepage} } -\pagestyle{fancy} -\fancyhf{} -\fancyhead[L]{\rightmark} -\fancyhead[R]{\thepage} +\fancypagestyle{fancy}{ + \fancyhf{} + \fancyhead[L]{\rightmark} + \fancyhead[R]{\thepage} +} \newcommand*{\resetfancyhead} {\fancyhead[L]{\textsf{\textsc{\textls[20]{\nouppercase\rightmark}}}}} @@ -239,8 +329,8 @@ \setlength{\skip\footins}{25pt} -\setlength{\overfullrule}{3pt} -\renewcommand*{\sidecaptionsep}{16pt} +\setlength{\overfullrule}{0pt} +\renewcommand*{\sidecaptionsep}{25pt} @@ -272,13 +362,17 @@ \newcommand*{\citenum}[1]{\@nameuse{b@#1}} \makeatother -\def\code#1{\texttt{#1}} +\renewcommand*{\code}[1]{\texttt{#1}} + +\newcommand*{\codelineindicator}{\mbox{\small$\mathscr{l}$}} \newrobustcmd*{\command}[1]{\mbox{\textbf{#1}}} +\newcommand*{\detoxindex}[1]{\index{\detokenize{#1}}} + \newcommand*{\doublequotes}[1]{\doubleguillemetright\kern-.03333em #1\doubleguillemetleft} -\newcommand*{\dumpmacro}[1]{\texttt{\detokenize\expandafter{#1}}} +\newcommand*{\dumpmacro}[1]{\texttt{\detokenize\expandafter{#1}\unskip}} \newcommand*{\filesystem}[1]{\mbox{\textit{#1\/}}} @@ -287,6 +381,12 @@ \newcommand*{\foreignphrase}[1]{\textsl{#1}} +\makeatletter +\newcommand*{\formatdimen}{\@ifstar{\@typog@rem@pt}{\@typog@strip@pt}} +\newcommand*{\@typog@rem@pt}[1]{\dimen0=\dimexpr#1\relax\strip@pt\dimen0\,pt} +\newcommand*{\@typog@strip@pt}[1]{\expandafter\strip@pt#1\relax\,pt} +\makeatother + \newcommand*{\formatskip}[3]{#1\genfrac{}{}{0pt}{}{{+}#2}{{-}#3}} \makeatletter @@ -294,19 +394,46 @@ \renewcommand*{\fps@table}{htbp} \makeatother +\apptocmd{\GlossaryParms} + {\RaggedRight\normalsize} + {\relax} + {\AppendingFailed} + +\let\oldhdpindex=\hdpindex +\renewcommand*{\hdpindex}[2]{\textbf{\oldhdpindex{#1}{#2}}} + +\let\oldhdclindex=\hdclindex +\renewcommand*{\hdclindex}[2] + {\ifstrequal{#2}{code} + {\oldhdclindex{#1}{codeidx}} + {\oldhdclindex{#1}{#2}}} + \newcommand*{\hollowrectangle}[2] {\setlength{\fboxrule}{.5pt}% \setlength{\fboxsep}{0pt}% \framebox{\rule{#1}{0pt}\rule{0pt}{#2}}} \newcommand*{\hollowsquare}[1]{\hollowrectangle{#1}{#1}} +\apptocmd{\IndexParms} + {\RaggedRight\small} + {\relax} + {\AppendingFailed} \makeatletter +\ExplSyntaxOn \apptocmd{\index@prologue} - {\marginnote{In the Index page ranges are stuck together with - \hyperref[syn:figuredash]{\cs{figuredash*}}.}} + {\legacy_if:nTF {codeline@index} + {We\space prefix\space all\space references\space + to\space code\space lines\space with~\singlequotes{\codelineindicator}.} + {}} {\relax} {\AppendingFailed} + +\newcommand*{\linenumberdecoration} + {\legacy_if:nTF {codeline@index} + {\codelineindicator} + {}} +\ExplSyntaxOff \makeatother \newcommand*{\logmacro}[1] @@ -348,11 +475,27 @@ \AtBeginDocument{\setlength{\emreference}{\fontdimen6\font}} \newrobustcmd*{\milliem}[1] {\ifdim #1=0pt - #1% + 0\,pt% \else \nativetextfraction{\the\numexpr\dimexpr (#1) * 1000 / \emreference}{1000}\:em% \fi} +\let\originalmulticols=\multicols +\let\endoriginalmulticols=\endmulticols +\RenewDocumentEnvironment{multicols}{m o o} + {\ifnum #1=1 + \IfNoValueTF{#2}{\relax}{#2}% + \else + \IfNoValueTF{#2} + {\originalmulticols{#1}} + {\originalmulticols{#1}[#2]}% + \fi} + {\ifnum #1=1 + \relax + \else + \endoriginalmulticols + \fi} + \newcommand*{\needtocspace}[1][3] {\addtocontents{toc}{\protect\needspace{#1\baselineskip}}} @@ -455,7 +598,7 @@ \newenvironment*{specialcodesection}[1] {\Needspace{4\baselineskip}% \begin{tcolorbox}[colback=white, colframe=\markercolor, - bottomrule=0pt, leftrule=5pt, rightrule=0pt, toprule=0pt] + bottomrule=.5pt, leftrule=5pt, rightrule=.5pt, toprule=.5pt] \sf\typogsetupsf \begin{list} {\specialcodesectionheading{#1}} @@ -498,11 +641,37 @@ \begin{minipage}{\floatcaptionwidth}} {\end{minipage}} \newcommand*{\tablenotemark}[1]{\smash{\textsuperscript{#1}}} +\newcommand*{\tablenotesymbol}[1]{% Bringhurst's "traditional order" (p69) from 1 to 6 + \ifcase#1\relax + #1% 0 + \or \textasteriskcentered% 1 + \or \textdagger% 2 + \or \textdaggerdbl% 3 + \or \textsection% 4 + \or \textbardbl% 5 + \or \textsection% 6 + \or \textasteriskcentered\textasteriskcentered%7 + \or \textdagger\textdagger%8 + \or \textdaggerdbl\textdaggerdbl%9 + \else + #1 + \fi +} \newcommand*{\termparbox}[1]{\parbox[t]{\linewidth}{#1\bottomstrut}} \newcommand*{\thousandsseparator}{\mbox{,}} +\ExplSyntaxOn +\newcommand*{\titlecase}[1]{\text_titlecase:n {#1}} +\ExplSyntaxOff + +\newcommand*{\toccontinuesonnextpage} + {\addtocontents{toc}{\par + \bigskip + \hfill\textit{Table of Contents continued on next page.}\par + \protect\clearpage}} + \newcommand*{\topstrut}{\rule{0pt}{1.3em}} \newcommand*{\typogsetuprm} @@ -514,11 +683,16 @@ {\typogsetup{raise*=.06667em, raiseguillemets=.05em}} +\newcommand*{\unmarkedfntext}[1] + {{\def\thefootnote{}\footnote{#1}% + \addtocounter{footnote}{-1}}} + +\newcommand*{\userman}[1]{\textbf{\hyperpage{#1}}}%%-- https://github.com/ho-tex/hypdoc/issues/11 + \newcommand*{\visualpar}{\textcolor{\markercolor}{\P}\linebreak[1]\enspace} \newenvironment*{whittyquote} {\begin{flushright} - \renewcommand*{\propername}[1]{\mbox{##1}}% \sf\typogsetupsf} {\end{flushright}} @@ -532,7 +706,6 @@ \end{minipage} \end{maxipage}} - \NewDocElement[macrolike = true, idxtype = dim., idxgroup = dimensions, @@ -547,6 +720,20 @@ {EnumItemKey}{enumitemkey} \pretocmd{\DescribeEnumItemKey}{\needspace{25pt}}{\relax}{\PrependingFailed} +\NewDocElement[macrolike = true, + idxtype = skip, + idxgroup = \LaTeX{} length (skip), + printtype = \textit{skip}] + {LaTeXSkip}{lskip} +\pretocmd{\DescribeLaTeXSkip}{\needspace{25pt}}{\relax}{\PrependingFailed} + +\NewDocElement[macrolike = true, + idxtype = counter, + idxgroup = \protect\TeX{} counters, + printtype = \textit{counter}] + {TeXCounter}{tcounter} +\pretocmd{\DescribeTeXCounter}{\needspace{25pt}}{\relax}{\PrependingFailed} + \hyphenation{% https://hyphenateit.com/en-us Double-guillemet-left @@ -585,6 +772,8 @@ line-width loose-ness loose-spacing + lower-case-adjust-label-items + lower-case-label-item-adjustments make-at-letter make-at-other mar-gin-al @@ -612,6 +801,7 @@ set-leading set-leading-percentage short-inter-text + shrink-limits single-guillemet-left single-guillemet-right single-quotes @@ -625,6 +815,7 @@ smooth-ragged-right-shape-septuplet smooth-ragged-right-shape-triplet space-skip + stretch-limits text-italics-correction tight-spacing tracing-boxes @@ -632,6 +823,8 @@ tracking-tt-spacing typog-get typog-setup + upper-case-adjust-label-items + upper-case-label-item-adjustments vtie-bot vtie-bot-disp vtie-bot-disp-par @@ -648,29 +841,52 @@ \begin{document} \typogsetuprm + \uppercaseadjustlabelitems{*} \DocInput{typog.dtx} \end{document} %</driver> %<*index-style> actual '=' +delim_0 "\\nobreak\\enspace" +delim_1 "\\nobreak\\enspace" +delim_2 "\\nobreak\\enspace" delim_r "\\figuredash*" heading_prefix "\\pagebreak[3]\\smallskip\n\n{\\sffamily\\bfseries\\large " heading_suffix "}\\nopagebreak\n" headings_flag 1 level '>' +line_max 65536 quote '!' %</index-style> +%<*changes-style> +actual '=' +delim_0 "\\nobreak\\enspace" +delim_1 "\\nobreak\\enspace" +delim_2 "\\nobreak\\enspace" +heading_prefix "\\pagebreak[3]\\smallskip\n\n{\\sffamily\\bfseries\\large " +heading_suffix "}\\nopagebreak\n" +headings_flag 0 +item_x1 "\\efill\n\\subitem " +item_x2 "\\ " +keyword "\\glossaryentry" +level '>' +line_max 65536 +postamble "\n\\end{theglossary}\n" +preamble "\\begin{theglossary}\n \\makeatletter\\scan@allowedfalse" +quote '!' +%</changes-style> % \fi % % % \DoNotIndex{\,} -% \DoNotIndex{\addtolength,\advance,\aftergroup,\allowdisplaybreaks,\arabic} -% \DoNotIndex{\AtBeginDocument,\autotransfer} -% \DoNotIndex{\baselineskip} -% \DoNotIndex{\c,\char,\clubpenalties,\clubpenalty,\count,\cs,\csname} +% \DoNotIndex{\\} +% \DoNotIndex{\addtocounter,\addtolength,\advance,\aftergroup,\allowdisplaybreaks,\arabic,\arraystretch} +% \DoNotIndex{\AfterEndPreamble,\AfterPreamble,\AtBeginDocument,\autotransfer} +% \DoNotIndex{\baselineskip,\begin,\begingroup,\booltrue,\box} +% \DoNotIndex{\c,\char,\clist,\clubpenalties,\clubpenalty,\count,\cs,\csname} % \DoNotIndex{\DeclareRobustCommand,\def,\define@choicekey,\define@key,\detokenize} % \DoNotIndex{\dim,\dimen,\dimexpr,\discretionary,\displaywidowpenalties,\displaywidowpenalty} -% \DoNotIndex{\edef,\else,\emergencystretch,\empty,\endcsname} +% \DoNotIndex{\edef,\else,\emergencystretch,\empty,\end,\endcsname,\endgroup} % \DoNotIndex{\endlastlineflushrightpar} % \DoNotIndex{\endlastlineraggedleftpar} % \DoNotIndex{\endnofontexpand,\endnofontexpansion} @@ -679,33 +895,37 @@ quote '!' % \DoNotIndex{\endsmoothraggedrightshapetriplet} % \DoNotIndex{\endtypoginspect} % \DoNotIndex{\exhyphenpenalty,\expandafter,\ExplSyntaxOff,\ExplSyntaxOn} -% \DoNotIndex{\fi,\finalhyphendemerits,\font,\fontdimen,\fp,\fussy,\futurelet} +% \DoNotIndex{\fi,\finalhyphendemerits,\font,\fontdimen,\forcsvlist,\fp,\fpeval,\fussy,\futurelet} % \DoNotIndex{\gdef,\global,\glueexpr,\@gobble} % \DoNotIndex{\guillemotleft,\guillemotright,\guilsinglleft,\guilsinglright} -% \DoNotIndex{\hbadness,\hfuzz,\hskip,\hspace} +% \DoNotIndex{\hbadness,\hbox,\hfuzz,\hskip,\hspace,\ht} % \DoNotIndex{\ignorespaces,\ignorespacesafterend} -% \DoNotIndex{\if,\IfBooleanT,\IfBooleanTF,\ifcase,\ifdefined,\ifdim,\iffalse,\ifmmode,\ifMT@expansion} -% \DoNotIndex{\@ifnextchar,\IfNoValueF,\IfNoValueTF,\ifnum} +% \DoNotIndex{\if,\ifblank,\ifbool,\IfBooleanT,\IfBooleanTF,\ifcase,\ifdefined,\ifdim,\iffalse,\ifmmode} +% \DoNotIndex{\ifMT@expansion,\@ifnextchar,\IfNoValueF,\IfNoValueTF,\ifnum,\ifodd,\ifstrequal} % \DoNotIndex{\iftypog@microtype@loadedfalse} % \DoNotIndex{\iftypog@microtype@preloadedfalse} -% \DoNotIndex{\ifvmode,\ifx,\ignorespaces,\inputlineno,\int,\interlinepenalty} +% \DoNotIndex{\ifvmode,\ifx,\ignorespaces,\inputlineno,\int,\interlinepenalty,\itemize} % \DoNotIndex{\jobname} % \DoNotIndex{\kern} -% \DoNotIndex{\l,\lastlinefit,\lastlineflushrightpar,\lastlineraggedleftpar,\leftmargin,\leftskip,\let} -% \DoNotIndex{\linepenalty,\linewidth,\@listdepth,\looseness,\lsstyle} -% \DoNotIndex{\@M,\m@th,\mathbin,\mathord,\maxdimen,\message,\microtypecontext,\microtypesetup} +% \DoNotIndex{\l,\labelitemi,\labelitemii,\labelitemiii,\labelitemiv} +% \DoNotIndex{\lastlinefit,\lastlineflushrightpar,\lastlineraggedleftpar} +% \DoNotIndex{\lefthyphenmin,\leftmargin,\leftskip,\let,\letcs} +% \DoNotIndex{\linepenalty,\linewidth,\@listdepth,\loop,\looseness,\lsstyle} +% \DoNotIndex{\@M,\m@th,\mathbin,\mathord,\maxdimen,\mbox,\message,\microtypecontext,\microtypesetup} % \DoNotIndex{\@minus,\mkern,\m@ne,\mspace,\MT@letterspace@,\MT@MT,\muexpr} -% \DoNotIndex{\@ne,\NeedsTeXFormat,\NewDocumentCommand,\NewDocumentEnvironment,\newcommand,\newenvironment} -% \DoNotIndex{\newcounter,\newdimen,\newif,\newlength,\newmuskip} +% \DoNotIndex{\@ne,\NeedsTeXFormat,\newbool,\NewDocumentCommand,\NewDocumentEnvironment} +% \DoNotIndex{\newcommand,\newenvironment} +% \DoNotIndex{\newcounter,\newdimen,\newif,\newlength,\newline,\newmuskip} % \DoNotIndex{\nobreak,\nofontexpand,\nofontexpansion,\nr,\numexpr} % \DoNotIndex{\or,\optarg} % \DoNotIndex{\p@,\PackageError,\PackageWarning} -% \DoNotIndex{\par,\parfillskip,\parindent,\parshape,\pdf@strcmp} +% \DoNotIndex{\par,\parfillskip,\parindent,\parshape,\patchcmd,\pdf@strcmp} % \DoNotIndex{\pdfstringdefDisableCommands} % \DoNotIndex{\penalty,\@plus,\PopPostHook,\postdisplaypenalty,\predisplaypenalty,\prg} % \DoNotIndex{\pretolerance,\protected,\ProvidesPackage,\PushPostHook} -% \DoNotIndex{\raisebox,\refstepcounter,\relax,\RenewExpandableDocumentCommand,\RequirePackage,\rightskip} -% \DoNotIndex{\setcounter,\SetEnumitemKey,\SetExpansion,\setkeys,\setlength,\setstretch} +% \DoNotIndex{\raisebox,\refstepcounter,\relax,\RenewExpandableDocumentCommand,\repeat,\RequirePackage} +% \DoNotIndex{\righthyphenmin,\rightskip,\rlap,\romannumeral,\rule} +% \DoNotIndex{\setbox,\setcounter,\SetEnumitemKey,\SetExpansion,\setkeys,\setlength,\setstretch} % \DoNotIndex{\showboxbreadth,\showboxdepth,\skip,\sloppy} % \DoNotIndex{\smoothraggedrightpar} % \DoNotIndex{\smoothraggedrightshapequintuplet} @@ -715,9 +935,9 @@ quote '!' % \DoNotIndex{\textemdash,\textendash,\textsf,\textsl,\texttimes,\textwidth,\the,\times,\tl,\tolerance} % \DoNotIndex{\tracingnone,\tracingpages,\tracingparagraphs} % \DoNotIndex{\typeout,\typoginspect,\typoglogo} -% \DoNotIndex{\unless} +% \DoNotIndex{\unhbox,\unless} % \DoNotIndex{\val,\value,\vbadness,\vfuzz} -% \DoNotIndex{\widowpenalties,\widowpenalty} +% \DoNotIndex{\wd,\widowpenalties,\widowpenalty} % \DoNotIndex{\z@,\z@skip} % % @@ -828,7 +1048,8 @@ end % \footnotesize % \noindent % This package is copyright \textcopyright~2024 Ch.~L.~Spiel. It may be distributed -% and\kernedslash*or modified under the conditions of the \LaTeX{} Project Public License +% and\kernedslash*or modified under the conditions of the +% \href{https://www.latex-project.org/lppl.txt}{\LaTeX{} Project Public License} % \acronym{(LPPL)}, either version~1.3c of this license or --~at your option~-- any later % version. This work has the \acronym{LPPL} maintenance status % \doublequotes{author-maintained}. @@ -836,30 +1057,36 @@ end % % % \clearpage -% \thispagestyle{pagenumberonly} -% \tableofcontents -% \vspace{\fill} +% \pagestyle{pagenumberonly} % +% \unmarkedfntext{The font sample on the title page was generated with the help of \MP{} using +% \doublequotes{\acronym{URW}~Palladio}% +% \detoxindex{font>typeface>URW Palladio=\acronym{URW} Palladio|userman}.} % -% \thispagestyle{pagenumberonly} -% \listoftables -% \phantomsection -% \addcontentsline{toc}{subsection}{List of Tables} -% \vspace{\fill} +% \begin{nofontexpansion} +% \begin{nocharprotrusion} +% \tableofcontents +% \end{nocharprotrusion} +% \end{nofontexpansion} % +% \addtocontents{toc}{% +% \protect\begin{whittyquote} +% Hoffentlich wird es nicht so schlimm, wie es schon ist! \\ +% \capitalemdash*~\propername{Karl Valentin} +% \protect\end{whittyquote}\par} % -% \begingroup -% \footnotesize -% \singlespacing -% \noindent -% The font sample on the title page was generated with the help of \MP{} using -% \doublequotes{\acronym{URW} Palladio~L}\index{font>URW Palladio L=\acronym{URW} Palladio -% L}. -% \endgroup +% \vspace{\fill} +% +% \begin{nofontexpansion} +% \begin{nocharprotrusion} +% \listoftables +% \end{nocharprotrusion} +% \end{nofontexpansion} % % % \clearpage % \pagenumbering{arabic} +% \pagestyle{fancy} % \section{Introduction}\label{sec:introduction} % % \begin{whittyquote} @@ -892,7 +1119,10 @@ end % \Cref{sec:latex-hyphenation} expands the hyphenation facilities of \LaTeX. % % \Cref{sec:break-ligatures,sec:manual-italic-correction,sec:extra-kerning,sec:raise-characters} -% deal with vertically positioning glyphs in a more pleasant way. +% deal with vertically positioning glyphs in a more pleasant way. Also in the realm of +% vertical alignments is \cref{sec:adjust-label-items} that explains how to height-adjust the +% labels in |itemize|~lists to perfection whether the items are followed by uppercase or by +% lowercase letters. % % \Cref{sec:align-last-line,sec:fill-last-line} discuss dearly missed macros for better control % of the last line of a paragraph. @@ -950,15 +1180,17 @@ end % \end{tabbing} % \end{synopsis} % -% \index{package options|(} -% The package \meta{OPTIONs} serve as configuration \meta{key}s, too. This means they can be -% set with \hyperref[syn:typogsetup]{\code{typogsetup}} and their values can be retrieved with -% \hyperref[syn:typogget]{\cs{typogget}}. Options that rely on package~\packagename{microtype} -% are indicated with \doublequotes{\microtyperequiredmarker}. +% \index{package options|(userman} +% The package \meta{OPTIONs} also serve as configuration \meta{key}s (unless noted otherwise). +% This means they can be set with \hyperref[syn:typogsetup]{\code{typogsetup}} and their values +% can be retrieved with \hyperref[syn:typogget]{\cs{typogget}}. Options that rely on +% package~\packagename{microtype} are indicated with \doublequotes{\microtyperequiredmarker}. % % \begin{typogsetup}{} % \newcommand*{\indexpackageoption}[1] -% {\index{package option>#1=\code{#1}}\index{#1=\code{#1}~(option)}\ignorespaces} +% {\detoxindex{package option>#1=\code{#1}|userman}% +% \detoxindex{#1=\code{#1}~(option)|userman}% +% \ignorespaces} % \begin{description} % [before={\let\oldmakelabel=\makelabel % \renewcommand{\makelabel}[1] @@ -978,17 +1210,44 @@ end % \item[|debug|, |nodebug|]\label{item:debug} % \indexpackageoption{debug} % \indexpackageoption{nodebug} -% Write package-specific debug information to the log file. Opposite: |nodebug|. The -% default is not to log debug information. +% Write some package-specific debug information to the \filesystem{log}~file. Opposite: +% |nodebug|. The default is not to record debug information. +% +% These two options neither can be used with \hyperref[syn:typogsetup]{\code{typogsetup}} +% nor with \hyperref[syn:typogget]{\cs{typogget}}. % % \item[|ligaturekern=|\meta{dim}]\label{item:ligaturekern} % \indexpackageoption{ligaturekern} % Set \meta{dim} of the kern that is inserted to split a ligature in % macro\hyperref[syn:nolig]{\cs{nolig}}. See -% \cref{sec:break-ligatures}.\shiftedmarginnote{We access the configuration values with -% \hyperref[syn:typogget]{\cs{typogget}}.} Default +% \cref{sec:break-ligatures}.\shiftedmarginnote{We access all the (default) configuration +% values with \hyperref[syn:typogget]{\cs{typogget}}.} Default % value:~\milliem{\typogget{ligaturekern}}. % +% \item[|lowercaselabelitemadjustments=\{|\meta{dim1}, \meta{dim2}, \meta{dim3}, \meta{dim4}|\}|]% +% \label{item:lowercaselabelitemadjustments} +% \indexpackageoption{lowercaselabelitemadjustments} +% \sinceversion{Since v0.4} +% Vertical shifts \meta{dimN} to apply to \cs{labelitem}\meta{N}, where \meta{N} is the +% nesting level of the |itemize|~list starting at one. An empty \meta{dimN} is equivalent +% to~\formatdimen*{0pt}. The adjustments apply to the lowercase setting +% (\hyperref[syn:lowercaseadjustlabelitems]{\code{\string\lowercaseadjustlabelitems}}). +% See \cref{sec:adjust-label-items} (in particular subsection~\singlequotes{Setup} and +% \cref{tab:labelitemadjustvalues} on \cpageref{tab:labelitemadjustvalues}) and also +% configuration option +% \hyperref[item:uppercaselabelitemadjustments]{\code{uppercaseadjustlabelitem}}. +% +% All four lengths default to~\formatdimen*{0pt}. +% +% \begin{important} +% \slightlysloppy +% \noindent +% Configuring \code{lowercaselabelitemadjustments} (or +% \code{uppercaselabelitemadjustments}) does \emph{not} activate the correction +% mechanism. Use one of the macros \code{\string\lowercaseadjustlabelitems} or +% \code{\string\uppercaseadjustlabelitems} for that purpose. +% \end{important} +% % \item[|mathitalicscorrection=|\meta{dim}]\label{item:mathitalicscorrection} % \indexpackageoption{mathitalicscorrection} % Italics correction in math mode. See \cref{sec:manual-italic-correction} and also the @@ -1000,10 +1259,14 @@ end % \item[|raise*=|\meta{dim}]\label{item:raise} % \indexpackageoption{raise*} % Set the length by which selected characters (dash, hyphen, times, and number dash) are -% raised. Default value:~0pt. +% raised. Default value:~\formatdimen*{0pt}. % % Only the raise amounts for guillemets are unaffected by this option. % +% This option neither can be used with \hyperref[syn:typogsetup]{\code{typogsetup}} nor +% with \hyperref[syn:typogget]{\cs{typogget}}, however, the specific options influenced by +% it can. +% % \item[|raisecapitaldash=|\meta{dim}]\label{item:raisecapitaldash} % \indexpackageoption{raisecapitaldash} % Set the length that the \cs{textendash} is raised in @@ -1093,6 +1356,30 @@ end % \emph{not} in the document body. % % By default this option is unset. +% +% \item[|uppercaselabelitemadjustments=\{|\meta{dim1}, \meta{dim2}, \meta{dim3}, \meta{dim4}|\}|]% +% \label{item:uppercaselabelitemadjustments} +% \indexpackageoption{uppercaselabelitemadjustments} +% \sinceversion{Since v0.4} +% Vertical shifts \meta{dimN} to apply to \cs{labelitem}\meta{N}, where \meta{N} is the +% nesting level of the |itemize|~list starting at one. An empty \meta{dimN} is equivalent +% to~\formatdimen*{0pt}. The adjustments apply to the uppercase setting +% (\hyperref[syn:uppercaseadjustlabelitems]{\code{\string\uppercaseadjustlabelitems}}). +% See \cref{sec:adjust-label-items} (in particular subsection~\singlequotes{Setup} and +% \cref{tab:labelitemadjustvalues} on \cpageref{tab:labelitemadjustvalues}) and also +% configuration option +% \hyperref[item:lowercaselabelitemadjustments]{\code{lowercaseadjustlabelitem}}. +% +% All four lengths default to~\formatdimen*{0pt}. +% +% \begin{important} +% \slightlysloppy +% \noindent +% Configuring \code{uppercaselabelitemadjustments} (or +% \code{lowercaselabelitemadjustments}) does \emph{not} activate the correction +% mechanism. Use one of the macros \code{\string\uppercaseadjustlabelitems} or +% \code{\string\lowercaseadjustlabelitems} for that purpose. +% \end{important} % \end{description} % \end{typogsetup} % \index{package options|)} @@ -1116,12 +1403,13 @@ end % issues a \cs{par} at its end. Environments with different name suffixes never close % with~\cs{par}. % -% \bigskip % -% \noindent +% \subsection{Setup and Reconfiguration}\label{sec:setup} +% % \DescribeEnv{typogsetup} -% Configure\index{configuration}\index{setup} the package with the given \meta{keys}. An empty -% argument of \code{typogsetup} resets all \meta{keys} to their default values. +% Configure\index{configuration|userman}\index{setup|userman} the package with the given +% \meta{keys}. An empty argument of \code{typogsetup} resets all \meta{keys} to their default +% values. % % \begin{synopsis}\label{syn:typogsetup} % \cs{begin}|{typogsetup}|\marg{keys} @@ -1129,7 +1417,7 @@ end % \cs{end}|{typogsetup}| % \end{synopsis} % -% The package can be (re-)configured\index{reconfigure} at any point with +% The package can be (re-)configured\index{reconfigure|userman} at any point with % \cs{typogsetup}\marg{keys}, or --~for localized changes~-- as % % \begin{codeexample} @@ -1143,6 +1431,12 @@ end % where \meta{keys} have the same format as the package options described in % \cref{sec:package-options}. % +% \begin{note} +% Use \code{\string\PassOptionsToPackage\{\meta{keys}\}\{typog\}} to pass \meta{keys} to +% \packagename{typog} before loading it and \code{\string\typogsetup\{\meta{keys}\}} after +% \code{\string\usepackage\{typog\}}. +% \end{note} +% % \begin{usecases} % \cs{typogsetup} can substitute configuring the package at load-time or serve as an % addition.~\visualpar Using the |typogsetup|~environment allows to fine-tune the parameters @@ -1154,9 +1448,9 @@ end % % \noindent % \DescribeMacro{\typogget} -% Sometimes the user needs to access internal configuration values of -% package~\packagename{typog}. This can be done in a safe way without resorting to code that -% is bracketed by \cs{makeatletter}/\cs{makeatother} with the help of the following macro. +% Sometimes the user needs to access configuration values of package~\packagename{typog}. This +% can be done in a safe way without resorting to code that is bracketed by \cs{makeatletter} +% and \cs{makeatother} with the help of the following macro. % % \begin{synopsis}\label{syn:typogget} % \cs{typogget}\marg{key} @@ -1177,15 +1471,47 @@ end % \> \{\cs{raisebox}\= \{\cs{typogget}\{raisecapitaldash\}\}\{\cs{cdot}\}\} % \end{codeexample} % -% The latter only is useful inside of an \code{itemize}~environment of course. +% The latter only is useful inside of an \code{itemize}~environment of course. Compare with +% the solution in \cref{sec:adjust-label-items} offered by \packagename{typog} since v0.4. % \end{usecase} % +% \DescribeMacro{\typoggetnth} +% \sinceversion{Since v0.4} +% If a configuration item is associated with a list as +% \hyperref[item:lowercaselabelitemadjustments]{\code{lowercaselabelitemadjustments}}, +% \hyperref[item:shrinklimits]{\code{shrinklimits}}, +% \hyperref[item:stretchlimits]{\code{stretchlimits}}, +% \hyperref[item:trackingttspacing]{\code{trackingttspacing}}, and +% \hyperref[item:uppercaselabelitemadjustments]{\code{uppercaselabelitemadjustments}} are, it +% may be convenient to fetch a particular list element of it. +% +% \begin{synopsis}\label{syn:typoggetnth} +% \cs{typoggetnth}\marg{csname}\marg{key}\marg{index} \\ +% \cs{typoggetnth}\marg{dimen-register}\marg{key}\marg{index} +% \end{synopsis} +% +% Retrieve the configuration value --~which is a comma-separated list~-- that is associated +% with~\meta{key} and store the item having position~\meta{index} in \meta{dimen-register} or +% the parameter-less, global macro~\meta{csname}. The destination \meta{dimen-register} may be +% predefined like, e.\,g., \cs{dimen0} or user-defined. Dimensions can also be stored in a +% macro by using the \meta{csname}~form of \cs{typoggetnth} but not \foreignphrase{vice versa}. +% +% Index into the list either from left-to-right with positive indices starting at~\(1\) up to +% the length of the list, or from right-to-left with negative indices starting at~\(-1\) down +% to the negative length. +% +% \begin{note} +% Macro~\cs{typoggetnth} \emph{only} works with \meta{key}s that are associated with a list +% of values. +% \end{note} +% % -% \subsection{Information}\label{sec:information}\index{information} +% \subsection{Information}\label{sec:information} +% \index{information|userman} % % \begin{whittyquote} % Never forget: The visual output counts; \\ -% it must always be checked, [\dots]. \\ +% it must always be checked, [\dots\itcorr{-4}]. \\ % \marginnote{The em-dash at then end of the quote is height-adjusted with % \hyperref[syn:capitalemdash]{\cs{capitalemdash*}}.}% % \capitalemdash*~\propername{Udo Wermuth}~\cite{wermuth:2017a} @@ -1196,14 +1522,14 @@ end % % % \subsubsection{Font Information}\label{sec:font-information} -% \index{font>information} +% \index{font>information|userman} % % \DescribeMacro{\fontsizeinfo} % Capture the font~size\footnote{We use \cs{fontdimen6}, the em-height as the font -% size.}\index{font>size} and line~spacing\footnote{The line~spacing simply is -% \cs{baselineskip}.}\index{line spacing} at the point where \cs{fontsizeinfo} \emph{is called} -% in macro~\meta{cs-name}. Both dimensions are measured in points~(pt) and the results are -% rounded to tenths. +% size.}\index{font>size|userman} and line~spacing\footnote{The line~spacing simply is +% \cs{baselineskip}.}\index{line spacing|userman} at the point where \cs{fontsizeinfo} \emph{is +% called} in macro~\meta{cs-name}. Both dimensions are measured in points~(pt) and the results +% are rounded to tenths. % % \begin{synopsis}\label{syn:fontsizeinfo} % \cs{fontsizeinfo}\marg{cs-name} @@ -1259,9 +1585,8 @@ end % % \begin{caution} % The end-of-trace marker sometimes gets placed too early and the trace seems truncated. -% \LaTeX{} reliably logs the requested the trace information, but the write operations for -% trace data and \cs{immediate}\cs{write} which is used to print the end-tag are not -% synchronized. +% \LaTeX{} reliably logs the requested trace information, but the write operations for trace +% data and \cs{immediate}\cs{write} which is used to print the end-tag are not synchronized. % \end{caution} % % @@ -1287,7 +1612,8 @@ end % % \begin{itemize}[noindent] % \item Any text tool can be used to ferret out the tags. \propername{Emacs} users will find -% \mbox{\code{(occur \meta{regexp})}} to be useful. +% \mbox{\code{(occur \meta{regexp})}} to be useful.\shiftedmarginnote{This \code{itemize} +% list demonstrates vertically adjusted label items (\cref{sec:adjust-label-items}).} % % \item As long as the tags are not nested \programname{sed} or \programname{perl} % extract the information gathered by~|typoginspect|, for example: @@ -1338,13 +1664,20 @@ end % % \item If more trace information is needed just add \cs{tracing\dots} calls right after % \code{\string\begin\{typoginspect\}} -% or~\code{\string\begin\{typoginspectpar\}}.\specialsectionendhere +% or~\code{\string\begin\{typoginspectpar\}}. +% +% \item As the overhead of \cs{typoginspect} is relatively low, hairy parts of a document can +% permanently be furnished with them, for example, the Index. +% +% \item Any labeled part can treat their ids to \meta{id}. Think of \cs{caption}s or any +% theorem-like environment and their associated, unique \cs{label}s.\specialsectionendhere % \end{itemize} % \end{tips} % % % \phantomsection -% \paragraph{Investigating the badness of a paragraph.}\label{sec:investigating-paragraph-badness}\index{paragraph>badness} +% \paragraph{Investigating the badness of a paragraph.}\label{sec:investigating-paragraph-badness} +% \index{paragraph>badness|userman} % % It is generally unnecessary to determine the \emph{exact} classification of a paragraph's % badness~\cite[p.~97n]{knuth:1986}, though the curious user can switch on logging of @@ -1386,9 +1719,9 @@ end % \begin{enumerate}[beginpenalty=10000, nosep] % \item The shortfall~\sample{s} and % \item glue~\sample{a} or~\sample{g}.\footnote{The author is unaware of any descriptions -% of \code{s}, \code{a}, or~\code{g}. The interested reader is referred to the source -% code, e.\,g., \filesystem{pdftex.web}; search for \code{print("\textvisiblespace s=")}. -% In the weaved documentation the first relevant section is~\S1851.} +% of \sample{s}, \sample{a}, or~\sample{g} and the interested reader is referred to the +% source code, e.\,g., \filesystem{pdftex.web}; search for \code{print("\textvisiblespace +% s=")}. In the weaved documentation the first relevant section is~\S1851.} % \end{enumerate} % \item The best\footnote{\singlequotes{Best} means the minimum-demerits path in the graph of % the feasible breakpoints, which has been constructed for the paragraph.} way to get @@ -1404,13 +1737,13 @@ end % as parenthesized values (units are thousandths of the current font's~em) like, e.\,g., % % \begin{codeexample} -% \textbackslash T1/erewhon-LF/m/n/9/@/@ (-13) \dots +% \textbackslash T1/erewhon-LF/m/n/9/@/@ (-13) \dots % \end{codeexample} % % or % % \begin{codeexample} -% \textbackslash T1/erewhon-LF/m/n/9/@/@/10ls (+7) \dots +% \textbackslash T1/erewhon-LF/m/n/9/@/@/10ls (+7) \dots % \end{codeexample} % % An \sample{ls} appended to the font name specification indicates that @@ -1419,7 +1752,9 @@ end % \end{note} % % -% \paragraph{Investigating page-breaks.}\index{page break} +% \phantomsection +% \paragraph{Investigating page-breaks.} +% \index{page break|userman} % % Use \code{\cs{tracingpages}=1} or the \hyperref[syn:typoginspect]{typoginspect}~environment % to switch on tracing of \TeX's page-break @@ -1486,7 +1821,7 @@ end % % % \subsection{Hyphenation}\label{sec:latex-hyphenation} -% \index{hyphenation} +% \index{hyphenation|userman} % % \TeX's and thus \LaTeX's hyphenation algorithm is highly sophisticated, yet the document % author sometimes lacks convenient macros to solve seemingly trivial typographic tasks. For @@ -1500,8 +1835,8 @@ end % \cs{allowhyphenation} % \end{synopsis} % -% Macro~\cs{allowhyphenation}\index{hyphenation>re-enable automatic} re-enables automatic -% hyphenation after \TeX{} has turned it off, for example, in the innocuous case of a +% Macro~\cs{allowhyphenation}\index{hyphenation>re-enable automatic|userman} re-enables +% automatic hyphenation after \TeX{} has turned it off, for example, in the innocuous case of a % hyphenated compound. % % The admittedly simple rules when \TeX{} auto-hyphenates and when not give rise to so many @@ -1636,7 +1971,7 @@ end % Whenever using \cs{-}, the short-hand form of \cs{discretionary\{-\}\{\}\{\}}, authors % writing in a foreign language should reconsider whether it really beats \cs{hyphenation} or % \cs{babelhyphenation}\footnote{\cs{babelhyphenation} is the multi-lingual extension of \TeX's -% \cs{hyphenation} and it is defined in package~\packagename{babel}~\cite{package:babel}}. in +% \cs{hyphenation} and it is defined in package~\packagename{babel}~\cite{package:babel}.} in % the particular situation. However, sometimes \cs{-} actually \emph{is} the way to go. % % Let us assume we mark up proper names with @@ -1662,6 +1997,12 @@ end % which are impossible to encode with \cs{hyphenation} or~\cs{babelhyphenation} as these expect % only letters and dashes as their arguments with spaces separating the words. % +% \index{hyphenation>first word|userman} +% \index{hyphenation>hskip=\cs{hskip}|userman} +% \TeX{} never hyphenates the initial word in a paragraph and \cs{allowhyphenation} cannot help +% in this case. Start the paragraph with \cs{hskip~0pt} to enable hyphenation even for the +% first word. +% % \begin{tip}[Typewriter Fonts] % Sometimes it is desired to get a hyphenatable typewriter font. \LaTeX{} suppresses any % hyphenation for fonts in \cs{ttfamily} by un-defining their \cs{hyphenchar}s. If these are @@ -1686,8 +2027,8 @@ end % \cs{breakpoint*} % \end{synopsis} % -% The starred form inserts an empty discretionary,\index{hyphenation>empty discretionary} which -% disables automatic hyphenation. The unstarred form inserts an empty discretionary and +% The starred form inserts an empty discretionary,\index{hyphenation>empty discretionary|userman} +% which disables automatic hyphenation. The unstarred form inserts an empty discretionary and % immediately re-enables automatic hyphenation. % % The difference between \cs{breakpoint} and the \LaTeX{} macro~\cs{allowbreak} is not only @@ -1729,7 +2070,7 @@ end % % % \subsection{Disable\kernedslash Break Ligatures}\label{sec:break-ligatures} -% \index{ligature} +% \index{ligature|userman} % % \DescribeMacro{\nolig*} % Break a ligature without introducing a hyphenation opportunity. @@ -1739,8 +2080,8 @@ end % \end{synopsis} % % Inserting \cs{nolig*} disables a ligature at the given point by a kern. Set the size of the -% kern\index{kerning>ligature} with \hyperref[item:ligaturekern]{|ligaturekern|} or override -% this value with \meta{kerning} as thousandths of the current font's~em. +% kern\index{kerning>ligature|userman} with \hyperref[item:ligaturekern]{\code{ligaturekern}} or +% override this value with \meta{kerning} as thousandths of the current font's~em. % % \begin{usecases} % \cs{nolig*} can be useful in headings, where additional hyphenation points are @@ -1762,12 +2103,12 @@ end % introduces a hyphenation opportunity with % penalty~\hyperref[item:breakpenalty]{|breakpenalty|}. % -% \begin{important}[\packagename{hyperref} bookmarks]\index{hyperref=\packagename{hyperref} (package)} +% \begin{important}[\packagename{hyperref} bookmarks]\index{hyperref=\packagename{hyperref} (package)|userman} % If a \cs{nolig} --~whether starred or un-starred~-- occurs in an argument that is processed % with package~\packagename{hyperref} for inclusion into the document's -% \acronym{PDF}-bookmarks\index{PDF=\acronym{PDF}}\index{bookmark} an additional argument is -% necessary to parse the macro. This argument either is \cs{relax} or~the empty -% group~(\code{\{\}}). +% \acronym{PDF}-bookmarks\index{PDF=\acronym{PDF}|userman}\index{bookmark|userman} an +% additional argument is necessary to parse the macro. This argument either is \cs{relax} +% or~the empty group~(\code{\{\}}). % % \begin{synopsis} % \begin{tabbing} @@ -1944,14 +2285,14 @@ end % % % \subsection{Apply Extra Kerning}\label{sec:extra-kerning} -% \index{kerning>extra} +% \index{kerning>extra|userman} % % Package \packagename{typog} supplies two sets of macros to kern some of the punctuation % symbols. One is for forward slashes the other, more extensive one, for hyphens. % % % \subsubsection{Slash}\label{sec:slash-with-kern} -% \index{kerning>forward slash} +% \index{kerning>forward slash|userman} % % \DescribeMacro{\kernedslash} % \DescribeMacro{\kernedslash*} @@ -1980,7 +2321,7 @@ end % % % \subsubsection{Hyphen}\label{sec:hyphen-with-kern} -% \index{kerning>hyphen} +% \index{kerning>hyphen|userman} % % \DescribeMacro{\kernedhyphen} % \DescribeMacro{\kernedhyphen*} @@ -2027,7 +2368,7 @@ end % % % \subsection{Raise Selected Characters}\label{sec:raise-characters} -% \index{raised character} +% \index{raised character|userman} % % Usually all hyphens and dashes of a font are designed to join lowercase letters. This holds % also true for most of our \cs{labelitem}\meta{N} markers, bullets, stars, and even fancy @@ -2036,10 +2377,10 @@ end % arises if |itemize|~list markers precede an uppercase letter, a lining numeral, or a big % mathematical operator. % -% We introduce a set of macros for the most common cases that allow typsetting these characters -% at a user definable, adjusted height above the baseline. Users can base their own -% definitions of raised characters on their associated dimensions.\footnote{Also compare with -% Ex.~12 in Ref.~\citenum{wermuth:2023} for an attempt to automate vertical alignment.} +% We introduce a set of macros for the most common cases that typeset these characters at a +% user definable, adjusted height above the baseline. Users can base their own definitions of +% raised characters on their associated dimensions.\footnote{Also compare with Ex.~12 in +% Ref.~\citenum{wermuth:2023} for an attempt to automate vertical alignment.} % % \begin{caution} % The height adjustment disables a font's built-in kerning. @@ -2051,7 +2392,7 @@ end % % % \subsubsection{Capital Hyphen}\label{sec:capital-hyphen} -% \index{raised character>hyphen} +% \index{raised character>hyphen|userman} % % \DescribeMacro{\capitalhyphen} % \DescribeMacro{\capitalhyphen*} @@ -2081,7 +2422,7 @@ end % % % \subsubsection{Capital Dash}\label{sec:capital-dash} -% \index{raised character>en-dash} +% \index{raised character>en-dash|userman} % % \DescribeMacro{\capitalendash} % \DescribeMacro{\capitalendash*} @@ -2127,7 +2468,7 @@ end % % % \subsubsection{Number Dash (Figure Dash)}\label{sec:number-dash} -% \index{raised character>number dash} +% \index{raised character>number dash|userman} % % \DescribeMacro{\figuredash} % \DescribeMacro{\figuredash*} @@ -2152,49 +2493,63 @@ end % The actual amount the en-dash gets raised in \cs{figuredash} is determined by % \hyperref[item:raisefiguredash]{|raisefiguredash|}. % -% Values of .05em to .1em are typical for fonts that need this kind of correction and~.1em is a -% good starting point. \Cref{tab:raisefiguredash} summarizes some findings. +% Values of .05\,em to .1\,em are typical for fonts that need this kind of correction +% and~.1\,em is a good starting point. \Cref{tab:raisefiguredash} summarizes some findings. % % \begin{table} % \centering % \caption[Suggested raise amounts for \cs{figuredash}]% -% {Suggested values for raising the en-dash between lining numerals of some selected -% fonts.} +% {Suggested values for raising \cs{figuredash}, which actually is an en-dash, +% between lining numerals of some selected fonts in multiples of~1\,em.} % \label{tab:raisefiguredash} % +% \newcommand*{\fbbmark}{\tablenotemark{\tablenotesymbol{1}}} +% % \begin{tabfigures} -% \begin{tabular}{@{}l>{\RaggedRight}p{20em}@{}} +% \begin{tabularx}{\linewidth}{@{}>{\RaggedRight}Xl@{}} % \toprule -% Raise & Font Name \\ -% em & \\ +% Font & Raise \\ % \midrule -% 0 & Alegreya\index{font>Alegreya}, Arvo\index{font>Arvo}, -% Bitter\index{font>Bitter}, Clara\index{font>Clara}, -% \acronym{EB}~Garamond\index{font>EB Garamond=\acronym{EB} Garamond}, -% Gentium\index{font>Gentium}, -% Ibarra Real Nova\index{font>Ibarra Real Nova}, -% \acronym{Inria}~Serif\index{font>Inria Serif=\acronym{Inria} Serif}, -% Libertine\index{font>Libertine}, Libertinus\index{font>Libertinus}, -% Merriweather\index{font>Merriweather}, -% \acronym{PT}~Serif\index{font>PT Serif=\acronym{PT} Serif}, -% Roboto Slab\index{font>Roboto Slab}, Spectral\index{font>Spectral}, -% \acronym{STIX}\index{font>STIX=\acronym{STIX}}, and many more \\ -% .05 & fbb\index{font>fbb}, Source Serif Pro\index{font>Source Serif Pro} \\ -% .0667 & Libre Baskerville\index{font>Libre Baskerville}, -% Crimson Pro\index{font>Crimson Pro}, -% Erewhon\index{font>Erewhon}, Droid Serif\index{font>Droid Serif} \\ -% .1 & \acronym{GFS}~Artemisia\index{font>GFS Artemisia=\acronym{GFS} Artemisia}, -% Libre Caslon\index{font>Libre Caslon}, -% Coelacanth\index{font>Coelacanth}, Crimson Pro\index{font>Crimson Pro}, -% Crimson Text\index{font>Crimson Text}, -% \TeX{} Gyre~Pagella\index{font>TeX Gyre Pagella=\TeX{} Gyre Pagella}, -% Quattrocento\index{font>}, -% \acronym{TX}~Fonts\index{font>TX Fonts=\acronym{TX} Fonts}, -% \acronym{ADF}~Venturis\index{font>ADF Venturis=\acronym{ADF} Venturis}, -% and many more \\ +% Alegreya\detoxindex{font>typeface>Alegreya|userman}, Arvo\detoxindex{font>typeface>Arvo|userman}, +% Bitter\detoxindex{font>typeface>Bitter|userman}, Clara\detoxindex{font>typeface>Clara|userman}, +% \acronym{EB}~Garamond\detoxindex{font>typeface>EB Garamond=\acronym{EB} Garamond|userman}, +% Gentium\detoxindex{font>typeface>Gentium|userman}, +% Ibarra Real Nova\detoxindex{font>typeface>Ibarra Real Nova|userman}, +% \acronym{Inria}~Serif\detoxindex{font>typeface>Inria Serif=\acronym{Inria} Serif|userman}, +% Libertine\detoxindex{font>typeface>Libertine|userman}, +% Libertinus\detoxindex{font>typeface>Libertinus Serif|userman}, +% Merriweather\detoxindex{font>typeface>Merriweather|userman}, +% \acronym{PT}~Serif\detoxindex{font>typeface>PT Serif=\acronym{PT} Serif|userman}, +% Roboto Slab\detoxindex{font>typeface>Roboto Slab|userman}, +% Spectral\detoxindex{font>typeface>Spectral|userman}, +% \acronym{STIX}\detoxindex{font>typeface>STIX=\acronym{STIX}|userman}, and many more & +% .0 \\ +% fbb\fbbmark\detoxindex{font>typeface>fbb|userman}, +% Source Serif Pro\detoxindex{font>typeface>Source Serif Pro|userman} & +% .05 \\ +% Libre Baskerville\detoxindex{font>typeface>Libre Baskerville|userman}, +% Crimson Pro\detoxindex{font>typeface>Crimson Pro|userman}, +% Erewhon\detoxindex{font>typeface>Erewhon|userman}, +% Droid Serif\detoxindex{font>typeface>Droid Serif|userman} & +% .0667 \\ +% \acronym{GFS}~Artemisia\detoxindex{font>typeface>GFS Artemisia=\acronym{GFS} Artemisia|userman}, +% Libre Caslon\detoxindex{font>typeface>Libre Caslon|userman}, +% Coelacanth\detoxindex{font>typeface>Coelacanth|userman}, +% Crimson Pro\detoxindex{font>typeface>Crimson Pro|userman}, +% Crimson Text\detoxindex{font>typeface>Crimson Text|userman}, +% \TeX{} Gyre~Pagella\detoxindex{font>typeface>TeX Gyre Pagella=\TeX{} Gyre Pagella|userman}, +% Quattrocento\detoxindex{font>typeface>Quattrocento|userman}, +% \acronym{TX}~Fonts\detoxindex{font>typeface>TX Fonts=\acronym{TX} Fonts|userman}, +% \acronym{ADF}~Venturis\detoxindex{font>typeface>ADF Venturis=\acronym{ADF} Venturis|userman}, +% and many more & +% .1 \\ % \bottomrule -% \end{tabular} +% \end{tabularx} % \end{tabfigures} +% +% \begin{tablenotes} +% \fbbmark\enspace Free Bembo. +% \end{tablenotes} % \end{table} % % Other macros may be redefined with \cs{figuredash} for a consistent appearance of the copy, @@ -2210,7 +2565,7 @@ end % % \subsubsection[Multiplication Sign]% % {Multiplication Sign -- Times~\sample{\texttimes}}\label{sec:mult-sign} -% \index{raised character>multiplication sign} +% \index{raised character>multiplication sign|userman} % % \DescribeMacro{\capitaltimes} % The \cs{capitaltimes}~macro is a variation of the @@ -2232,17 +2587,19 @@ end % % % \subsubsection{Guillemets}\label{sec:guillemets} -% \index{raised character>guillemets} +% \index{raised character>guillemets|userman} % % Another possible typographic problem this package addresses is that both sets --~single and % double quotes~-- of guillemets may suffer from a too small distance to the baseline. % % For the implementation \packagename{typog} relies on the T1\footnote{Font -% encoding~T1\index{font>encoding} can be forced via \cs{usepackage}|[T1]\{fontenc\}| in the -% document preamble.}~font encoding not on package~\packagename{babel}. +% encoding~T1\detoxindex{font>encoding|userman} can be forced via +% \cs{usepackage}|[T1]\{fontenc\}| in the document preamble.}~font encoding not on +% package~\packagename{babel}. % % % \paragraph{Lowercase Versions.} +% % \DescribeMacro{\singleguillemetleft} % \DescribeMacro{\singleguillemetright} % \DescribeMacro{\doubleguillemetleft} @@ -2280,33 +2637,34 @@ end % or lining numerals is \cs{Singleguillemetleft} and \cs{Singleguillemetright} and % \cs{Doubleguillemetleft} and \cs{doubleguillemetright}. Mnemonic: These macros start with an % uppercase letter. Their height above the baseline is adjusted with -% \hyperref[item:raisecapitalguillemets]{|raisecapitalguillemets|}. Values of .025em to .075em -% are typical for fonts that need this kind of correction. \Cref{tab:raiseguillemets} +% \hyperref[item:raisecapitalguillemets]{|raisecapitalguillemets|}. Values of .025\,em to +% .075\,em are typical for fonts that need this kind of correction. \Cref{tab:raiseguillemets} % summarizes some findings. % % \begin{table} % \centering % \caption[Suggested raise amounts for guillemets]% -% {Suggested values for raising guillemets of some selected fonts.} +% {Suggested values for raising guillemets of some selected fonts in multiples +% of~1\,em.} % \label{tab:raiseguillemets} % % \begin{tabfigures} -% \begin{tabular}{@{}cc>{\RaggedRight}p{20em}@{}} +% \def~{\hphantom{0}} +% \begin{tabular}{@{}>{\RaggedRight}p{.5\textwidth}cc@{}} % \toprule -% \multicolumn{2}{@{}c}{Raise} & Font Name \\ -% Lowercase & Uppercase & \\ -% em & em & \\ +% Font & Uppercase & Lowercase \\ % \midrule -% 0 & .05\hphantom{00} & -% \acronym{EB}~Garamond\index{font>EB Garamond=\acronym{EB} Garamond}, -% Libertinus\index{font>Libertinus}, -% Merriweather\index{font>Merriweather}, and many more \\ -% .025 & .05\hphantom{00} & Gentium\index{font>Gentium} \\ -% .04\hphantom{0} & .0667 & -% \acronym{ADF}~Baskervald\index{font>ADF Baskervald=\acronym{ADF} Baskervald} \\ -% .05\hphantom{0} & .0625 & -% \acronym{GFS}~Artemisia\index{font>GFS Artemisia=\acronym{GFS} Artemisia}, -% \acronym{GFS}~Didot\index{font>GFS Didot=\acronym{GFS} Didot} \\ +% \acronym{EB} Garamond\detoxindex{font>typeface>EB Garamond=\acronym{EB} Garamond|userman}, +% Libertinus\index{font>typeface>Libertinus Serif|userman}, +% Merriweather\index{font>typeface>Merriweather|userman}, and many more & +% .05~~ & .0~~ \\ +% Gentium\index{font>typeface>Gentium|userman} & +% .05~~ & .025 \\ +% \acronym{GFS} Artemisia\detoxindex{font>typeface>GFS Artemisia=\acronym{GFS} Artemisia|userman}, +% \acronym{GFS} Didot\detoxindex{font>typeface>GFS Didot=\acronym{GFS} Didot|userman} & +% .0625 & .05~ \\ +% \acronym{ADF} Baskervald\index{font>typeface>ADF Baskervald=\acronym{ADF} Baskervald|userman} & +% .0667 & .04~ \\ % \bottomrule % \end{tabular} % \end{tabfigures} @@ -2322,7 +2680,8 @@ end % \cs{let}\cs{sq}=\cs{singlequotes} % \end{codeexample} % -% and similar definitions for \cs{Singlequotes}, \cs{doublequotes}, and~\cs{Doublequotes}. +% \noindent +% and similar definitions for \cs{Singlequotes}, \cs{doublequotes}, and \cs{Doublequotes}. % % Users working according to the French typesetting conventions will want to add extra % spacing between the guillemets and the macro argument already in these macros. @@ -2334,7 +2693,7 @@ end % % % \paragraph{Interaction with package~\packagename{csquotes}.} -% \index{csquotes=\packagename{csquotes} (package)} +% \index{csquotes=\packagename{csquotes} (package)|userman} % % The users of package~\packagename{csquotes} % can hook up the guillemets as defined by \packagename{typog} @@ -2367,21 +2726,374 @@ end % \end{futuredirection} % % +% \subsection[Vertically Adjust Label Items] +% {Vertically Adjust Label Items of +% Environment \code{itemize}}\label{sec:adjust-label-items} +% \index{label items|userman} +% +% \begin{whittyquote} +% Perfection of planned layout \\ +% is archieved only by institutions \\ +% on the point of collapse. \\ +% \capitalemdash*~\propername{Cyril Northcote Parkinson} +% \end{whittyquote} +% +% \noindent +% The symbols that \LaTeX{} uses to distinguish the items of |itemize|~lists do not always +% align well in the vertical direction with the following text. Sometimes the label is too +% low, especially if followed by an uppercase (initial) letter. In rare occasions the label is +% placed too far above the baseline. If any label has been taken from a math-font vertical +% alignment with the text font is almost purely accidental.\footnote{The exception being +% mathematics typeset as text via package~\packagename{mathastext}~\cite{package:mathastext}.} +% +% \hangindent=2\parindent +% \hangafter=-3 +% \noindent +% \DescribeMacro{\uppercaseadjustlabelitems} +% \DescribeMacro{\lowercaseadjustlabelitems} +% \DescribeMacro{\noadjustlabelitems} +% \sinceversion{All three since v0.4} +% Package~\packagename{typog} lets the user vertically align the \code{itemize}~labels for +% subsequent uppercase or lowercase letters, where the designations~\singlequotes{uppercase} +% and \singlequotes{lowercase} are just names for two four-tuples of lengths (technically: +% |dimen|s) to shift the labels up or down. +% +% \begin{synopsis} +% \label{syn:lowercaseadjustlabelitems} +% \label{syn:noadjustlabelitems} +% \label{syn:uppercaseadjustlabelitems} +% \cs{uppercaseadjustlabelitems}\marg{levels-to-adjust} \\ +% \cs{lowercaseadjustlabelitems}\marg{levels-to-adjust} \\ +% \cs{noadjustlabelitems}\marg{levels-to-adjust} +% \end{synopsis} +% +% Apply uppercase adjustment, lowercase adjustment or no adjustment to the labels in +% |itemize|~environments at the \meta{levels-to-adjust}. The adjustment values themselves, +% this is the vertical shifts are configured with +% options~\hyperref[item:uppercaselabelitemadjustments]{\code{uppercaselabelitemadjustments}} +% and~\hyperref[item:lowercaselabelitemadjustments]{\code{lowercaselabelitemadjustments}}. +% They are doubly font dependent: on the one hand the font where the label itself comes from +% and on the other hand the font of the copy. +% +% The argument \meta{levels-to-adjust} is a --~possibly empty~-- comma separated list of the +% levels the respective adjustments are to be applied to. The levels themselves are given as +% \emph{decimal} numbers, this is, 1, 2, 3, 4 or the special value~\sample{*} which stands for +% all four levels. An empty argument list also has a special meaning. Used within any +% \code{itemize}~environment it automatically applies the adjustment to exactly this level. +% +% \begin{example} +% \begin{typogsetup}{uppercaselabelitemadjustments={.1em}} +% With the flexible syntax the following settings are possible. +% +% \renewcommand*{\labelitemi}{{\small$\rhd$}}% +% \begin{itemize}\uppercaseadjustlabelitems{} +% \item Correct all |itemize| labels for uppercase letters. +% +% \begin{codeexample} +% \cs{uppercaseadjustlabelitems}\{*\} +% \end{codeexample} +% +% \item Adjust nesting levels~1, 2, and~3 for uppercase letters and level~4 for lowercase. +% +% \begin{codeexample} +% \cs{lowercaseadjustlabelitems}\{4\} \\ +% \cs{uppercaseadjustlabelitems}\{2,3,1\} +% \end{codeexample} +% +% \item Within an |itemize|~environment just turn off any correction for this level whatever +% it may be. +% +% \begin{codeexample} +% \cs{begin}\{itemize\} \\ +% \cs{noadjustlabelitems}\{\} \\ +% \cs{item} \dots \\ +% \cs{end}\{itemize\} +% \end{codeexample} +% +% \item Override \cs{labelitemi} with a right-pointing triangle and adjust its vertical +% position inside of a \code{typogsetup}~environment. +% +% \begin{codeexample} +% \cs{begin}\=\{typogsetup\} \\ +% \>\{uppercaselabelitemadjustments=\{.1em\}\} \\ +% 12\=34567890 \kill +% \>\cs{renewcommand*}\{\cs{labelitemi}\}\{\{\cs{small}\$\cs{rhd}\$\}\} \\ +% \>\cs{begin}\{itemize\} \\ +% \>\cs{uppercaseadjustlabelitems}\{\} \\ +% \>\cs{item} \dots \\ +% \>\cs{end}\{itemize\} \\ +% \cs{end}\{typogsetup\} +% \end{codeexample} +% \end{itemize} +% +% The observant reader will have noticed that the itemized list in this emphasized section +% uses the code of the last example. +% \end{typogsetup} +% \end{example} +% +% +% \paragraph{Setup.} +% +% To assist the user in finding the desired adjustments of the labels of \packagename{typog} +% provides macros that help setting up +% \hyperref[item:lowercaselabelitemadjustments]{\code{lowercaselabelitemadjustments}} and +% \hyperref[item:uppercaselabelitemadjustments]{\code{uppercaselabelitemadjustments}}. Their +% intended uses are in the draft phase of a document or in non-printed sections of the text. +% +% The macros assume a \singlequotes{correct} height that they derive from the measured height +% of a sample text scaled by a user-defined factor, which defaults +% to~\nativetextfraction{1}{2}.\footnote{The default factor of~.5 hearkens back to +% \propername{Strizver's} suggestion that \doublequotes{[b]ullets should be centered on either +% the cap~height or x-height of the neighboring text, \dots.}~\cite[p.~220]{strizver:2014}.} +% The then correct height gets indicated by a thin horizontal line parallel to the baseline. +% Thus, at sufficiently high magnifications it is possible to judge whether a label gets +% typeset too high or too low with respect to this reference line. +% +% \begin{note} +% The macros use the actual height of a given sample~text. So, a lowercase~sample should not +% contain any letters with ascenders. +% +% Swashes whether upper- or lowercase always need special attention. +% \end{note} +% +% \DescribeMacro{\typogadjuststairs} +% \sinceversion{Since v0.4} +% To get a quick overview how the four \code{itemize}~labels align vertically +% \cs{typogadjuststairs} draws them at user-defined steps, typically +% \nativetextfraction{1}{4}\,pt, \nativetextfraction{1}{3}\,pt, or +% \nativetextfraction{1}{2}\,pt. It ignores any existing adjustments and in that way can be +% utilized as a first configuration step or, for a small \meta{step-size} and a high +% \meta{number-of-steps}, for an easy refinement. +% +% \begin{synopsis} +% \begin{tabbing} +% \label{syn:typogadjuststairs} +% \cs{typogadjuststairs}\=[\meta{scale-factor}=.5] \\ +% \>\marg{step-size}\marg{number-of-steps} \\ +% \>\marg{sample} +% \end{tabbing} +% \end{synopsis} +% +% Generate stairs of \meta{number-of-steps} vertically shifted label items; use the next odd +% number, if \meta{number-of-steps} is even. Draw a reference hairline at \meta{scale-factor} +% times the height of \meta{sample}, where \meta{scale-factor} defaults to~.5. The stairs +% start at a vertical shift of +% \begin{gather*} +% -\frac{\text{\meta{number-of-steps}} - 1}{2} \times \text{\meta{step-size}} \\ +% \intertext{and repeat up} +% \frac{\text{\meta{number-of-steps}} - 1}{2} \times \text{\meta{step-size}}. +% \end{gather*} +% +% \noindent +% The central step --~which is always surrounded by a bit more space~-- shows the neutral +% alignment, this is~0\,pt. \cs{typogadjuststairs} never prints the contents of \meta{sample}. +% +% \begin{example} +% Play ball! +% +% \begin{center} +% \typogadjuststairs{.25pt}{9}{ABC} +% \end{center} +% +% This is the result of \code{\string\typogadjuststairs\{.25pt\}\{9\}\{ABC\}} with the +% document's definitions of \cs{labelitem}\meta{N}. The fifth label~item in each line is the +% uncorrected one. +% \end{example} +% +% \hangindent=2\parindent +% \hangafter=-3 +% \noindent +% \DescribeMacro{\typoguppercaseadjustcheck} +% \DescribeMacro{\typoglowercaseadjustcheck} +% \sinceversion{Both since v0.4} +% For a quick and easy check how the four label items vertically align \emph{as configured} use +% \code{\string\typoguppercaseadjustcheck} and \code{\string\typoglowercaseadjustcheck}. +% Experienced users with a keen eye for type can apply these macros even in the initial setup. +% An accurate determination of \code{uppercaselabelitemadjustments} and +% \code{lowercaselabelitemadjustments} is preferably done at a high magnification (400\% to +% 600\% on a 100\,dpi screen) with a representative sample of initial letters. +% +% \begin{synopsis} +% \label{syn:typoguppercaseadjustcheck} +% \label{syn:typoglowercaseadjustcheck} +% \cs{typoguppercaseadjustcheck}[\meta{scale-factor}=.5]\marg{sample} \\ +% \cs{typoglowercaseadjustcheck}[\meta{scale-factor}=.5]\marg{sample} +% \end{synopsis} +% +% Typeset all four label items adjusted for uppercase or for lowercase with an indicator line +% at \meta{scale-factor} times the \meta{sample}'s actual height. The default +% \meta{scale-factor} is~.5. Both macros refer to the currently configured values for the +% uppercase or lowercase adjustments but they are independent of any settings done with +% \cs{uppercaseadjustlabelitems}, \cs{lowercaseadjustlabelitems}, or \cs{noadjustlabelitems}. +% Again, \meta{sample} does not get printed. +% +% \begin{example} +% Uppercase check with \code{\string\typoguppercaseadjustcheck\{ABCXYZ\}}: +% +% \centering +% ABGH\typoguppercaseadjustcheck{ABCXYZ}QWYZ,\enspace +% 0123\typoguppercaseadjustcheck{ABCXYZ}4567 +% +% \justifying +% \noindent +% and similarly for lowercase: \code{\string\typoglowercaseadjustcheck\{acexyz\}}: +% +% \centering +% ace\typoglowercaseadjustcheck{acexyz}mno,\enspace +% bdf\typoglowercaseadjustcheck{acexyz}gjy,\enspace +% {\proportionaloldstylefigures 0123\typoglowercaseadjustcheck{acexyz}4567,} +% +% \justifying +% \noindent +% where we have bracketed the macro calls with selected uppercase and lowercase letters, or +% suitable figures. +% \end{example} +% +% In \Cref{tab:labelitemadjustvalues} on \cpageref{tab:labelitemadjustvalues} we collected some +% suggestions for adjustment values in the \emph{default} case when the label items are not +% redefined by the user and expand like +% +% \begin{center} +% \def\arraystretch{1} +% \begin{tabular}{@{}l@{\enspace\(\vdash\)\enspace}l@{}} +% \cs{labelitemi} & \dumpmacro{\labelitemi}, \\ +% \cs{labelitemii} & \dumpmacro{\labelitemii}, \\ +% \cs{labelitemiii} & \dumpmacro{\labelitemiii}, and \\ +% \cs{labelitemiv} & \dumpmacro{\labelitemiv}. +% \end{tabular} +% \end{center} +% +% \noindent +% They display as \sample{\labelitemi}, \sample{\labelitemii}, \sample{\labelitemiii}, and +% \sample{\labelitemiv}, respectively. +% +% \begin{table} +% \centering +% \caption[Label item adjustment suggestions]% +% {Some suggested values for the vertical adjustments of label items. The table +% assumes that the default definitions (of class~\packagename{article}) for +% \cs{labelitem}\meta{N} are in effect. The \code{itemize}-list levels~\code{i}, +% \code{ii}, \code{iii} and~\code{iv} are referred to with \(N = 1, 2, 3, 4\). All +% lengths are given as printer points~(pt) and refer to a document font size of +% \formatdimen*{10pt}.} +% \label{tab:labelitemadjustvalues} +% +% \newcommand*{\etbbmark}{\tablenotemark{\tablenotesymbol{1}}} +% \newcommand*{\xchartermark}{\tablenotemark{\tablenotesymbol{2}}} +% \newcommand*{\kpmark}{\tablenotemark{\tablenotesymbol{3}}} +% \newcommand*{\palladiomark}{\tablenotemark{\tablenotesymbol{4}}} +% \newcommand*{\utopiamark}{\tablenotemark{\tablenotesymbol{5}}} +% +% \begin{tabfigures} +% \def~{\hphantom{0}} +% \def\mc#1{#1~~~} +% \noindent +% \makebox[0pt]{% +% \begin{tabular}{@{}l*{4}{r}@{\qquad}*{4}{r}@{}} +% \toprule +% Font Name & +% \multicolumn{4}{c}{Uppercase Adjustments} & \multicolumn{4}{c@{}}{Lowercase Adjustments} \\ +% {} & +% \mc{1} & \mc{2} & \mc{3} & \mc{4} & +% \mc{1} & \mc{2} & \mc{3} & \mc{4} \\ +% \midrule +% \acronym{ADF} Accanthis\detoxindex{font>typeface>ADF Venturis=\acronym{ADF} Accanthis|userman} & +% .5~~ & 1.5~~ & \textminus1.5~~ & 1.125 & +% \textminus.75~ & .25~ & \textminus2.75~ & \textminus.125 \\ +% \acronym{ADF} Venturis\detoxindex{font>typeface>ADF Venturis=\acronym{ADF} Venturis|userman} & +% .0~~ & 1.0~~ & .75~ & 1.0~~ & +% \textminus.75~ & .0~~ & \textminus.25~ & .0~~ \\ +% \acronym{CM} Roman\detoxindex{font>typeface>CM Roman=\acronym{CM} Roman|userman} & +% 1.0~~ & .75~ & 1.0~~ & 1.0~~ & +% \textminus.25~ & \textminus.5~~ & \textminus.25~ & \textminus.25~ \\ +% Domitian\detoxindex{font>typeface>Domitian|userman} & +% .25~ & 1.0~~ & .75~ & 1.0~~ & +% \textminus1.0~~ & .0~~ & \textminus.325 & \textminus.25~ \\ +% Cochineal\detoxindex{font>typeface>Cochineal|userman} & +% 1.0~~ & 1.0~~ & 1.0~~ & 1.0~~ & +% \textminus.125 & \textminus.125 & \textminus.125 & \textminus.125 \\ +% \acronym{EB} Garamond\detoxindex{font>typeface>EB Garamond=\acronym{EB} Garamond|userman} & +% .0~~ & 1.25~ & \textminus.875 & 1.325 & +% \textminus1.5~~ & .0~~ & \textminus2.0~~ & 0.125 \\ +% etbb\etbbmark\detoxindex{font>typeface>etbb|userman} & +% .25~ & 1.0~~ & 1.125 & .5~~ & +% \textminus1.0~~ & \textminus.0~~ & \textminus.0~~ & \textminus.5~~ \\ +% Extended Charter\xchartermark\detoxindex{font>typeface>Extended Charter|userman} & +% \textminus.25~ & 1.0~~ & 1.75 & .125 & +% \textminus1.125 & .0~~ & .875 & \textminus.875 \\ +% Gentium\detoxindex{font>typeface>Gentium|userman} & +% .0~~ & .75~ & .0~~ & .0~~ & +% \textminus.5~~ & \textminus.25~ & \textminus.75~ & \textminus1.0~~ \\ +% \acronym{GFS} Bodoni\detoxindex{font>typeface>GFS Bodoni=\acronym{GFS} Bodoni|userman} & +% \textminus.25~ & .625 & 1.0~~ & 1.125 & +% \textminus1.25~ & \textminus.625 & \textminus.5~~ & \textminus.25~ \\ +% \acronym{GFS} Didot\detoxindex{font>typeface>GFS Didot=\acronym{GFS} Didot|userman} & +% \textminus1.5~~ & .75~ & 1.0~~ & 1.25~ & +% \textminus2.75~ & \textminus.25~ & \textminus.25~ & .25~ \\ +% \acronym{IBM} Plex Serif\detoxindex{font>typeface>IBM Plex Serif=\acronym{IBM} Plex Serif|userman} & +% .5~~ & .5~~ & \textminus1.325 & .5~~ & +% \textminus.25~ & \textminus.25~ & \textminus2.25~ & \textminus.25~ \\ +% \acronym{KP} Serif\kpmark\detoxindex{font>typeface>KP Serif=\acronym{KP} Serif|userman} & +% .0~~ & 1.0~~ & 1.25~ & .75~ & +% \textminus1.0~~ & .0~~ & .0~~ & \textminus.5~~ \\ +% Libertinus Serif\detoxindex{font>typeface>Libertinus Serif|userman} & +% 1.0~~ & .75~ & 1.125 & .75~ & +% .0~~ & \textminus.325 & .0~~ & \textminus.25~ \\ +% \acronym{ML} Modern\detoxindex{font>typeface>ML Modern=\acronym{ML} Modern|userman} & +% 1.25~ & .75~ & 1.0~~ & .125 & +% .0~~ & \textminus.5~~ & \textminus.25~ & \textminus.125 \\ +% Source Serif Pro\detoxindex{font>typeface>Source Serif Pro|userman} & +% .125 & .75~ & \textminus1.0~~ & .125 & +% \textminus.75~ & .0~~ & \textminus2.0~~ & \textminus.75~ \\ +% Spectral\detoxindex{font>typeface>Spectral|userman} & +% .625 & .625 & \textminus1.5~~ & .625 & +% \textminus.25~ & \textminus.25~ & \textminus2.5~~ & \textminus.25~ \\ +% \acronym{STIX}\detoxindex{font>typeface>STIX=\acronym{STIX}|userman} & +% 1.0~~ & 1.0~~ & .75~ & 1.0~~ & +% .0~~ & .0~~ & .0~~ & .0~~ \\ +% \acronym{URW} Palladio\palladiomark\detoxindex{font>typeface>URW Palladio=\acronym{URW} Palladio|userman} & +% .25~ & 1.125 & 1.0~~ & 1.0~~ & +% \textminus1.0~~ & \textminus.125 & \textminus.125 & \textminus.125 \\ +% Utopia Regular\utopiamark\detoxindex{font>typeface>Utopia Regular|userman} & +% .0~~ & 1.0~~ & .75~ & 1.0~~ & +% \textminus.75~ & .0~~ & \textminus.25~ & .0~~ \\ +% \bottomrule +% \end{tabular}} +% \end{tabfigures} +% +% \begin{tablenotes} +% \etbbmark\enspace \propername{Edward Tufte}'s Bembo in package~\packagename{ETbb}. Note +% the two initial capital letters in the filename. +% +% \xchartermark\enspace Found in package \packagename{XCharter}. Again note the two +% initial capitals in the filename. +% +% \kpmark\enspace In package \packagename{kpfonts}. +% +% \palladiomark\enspace Contained in package~\packagename{mathpazo}. +% +% \utopiamark\enspace Utopia is available through package~\packagename{fourier} or +% package~\packagename{mathdesign}. In the latter case pass option~\code{adobe-utopia} to +% the package. +% \end{tablenotes} +% \end{table} +% +% % \subsection[Align Last Line] % {Align Last Line of a Paragraph}\label{sec:align-last-line} -% \index{paragraph>align last line} +% \index{paragraph>align last line|userman} % % The usual algorithms of \LaTeX{} typeset the last line of a paragraph flush with the left % margin unless |center|, |raggedleft| or |Centering|, |FlushRight| % (package~\packagename{ragged2e}~\cite{package:ragged2e}) are in effect. For an instructive % discussion consult Ch.~17, \doublequotes{Paragraph End}, of Ref.~\citenum{eijkhout:2007}. -% The following environments allow to adjust the last lines of paragraphs in different ways. +% The following environments adjust the last lines of paragraphs in different ways. % % \DescribeEnv{lastlineraggedleftpar} % \DescribeEnv{lastlineflushrightpar} -% The environment |lastlineraggedleftpar|\index{paragraph>align last line>flush right} adjusts -% the various skips such that the last lines of the paragraphs gets typeset flush with the -% right margin. +% The environment \code{lastlineraggedleftpar}\index{paragraph>align last line>flush right|userman} +% adjusts the various skips such that the last lines of the paragraphs gets typeset flush with +% the right margin. % % \begin{synopsis}\label{syn:lastlineraggedleftpar}\label{syn:lastlineflushrightpar} % \cs{begin}|{lastlineraggedleftpar}| \\ @@ -2393,8 +3105,9 @@ end % The name |lastlineflushrightpar| is an alias for~\code{lastlineraggedleftpar}. % % \DescribeEnv{lastlinecenteredpar} -% Center\index{paragraph>align last line>centered} the last lines of the paragraphs enclosed by -% this environment.\footnote{Also compare the approach taken in Ref.~\citenum{wermuth:2018}.} +% Center\index{paragraph>align last line>centered|userman} the last lines of the paragraphs +% enclosed by this environment.\footnote{Also compare the approach taken in +% Ref.~\citenum{wermuth:2018}.} % % \begin{synopsis}\label{syn:lastlinecenteredpar} % \cs{begin}|{lastlinecenteredpar}| \\ @@ -2412,7 +3125,7 @@ end % \needtocspace % \subsection[Fill Last Line] % {Fill Last Line of a Paragraph}\label{sec:fill-last-line} -% \index{paragraph>fill last line} +% \index{paragraph>fill last line|userman} % % The problem of when and how to \singlequotes{fill} the last line of a paragraph is quite % intricate. We first define the problem then we proceed to general purpose functions and we @@ -2421,7 +3134,7 @@ end % % \subsubsection{Problem Definition} % -% Depending on the value of \cs{parindent}, either zero or nonzero, there may be the desire to +% Depending on the value of \cs{parindent}, either zero or nonzero, there may be the need to % control the length of the last line of a paragraph. % % \iffalse @@ -2562,7 +3275,7 @@ end % \includegraphics{crooked-paragraphs-3.mps} % \end{center} % \end{minipage}\footnotetext{Package~\packagename{parskip} defines \cs{parskip} -% as \mbox{6pt plus 2pt} for a base size of~10pt.} +% as \mbox{6\,pt plus 2\,pt} for a base size of~10\,pt.} % % \medskip % \begin{minipage}{\linewidth} @@ -2576,7 +3289,7 @@ end % % The suggestions for the gap-width vary from two~em to twice the width of a % \singlequotes{typical} \cs{parindent}\footnote{% For example, \LaTeX's class -% \packagename{article} uses a \cs{parindent} of~25pt.} for the gap~\cite{carlisle:1996}. +% \packagename{article} uses a \cs{parindent} of~25\,pt.} for the gap~\cite{carlisle:1996}. % \end{enumerate} % % \begin{tip} @@ -2598,9 +3311,10 @@ end % them should have certain advantageous properties. % % \begin{itemize} -% \item Technically, the paragraphs need to contain enough glue (see -% e.\,g.~\cref{sec:sloppy-paragraphs}) to achieve a low badness such that the desired -% paragraph end is deemed feasible by \TeX. +% \item Technically, the paragraphs need to contain enough glue (see for example +% \cref{sec:sloppy-paragraphs}) to achieve a low badness such that the desired paragraph +% end is deemed feasible by \TeX.\shiftedmarginnote{This \code{itemize} list demonstrates +% vertically adjusted label items (\cref{sec:adjust-label-items}).} % % \item Aesthetically, the paragraphs must be long enough to absorb the change in last-line % fill level otherwise their gray-values visibly deviate from the @@ -2618,18 +3332,21 @@ end % \item End-of-paragraph intervention.\label{enum:end-of-paragraph-intervention} % % \begin{enumerate}[notopsep] -% \item Tie~\sample{\texttt{\char126}}\label{enum:tie-last-words}\index{paragraph>fill last line>tie} +% \item Tie~\sample{\texttt{\char126}}\label{enum:tie-last-words} +% \index{paragraph>fill last line>tie|userman} % % Tie the last words. % % The problem with the tie may be a hyphenation of one of the words that participates in % the tie. The next item avoids this disadvantage. % -% \item \cs{mbox}\label{enum:mbox-last-words}\index{paragraph>fill last line>mbox=\cs{mbox}} +% \item \cs{mbox}\label{enum:mbox-last-words} +% \index{paragraph>fill last line>mbox=\cs{mbox}|userman} % % Join the last words or inline equation at the end of the paragraph with an~\cs{mbox}. % -% \item \cs{linebreak}\label{enum:linebreak}\index{paragraph>fill last line>linebreak=\cs{linebreak}} +% \item \cs{linebreak}\label{enum:linebreak} +% \index{paragraph>fill last line>linebreak=\cs{linebreak}|userman} % % Add a \cs{linebreak} to the back part of the paragraph (approximately where the % \cs{mbox} of item~\ref{enum:mbox-last-words} would start) in a way that the last line @@ -2646,7 +3363,8 @@ end % \item Uniform paragraph change.\label{enum:uniform-paragraph-change} % % \begin{enumerate}[notopsep] -% \item Vary spacing.\label{enum:vary-spacing}\index{font>spacing} +% \item Vary spacing.\label{enum:vary-spacing} +% \index{font>spacing|userman} % % Modify the inter-word spacing, for example, with the macros introduced in % \cref{sec:looser-tighter-spacing}. @@ -2655,13 +3373,15 @@ end % or~\hyperref[syn:tightspacing]{|tightspacing|}. % Increase the spacing~\meta{level} until the last line gets the desired length. % -% \item Vary font tracking.\label{enum:vary-font-tracking}\index{font>tracking} +% \item Vary font tracking.\label{enum:vary-font-tracking} +% \index{font>tracking|userman} % % Enclose the paragraph in a \hyperref[syn:setfonttracking]{\code{setfonttracking}}~group. % See \cref{sec:tracking-control}. Increase or decrease the tracking in steps of % \nativetextfraction{1}{1000}\,em until the last line looks good. % -% \item Vary font expansion.\label{enum:vary-font-expansion}\index{font>expansion} +% \item Vary font expansion.\label{enum:vary-font-expansion} +% \index{font>expansion|userman} % % Enclose the paragraph in a \hyperref[syn:setfontexpand]{\code{setfontexpand}}~group. See % \cref{sec:font-expansion-control}. @@ -2688,15 +3408,17 @@ end % % \DescribeEnv{shortenpar} % \DescribeEnv{prolongpar} -% The two environments |shortenpar|\index{paragraph>fill last -% line>shortenpar=\code{shortenpar}} and |prolongpar|\index{paragraph>fill last -% line>prolongpar=\code{prolongpar}} can be employed in quite general situations when a +% The two environments +% \code{shortenpar}\index{paragraph>fill last line>shortenpar=\code{shortenpar}|userman} +% and \code{prolongpar}\index{paragraph>fill last line>prolongpar=\code{prolongpar}|userman} +% can be employed in quite general situations when a % paragraph should be typeset one line longer or shorter, e.\,g., to avoid a -% widow~line\footnote{The last line of a paragraph becomes a \singlequotes{widow}\index{forlorn -% line>widow} (ger.~\foreignphrase{Hurenkind}) if it starts the following page or column.} or -% a club~line\footnote{The first line of a paragraph is called -% \singlequotes{club}\index{forlorn line>club} or~\singlequotes{orphan}\index{forlorn -% line>orphan} (ger.~\foreignphrase{Schusterjunge}) if it appears at the bottom of the page or +% widow~line\footnote{The last line of a paragraph becomes a +% \singlequotes{widow}\detoxindex{forlorn line>widow|userman} (ger.~\foreignphrase{Hurenkind}) if it +% starts the following page or column.} or a club~line\footnote{The first line of a paragraph +% is called \singlequotes{club}\detoxindex{forlorn line>club|userman} +% or~\singlequotes{orphan}\detoxindex{forlorn line>orphan|userman} +% (ger.~\foreignphrase{Schusterjunge}) if it appears at the bottom of the page or % column.}~[\citenum{knuth:1986}, p.~104 and~\citenum{mittelbach:2018c}]. (See also % \cref{sec:vtie-paragraph} for special functions to avoid clubs or widows.) % \singlequotes{Accidentally}, they also change the length of the last line of the paragraph. @@ -2730,7 +3452,8 @@ end % parameter change. % % \DescribeEnv{covernextindentpar} -% Environment |covernextindentpar|\index{paragraph>fill last line>covernextindentpar=\code{covernextindentpar}} +% Environment \code{covernextindentpar}% +% \index{paragraph>fill last line>covernextindentpar=\code{covernextindentpar}|userman} % can be helpful for \hyperref[item:o1]{case~O1}, i.\,e., a too short last line. % % \begin{synopsis}\label{syn:covernextindentpar} @@ -2747,9 +3470,10 @@ end % (if \(\cs{parindent} = 0\)), or \meta{dim} if called with an optional argument. % % \DescribeEnv{openlastlinepar} -% The next environment, |openlastlinepar|,\index{paragraph>fill last -% line>openlastlinepar=\code{openlastlinepar}} takes care of \hyperref[item:o2]{case~O2}, -% i.\,e., a last line in a paragraph that is almost full or completely filled. +% The next environment, \code{openlastlinepar},% +% \index{paragraph>fill last line>openlastlinepar=\code{openlastlinepar}|userman} +% takes care of \hyperref[item:o2]{case~O2}, i.\,e., a last line in a paragraph that is almost +% full or completely filled. % % \begin{synopsis}\label{syn:openlastlinepar} % \cs{begin}|{openlastlinepar}|\oarg{dim} \\ @@ -2769,13 +3493,15 @@ end % last line is avoided, but the result may be of \hyperref[item:o1]{type~O1} nonetheless. % % +% \toccontinuesonnextpage % \needtocspace % \Needspace{150pt} -% \subsection{Spacing}\label{sec:spacing-control}\index{font>spacing} +% \subsection{Spacing}\label{sec:spacing-control} +% \index{font>spacing|userman} % % \begin{whittyquote} -% 90~\% of design is typography. \\ -% And the other 90~\% is whitespace. \\ +% 90\% of design is typography. \\ +% And the other 90\% is whitespace. \\ % \capitalemdash*~\propername{Jeffrey Zeldman} % \end{whittyquote} % @@ -2785,7 +3511,9 @@ end % \cref{sec:microtype-frontend}. % % -% \subsubsection[Looser\kernedslash Tighter]{Looser or Tighter Spacing}\label{sec:looser-tighter-spacing}\index{font>spacing>loose}\index{font>spacing>tight} +% \subsubsection[Looser\kernedslash Tighter]{Looser or Tighter Spacing}\label{sec:looser-tighter-spacing} +% \index{font>spacing>loose|userman} +% \index{font>spacing>tight|userman} % % % \begin{whittyquote} @@ -2822,7 +3550,7 @@ end % % \begin{SCtable}[10] % \caption[Spacing changes made by \code{loosespacing}]% -% {Adjustments made by environment |loosespacing| to \cs{spaceskip}. +% {Adjustments made by environment \code{loosespacing} to \cs{spaceskip}. % The mapping of \meta{level} to the exact skip definitions are % \(1 \mapsto \formatskip{1.05}{.5}{.1}\), % \(2 \mapsto \formatskip{1.1}{.5}{.1}\), @@ -2836,7 +3564,7 @@ end % \def~{\hphantom{0}}% % \begin{tabular}{@{}ccl@{}} % \toprule -% \meta{level} & Adjustment & Comment \\ +% \meta{level} & Adjustment & Note \\ % {} & \% & \\ % \midrule % 0 & n/a & neutral \\ @@ -2861,29 +3589,29 @@ end % \cref{tab:tightspacing}. % % \begin{SCtable}[10] +% \def~{\hphantom{0}} % \caption[Spacing changes made by \code{tightspacing}]% -% {Adjustments made by environment |tightspacing| to \cs{spaceskip}. +% {Adjustments made by environment \code{tightspacing} to \cs{spaceskip}. % The mapping of \meta{level} to the exact skip definitions are -% \(1 \mapsto \formatskip{.9875}{.0125}{.5\hphantom{000}}\)\!, -% \(2 \mapsto \formatskip{.975}{.025}{.5\hphantom{00}}\)\!, -% \(3 \mapsto \formatskip{.95}{.05}{.5\hphantom{0}}\)\!, and +% \(1 \mapsto \formatskip{.9875}{.0125}{.5~~~}\)\!, +% \(2 \mapsto \formatskip{.975}{.025}{.5~~}\)\!, +% \(3 \mapsto \formatskip{.95}{.05}{.5~}\)\!, and % \(\ge 4 \mapsto \formatskip{.9}{.1}{.5}\), % where all factors scale with \cs{dimen2}, % the current font's space-width.} % \label{tab:tightspacing} % % \begin{tabfigures} -% \def~{\hphantom{0}}% % \begin{tabular}{@{}ccl@{}} % \toprule -% \meta{level} & Adjustment & Comment \\ +% \meta{level} & Adjustment & Note \\ % {} & \% & \\ % \midrule % 0 & n/a & neutral \\ -% 1 & ~{-}1.25 & default \\ -% 2 & ~{-}2.5~ & \\ -% 3 & ~{-}5\hphantom{.00} & \\ -% \(\ge\)\:4 & -10\hphantom{.00} & \\ +% 1 & ~\textminus 1.25 & default \\ +% 2 & ~\textminus 2.5~ & \\ +% 3 & ~\textminus 5\hphantom{.}~~ & \\ +% \(\ge\)\:4 & \textminus 10\hphantom{.}~~ & \\ % \bottomrule % \end{tabular} % \end{tabfigures} @@ -2902,7 +3630,8 @@ end % \end{usecases} % % -% \subsubsection{Wide Space}\label{sec:wide-space}\index{wide space} +% \subsubsection{Wide Space}\label{sec:wide-space} +% \index{wide space|userman} % % The \cs{widespace} macro and its companion \cs{narrowspace} derive their appearances from % several of the current font's \cs{fontdimen}\meta{number}s. \TeX{} addresses the latter by @@ -2914,10 +3643,11 @@ end % % \begin{SCtable} % \caption[\cs{fontdimen}\meta{number} parameters] -% {The first column~\sample{\#} states the index of the \cs{fontdimen} parameter: -% \meta{number}. Column~2 presents short descriptions of the -% \cs{fontdimen}\meta{number} parameters. As examples, the values for the current -% font are shown in column~3; they are normalized to the quad-size.\bottomstrut} +% {All \TeX{} font parameters normalized to the font's quad-size. The first +% column~\sample{\#} states the index of the \cs{fontdimen} parameter: +% \meta{number}. Column~2 presents short descriptions of +% \cs{fontdimen}\meta{number}. As examples, the values for the current font are +% shown in column~3.\bottomstrut} % \label{tab:fontdimen} % % \begin{tabfigures} @@ -2931,7 +3661,6 @@ end % \begin{tabular}{@{}lll@{}} % \toprule % \# & Description & Value \\ -% {} & & \multicolumn{1}{c}{\%} \\ % \midrule % 1 & Slant per 1\,pt height & ~~\relativefontdimen1\topstrut \\ % 2 & Interword space width & ~\relativefontdimen2 \\ @@ -2990,7 +3719,8 @@ end % \end{usecase} % % -% \subsubsection{Narrow Space}\label{sec:narrow-space}\index{narrow space} +% \subsubsection{Narrow Space}\label{sec:narrow-space} +% \index{narrow space|userman} % % \DescribeMacro{\narrowspace} % \DescribeMacro{\narrowspace*} @@ -3033,25 +3763,25 @@ end % \centering % \caption[Comparison of some space sizes] % {Exemplary comparison of standard \cs{space} versus \cs{narrowspace} and -% \cs{widespace}. All values are relative to the size of the current font's quad -% size. \cs{narrowspace} and \cs{widespace} use the package's defaults.~\visualpar -% The upper values in the Width-column for \cs{narrowspace}, and \cs{widespace} -% refer to the \(\cs{fontdimen7} \not= 0\) case and the lower ones to the -% \(\cs{fontdimen7} = 0\) code-path.} +% \cs{widespace}. All values are relative to the size of the current font's +% quad-size and shown as a percentage of it. \cs{narrowspace} and \cs{widespace} +% use the package's defaults.~\visualpar The upper values in the +% \singlequotes{Width}~column for \cs{narrowspace} and \cs{widespace} refer to the +% \(\cs{fontdimen7} \not= 0\) case and the lower ones to the \(\cs{fontdimen7} = 0\) +% code-path.} % \label{tab:space-sizes} % % \begin{tabfigures} -% \def~{\hphantom{0}}% +% \def~{\hphantom{0}} % \ExplSyntaxOn % \def\relativedimen#1{\fp_eval:n {round (1000 * (#1) / \the\fontdimen6\font) / 10}} % \def\relativefontdimen#1{\relativedimen{\the\fontdimen#1\font}} % \ExplSyntaxOff % \def\nrows{1.75} % -% \begin{tabular}{@{}llll@{}} +% \begin{tabular}{@{}l*{3}{r}@{}} % \toprule -% Name & Width & Stretch & Shrink \\ -% {} & \% & \% & \% \\ +% Macro & Width & Stretch & Shrink \\ % \midrule % \multirow{\nrows}{*}{\cs{narrowspace}} & % \relativedimen{\the\fontdimen2\font - \narrowspacestrength * \the\fontdimen7\font} & @@ -3071,7 +3801,7 @@ end % % % \subsection{\packagename{Microtype} Front\capitalhyphen End}\label{sec:microtype-frontend} -% \index{microtype=\packagename{microtype} (package)} +% \index{microtype=\packagename{microtype} (package)|userman} % % The functionalities are just front-ends of selected macros in % package~\packagename{microtype} -- welcome syntactic sugar. @@ -3091,7 +3821,8 @@ end % \end{important} % % -% \subsubsection{Tracking}\label{sec:tracking-control}\index{font>tracking} +% \subsubsection{Tracking}\label{sec:tracking-control} +% \index{font>tracking|userman} % % \begin{caution} % The tracking changes may interfere with implicit changes of tracking declared with @@ -3136,7 +3867,7 @@ end % \end{codeexample} % % If the argument of option~\code{trackingttspacing} is omitted the outer spacing defaults to -% \makeatletter\mbox{\typog@trackingttspacing}\makeatother. +% \makeatletter\mbox{\typog@config@trackingttspacing}\makeatother. % % \begin{usecases} % Nudge line breaks or hyphenation points.~\visualpar Avoid clashes of descenders and @@ -3145,7 +3876,8 @@ end % \end{usecases} % % -% \subsubsection{Font Expansion}\label{sec:font-expansion-control}\index{font>expansion} +% \subsubsection{Font Expansion}\label{sec:font-expansion-control} +% \index{font>expansion|userman} % % \DescribeEnv{setfontshrink} % \DescribeEnv{setfontstretch} @@ -3153,10 +3885,10 @@ end % component, i.\,e., shrinkability and stretchability, respectively. % % \begin{synopsis}\label{syn:setfontshrink}\label{syn:setfontstretch} -% \cs{begin}|{setfontshrink}|\marg{level} +% \cs{begin}|{setfontshrink}|\oarg{level} % \dots{} % \cs{end}|{setfontshrink}| \\ -% \cs{begin}|{setfontstretch}|\marg{level} +% \cs{begin}|{setfontstretch}|\oarg{level} % \dots{} % \cs{end}|{setfontstretch}| % \end{synopsis} @@ -3165,20 +3897,20 @@ end % summarize the values for |stretch| and |shrink| in these environments. % % \begin{SCtable} -% \caption[Shrink values of \code{setfontshrink}]% +% \caption[Shrink values of \code{setfontshrink}] % {\slightlysloppy[2] Preconfigured values for |shrink| inside of -% environment~\code{setfontshrink}. Note that all |stretch| values are zero, so the fonts -% only can shrink.} +% environment~\code{setfontshrink} as \nativetextfraction{1}{1000}\,em. Note that all +% |stretch| values are zero, so the fonts only can shrink.} % \label{tab:setfontshrink-values} % % \begin{tabfigures} +% \def~{\hphantom{0}} % \begin{tabular}{@{}cccl@{}} % \toprule -% \meta{level} & |stretch| & |shrink| & Comment \\ -% {} & \nativetextfraction{1}{1000}\,em & \nativetextfraction{1}{1000}\,em & \\ +% \meta{level} & |stretch| & |shrink| & Note \\ % \midrule % 0 & n/a & n/a & no operation \\ -% 1 & 0 & \hphantom{0}\makeatletter\typog@shrink@i\makeatother & default \\ +% 1 & 0 & ~\makeatletter\typog@shrink@i\makeatother & default \\ % 2 & 0 & \makeatletter\typog@shrink@ii\makeatother & \\ % 3 & 0 & \makeatletter\typog@shrink@iii\makeatother & \\ % \bottomrule @@ -3188,20 +3920,20 @@ end % % \begin{SCtable} % \centering -% \caption[Stretch values of \code{setfontstretch}]% +% \caption[Stretch values of \code{setfontstretch}] % {\slightlysloppy[2] Preconfigured values for |stretch| inside of -% environment~\code{setfontstretch}. Note that all |shrink| values are zero, so the fonts -% only can stretch.} +% environment~\code{setfontstretch} as \nativetextfraction{1}{1000}\,em. Note that all +% |shrink| values are zero, so the fonts only can stretch.} % \label{tab:setfontstretch-values} % % \begin{tabfigures} +% \def~{\hphantom{0}} % \begin{tabular}{@{}cccl@{}} % \toprule % \meta{level} & |stretch| & |shrink| \\ -% {} & \nativetextfraction{1}{1000}\,em & \nativetextfraction{1}{1000}\,em & \\ % \midrule % 0 & n/a & n/a & no operation \\ -% 1 & \hphantom{0}\makeatletter\typog@stretch@i\makeatother & 0 & default \\ +% 1 & ~\makeatletter\typog@stretch@i\makeatother & 0 & default \\ % 2 & \makeatletter\typog@stretch@ii\makeatother & 0 & \\ % 3 & \makeatletter\typog@stretch@iii\makeatother & 0 & \\ % \bottomrule @@ -3224,7 +3956,7 @@ end % Manipulate both, |stretch| and |shrink|~values at the same time. % % \begin{synopsis}\label{syn:setfontexpand} -% \cs{begin}|{setfontexpand}|\marg{level} +% \cs{begin}|{setfontexpand}|\oarg{level} % \dots{} % \cs{end}|{setfontexpand}| % \end{synopsis} @@ -3232,20 +3964,20 @@ end % \Cref{tab:setfontexpand-values} gives an overview of the values associated with \meta{level}. % % \begin{SCtable} -% \caption[Shrink and stretch values of \code{setfontexpand}]% +% \caption[Shrink and stretch values of \code{setfontexpand}] % {\slightlysloppy[2] Preconfigured values for |shrink| and |stretch| inside of -% environment~\code{setfontexpand}. Note that both |shrink| and |stretch| values are -% nonzero, so the fonts can shrink or expand.} +% environment~\code{setfontexpand} as \nativetextfraction{1}{1000}\,em. Note that both +% |shrink| and |stretch| values are nonzero, so the fonts can shrink or expand.} % \label{tab:setfontexpand-values} % % \begin{tabfigures} +% \def~{\hphantom{0}} % \begin{tabular}{@{}cccl@{}} % \toprule -% \meta{level} & |stretch| & |shrink| & Comment \\ -% {} & \nativetextfraction{1}{1000}\,em & \nativetextfraction{1}{1000}\,em & \\ +% \meta{level} & |stretch| & |shrink| & Note \\ % \midrule % 0 & n/a & n/a & no operation \\ -% 1 & \hphantom{0}\makeatletter\typog@stretch@i\makeatother & \hphantom{0}\makeatletter\typog@stretch@i\makeatother & default \\ +% 1 & ~\makeatletter\typog@stretch@i\makeatother & ~\makeatletter\typog@stretch@i\makeatother & default \\ % 2 & \makeatletter\typog@stretch@ii\makeatother & \makeatletter\typog@stretch@ii\makeatother & \\ % 3 & \makeatletter\typog@stretch@iii\makeatother & \makeatletter\typog@stretch@iii\makeatother & \\ % \bottomrule @@ -3302,7 +4034,8 @@ end % \end{usecases} % % -% \subsubsection{Character Protrusion}\label{sec:protrusion}\index{font>protrusion} +% \subsubsection{Character Protrusion}\label{sec:protrusion} +% \index{font>protrusion|userman} % % \DescribeEnv{nocharprotrusion} % Disable the \packagename{microtype} feature~\singlequotes{protrusion} inside of the @@ -3320,8 +4053,8 @@ end % \end{usecases} % % -% \FloatBarrier -% \subsection{Sloppy Paragraphs}\label{sec:sloppy-paragraphs}\index{paragraph>sloppy} +% \subsection{Sloppy Paragraphs}\label{sec:sloppy-paragraphs} +% \index{paragraph>sloppy|userman} % % Experienced \LaTeX{} users know that \cs{sloppy} is more of a problem by itself and not % really a viable solution of the \doublequotes{overfull~box} syndrome. @@ -3357,21 +4090,22 @@ end % % \begin{suspendshortverb} % \begin{tabfigures} +% \def~{\hphantom{0}} % \begin{tabular}{@{}ccccl@{}} % \toprule -% \meta{sloppiness} & \cs{toler-} & \cs{hfuzz} & \cs{emergency-} & Comment \\ +% \meta{sloppiness} & \cs{toler-} & \cs{hfuzz} & \cs{emergency-} & Note \\ % {} & \code{ance} & \cs{vfuzz} & \code{stretch}~\(G\) & \\ % {} & & pt & em & \\ % \midrule -% 0 & \hphantom{0}200\hphantom{\tolerancemark} & .1\hphantom{0} & 0\hphantom{.000\scaledmark} & \TeX: \verb+\fussy+ \\ -% 1 & \hphantom{0}330\tolerancemark & .15 & \hphantom{0}.375\scaledmark & default \\ -% 2 & \hphantom{0}530\tolerancemark & .2\hphantom{0} & \hphantom{0}.75\scaledmark\hphantom{0} & \\ -% 3 & \hphantom{0}870\tolerancemark & .25 & 1.125\scaledmark & \\ -% 4 & 1410\tolerancemark & .3\hphantom{0} & 1.5\scaledmark\hphantom{00} & \\ +% 0 & ~200\hphantom{\tolerancemark} & .1~ & 0\hphantom{.000\scaledmark} & \TeX: \verb+\fussy+ \\ +% 1 & ~330\tolerancemark & .15 & ~.375\scaledmark & default \\ +% 2 & ~530\tolerancemark & .2~ & ~.75\scaledmark~ & \\ +% 3 & ~870\tolerancemark & .25 & 1.125\scaledmark & \\ +% 4 & 1410\tolerancemark & .3~ & 1.5\scaledmark~~ & \\ % 5 & 2310\tolerancemark & .35 & 1.875\scaledmark & \\ -% 6 & 3760\tolerancemark & .4\hphantom{0} & 2.25\scaledmark\hphantom{0} & \\ +% 6 & 3760\tolerancemark & .4~ & 2.25\scaledmark~ & \\ % 7 & 6130\tolerancemark & .45 & 2.625\scaledmark & \\ -% \(\ge\)\:8 & 9999\hphantom{\tolerancemark} & .5\hphantom{0} & 3\hphantom{.000\scaledmark} & \TeX: \verb+\sloppy+ \\ +% \(\ge\)\:8 & 9999\hphantom{\tolerancemark} & .5~ & 3\hphantom{.000\scaledmark} & \TeX: \verb+\sloppy+ \\ % \bottomrule % \end{tabular} % \end{tabfigures} @@ -3403,8 +4137,8 @@ end % \end{usecases} % % -% \FloatBarrier -% \subsection{Vertically Partially-Tied Paragraphs}\label{sec:vtie-paragraph}\index{paragraph>vertically tied} +% \subsection{Vertically Partially-Tied Paragraphs}\label{sec:vtie-paragraph} +% \index{paragraph>vertically tied|userman} % % \LaTeX{} provides several macros and environments to tie material vertically~-- most % prominently |samepage| and |minipage|.\footnote{A valuable complement to these is @@ -3421,7 +4155,7 @@ end % % \DescribeMacro{\vtietop} % \DescribeEnv{vtietoppar} -% Avoid a club\index{forlorn line>club} line in each partial paragraph. +% Avoid a club\index{forlorn line>club|userman} line in each partial paragraph. % % \begin{synopsis}\label{syn:vtietop}\label{syn:vtietoppar} % \cs{vtietop}\oarg{number-of-lines} \\[\smallskipamount] @@ -3436,16 +4170,17 @@ end % % \begin{usecases} % String together the first paragraph right after a sectioning command.~\visualpar Tie the -% first line of an itemized, enumerated, or a description list\index{list} with the paragraph -% following~\cs{item}. +% first line of an itemized, enumerated, or a description list\index{list|userman} with the +% paragraph following~\cs{item}. % \end{usecases} % % \noindent % \DescribeMacro{\splicevtietop} -% Inside of a \code{list} a one-off solution simply concatenates \cs{item}[\dots]\cs{vtietop} -% to fuse the line with the \code{item\#}, the representation of the \code{enum\#}, or the -% description term with the first paragraph. For a systematic use prefer \cs{splicevtietop} -% and apply it as the first thing in the \code{list}~body. +% Inside of a \code{list} a one-off solution simply concatenates +% \cs{item}[\dots\itcorr{-5}]\cs{vtietop} to fuse the line with the \code{item\#}, the +% representation of the \code{enum\#}, or the description term with the first paragraph. For a +% systematic use prefer \cs{splicevtietop} and apply it as the first thing in the +% \code{list}~body. % % \begin{synopsis}\label{syn:splicevtietop} % \cs{splicevtietop}\oarg{number-of-lines} @@ -3492,7 +4227,7 @@ end % \noindent % \DescribeMacro{\vtiebot} % \DescribeEnv{vtiebotpar} -% Avoid a widow\index{forlorn line>widow} line in each partial paragraph. +% Avoid a widow\index{forlorn line>widow|userman} line in each partial paragraph. % % \begin{synopsis}\label{syn:vtiebot}\label{syn:vtiebotpar} % \cs{vtiebot}\oarg{number-of-lines} \\[\smallskipamount] @@ -3507,7 +4242,8 @@ end % % \noindent % \DescribeEnv{vtiebotdisp} -% Avoid a display widow\index{forlorn line>display widow} line in each partial paragraph. +% Avoid a display widow\index{forlorn line>display widow|userman} line in each partial +% paragraph. % % \begin{synopsis}\label{syn:vtiebotdisp}\label{syn:vtiebotdisppar} % \cs{begin}|vtiebotdisp|\oarg{before-disp-number-of-lines} \\ @@ -3579,15 +4315,16 @@ end % % \begin{typoginspectpar}{partial-paragraphs} % \setlength{\smoothraggedrightragwidth}{8pt} -% \paragraph{Partial Paragraphs And Counting Lines.} The top-of-paragraph ties, \cs{vtietop} -% and \code{vtietoppar} count \meta{number\hyp{}of\hyp{}lines} from the beginning of every -% partial paragraph. Each displayed math in the paragraph resets the count. The -% bottom-paragraph ties, \cs{vtiebot}, \code{vtiebotpar}, \cs{vtiebotdisp}, and -% \code{vtiebotdisppar} count backward from the end of each partial paragraph. Again, each -% displayed math in the paragraph resets the count. According to \TeX's rules, a displayed -% math formula always is counted as \emph{three} lines no matter its contents. -% \Cref{tab:partial-paragraph-line-counts} summarizes these rules with the help of an -% example. +% \paragraph{Partial Paragraphs And Counting Lines.} +% +% The top-of-paragraph ties, \cs{vtietop} and \code{vtietoppar} count +% \meta{number\hyp{}of\hyp{}lines} from the beginning of every partial paragraph. Each +% displayed math in the paragraph resets the count. The bottom-paragraph ties, \cs{vtiebot}, +% \code{vtiebotpar}, \cs{vtiebotdisp}, and \code{vtiebotdisppar} count backward from the end +% of each partial paragraph. Again, each displayed math in the paragraph resets the count. +% According to \TeX's rules, a displayed math formula always is counted as \emph{three} lines +% no matter its contents. \Cref{tab:partial-paragraph-line-counts} summarizes these rules +% with the help of an example. % \end{typoginspectpar} % % \begin{table} @@ -3655,11 +4392,11 @@ end % \end{usecases} % % -% \FloatBarrier -% \subsection{Breakable Displayed Equations}\label{sec:breakable-display}\index{page break} +% \subsection{Breakable Displayed Equations}\label{sec:breakable-display} +% \index{page break|userman} % % \DescribeEnv{breakabledisplay} -% Package~\packagename{amsmath}\index{amsmath=\packagename{amsmath} (package)} offers +% Package~\packagename{amsmath}\index{amsmath=\packagename{amsmath} (package)|userman} offers % \cs{allowdisplaybreaks} to render displayed equations breakable at each of their lines. % Environment~\cs{breakabledisplay} is a wrapper around it which limits the macro's influence % to the environment. Furthermore, the default \meta{level} of \code{breakabledisplay} is~3 @@ -3688,16 +4425,17 @@ end % \newcommand*{\clubmark}{\tablenotemark{\dag}} % % \begin{tabfigures} +% \def~{\hphantom{0}} % \begin{tabular}{@{}ccl@{}} % \toprule -% \meta{level} & \cs{interdisplay-} & Comment \\ +% \meta{level} & \cs{interdisplay-} & Note \\ % {} & \code{linepenalty} & \\ % \midrule % 0 & 10000 & no operation \\ -% 1 & \hphantom{0}9999 & \\ -% 2 & \hphantom{0}6999 & \\ -% 3 & \hphantom{0}2999 & default \\ -% 4 & \hphantom{0000}0\rlap{\clubmark} & \\ +% 1 & ~9999 & \\ +% 2 & ~6999 & \\ +% 3 & ~2999 & default \\ +% 4 & ~~~~0\rlap{\clubmark} & \\ % \bottomrule % \end{tabular} % \end{tabfigures} @@ -3738,7 +4476,6 @@ end % \end{usecases} % % -% \FloatBarrier % \clearpage % \subsection{\packagename{Setspace} Front-End}\label{sec:setspace-frontend} % @@ -3747,11 +4484,11 @@ end % interface of \cs{setstretch} though is unintuitive as it asks for an obscure % factor.\fontsizeinfo{setspacefontsizeinfo}\marginnote{In the copy of this document gets % typeset with~\setspacefontsizeinfo*.} The \LaTeX{} user however prefers to keep her eyes on -% the ball and set the line skip\index{baseline skip} directly (e.\,g.~12.5pt) or the lines' -% leading\index{leading} to a length or percentage of the font's size.\footnote{To find out -% about the current font's size and the \cs{baselineskip} in printable form check out -% \cref{sec:font-information} on \cpageref{sec:font-information}.} This is where the following -% macros go to bat. +% the ball and set the line skip\index{baseline skip|userman} directly (e.\,g.~12.5\,pt) or the +% lines' leading\index{leading|userman} to a length or percentage of the font's +% size.\footnote{To find out about the current font's size and the \cs{baselineskip} in +% printable form check out \cref{sec:font-information} on \cpageref{sec:font-information}.} +% This is where the following macros go to bat. % % \begin{important} % All macros that are introduced in this section rely on macro~\cs{setstretch}. So @@ -3785,24 +4522,25 @@ end % will be used in the computation. % % \begin{example} -% Let us assume we want to lighten the gray value of the copy a tad with a \cs{baselineskip} -% increased (from e.g.~12pt) to~12.5pt. To this end we say: +% \begin{itemize}[notopsep] +% \item Let us assume we want to lighten the gray value of the copy a tad with the +% \cs{baselineskip} increased from 12\,pt to~12.5\,pt. To this end we say: % % \begin{codeexample} -% \cs{setbaselineskip}\{12.5pt\}\specialsectionendhere +% \cs{setbaselineskip}\{12.5\,pt\} % \end{codeexample} -% \end{example} % -% \begin{tip} -% To set the \cs{baselineskip} relative to the current value use +% \item In a generic part of the document, where the actual \cs{baselineskip} is not known, +% we can refer to its current value and rescale it: % % \begin{codeexample} -% \cs{setbaselineskip}\{\meta{factor}\cs{baselineskip}\} +% \cs{setbaselineskip}\{\cs{baselineskip} * 12.5 / 12\} % \end{codeexample} % -% \noindent -% where \meta{factor} is a floating-point number. -% \end{tip} +% Care should be taken if code like the above is implicitly or explicitly +% repeated, because it results in a geometric series.\specialsectionendhere +% \end{itemize} +% \end{example} % % \DescribeMacro{\resetbaselineskip} % \sinceversion{Since v0.3} @@ -3816,6 +4554,9 @@ end % notion of what is a single-line \cs{baselineskip}. % % +% \hangindent=2\parindent +% \hangafter=-2 +% \noindent % \DescribeMacro{\setbaselineskippercentage} % \sinceversion{Since v0.3} % Set the \cs{baselineskip} with a relative value calculated as a percentage of the current @@ -3828,14 +4569,14 @@ end % Set \cs{baselineskip} to \(\cs{typogfontsize} \times \meta{baselineskip-percentage} / 100\). % % \begin{example} -% We modify the previous example and assume a font design size of 10pt, but now write +% We modify the previous example and assume a font design size of 10\,pt, but now write % % \begin{codeexample} % \cs{setbaselineskippercentage}\{125\} % \end{codeexample} % % \noindent -% which sets \cs{baselineskip} to \(10\text{pt} \times 125 / 100 = 12.5\text{pt}\). +% which sets \cs{baselineskip} to \(10\text{\,pt} \times 125 / 100 = 12.5\text{\,pt}\). % \end{example} % % \DescribeMacro{\setleading} @@ -3850,7 +4591,7 @@ end % \meta{leading} can be negative, e.\,g.~to set solid. % % \begin{example} -% Another solution of the previous example, given a font design size of 10pt is to write +% Another solution of the previous example, given a font design size of 10\,pt is to write % % \begin{codeexample} % \cs{setleading}\{2.5pt\} @@ -3872,14 +4613,14 @@ end % Set \cs{baselineskip} to \(\cs{typogfontsize} \times (1 + \meta{leading-percentage} / 100)\). % % \begin{example} -% We modify the previous example and again assume a font design size of 10pt, but now write +% We modify the previous example and again assume a font design size of 10\,pt, but now write % % \begin{codeexample} % \cs{setleadingpercentage}\{25\} % \end{codeexample} % % \noindent -% which sets \cs{baselineskip} to \(10\text{pt} \times (1 + 25 / 100) = 12.5\text{pt}\). +% which sets \cs{baselineskip} to \(10\text{\,pt} \times (1 + 25 / 100) = 12.5\text{\,pt}\). % \end{example} % % \smallskip @@ -3949,9 +4690,9 @@ end % \end{tip} % % -% \FloatBarrier % \clearpage -% \subsection{Smooth Ragged}\label{sec:smooth-ragged}\index{ragged right} +% \subsection{Smooth Ragged}\label{sec:smooth-ragged} +% \index{ragged right|userman} % % \begin{whittyquote} % The attention someone gives \\ @@ -3964,25 +4705,30 @@ end % \noindent % Package \packagename{typog} implements a novel approach to typeset ragged paragraphs. % Instead of setting the glue inside of a paragraph to zero and letting the line-widths vary -% accordingly~\cite{wermuth:2020} we prescribe the line-widths with the \cs{parshape}~primitive -% and leave alone the stretchability or shrinkability of the glue. +% accordingly~\cite{wermuth:2020} we prescribe the line-widths with \TeX's +% \cs{parshape}~primitive and leave alone the stretchability or shrinkability of the glue. % -% \begin{slightlysloppypar} -% \hangindent=5.5em\hangafter=-5 +% \begin{caution} +% None of the following environments work inside of lists. +% \end{caution} +% +% \begin{slightlysloppypar}[2] +% \hangindent=3.5\parindent +% \hangafter=-6 +% \noindent % \DescribeEnv{smoothraggedrightshapetriplet} % \DescribeEnv{smoothraggedrightshapequintuplet} % \DescribeEnv{smoothraggedrightshapeseptuplet} -% We introduce three environments that allow for setting three, five, or seven different -% line-lengths: \code{smoothraggedrightshapetriplet}, -% \code{smoothraggedrightshapequintuplet}, and \code{smoothraggedrightshapeseptuplet}; they -% work for paragraphs up to +% We introduce three environments that set three, five, or seven different line-lengths +% (which \TeX{} of course will repeat for paragraphs longer than three, five, or seven +% lines): \code{smoothraggedrightshapetriplet}, \code{smoothraggedrightshapequintuplet}, and +% \code{smoothraggedrightshapeseptuplet}; they work for paragraph lengths up to % \makeatletter -% \typog@triplet@max@lines, \typog@quintuplet@max@lines, or \typog@septuplet@max@lines~lines, +% \typog@triplet@max@lines, \typog@quintuplet@max@lines, and \typog@septuplet@max@lines~lines, % \makeatother % respectively. % \end{slightlysloppypar} % -% % \begin{maxipage} % \begin{synopsis}\label{syn:smoothraggedrightshapetriplet}\label{syn:smoothraggedrightshapequintuplet}\label{syn:smoothraggedrightshapeseptuplet} % \cs{begin}|{smoothraggedrightshapetriplet}|\oarg{option\dots}\marg{width1}\marg{width2}\marg{width3} \\ @@ -4224,23 +4970,47 @@ end % The default generator is |triplet|. % % \item[\cs{smoothraggedrightleftskip}=\meta{dim}] -% Value for |leftskip| to pass to the generator. Default:~0pt. +% Value for |leftskip| to pass to the generator. Default:~0\,pt. % % \item[\cs{smoothraggedrightparindent}=\meta{dim}] -% Value for |parindent| to pass to the generator. Default:~0pt. +% Value for |parindent| to pass to the generator. Default:~0\,pt. % % \item[\cs{smoothraggedrightragwidth}=\meta{dim}] -% Value for the width of the ragged right margin. Default:~2em. +% Value for the width of the ragged right margin. Default:~2\,em. % \end{description} % +% \begin{samepage} +% \def\smoothraggedrightgenerator{quintuplet} +% \setlength{\smoothraggedrightragwidth}{7pt} +% \begin{nocharprotrusion}\fussy +% \begin{smoothraggedright} +% Throughout this manual we have demonstrated how \code{smoothraggedright} environments +% work for very narrow columns namely inside of the document's margins: all maginal notes +% were typeset inside of \cs{smoothraggedright} environments (quintuplet generator, +% 1.5\,em rag width, at footnote~size in addition using +% environments~\code{slightlysloppy} and \code{loosespacing}). Here, we utilize it with +% the \smoothraggedrightgenerator~generator and a rag-width of only +% \the\smoothraggedrightragwidth{} in a paragraph that is \the\linewidth~wide and +% averages around twelve words per line. There is much more glue to adapt to the +% line-ends and thus the desired rag is archieved far easier. The sloppyness is minimal, +% this is, \cs{fussy} is in effect and character protrusion into the margins is switched +% off. A limitation of the current implementation is that it is ineffective inside of lists. +% Therefore, this paragraph has not been wrapped inside of an \singlequotes{example}, because +% all examples are coded as lists. +% \end{smoothraggedright} +% \end{nocharprotrusion} +% \end{samepage} +% % \begin{usecases} % Replacement for \cs{RaggedRight}~\cite{package:ragged2e}.~\visualpar Design alternative for % fully justified paragraphs if used with a small rag-width. % \end{usecases} % -% -% \addtocontents{toc}{\par\bigskip\hfill\textit{Table of Contents continued on next page.}} -% \addtocontents{toc}{\clearpage} +% \begin{futuredirection} +% Translate the code to \packagename{l3galley} which is part of the +% \packagename{l3experimental}~package~\cite{package:l3experimental}. Galley~code is +% supposed to work inside of lists, too. +% \end{futuredirection} % % % \sectionfinish @@ -4250,7 +5020,7 @@ end % Many other packages help with getting better output from \LaTeX. Here is a list --~in % alphabetical order~-- of the ones the author considers particularly valuable. % -% \sbox{\listlabelbox}{\packagename{microtype}} +% \sbox{\listlabelbox}{\packagename{enumitem}} % \begin{description}[font=\normalfont, labelsep*=1em, labelwidth=\wd\listlabelbox, leftmargin=!] % \item[\packagename{enumitem}] % Flexible and consistent definition of all basic \LaTeX-list types plus inline @@ -4268,6 +5038,9 @@ end % Fine control of spacing, tracking, sidebearings, character protrusion into the margins, % font expansion, and much more~\cite{package:microtype}. % +% See \Cref{sec:microtype-frontend} for a front-end to \packagename{microtype} offered by +% this package. +% % See also \propername{Khirevich's} discussion~\cite{khirevich:2013}. % % \item[\packagename{ragged2e}] @@ -4275,8 +5048,11 @@ end % |center|~\cite{package:ragged2e}. % % \item[\packagename{setspace}] -% Consistently set the document's line-spacing, i.\,e., +% Consistently set the line-spacing of a document, i.\,e., control % \cs{baselineskip}~\cite{package:setspace}. +% +% See \Cref{sec:setspace-frontend} for a front-end to \packagename{setspace} offered by this +% package. % \end{description} % % @@ -4291,26 +5067,34 @@ end % % The companion program \programname{typog-grep} for analyzing the output of % \hyperref[syn:typoginspect]{\code{typoginspect}} and -% \hyperref[syn:typoginspect]{\code{typoginspectpar}} has its own manual page. We reproduce -% it here for completeness of the documentation. +% \hyperref[syn:typoginspect]{\code{typoginspectpar}} has its own manual page. We +% reproduce it here for completeness of the documentation. % +% \addtocontents{toc}{\protect\setcounter{tocdepth}{0}} % \begin{suspendshortverb} % \setlength{\parindent}{0pt} % \setlength{\parskip}{6.0pt plus 2.0pt minus .5pt} -% \input typog-grep +% \input{typog-grep.tex} % \end{suspendshortverb} +% \addtocontents{toc}{\protect\setcounter{tocdepth}{2}} % % \sectionfinish % \clearpage -% \phantomsection -% \resetfancyhead -% \addcontentsline{toc}{section}{Change History} -% \PrintChanges +% \begingroup +% \setcounter{GlossaryColumns}{1} +% \phantomsection +% \label{sec:changes} +% \resetfancyhead +% \addtocontents{toc}{\bigskip} +% \addcontentsline{toc}{section}{\numberline{}Change History} +% \PrintChanges +% \endgroup % % \sectionfinish % \clearpage % \phantomsection -% \addcontentsline{toc}{section}{References} +% \addtocontents{toc}{\medskip} +% \addcontentsline{toc}{section}{\numberline{}References} % \begin{RaggedRight} % \begin{thebibliography}{88} % \bibitem{abrahams:2020} @@ -4354,6 +5138,12 @@ end % 1998, % \biburl{https://mirrors.ctan.org/systems/doc/etex/etex_man.pdf}. % +% \bibitem{package:mathastext} +% \bibauthor{Burnol, Jean-François}. +% \bibtitle{Package~\packagename{mathastext}}. +% 2023, +% \biburl{https://ctan.org/pkg/mathastext}. +% % \bibitem{carlisle:1996} % \bibauthor{Carlisle, David}. % \bibtitle{Russian Paragraph Shapes}. @@ -4399,6 +5189,12 @@ end % Addison Wesley, Reading\kernedslash MA, % 1986. % +% \bibitem{package:l3experimental} +% \bibauthor{The \LaTeX\ Project}. +% \bibtitle{Package~\packagename{l3experimental}}. +% 2024, +% \biburl{https://ctan.org/pkg/l3experimental}. +% % \bibitem{package:layout} % \bibauthor{McPherson, Kent}. % \bibtitle{Package~\packagename{layout}}. @@ -4450,6 +5246,13 @@ end % TUGboat, 11(1), 69\figuredash85, 1990, % \biburl{http://www.tug.org/TUGboat/Articles/tb11-1/tb27salomon.pdf}. % +% \bibitem{strizver:2014} +% \bibauthor{Strizver, Ilene}. +% \bibtitle{Type rules!: the designer's guide to professional typography}, +% 4\textsuperior{th}~ed. +% John Wiley~\& Sons, Hoboken\kernedslash NJ, +% 2014. +% % \bibitem{package:setspace} % \bibauthor{Tobin, Geoffrey,} and \bibauthor{Robin Fairbairns}. % \bibtitle{Package~\packagename{setspace}}. @@ -4526,23 +5329,35 @@ end % \end{RaggedRight} % % \sectionfinish +% +% % \clearpage -% \begin{RaggedRight} +% \begingroup % \setcounter{IndexColumns}{2} % \setlength{\columnsep}{30pt} % \label{sec:index} % \phantomsection -% \addcontentsline{toc}{section}{Index} +% \addtocontents{toc}{\medskip} +% \addcontentsline{toc}{section}{\numberline{}Index} +% \raggedcolumns +% \def\codeidx##1{\linenumberdecoration\textbf{##1}} +% \def\main##1{\linenumberdecoration\underbar{\textbf{##1}}} +% \def\usage##1{\textit{\textbf{##1}}} % \PrintIndex -% \end{RaggedRight} +% \endgroup % } % -% % \sectionfinish +% +% % \clearpage % \appendix % \section{Package Code}\label{sec:package-code} -% \addtocontents{toc}{\begingroup\small} +% \addtocontents{toc}{\protect\begin{list}{}{\leftmargin=\subsectiontocindent\parsep=0pt}} +% \addtocontents{toc}{\protect\item} +% \addtocontents{toc}{\RaggedRight} +% \addtocontents{toc}{\small} +% \addtocontents{toc}{\tocsquashedsubsections} % \addtocontents{toc}{\protect\begin{multicols}{2}} % \addtocontents{toc}{\protect\raggedcolumns} % @@ -4555,7 +5370,7 @@ end %<*package> \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{typog} - [2024/05/07 v0.3 TypoGraphic extensions] + [2024/07/08 v0.4 TypoGraphic extensions] \RequirePackage{etoolbox} \RequirePackage{everyhook} @@ -4592,17 +5407,34 @@ end % \end{macro} % % \begin{macro}{\typog@typeout} +% Our information printer. +% Just adds a prefix so that we can tease apart the \filesystem{log} later. +% +% \begin{macrocode} +\newcommand*{\typog@typeout}[1]{\typeout{typog: #1}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\typog@typeout} % Our debug information printer. % % \begin{macrocode} -\newcommand*{\typog@typeout}[1] - {\iftypog@debug - \typeout{typog: #1}% - \fi} +\newcommand*{\typog@debug@typeout}[1]{\iftypog@debug\typog@typeout{#1}\fi} % \end{macrocode} % \end{macro} % +% \begin{tcounter}{typog@@iteration} +% We want our own counter (currently for keeping track of iterations) that does not get +% trampled underfoot too easily. +% +% \begin{macrocode} +\newcounter{typog@@iteration} + +% \end{macrocode} +% \end{tcounter} +% % \begin{macro}{\typog@trim@spaces} % Pull \cs{tl\_trim\_spaces} into the \singlequotes{classic} namespace. % @@ -4693,69 +5525,149 @@ end % % Our own state\dots % -% \begin{macro}{\typog@mathitalicscorrection} +% \begin{macro}{\typog@config@mathitalicscorrection} % \begin{macrocode} -\newmuskip\typog@mathitalicscorrection +\newmuskip\typog@config@mathitalicscorrection + % \end{macrocode} % \end{macro} % -% \begin{macro}{\typog@textitalicscorrection} +% Actual \cs{labelitem}\meta{N} corrections. +% +% \begin{ldimen}{\typog@adjust@labelitemi} +% \begin{macrocode} +\newdimen{\typog@adjust@labelitemi} +% \end{macrocode} +% \end{ldimen} +% +% \begin{ldimen}{\typog@adjust@labelitemii} +% \begin{macrocode} +\newdimen{\typog@adjust@labelitemii} +% \end{macrocode} +% \end{ldimen} +% +% \begin{ldimen}{\typog@adjust@labelitemiii} +% \begin{macrocode} +\newdimen{\typog@adjust@labelitemiii} +% \end{macrocode} +% \end{ldimen} +% +% \begin{ldimen}{\typog@adjust@labelitemiv} +% \begin{macrocode} +\newdimen{\typog@adjust@labelitemiv} +% \end{macrocode} +% \end{ldimen} +% +% Configuration constants for \cs{labelitem}\meta{N} corrections. +% +% \begin{ldimen}{\typog@adjust@lowercase@labelitemi} +% \begin{macrocode} +\newdimen{\typog@adjust@lowercase@labelitemi} +% \end{macrocode} +% \end{ldimen} +% +% \begin{ldimen}{\typog@adjust@lowercase@labelitemii} +% \begin{macrocode} +\newdimen{\typog@adjust@lowercase@labelitemii} +% \end{macrocode} +% \end{ldimen} +% +% \begin{ldimen}{\typog@adjust@lowercase@labelitemiii} +% \begin{macrocode} +\newdimen{\typog@adjust@lowercase@labelitemiii} +% \end{macrocode} +% \end{ldimen} +% +% \begin{ldimen}{\typog@adjust@lowercase@labelitemiv} +% \begin{macrocode} +\newdimen{\typog@adjust@lowercase@labelitemiv} +% \end{macrocode} +% \end{ldimen} +% +% \begin{ldimen}{\typog@adjust@uppercase@labelitemi} +% \begin{macrocode} +\newdimen{\typog@adjust@uppercase@labelitemi} +% \end{macrocode} +% \end{ldimen} +% +% \begin{ldimen}{\typog@adjust@uppercase@labelitemii} +% \begin{macrocode} +\newdimen{\typog@adjust@uppercase@labelitemii} +% \end{macrocode} +% \end{ldimen} +% +% \begin{ldimen}{\typog@adjust@uppercase@labelitemiii} % \begin{macrocode} -\newlength{\typog@textitalicscorrection} +\newdimen{\typog@adjust@uppercase@labelitemiii} +% \end{macrocode} +% \end{ldimen} +% +% \begin{ldimen}{\typog@adjust@uppercase@labelitemiv} +% \begin{macrocode} +\newdimen{\typog@adjust@uppercase@labelitemiv} + +% \end{macrocode} +% \end{ldimen} +% +% Other lengths\dots +% +% \begin{macro}{\typog@config@textitalicscorrection} +% \begin{macrocode} +\newlength{\typog@config@textitalicscorrection} % \end{macrocode} % \end{macro} % -% \begin{macro}{\typog@ligaturekern} +% \begin{macro}{\typog@config@ligaturekern} % \begin{macrocode} -\newlength{\typog@ligaturekern} +\newlength{\typog@config@ligaturekern} % \end{macrocode} % \end{macro} % -% \begin{macro}{\typog@raisecapitaldash} +% \begin{macro}{\typog@config@raisecapitaldash} % \begin{macrocode} -\newlength{\typog@raisecapitaldash} +\newlength{\typog@config@raisecapitaldash} % \end{macrocode} % \end{macro} % -% \begin{macro}{\typog@raisecapitalguillemets} +% \begin{macro}{\typog@config@raisecapitalguillemets} % \begin{macrocode} -\newlength{\typog@raisecapitalguillemets} +\newlength{\typog@config@raisecapitalguillemets} % \end{macrocode} % \end{macro} % -% \begin{macro}{\typog@raisecapitalhyphen} +% \begin{macro}{\typog@config@raisecapitalhyphen} % \begin{macrocode} -\newlength{\typog@raisecapitalhyphen} +\newlength{\typog@config@raisecapitalhyphen} % \end{macrocode} % \end{macro} % -% \begin{macro}{\typog@raisecapitaltimes} +% \begin{macro}{\typog@config@raisecapitaltimes} % \begin{macrocode} -\newlength{\typog@raisecapitaltimes} +\newlength{\typog@config@raisecapitaltimes} % \end{macrocode} % \end{macro} % -% \begin{macro}{\typog@raiseguillemets} +% \begin{macro}{\typog@config@raiseguillemets} % \begin{macrocode} -\newlength{\typog@raiseguillemets} +\newlength{\typog@config@raiseguillemets} % \end{macrocode} % \end{macro} % -% \begin{macro}{\typog@raisefiguredash} +% \begin{macro}{\typog@config@raisefiguredash} % \begin{macrocode} -\newlength{\typog@raisefiguredash} +\newlength{\typog@config@raisefiguredash} % \end{macrocode} % \end{macro} % -% \begin{macro}{\typog@slashkern} +% \begin{macro}{\typog@config@slashkern} % \begin{macrocode} -\newlength{\typog@slashkern} +\newlength{\typog@config@slashkern} % \end{macrocode} % \end{macro} % -% \begin{macro}{\typog@breakpenalty} +% \begin{macro}{\typog@config@breakpenalty} % \begin{macrocode} -\newcommand*{\typog@breakpenalty}{\exhyphenpenalty} +\newcommand*{\typog@config@breakpenalty}{\exhyphenpenalty} % \end{macrocode} % \end{macro} % @@ -4771,9 +5683,9 @@ end % \end{macrocode} % \end{macro} % -% \begin{macro}{\typog@trackingttspacing} +% \begin{macro}{\typog@config@trackingttspacing} % \begin{macrocode} -\newcommand*{\typog@trackingttspacing}{300, 90, 60} +\newcommand*{\typog@config@trackingttspacing}{300, 90, 60} % \end{macrocode} % \end{macro} % @@ -4871,77 +5783,99 @@ end \newcommand*{\typog@set@shrink@limits} {\edef\typog@@star{*}% - \edef\typog@@limit{\typog@triple@get@i{\typog@shrinklimits}}% + \edef\typog@@limit{\typog@triple@get@i{\typog@config@shrinklimits}}% \unless\ifx\typog@@limit\typog@@star\edef\typog@shrink@i{\number\typog@@limit}\fi - \edef\typog@@limit{\typog@triple@get@ii{\typog@shrinklimits}}% + \edef\typog@@limit{\typog@triple@get@ii{\typog@config@shrinklimits}}% \unless\ifx\typog@@limit\typog@@star\edef\typog@shrink@ii{\number\typog@@limit}\fi - \edef\typog@@limit{\typog@triple@get@iii{\typog@shrinklimits}}% + \edef\typog@@limit{\typog@triple@get@iii{\typog@config@shrinklimits}}% \unless\ifx\typog@@limit\typog@@star\edef\typog@shrink@iii{\number\typog@@limit}\fi} \newcommand*{\typog@set@stretch@limits} {\edef\typog@@star{*}% - \edef\typog@@limit{\typog@triple@get@i{\typog@stretchlimits}}% + \edef\typog@@limit{\typog@triple@get@i{\typog@config@stretchlimits}}% \unless\ifx\typog@@limit\typog@@star\edef\typog@stretch@i{\number\typog@@limit}\fi - \edef\typog@@limit{\typog@triple@get@ii{\typog@stretchlimits}}% + \edef\typog@@limit{\typog@triple@get@ii{\typog@config@stretchlimits}}% \unless\ifx\typog@@limit\typog@@star\edef\typog@stretch@ii{\number\typog@@limit}\fi - \edef\typog@@limit{\typog@triple@get@iii{\typog@stretchlimits}}% + \edef\typog@@limit{\typog@triple@get@iii{\typog@config@stretchlimits}}% \unless\ifx\typog@@limit\typog@@star\edef\typog@stretch@iii{\number\typog@@limit}\fi} \DeclareOptionX<typog>{breakpenalty}% - {\renewcommand*{\typog@breakpenalty}{#1}} + {\renewcommand*{\typog@config@breakpenalty}{#1}} \DeclareOptionX<typog>{debug}{\typog@debugtrue} \DeclareOptionX<typog>{mathitalicscorrection}[.4mu]% - {\typog@mathitalicscorrection=#1\relax}% + {\typog@config@mathitalicscorrection=#1\relax}% \DeclareOptionX<typog>{nodebug}{\typog@debugfalse} \DeclareOptionX<typog>{textitalicscorrection}[.02em]% - {\setlength{\typog@textitalicscorrection}{#1}} + {\setlength{\typog@config@textitalicscorrection}{#1}} \DeclareOptionX<typog>{ligaturekern}[.033333em]% - {\setlength{\typog@ligaturekern}{#1}} + {\setlength{\typog@config@ligaturekern}{#1}} +\DeclareOptionX<typog>{lowercaselabelitemadjustments}% + {\typog@debug@typeout{lowercaselabelitemadjustments={#1}} + \def\typog@@do##1{\addtocounter{typog@@iteration}{1} + \global\setlength{\csname typog@adjust@lowercase@labelitem\romannumeral\thetypog@@iteration\endcsname}{##1}} + \setcounter{typog@@iteration}{0} + \forcsvlist{\typog@@do}{#1}} +\newcommand*{\typog@config@lowercaselabelitemadjustments} + {\the\typog@adjust@lowercase@labelitemi,\space + \the\typog@adjust@lowercase@labelitemii,\space + \the\typog@adjust@lowercase@labelitemiii,\space + \the\typog@adjust@lowercase@labelitemiv} \DeclareOptionX<typog>{raisecapitaldash}[\z@]% - {\setlength{\typog@raisecapitaldash}{#1}} + {\setlength{\typog@config@raisecapitaldash}{#1}} \DeclareOptionX<typog>{raisecapitalguillemets}[\z@]% - {\setlength{\typog@raisecapitalguillemets}{#1}} + {\setlength{\typog@config@raisecapitalguillemets}{#1}} \DeclareOptionX<typog>{raisecapitalhyphen}[\z@]% - {\setlength{\typog@raisecapitalhyphen}{#1}} + {\setlength{\typog@config@raisecapitalhyphen}{#1}} \DeclareOptionX<typog>{raisecapitaltimes}[\z@]% - {\setlength{\typog@raisecapitaltimes}{#1}} + {\setlength{\typog@config@raisecapitaltimes}{#1}} \DeclareOptionX<typog>{raiseguillemets}[\z@]% - {\setlength{\typog@raiseguillemets}{#1}} + {\setlength{\typog@config@raiseguillemets}{#1}} \DeclareOptionX<typog>{raisefiguredash}[\z@]% - {\setlength{\typog@raisefiguredash}{#1}} + {\setlength{\typog@config@raisefiguredash}{#1}} \DeclareOptionX<typog>{raise*}[\z@]% - {\setlength{\typog@raisecapitaldash}{#1}% - \setlength{\typog@raisecapitalhyphen}{#1}% - \setlength{\typog@raisecapitaltimes}{#1}% - \setlength{\typog@raisefiguredash}{#1}} + {\setlength{\typog@config@raisecapitaldash}{#1}% + \setlength{\typog@config@raisecapitalhyphen}{#1}% + \setlength{\typog@config@raisecapitaltimes}{#1}% + \setlength{\typog@config@raisefiguredash}{#1}} \DeclareOptionX<typog>{shrinklimits}% [\typog@default@shrink@i, \typog@default@shrink@ii, \typog@default@shrink@iii]% {\typog@require@preloaded@microtype \ifx\@onlypreamble\@notprerr \PackageWarning{typog}{option `shrinklimits' can only be used in the preamble}% \else - \edef\typog@shrinklimits{#1}% + \edef\typog@config@shrinklimits{#1}% \typog@set@shrink@limits \fi} \DeclareOptionX<typog>{slashkern}[.05em]% - {\setlength{\typog@slashkern}{#1}} + {\setlength{\typog@config@slashkern}{#1}} \DeclareOptionX<typog>{stretchlimits}% [\typog@default@stretch@i, \typog@default@stretch@ii, \typog@default@stretch@iii]% {\typog@require@preloaded@microtype \ifx\@onlypreamble\@notprerr \PackageWarning{typog}{option `stretchlimits' can only be used in the preamble}% \else - \edef\typog@stretchlimits{#1}% + \edef\typog@config@stretchlimits{#1}% \typog@set@stretch@limits \fi} -\DeclareOptionX<typog>{trackingttspacing}[\typog@trackingttspacing]% +\DeclareOptionX<typog>{trackingttspacing}[\typog@config@trackingttspacing]% {\typog@require@preloaded@microtype \ifx\@onlypreamble\@notprerr \PackageWarning{typog}{option `trackingttspacing' can only be used in the preamble}% \else - \typog@typeout{trackingttspacing=#1}% + \typog@debug@typeout{trackingttspacing=#1}% \SetTracking[outer spacing={#1}]{encoding=*, family=tt*}{0}% \fi} +\DeclareOptionX<typog>{uppercaselabelitemadjustments}% + {\typog@debug@typeout{uppercaselabelitemadjustments={#1}} + \def\typog@@do##1{\addtocounter{typog@@iteration}{1} + \setlength{\csname typog@adjust@uppercase@labelitem\romannumeral\thetypog@@iteration\endcsname}{##1}} + \setcounter{typog@@iteration}{0} + \forcsvlist{\typog@@do}{#1}} +\newcommand*{\typog@config@uppercaselabelitemadjustments} + {\the\typog@adjust@uppercase@labelitemi,\space + \the\typog@adjust@uppercase@labelitemii,\space + \the\typog@adjust@uppercase@labelitemiii,\space + \the\typog@adjust@uppercase@labelitemiv} \newcommand*{\typog@initialize@options} {\ExecuteOptionsX<typog>{ @@ -4963,7 +5897,7 @@ end % \fi % % -% \subsection*{Setup} +% \subsection{Setup and Reconfiguration} % % \begin{environment}{typogsetup} % An empty argument list resets all initialized values to their defaults. @@ -4982,8 +5916,42 @@ end % \end{environment} % % \begin{macro}{\typogget} +% Access the package's configuration (name-)space. +% % \begin{macrocode} -\NewDocumentCommand{\typogget}{m}{\csname typog@#1\endcsname} +\NewDocumentCommand{\typogget}{m}{\csname typog@config@#1\endcsname} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\typoggetnth} +% \changes{v0.4}{2024-05-15}{New macro.} +% Access the \(n\)\textsuperscript{th} element of a comma-separated, list-like configuration +% item's value. +% +% \begin{macrocode} +\ExplSyntaxOn +\cs_generate_variant:Nn \seq_set_split:Nnn {Nne} +\cs_new:Npn \typog_get_nth_csname:cnn #1#2#3 + { + \seq_set_split:Nne \l_tmpa_seq {,} {\cs:w typog@config@#2 \cs_end:} + \cs_gset:cpn {#1} {\seq_item:Nn \l_tmpa_seq {#3}} + } +\cs_new:Npn \typog_get_nth_dimen:nnn #1#2#3 + { + \seq_set_split:Nne \l_tmpa_seq {,} {\cs:w typog@config@#2 \cs_end:} + \dim_set:Nn {#1} {\seq_item:Nn \l_tmpa_seq {#3}} + } +\NewDocumentCommand{\typoggetnth}{m m m}{ + \token_if_dim_register:NTF {#1} + { + \typog_get_nth_dimen:nnn {#1} {#2} {#3} + } + { + \typog_get_nth_csname:cnn {#1} {#2} {#3} + } +} +\ExplSyntaxOff % \end{macrocode} % \end{macro} @@ -5065,6 +6033,7 @@ end % % \begin{macrocode} \newcounter{typog@inspect@count} + % \end{macrocode} % \end{macro} % @@ -5085,11 +6054,16 @@ end \edef\typog@@arg{#2}% \ifx\typog@@arg\empty \stepcounter{typog@inspect@count}% - \edef\typog@@id{\typog@default@inspect@id@prefix\arabic{typog@inspect@count}}% + \edef\typog@@id{\typog@default@inspect@id@prefix + \arabic{typog@inspect@count}}% \else \edef\typog@@id{\typog@trim@spaces{\typog@@arg}}% \fi - \typeout{<typog-inspect id="\typog@@id" job="\jobname" line="\the\inputlineno" page="\the\value{page}">}% + \typeout{<typog-inspect\space + id="\typog@@id"\space + job="\jobname"\space + line="\the\inputlineno"\space + page="\the\value{page}">}% % \end{macrocode} % % Set both badness thresholds to absurdly low values as to activate \TeX's reports. @@ -5210,7 +6184,7 @@ end % \begin{macro}{\nolig} % \begin{macrocode} \NewDocumentCommand{\nolig}{s o} - {\dimen0=\IfNoValueTF{#2}{\typog@ligaturekern}{#2\typog@dim@unit}% + {\dimen0=\IfNoValueTF{#2}{\typog@config@ligaturekern}{#2\typog@dim@unit}% \IfBooleanTF{#1}% {\kern\dimen0\ignorespaces}% {\discretionary{\typog@hyphen}{}{\kern\dimen0}% @@ -5249,7 +6223,7 @@ end % % \begin{macrocode} \newcommand*{\typog@itcorr@text@unconditional}[1] - {\kern#1\typog@textitalicscorrection} + {\kern#1\typog@config@textitalicscorrection} % \end{macrocode} % \end{macro} % @@ -5275,7 +6249,7 @@ end % % \begin{macrocode} \newcommand*{\typog@itcorr@math}[1] - {\mkern#1\typog@mathitalicscorrection} + {\mkern#1\typog@config@mathitalicscorrection} % \end{macrocode} % \end{macro} % @@ -5326,11 +6300,11 @@ end % % \begin{macrocode} \NewDocumentCommand{\kernedslash}{s} - {\hspace*{\typog@slashkern}% + {\hspace*{\typog@config@slashkern}% \typog@forwardslash \IfBooleanTF{#1}% - {\hspace*{\typog@slashkern}\ignorespaces}% - {\typog@breakpoint\typog@allowhyphenation\hspace*{\typog@slashkern}}} + {\hspace*{\typog@config@slashkern}\ignorespaces}% + {\typog@breakpoint\typog@allowhyphenation\hspace*{\typog@config@slashkern}}} % \end{macrocode} % % \acronym{PDF}-substitute definition @@ -5358,7 +6332,7 @@ end \def\typog@@optarg{#2}% \hspace*{#3\typog@dim@unit}% \raisebox{\ifx\typog@@optarg\typog@@auto - \typog@raisecapitalhyphen + \typog@config@raisecapitalhyphen \else \typog@@optarg\typog@dim@unit \fi}{\typog@hyphen}% @@ -5428,7 +6402,7 @@ end % % \begin{macrocode} \newcommand*{\typog@breakpoint} - {\penalty\typog@breakpenalty} + {\penalty\typog@config@breakpenalty} % \end{macrocode} % \end{macro} % @@ -5439,7 +6413,7 @@ end % % \begin{macrocode} \NewDocumentCommand{\capitalhyphen}{s} - {\raisebox{\typog@raisecapitalhyphen}{\typog@hyphen}% + {\raisebox{\typog@config@raisecapitalhyphen}{\typog@hyphen}% \IfBooleanTF{#1}% {\ignorespaces}% {\typog@breakpoint\typog@allowhyphenation}} @@ -5473,7 +6447,7 @@ end % % \begin{macrocode} \NewDocumentCommand{\capitalendash}{s} - {\raisebox{\typog@raisecapitaldash}{\textendash}% + {\raisebox{\typog@config@raisecapitaldash}{\textendash}% \IfBooleanTF{#1}% {\ignorespaces}% {\typog@breakpoint\typog@allowhyphenation}} @@ -5503,7 +6477,7 @@ end % % \begin{macrocode} \NewDocumentCommand{\capitalemdash}{s} - {\raisebox{\typog@raisecapitaldash}{\textemdash}% + {\raisebox{\typog@config@raisecapitaldash}{\textemdash}% \IfBooleanTF{#1}% {\ignorespaces}% {\typog@breakpoint\typog@allowhyphenation}} @@ -5531,7 +6505,7 @@ end % % \begin{macrocode} \NewDocumentCommand{\figuredash}{s} - {\raisebox{\typog@raisefiguredash}{\textendash}% + {\raisebox{\typog@config@raisefiguredash}{\textendash}% \IfBooleanTF{#1}% {\ignorespaces}% {\typog@breakpoint\typog@allowhyphenation}} @@ -5550,9 +6524,9 @@ end % \begin{macrocode} \NewDocumentCommand{\capitaltimes}{} {\ifmmode - \mathbin{\raisebox{\typog@raisecapitaltimes}{$\m@th\times$}}% + \mathbin{\raisebox{\typog@config@raisecapitaltimes}{$\m@th\times$}}% \else - \raisebox{\typog@raisecapitaltimes}{\texttimes}% + \raisebox{\typog@config@raisecapitaltimes}{\texttimes}% \fi} % \end{macrocode} % @@ -5571,7 +6545,7 @@ end % \begin{macrocode} \NewDocumentCommand{\singleguillemetleft}{} {\typog@allowhyphenation - \raisebox{\typog@raiseguillemets}{\guilsinglleft}} + \raisebox{\typog@config@raiseguillemets}{\guilsinglleft}} % \end{macrocode} % % \acronym{PDF}-substitute definition @@ -5584,7 +6558,7 @@ end % \begin{macro}{\singleguillemetright} % \begin{macrocode} \NewDocumentCommand{\singleguillemetright}{} - {\raisebox{\typog@raiseguillemets}{\guilsinglright}% + {\raisebox{\typog@config@raiseguillemets}{\guilsinglright}% \typog@allowhyphenation} % \end{macrocode} % @@ -5599,7 +6573,7 @@ end % \begin{macrocode} \NewDocumentCommand{\doubleguillemetleft}{} {\typog@allowhyphenation - \raisebox{\typog@raiseguillemets}{\guillemotleft}} + \raisebox{\typog@config@raiseguillemets}{\guillemotleft}} % \end{macrocode} % % \acronym{PDF}-substitute definition @@ -5612,7 +6586,7 @@ end % \begin{macro}{\doubleguillemetright} % \begin{macrocode} \NewDocumentCommand{\doubleguillemetright}{} - {\raisebox{\typog@raiseguillemets}{\guillemotright}% + {\raisebox{\typog@config@raiseguillemets}{\guillemotright}% \typog@allowhyphenation} % \end{macrocode} % @@ -5627,7 +6601,7 @@ end % \begin{macrocode} \NewDocumentCommand{\Singleguillemetleft}{} {\typog@allowhyphenation - \raisebox{\typog@raisecapitalguillemets}{\guilsinglleft}} + \raisebox{\typog@config@raisecapitalguillemets}{\guilsinglleft}} % \end{macrocode} % % \acronym{PDF}-substitute definition @@ -5640,7 +6614,7 @@ end % \begin{macro}{\Singleguillemetright} % \begin{macrocode} \NewDocumentCommand{\Singleguillemetright}{} - {\raisebox{\typog@raisecapitalguillemets}{\guilsinglright}% + {\raisebox{\typog@config@raisecapitalguillemets}{\guilsinglright}% \typog@allowhyphenation} % \end{macrocode} % @@ -5655,7 +6629,7 @@ end % \begin{macrocode} \NewDocumentCommand{\Doubleguillemetleft}{} {\typog@allowhyphenation - \raisebox{\typog@raisecapitalguillemets}{\guillemotleft}} + \raisebox{\typog@config@raisecapitalguillemets}{\guillemotleft}} % \end{macrocode} % % \acronym{PDF}-substitute definition @@ -5668,7 +6642,7 @@ end % \begin{macro}{\Doubleguillemetright} % \begin{macrocode} \NewDocumentCommand{\Doubleguillemetright}{} - {\raisebox{\typog@raisecapitalguillemets}{\guillemotright}% + {\raisebox{\typog@config@raisecapitalguillemets}{\guillemotright}% \typog@allowhyphenation} % \end{macrocode} % @@ -5681,6 +6655,457 @@ end % \end{macro} % % +% \subsection{Vert. Adjust Label Items} +% +% \begin{macro}{\@typog@uppercase@adjust@labelitem} +% Handle all possible requests for uppercase label item correction. +% Patch |itemize|~environments. +% +% \begin{macrocode} +\newcommand*{\@typog@uppercase@adjust@labelitem}[1] + {\@typog@maybe@patch@itemize + \ifstrequal{#1}{*} + {\setlength{\typog@adjust@labelitemi} + {\typog@adjust@uppercase@labelitemi} + \setlength{\typog@adjust@labelitemii} + {\typog@adjust@uppercase@labelitemii} + \setlength{\typog@adjust@labelitemiii} + {\typog@adjust@uppercase@labelitemiii} + \setlength{\typog@adjust@labelitemiv} + {\typog@adjust@uppercase@labelitemiv}} + {\ifcase #1% 0 + \relax % outside of any itemize environment + \or % 1 + \setlength{\typog@adjust@labelitemi} + {\typog@adjust@uppercase@labelitemi} + \or % 2 + \setlength{\typog@adjust@labelitemii} + {\typog@adjust@uppercase@labelitemii} + \or % 3 + \setlength{\typog@adjust@labelitemiii} + {\typog@adjust@uppercase@labelitemiii} + \or % 4 + \setlength{\typog@adjust@labelitemiv} + {\typog@adjust@uppercase@labelitemiv} + \else + \PackageError{typog} + {Itemize level out of range} + {Valid levels are 1, 2, 3, 4, and *} + \fi}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@typog@lowercase@adjust@labelitem} +% Handle all possible requests for lowercase label item correction. +% Patch |itemize|~environments. +% +% \begin{macrocode} +\newcommand*{\@typog@lowercase@adjust@labelitem}[1] + {\@typog@maybe@patch@itemize + \ifstrequal{#1}{*} + {\setlength{\typog@adjust@labelitemi} + {\typog@adjust@lowercase@labelitemi} + \setlength{\typog@adjust@labelitemii} + {\typog@adjust@lowercase@labelitemii} + \setlength{\typog@adjust@labelitemiii} + {\typog@adjust@lowercase@labelitemiii} + \setlength{\typog@adjust@labelitemiv} + {\typog@adjust@lowercase@labelitemiv}} + {\ifcase #1% 0 + \relax % outside of any itemize environment + \or % 1 + \setlength{\typog@adjust@labelitemi} + {\typog@adjust@lowercase@labelitemi} + \or % 2 + \setlength{\typog@adjust@labelitemii} + {\typog@adjust@lowercase@labelitemii} + \or % 3 + \setlength{\typog@adjust@labelitemiii} + {\typog@adjust@lowercase@labelitemiii} + \or % 4 + \setlength{\typog@adjust@labelitemiv} + {\typog@adjust@lowercase@labelitemiv} + \else + \PackageError{typog} + {Itemize level out of range} + {Valid levels are 1, 2, 3, 4, and *} + \fi}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@typog@noadjust@labelitem} +% Neutralize all label item corrections. +% This function \emph{does not} request patching any |itemize|~environment! +% +% \begin{macrocode} +\newcommand*{\@typog@noadjust@labelitem}[1] + {\ifstrequal{#1}{*} + {\setlength{\typog@adjust@labelitemi}{\z@} + \setlength{\typog@adjust@labelitemii}{\z@} + \setlength{\typog@adjust@labelitemiii}{\z@} + \setlength{\typog@adjust@labelitemiv}{\z@}} + {\ifcase #1% 0 + \relax % outside of any itemize environment + \or % 1 + \setlength{\typog@adjust@labelitemi}{\z@} + \or % 2 + \setlength{\typog@adjust@labelitemii}{\z@} + \or % 3 + \setlength{\typog@adjust@labelitemiii}{\z@} + \or % 4 + \setlength{\typog@adjust@labelitemiv}{\z@} + \else + \PackageError{typog} + {Itemize level out of range} + {Valid levels are 1, 2, 3, 4, and *} + \fi}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\uppercaseadjustlabelitems} +% \changes{v0.4}{2024-05-14}{New macro.} +% User macro that handles lists and the treats the empty list specially. We wrap the code +% into \cs{AfterPreamble} because it may be called in the document's preamble where we don't +% know whether package~\packagename{enumitem} already has been loaded and we can patch its +% variant of \code{itemize}. +% +% \begin{macrocode} +\NewDocumentCommand{\uppercaseadjustlabelitems}{m} + {\AfterPreamble{% + \ifblank{#1} + {\@typog@uppercase@adjust@labelitem{\@itemdepth}} + {\forcsvlist{\@typog@uppercase@adjust@labelitem}{#1}}% + \ignorespaces}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\lowercaseadjustlabelitems} +% \changes{v0.4}{2024-05-14}{New macro.} +% User macro that handles lists and the treats the empty list specially. +% +% \begin{macrocode} +\NewDocumentCommand{\lowercaseadjustlabelitems}{m} + {\AfterPreamble{% + \ifblank{#1} + {\@typog@lowercase@adjust@labelitem{\@itemdepth}} + {\forcsvlist{\@typog@lowercase@adjust@labelitem}{#1}}% + \ignorespaces}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\noadjustlabelitems} +% \changes{v0.4}{2024-05-14}{New macro.} +% User macro that handles lists and the treats the empty list specially. +% +% \begin{macrocode} +\NewDocumentCommand{\noadjustlabelitems}{m} + {\ifblank{#1} + {\@typog@noadjust@labelitem{\@itemdepth}} + {\forcsvlist{\@typog@noadjust@labelitem}{#1}}% + \ignorespaces} + +% \end{macrocode} +% \end{macro} +% +% Now we get to the dirty part. All the above definitions do not get called until we hack the +% existing |itemize|-environments, either the one of plain~\LaTeX{} or the one modified by +% package~\packagename{enumitem}. +% +% Here comes the result of \code{latexdef -c article -s itemize}, which was used to derive the +% patch code: +% +% \begin{verbatim} +% \def\itemize{% +% \ifnum \@itemdepth > \thr@@ +% \@toodeep +% \else +% \advance\@itemdepth\@ne +% \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}% +% \expandafter +% \list +% \csname\@itemitem\endcsname +% {\def\makelabel##1{\hss\llap{##1}}}% +% \fi}\end{verbatim} +% +% \begin{macro}{\@typog@itemize@patch} +% This is the additional code we inject into plain \LaTeX's or +% package~\packagename{enumitem}'s \cs{itemize}. +% +% \begin{macrocode} +\newcommand*{\@typog@itemize@patch} +% \end{macrocode} +% +% Save the original definition of \cs{@itemitem} for chain-calling it later on. +% +% \begin{macrocode} + {\letcs{\@typog@old@itemitem}{\@itemitem} +% \end{macrocode} +% +% Sneak in our own macro's name. +% +% \begin{macrocode} + \edef\@itemitem{@typog@labelitem\romannumeral\the\@itemdepth} +% \end{macrocode} +% +% Redefine under the original macro's name so that our code gets called and the old code +% (\cs{@typog@old@itemitem}) is expanded. +% +% \begin{macrocode} + \expandafter\def\csname\@itemitem\endcsname + {\raisebox{\csname typog@adjust@labelitem\romannumeral\the\@itemdepth\endcsname} + {\@typog@old@itemitem}}} + +% \end{macrocode} +% \end{macro} +% +% If package~\packagename{enumitem} has been loaded, we use the \emph{same} patch. Here comes +% the result of \code{latexdef -c article -p enumitem -s enit@itemize@i} that explains, why no +% change is required: +% +% \begin{verbatim} +% \def\enit@itemize@i#1#2#3#4{% +% \ifnum #1 > #3 \relax +% \enit@toodeep +% \else +% \enit@prelist\@ne{#1}{#2}% +% \edef\@itemitem{label#2\romannumeral#1}% +% \expandafter +% \enit@list +% \csname\@itemitem\endcsname +% {\let\enit@calc\z@ +% \def\makelabel##1{\enit@align{\enit@format{##1}}}% +% \enit@preset{#2}{#1}{#4}% +% \enit@calcleft +% \enit@before +% \enit@negwidth}% +% \enit@keyfirst +% \fi}\end{verbatim} +% +% \begin{macro}{\@typog@patch@itemize} +% Unconditionally apply the patches that are just \emph{single} macro calls to disturb the +% original macros as little as possible. If we detect \packagename{enumitem} to be present +% we modify its definition of \code{itemize} otherwise we wrestle \LaTeX's macro. +% +% \begin{macrocode} +\newcommand*{\@typog@patch@itemize} + {\ifdefined\enit@itemize@i + \patchcmd{\enit@itemize@i} + {\expandafter} + {\@typog@itemize@patch\expandafter} + {\typog@debug@typeout{patching enumitem \string\enit@itemize@i\space succeeded}} + {\PackageError{typog} + {Patching enumitem macro \string\enit@itemize@i\space failed} + {}} + \else + \patchcmd{\itemize} + {\expandafter} + {\@typog@itemize@patch\expandafter} + {\typog@debug@typeout{patching \string\itemize\space succeeded}} + {\PackageError{typog} + {Patching plain LaTeX macro \string\itemize\space failed} + {}} + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@typog@maybe@patch@itemize} +% Apply the patches only once. +% +% \begin{macrocode} +\newbool{@typog@itemize@has@been@patched} +\newcommand*{\@typog@maybe@patch@itemize} + {\ifbool{@typog@itemize@has@been@patched} + {\relax} + {\@typog@patch@itemize + \booltrue{@typog@itemize@has@been@patched}}} + +% \end{macrocode} +% \end{macro} +% +% Here come our convenience macros to simplify an accurate setup of the label adjustments. +% +% \begin{macro}{\typog@hairline@width} +% Line width of the horizontal reference lines in our convenience macros. +% +% \begin{macrocode} +\newcommand*{\typog@hairline@width}{.125pt} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\typogadjuststairsfor} +% The arguments are: +% \#1: \meta{scale-factor}, +% \#2: \meta{step-size}, +% \#3: \meta{number-of-steps}, +% \#4: \meta{sample}, and +% \#5: \cs{labelitem}\meta{N}. +% +% Generate an ascending stairs of argument~\#5. +% +% \begin{macrocode} +\newcommand*{\typogadjuststairsfor}[5] +% \end{macrocode} +% +% Store (half of) the space between two samples in \cs{dimen0}. +% +% \begin{macrocode} + {\dimen0=1pt% +% \end{macrocode} +% +% Load the \meta{number-of-steps} and ensure that it is odd. +% +% \begin{macrocode} + \count0=#3\relax + \unless\ifodd\count0 + \advance\count0 by 1% + \fi +% \end{macrocode} +% +% Set the iteration counter. +% +% \begin{macrocode} + \setcounter{typog@@iteration}{1}% +% \end{macrocode} +% +% Put the \meta{sample} into a box so that we can measure it with \cs{ht}. +% +% \begin{macrocode} + \setbox0=\hbox{#4}% +% \end{macrocode} +% +% Box~1 is the accumulator for the raised samples. +% +% \begin{macrocode} + \setbox1=\hbox{}% +% \end{macrocode} +% +% Build the stairs. +% +% \begin{macrocode} + \loop + \ifnum\thetypog@@iteration=\numexpr\count0 / 2\relax + \dimen1=2\dimen0 + \else + \dimen1=\dimen0 + \fi + \dimen2=\dimexpr#2 * (\thetypog@@iteration - \count0 / 2)\relax + \setbox1=\hbox{\unhbox1\raisebox{\dimen2}{\kern\dimen1 #5\kern\dimen1}}% + \addtocounter{typog@@iteration}{1}% + \unless\ifnum\thetypog@@iteration>\count0 + \repeat +% \end{macrocode} +% +% Merge the stairs with a hairline at \#1 times the height of \meta{sample}. +% Answer just a single box. +% +% \begin{macrocode} + \mbox{\rlap{\raisebox{\fpeval{#1}\ht0}{\rule{\wd1}{\typog@hairline@width}}}\box1}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\typogadjuststairs} +% \changes{v0.4}{2024-05-14}{New macro.} +% The arguments are: +% \#1: \meta{scale-factor}, +% \#2: \meta{step-size}, +% \#3: \meta{number-of-steps}, and +% \#4: \meta{sample}. +% +% \begin{macrocode} +\NewDocumentCommand{\typogadjuststairs}{O{.5} m m m} + {\begingroup + \unless\ifdim #2>\z@ + \PackageError{typog} + {\string\typogadjuststairs\space non-positive step-size} + {step-size must be a positive dimension}% + \fi + \ifnum #3<1 + \PackageError{typog} + {\string\typogadjuststairs\space too few number-of-steps} + {number-of-steps must at least be 1}% + \fi + \ifblank{#4} + {\PackageError{typog} + {sample must not be empty} + {supply either some uppercase or some lowercase letters}} + {}% + \def\arraystretch{1}% + \begin{tabular}{@{}c@{}} + \typogadjuststairsfor{#1}{#2}{#3}{#4}{\labelitemi} \\ + \typogadjuststairsfor{#1}{#2}{#3}{#4}{\labelitemii} \\ + \typogadjuststairsfor{#1}{#2}{#3}{#4}{\labelitemiii} \\ + \typogadjuststairsfor{#1}{#2}{#3}{#4}{\labelitemiv} + \end{tabular} + \endgroup} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\typog@uppercase@adjusted@labelitems} +% Return all four labelitems in a horizontal box after they have been adjusted with the +% uppercase-constants set. +% +% \begin{macrocode} +\newcommand*{\typog@uppercase@adjusted@labelitems} + {\hbox{\raisebox{\typog@adjust@uppercase@labelitemi}{\labelitemi}% + \raisebox{\typog@adjust@uppercase@labelitemii}{\labelitemii}% + \raisebox{\typog@adjust@uppercase@labelitemiii}{\labelitemiii}% + \raisebox{\typog@adjust@uppercase@labelitemiv}{\labelitemiv}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\typoguppercaseadjustcheck} +% \changes{v0.4}{2024-05-14}{New macro.} +% We stuff the user's sample text into a box only to measure its height. We typeset all four +% labels and draw a hairline at half the height of the sample right through it. +% +% \begin{macrocode} +\NewDocumentCommand{\typoguppercaseadjustcheck}{O{.5} m} + {\setbox0=\hbox{#2}% + \setbox1=\typog@uppercase@adjusted@labelitems + \mbox{\rlap{\raisebox{\fpeval{#1}\ht0} + {\rule{\wd1}{\typog@hairline@width}}}% + \box1}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\typog@lowercase@adjusted@labelitems} +% Return all four labelitems in a horizontal box after they have been adjusted with the +% lowercase-constants set. +% +% \begin{macrocode} +\newcommand*{\typog@lowercase@adjusted@labelitems} + {\hbox{\raisebox{\typog@adjust@lowercase@labelitemi}{\labelitemi}% + \raisebox{\typog@adjust@lowercase@labelitemii}{\labelitemii}% + \raisebox{\typog@adjust@lowercase@labelitemiii}{\labelitemiii}% + \raisebox{\typog@adjust@lowercase@labelitemiv}{\labelitemiv}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\typoglowercaseadjustcheck} +% \changes{v0.4}{2024-05-14}{New macro.} +% Same code as \cs{typoguppercaseadjustcheck} for lowercase. +% +% \begin{macrocode} +\NewDocumentCommand{\typoglowercaseadjustcheck}{O{.5} m} + {\setbox0=\hbox{#2}% + \setbox1=\typog@lowercase@adjusted@labelitems + \mbox{\rlap{\raisebox{\fpeval{#1}\ht0} + {\rule{\wd1}{\typog@hairline@width}}}% + \box1}} + +% \end{macrocode} +% \end{macro} +% +% % \subsection[Align Last Line]{Align Last Line of a Paragraph} % % The code of environment |lastlineraggedleftpar| @@ -5955,7 +7380,7 @@ end % \end{environment} % % -% \subsection{Microtype Front\capitalhyphen End} +% \subsection{\packagename{Microtype} Front\capitalhyphen End} % % \subsubsection*{Tracking} % @@ -6296,7 +7721,7 @@ end % \item[Initialize.] \code{load("list\_functions")\$} % \item[\cs{tolerance}:] \code{logspace(log10(200), log10(9999), 9), numer;} % \item[\cs{emergencystretch}:] \code{linspace(0, 3, 9), numer;} -% \item[\cs{hfuzz}:] \code{linspace(0.1, 0.5, 9);} +% \item[\cs{hfuzz}:] \code{linspace(.1, .5, 9);} % \end{description} % \end{implementationnote} % @@ -6338,7 +7763,7 @@ end \NewDocumentCommand{\vtietop}{O{3}} {\setcounter{typog@mean@penalty} {\typog@geometric@mean{\@M}{\clubpenalty}}% - \typog@typeout{vtietop: penalties \the\@M--\the\value{typog@mean@penalty}--\the\clubpenalty}% + \typog@debug@typeout{vtietop: penalties \the\@M--\the\value{typog@mean@penalty}--\the\clubpenalty}% \unless\ifnum\clubpenalty<\@M \PackageWarning{typog}{vtietop: clubpenalty=\the\clubpenalty\space>= 10000}% \fi @@ -6426,7 +7851,7 @@ end \NewDocumentCommand{\vtiebot}{O{3}} {\setcounter{typog@mean@penalty} {\typog@geometric@mean{\@M}{\widowpenalty}}% - \typog@typeout{vtiebot: penalties \the\@M--\the\value{typog@mean@penalty}--\the\widowpenalty}% + \typog@debug@typeout{vtiebot: penalties \the\@M--\the\value{typog@mean@penalty}--\the\widowpenalty}% \unless\ifnum\widowpenalty<\@M \PackageWarning{typog}{vtiebot: widowpenalty=\the\widowpenalty\space>= 10000}% \fi @@ -6494,7 +7919,7 @@ end \NewDocumentCommand{\typog@vtiebotdisp}{m} {\setcounter{typog@mean@penalty} {\typog@geometric@mean{\@M}{\displaywidowpenalty}}% - \typog@typeout{vtiebotdisp: penalties \the\@M--\the\value{typog@mean@penalty}--\the\displaywidowpenalty}% + \typog@debug@typeout{vtiebotdisp: penalties \the\@M--\the\value{typog@mean@penalty}--\the\displaywidowpenalty}% \unless\ifnum\displaywidowpenalty<\@M \PackageWarning{typog}{vtiebotdisp: displaywidowpenalty=\the\displaywidowpenalty\space>= 10000}% \fi @@ -6588,7 +8013,7 @@ end % \end{environment} % % -% \subsection{Setspace Front-End} +% \subsection{\packagename{Setspace} Front-End} % % \begin{macro}{\typog@iter@limit} % The maximum number of iterations we perform before bailing out with an error. Can be @@ -6631,9 +8056,9 @@ end % \begin{macrocode} \dim_set:Nn \l_tmpa_dim {\glueexpr #1} - \typog@typeout{\string\setbaselineskip:\space + \typog@debug@typeout{\string\setbaselineskip:\space initial\space baselineskip:\space \the\baselineskip} - \typog@typeout{\string\setbaselineskip:\space + \typog@debug@typeout{\string\setbaselineskip:\space target\space baselineskip:\space \dim_use:N \l_tmpa_dim} \dim_compare:nNnTF {\baselineskip} > {\c_zero_dim} @@ -6686,10 +8111,10 @@ end {} } - \typog@typeout{\string\setbaselineskip:\space + \typog@debug@typeout{\string\setbaselineskip:\space final\space \string\setstretch\space argument:\space \fp_use:N \l_tmpa_fp} - \typog@typeout{\string\setbaselineskip:\space + \typog@debug@typeout{\string\setbaselineskip:\space final\space baselineskip:\space \the\baselineskip} } @@ -6756,7 +8181,7 @@ end % \begin{macrocode} \AfterEndPreamble{ \dim_set:Nn \typogfontsize {\fontdimen6\font} - \typog@typeout{\string\typogfontsize = + \typog@debug@typeout{\string\typogfontsize = \dim_use:N \typogfontsize\space (at\space begin\space of\space document)} } @@ -6892,13 +8317,13 @@ end \skip1=#2\relax \skip2=#3\relax \skip3=#4\relax - \typog@typeout{smoothraggedrightshapetriplet: skip0=\the\skip0}% - \typog@typeout{smoothraggedrightshapetriplet: skip1=\the\skip1}% - \typog@typeout{smoothraggedrightshapetriplet: skip2=\the\skip2}% - \typog@typeout{smoothraggedrightshapetriplet: skip3=\the\skip3}% + \typog@debug@typeout{smoothraggedrightshapetriplet: skip0=\the\skip0}% + \typog@debug@typeout{smoothraggedrightshapetriplet: skip1=\the\skip1}% + \typog@debug@typeout{smoothraggedrightshapetriplet: skip2=\the\skip2}% + \typog@debug@typeout{smoothraggedrightshapetriplet: skip3=\the\skip3}% \unless\ifnum\typog@mod{\typog@triplet@max@lines}{3}=0 \PackageError{typog} - {Line number of triplet generator % + {Line number of triplet generator\space (\typog@triplet@max@lines) not divisible by 3} {} \fi @@ -6943,15 +8368,15 @@ end \skip3=#4\relax \skip4=#5\relax \skip5=#6\relax - \typog@typeout{smoothraggedrightshapequintuplet: skip0=\the\skip0}% - \typog@typeout{smoothraggedrightshapequintuplet: skip1=\the\skip1}% - \typog@typeout{smoothraggedrightshapequintuplet: skip2=\the\skip2}% - \typog@typeout{smoothraggedrightshapequintuplet: skip3=\the\skip3}% - \typog@typeout{smoothraggedrightshapequintuplet: skip4=\the\skip4}% - \typog@typeout{smoothraggedrightshapequintuplet: skip5=\the\skip5}% + \typog@debug@typeout{smoothraggedrightshapequintuplet: skip0=\the\skip0}% + \typog@debug@typeout{smoothraggedrightshapequintuplet: skip1=\the\skip1}% + \typog@debug@typeout{smoothraggedrightshapequintuplet: skip2=\the\skip2}% + \typog@debug@typeout{smoothraggedrightshapequintuplet: skip3=\the\skip3}% + \typog@debug@typeout{smoothraggedrightshapequintuplet: skip4=\the\skip4}% + \typog@debug@typeout{smoothraggedrightshapequintuplet: skip5=\the\skip5}% \unless\ifnum\typog@mod{\typog@quintuplet@max@lines}{5}=0 \PackageError{typog} - {Line number of quintuplet generator % + {Line number of quintuplet generator\space (\typog@quintuplet@max@lines) not divisible by 5} {} \fi @@ -6998,17 +8423,17 @@ end \skip5=#6\relax \skip6=#7\relax \skip7=#8\relax - \typog@typeout{smoothraggedrightshapeseptuplet: skip0=\the\skip0}% - \typog@typeout{smoothraggedrightshapeseptuplet: skip1=\the\skip1}% - \typog@typeout{smoothraggedrightshapeseptuplet: skip2=\the\skip2}% - \typog@typeout{smoothraggedrightshapeseptuplet: skip3=\the\skip3}% - \typog@typeout{smoothraggedrightshapeseptuplet: skip4=\the\skip4}% - \typog@typeout{smoothraggedrightshapeseptuplet: skip5=\the\skip5}% - \typog@typeout{smoothraggedrightshapeseptuplet: skip6=\the\skip6}% - \typog@typeout{smoothraggedrightshapeseptuplet: skip7=\the\skip7}% + \typog@debug@typeout{smoothraggedrightshapeseptuplet: skip0=\the\skip0}% + \typog@debug@typeout{smoothraggedrightshapeseptuplet: skip1=\the\skip1}% + \typog@debug@typeout{smoothraggedrightshapeseptuplet: skip2=\the\skip2}% + \typog@debug@typeout{smoothraggedrightshapeseptuplet: skip3=\the\skip3}% + \typog@debug@typeout{smoothraggedrightshapeseptuplet: skip4=\the\skip4}% + \typog@debug@typeout{smoothraggedrightshapeseptuplet: skip5=\the\skip5}% + \typog@debug@typeout{smoothraggedrightshapeseptuplet: skip6=\the\skip6}% + \typog@debug@typeout{smoothraggedrightshapeseptuplet: skip7=\the\skip7}% \unless\ifnum\typog@mod{\typog@septuplet@max@lines}{7}=0 \PackageError{typog} - {Line number of septuplet generator % + {Line number of septuplet generator\space (\typog@septuplet@max@lines) not divisible by 7} {} \fi @@ -7115,7 +8540,7 @@ end % |generator=triplet| produces a \doublequotes{short line -- long line -- middle length line}~sequence. % \begin{macrocode} \typog@fuzzwidth=.25\smoothraggedrightragwidth - \typog@typeout{smoothraggedright: generator=triplet, typog@fuzzwidth=\the\typog@fuzzwidth}% + \typog@debug@typeout{smoothraggedright: generator=triplet, typog@fuzzwidth=\the\typog@fuzzwidth}% \smoothraggedrightshapetriplet[leftskip=\typog@@smoothraggedrightleftskip, parindent=\glueexpr\smoothraggedrightparindent + \parindent, #1]% @@ -7130,7 +8555,7 @@ end % |generator=quintuplet|. % \begin{macrocode} \typog@fuzzwidth=.125\smoothraggedrightragwidth - \typog@typeout{smoothraggedright: generator=quintuplet, typog@fuzzwidth=\the\typog@fuzzwidth}% + \typog@debug@typeout{smoothraggedright: generator=quintuplet, typog@fuzzwidth=\the\typog@fuzzwidth}% \smoothraggedrightshapequintuplet[leftskip=\typog@@smoothraggedrightleftskip, parindent=\glueexpr\smoothraggedrightparindent + \parindent, #1]% @@ -7153,7 +8578,7 @@ end % % \begin{macrocode} \typog@fuzzwidth=.08333\smoothraggedrightragwidth - \typog@typeout{smoothraggedright: generator=septuplet, typog@fuzzwidth=\the\typog@fuzzwidth}% + \typog@debug@typeout{smoothraggedright: generator=septuplet, typog@fuzzwidth=\the\typog@fuzzwidth}% \smoothraggedrightshapeseptuplet[leftskip=\typog@@smoothraggedrightleftskip, parindent=\glueexpr\smoothraggedrightparindent + \parindent, #1]% @@ -7198,7 +8623,7 @@ end % % % \addtocontents{toc}{\protect\end{multicols}} -% \addtocontents{toc}{\endgroup} +% \addtocontents{toc}{\protect\end{list}} % % % \Finale @@ -7220,10 +8645,14 @@ end \usepackage{fullwidth} \usepackage{hyphenat} \usepackage{mathtools} -\usepackage[activate=true, verbose=true]{microtype} +\usepackage[activate=true, verbose=false]{microtype} \usepackage{ragged2e} \usepackage[nobottomtitles*]{titlesec}\renewcommand*{\bottomtitlespace}{.2\textheight} -\usepackage[debug, trackingttspacing]{typog} +\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} @@ -7234,49 +8663,42 @@ end \def\xsfdefault{\relax} -{ - \def\examplefont{6} - - \ifcase\examplefont % 0 -- document's default sans-serif font (e.g., ecrm1000) - \gdef\examplefontname{default} - \global\let\xsf=\sf - \global\let\xsfdefault=\sfdefault - \or % 1 -- Nunito - \gdef\examplefontname{Nunito} - \usepackage{nunito} - \xdef\xsfdefault{\rmdefault} - \gdef\xsf{\let\sfdefault=\xsfdefault\sf} - \or % 2 -- OpenSans - \gdef\examplefontname{OpenSans} - \usepackage[defaultsans]{opensans} - \xdef\xsfdefault{\sfdefault} - \gdef\xsf{\let\sfdefault=\xsfdefault\sf} - \or % 3 -- Noto Sans - \gdef\examplefontname{OpenSans} - \usepackage[sfdefault]{noto} - \xdef\xsfdefault{\sfdefault} - \gdef\xsf{\let\sfdefault=\xsfdefault\sf} - \or % 4 -- Roboto - \gdef\examplefontname{Roboto} - \usepackage[sfdefault]{roboto} - \xdef\xsfdefault{\sfdefault} - \gdef\xsf{\let\sfdefault=\xsfdefault\sf} - \or % 5 -- Montserrat - \gdef\examplefontname{Montserrat Alternate} - \usepackage[alternates]{montserrat} - \xdef\xsfdefault{\sfdefault} - \gdef\xsf{\let\sfdefault=\xsfdefault\sf} - \or % 6 -- Inter - \gdef\examplefontname{Inter} - \usepackage[sfdefault]{inter} - \xdef\xsfdefault{\sfdefault} - \gdef\xsf{\let\sfdefault=\xsfdefault\sf} - \else - \SelectedUnknownExampleFont - \fi - \typeout{typog-example: font for examples: `\xsfdefault'}% -} +\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} @@ -7388,7 +8810,6 @@ end 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.} - %There is a much better way to get the desired effect:~[\dots] \newcommand*{\texbooktolerancesamplecredits} {\medskip\noindent \textsl{The sample text was taken from The~\TeX{}book~\cite[p.~107]{knuth:1986}.}} @@ -7396,7 +8817,7 @@ end \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]} + 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, @@ -7404,7 +8825,7 @@ end 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]} + 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}.}} @@ -7458,7 +8879,7 @@ end \setcounter{tocdepth}{1} -\setlength{\overfullrule}{3pt} +\setlength{\overfullrule}{0pt} \hbadness=-1 @@ -7575,7 +8996,76 @@ in the official documentation of package~\packagename{typog}. \noindent Unless otherwise noted the font used in the examples is \singlequotes{\examplefontname}. -\bigskip + +\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} @@ -8068,6 +9558,82 @@ We again compare the default implementation with the adjusted one. \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} @@ -8292,7 +9858,7 @@ consult \propername{David Carlisle's} excellent post on \propername{StackExchang \begin{center} \setlength{\overfullrule}{0pt} - \newcommand*{\spacesampletext}[1]{some#1text#1with#1spaces\rule{0.1pt}{1em}} + \newcommand*{\spacesampletext}[1]{some#1text#1with#1spaces\rule{.1pt}{1em}} \newsavebox{\narrowspacesample} \sbox{\narrowspacesample}{\spacesampletext{\narrowspace}} \newsavebox{\widespacesample} @@ -8707,7 +10273,7 @@ New settings: \baselinesetsize. \newcommand*{\relbls}{130} \paragraph{\code{\string\setbaselineskippercentage\{\relbls\}}} -\setbaselineskippercentage{1 + 2 + .3333 * 100 + 100 * 0.6667}% float expression +\setbaselineskippercentage{1 + 2 + .3333 * 100 + 100 * .6667}% float expression \setbaselineskippercentage{\relbls} \fontsizeinfo{baselinesetsize} New settings: \baselinesetsize. @@ -8840,7 +10406,7 @@ visually: \rule{.1pt}{.8em}\kern\parindent\rule{.1pt}{.8em}; % % % \iffalse -%<*nomicrotype> +%<*without-microtype> \documentclass[]{article} @@ -8853,7 +10419,9 @@ visually: \rule{.1pt}{.8em}\kern\parindent\rule{.1pt}{.8em}; {\singleguillemetright} {\singleguillemetleft} -\usepackage[]{typog} +\usepackage[uppercaselabelitemadjustments={.1em, .075em, .1em, .1em}, + lowercaselabelitemadjustments={-.025em, -.05em, -.025em, -.025em}] + {typog} \newcommand*{\packagename}[1]{\mbox{\textsf{#1}}} @@ -8868,7 +10436,9 @@ visually: \rule{.1pt}{.8em}\kern\parindent\rule{.1pt}{.8em}; \bigskip -\noindent + +\section*{No Microtype} + This example \LaTeX-document uses package~\packagename{typog} \emph{without} package~\packagename{microtype}. @@ -8876,6 +10446,38 @@ We want \packagename{typog} to be as usable as possible even without the nice features that \packagename{microtype} offers. After all \packagename{typog} is just a front-end for it. + +\section*{No EnumItem} + +We intentionally do not load package~\packagename{enumitem}, either. +So, we can test whether \packagename{typog} correctly patches the +plain \LaTeX{} definition if environment~\texttt{itemize}. + +The vertical alignment of the label items was setup for +uppercase (ABC\typoguppercaseadjustcheck{ABCXYZ}XYZ) and for +lowercase (ace\typoglowercaseadjustcheck{acexyz}xyz), though +this is not necessary for the test. + +\uppercaseadjustlabelitems{*} +\begin{itemize} +\item Level i +\item Sublist \dots + \begin{itemize} + \item Level ii + \item Sublist \dots + \begin{itemize} + \item Level iii + \item Sublist \dots + \begin{itemize} + \item Level iv + \end{itemize} + \end{itemize} + \end{itemize} +\end{itemize} + + +\section*{CSQuotes} + As we are testing a special configuration here anyhow, we hook up our quotes with package~csquotes to check whether they interact ok. @@ -8883,7 +10485,28 @@ to check whether they interact ok. \enquote{This is the outer part of the phrase which contains the \enquote{inner part}.}} \end{document} -%</nomicrotype> +%</without-microtype> +% \fi +% +% +% +% \iffalse +%<*minimal-test> +\documentclass{minimal} + +\usepackage{typog} + +\newcommand*{\raiseamount}{0.5pt} + +\begin{document} +\begin{typogsetup}{raise*=\raiseamount} + Em-dash raised by \the\typogget{raisecapitaldash} (expected: \raiseamount). +\end{typogsetup} + +\fontsizeinfo{typoinfo} +Document class ``minimal'' sets up font size and line spacing as~\typoinfo. +\end{document} +%</minimal-test> % \fi % % @@ -8902,35 +10525,49 @@ to check whether they interact ok. /@menu/,/@end menu/d ## Convert sectioning macros to our own hierarchy. -s/^@chapter \(.*\)$/\\subsection*{\\textls[40]{\1}}/ -s/^@section \(.*\)$/\\subsubsection*{\1}/ +s/^@chapter \(.*\)$/\\subsection{\\titlecase{\1}\\label{\1}}/ +s/^@section \(.*\)$/\\subsubsection{\\titlecase{\1}}\\label{\1}/ ## Make `@asis' list resemble the Texinfo format. s/@table @asis/\\begin{list}{}{\\itemindent=-20pt\\leftmargin=20pt}/ s/@end table/\\end{list}/ +## We substitute our maxipage environment for @display. +s/@display/\\begin{maxipage}/ +s/@end display/\\end{maxipage}/ + +## Translate `@example' environments. +s/@example/\\begin{quote}\\tt\\obeylines/ +s/@end example/\\end{quote}\n\n/ + ## Indenting by four spaces generates a `verbatim' environment. s/@verbatim/\\begin{verbatim}/ s/@end verbatim/\\end{verbatim}/ -## We substitute @display for our maxipage environment. -s/@display/\\begin{maxipage}/ -s/@end display/\\end{maxipage}/ - ## The argument format of the URL macro is different. s/@url{\([^,]*\), \([^}]*\)}/\\href{\1}{\2}/g ## Use our own markup. s/\.\.\./\\dots{}/g s/LaTeX/\\LaTeX{}/g -s/@file/\\textit/g +s/@file/\\emph/g s/@strong/\\textbf/g +s/@var/\\emph/g s/[w]{/mbox{/g +## Translate some Texinfo macros. +s/@backslashchar/\\char`\\\\/g +s/@lbracechar/\\{/g +s/@noindent/\\noindent/g +s/@rbracechar/\\}/g + ## Quote some special characters. s/%/\\%/g s/_/\\_/g +## Add space around alternative-indicators. +s/[|]/\\,|\\,/g + ## Adapt to how a man-page is typeset. ## En-dashes in front of long options really suck! s/--/-\\nolig*-/g @@ -8944,7 +10581,7 @@ s/@@/@/g s/\\jobname/\\textbackslash jobname/g ## Make qualified Perl names breakable. -s/::/::\\discretionary{}{}{}/g +s/::/::\\breakpoint*/g %</teximan2latex> % \fi % @@ -8960,6 +10597,7 @@ use strict; use warnings; use Data::Dumper (); +use Encode (); use English; use File::Basename (); use Getopt::Long; @@ -9011,32 +10649,32 @@ sub limit_string_length { ## We set all colors to `undef' and fill them later with the values ## of the actual configuration. my $highlight_patterns = { - PARTIAL_LINE => { - FONT_SPEC => [qr# - \\ - (?: OMS | OMX | OT1 | T1 | TS1 | U ) - (?: /[^/]+ ){5} / \S+ \s - (?: \([+-]\d+\) )? - #x, undef], - MATH => [qr# - \$ - \\ - (?: LMS | OML ) - (?: /[^/]+ ){5} / \S+ \s - (?: \([+-]\d+\) )? - .*? - \$ - #x, undef] - }, - WHOLE_LINE => { - FILL_STATE => [qr#^(?:Under|Over)full \\hbox .*$#, undef], - FIRST_VBOX => [qr#^%%#, undef], - HORIZONTAL_BREAKPOINT => [qr#^@@\d+:.*$#, undef], - HORIZONTAL_BREAK_CANDIDATE => [qr#^@[\\ ].*$#, undef], - LINE_BREAK_PASS => [qr#^@[a-z]+?pass#, undef], - TIGHTNESS => [qr#^(?:Loose|Tight) \\hbox .*$#, undef], - VERTICAL_BREAKPOINT => [qr#^% t=\d+.*$#, undef] - } + PARTIAL_LINE => { + FONT_SPEC => [qr# + \\ + (?: OMS | OMX | OT1 | T1 | TS1 | U ) + (?: /[^/]+ ){5} / \S+ \s + (?: \([+-]\d+\) )? + #x, undef], + MATH => [qr# + \$ + \\ + (?: LMS | OML ) + (?: /[^/]+ ){5} / \S+ \s + (?: \([+-]\d+\) )? + .*? + \$ + #x, undef] + }, + WHOLE_LINE => { + FILL_STATE => [qr#^(?:Under|Over)full \\hbox .*$#, undef], + FIRST_VBOX => [qr#^%%#, undef], + HORIZONTAL_BREAKPOINT => [qr#^@@\d+:.*$#, undef], + HORIZONTAL_BREAK_CANDIDATE => [qr#^@[\\ ].*$#, undef], + LINE_BREAK_PASS => [qr#^@[a-z]+?pass#, undef], + TIGHTNESS => [qr#^(?:Loose|Tight) \\hbox .*$#, undef], + VERTICAL_BREAKPOINT => [qr#^% t=\d+.*$#, undef] + } }; @@ -9048,7 +10686,7 @@ sub colorize_line { return Term::ANSIColor::colored($line, $pattern_color_pair->[1]) if $line =~ $pattern_color_pair->[0]; } - return $line if $line =~ m#^\.#; # we do not paint box contents yet + return $line if $line =~ m#^\.#; # we do not paint box contents yet $line =~ s#$highlight_patterns->{PARTIAL_LINE}->{MATH}->[0] #Term::ANSIColor::colored($MATCH, $highlight_patterns->{PARTIAL_LINE}->{MATH}->[1]) @@ -9074,13 +10712,30 @@ my $open_tag_regexp = >#x; +sub find_encoder { + my $encoding = shift; + + my $encoder; + + if ($encoding) { + $encoder = Encode::find_encoding($encoding); + if (!$encoder) { + issue_warning("encoding @{[quote_literal($encoding)]} unknown; proceeding without decoder"); + } + } + + return $encoder; +} + + sub grep_log_file { my ($options, $configuration, $file, $filename, $id_regexp) = @_; + my $encoder = find_encoder($options->{ENCODING}); my $job_name; - my $line_number = 0; # line number in the log file we are inspecting, i.e., $filename + my $line_number = 0; # line number in the log file we are inspecting, i.e., $filename my $match_count = 0; - my $source_line_number; # line number in TeX file the log refers to, i.e., "$job_name.tex" + my $source_line_number; # line number in TeX file the log refers to, i.e., "$job_name.tex" my $page_number; my $regexp_modifier = $options->{IGNORE_CASE} ? 'i' : ''; my $id_value; @@ -9094,6 +10749,8 @@ sub grep_log_file { chomp $line; $line_number++; + $line = Encode::encode_utf8($encoder->decode($line, Encode::FB_CROAK)) if $encoder; + if ($line =~ $close_tag_regexp) { fail_with_error("$filename: $line_number: mismatched open/close tags") unless @nesting_levels; pop @nesting_levels; @@ -9175,19 +10832,25 @@ sub grep_log_file { } } } + + return $match_count; } sub show_ids_in_file { my ($options, $configuration, $file, $filename, $id_regexp) = @_; + my $encoder = find_encoder($options->{ENCODING}); my $line_number = 0; + my $match_count = 0; my @nesting_levels; while (my $line = readline $file) { chomp $line; $line_number++; + $line = Encode::encode_utf8($encoder->decode($line, Encode::FB_CROAK)) if $encoder; + if ($line =~ $close_tag_regexp) { fail_with_error("$filename: $line_number: mismatched open/close tags") unless @nesting_levels; pop @nesting_levels; @@ -9200,6 +10863,7 @@ sub show_ids_in_file { my $page_number = $+{page_match}; ++$MATCH_COUNT; + ++$match_count; push @nesting_levels, 1; if ($options->{LOG_LINE_NUMBER}) { @@ -9239,6 +10903,8 @@ sub show_ids_in_file { print ' ' x $indent, $id_value, "\n"; } } + + return $match_count; } @@ -9256,7 +10922,7 @@ sub open_file_for_reading { fail_with_error("cannot open @{[quote_filesystem($filename)]}: $OS_ERROR"); } - $file; + return $file; } @@ -9272,9 +10938,9 @@ sub grep_or_show { my ($options, $configuration, $file, $filename, $id_regexp) = @_; if ($options->{SHOW_ALL_IDS}) { - show_ids_in_file($options, $configuration, $file, $filename, $id_regexp); + return show_ids_in_file($options, $configuration, $file, $filename, $id_regexp); } else { - grep_log_file($options, $configuration, $file, $filename, $id_regexp); + return grep_log_file($options, $configuration, $file, $filename, $id_regexp); } } @@ -9282,6 +10948,8 @@ sub grep_or_show { sub scan_files { my ($options, $configuration, $id_regexp, $log_filenames) = @_; + my $match_count = 0; + if (@$log_filenames) { foreach my $log_filename (@$log_filenames) { $log_filename = 'stdin' if $log_filename eq '-'; @@ -9294,15 +10962,17 @@ sub scan_files { print $filename_header; } my $file = open_file_for_reading($log_filename); - grep_or_show($options, $configuration, $file, $log_filename, $id_regexp); + $match_count += grep_or_show($options, $configuration, $file, $log_filename, $id_regexp); close_file($file, $log_filename); } } else { my $log_filename = 'stdin'; my $file = open_file_for_reading($log_filename); - grep_or_show($options, $configuration, $file, $log_filename, $id_regexp); + $match_count = grep_or_show($options, $configuration, $file, $log_filename, $id_regexp); close_file($file, $log_filename); } + + return $match_count; } @@ -9319,10 +10989,12 @@ sub redirect_and_scan_files { my $stdout = select $pager; $pager->autoflush; - scan_files($options, $configuration, $id_regexp, $log_filenames); + my $match_count = scan_files($options, $configuration, $id_regexp, $log_filenames); close $pager or issue_warning "error occurred while closing the pager (pid: $pid) pipe: $OS_ERROR"; select $stdout; + + return $match_count; } @@ -9431,6 +11103,7 @@ sub setup_configuation { my $default_options = { COLORIZE_MODE => 'auto', DEBUG => 0, + ENCODING => undef, ID => 0, IGNORE_CASE => 0, JOB_NAME => 0, @@ -9452,6 +11125,7 @@ Options --colour [WHEN] use color to highlight specific log contents WHEN is 'always', 'never', or 'auto' -C, --config KEY=VALUE set configuration KEY to VALUE + -E, --encoding ENCODING set character ENCODING of LOG-FILE -i, --[no-]id print matching id with output lines -y, --[no-]ignore-case ignore case distinctions in patterns and data -j, --[no-]job-name print \\jobname with output lines @@ -9461,10 +11135,12 @@ Options -P, --[no-]pager redirect output to pager -w, --[no-]word-regexp match only whole words - -a, --all, --any show all IDs in LOG-FILE + -a, --all, --any discover all IDs in LOG-FILE + --debug turn on debug output -h, --help display this help and exit --show-config show default configuration and exit + --show-encodings show all known encodings and exit -V, --version show version information and exit HELP_TEXT @@ -9473,6 +11149,17 @@ HELP_TEXT } +sub show_encodings { + my @all_encodings = Encode->encodings(':all'); + + foreach my $encoding (@all_encodings) { + print "$encoding\n"; + } + + exit 0; +} + + sub show_configuration { my $format_string_value = sub {quote_literal($default_configuration->{$_[0]})}; @@ -9508,10 +11195,10 @@ FIXED_CONFIGURATION_TEXT sub show_version { print <<VERSION_TEXT; -typog-grep 0.1 +typog-grep @RELEASE@ Copyright (C) 2024 by Ch. L. Spiel -License LPPL: LaTeX Project Public License version 1.3 or later +License LPPL: LaTeX Project Public License version 1.3c or later VERSION_TEXT exit 0; @@ -9527,6 +11214,7 @@ sub get_options { 'color|colour=s' => \$options->{COLORIZE_MODE}, 'C|configuration=s' => sub{setup_configuation($_[1], $configuration)}, 'debug+' => \$DEBUG, + 'E|encoding=s' => \$options->{ENCODING}, 'h|help' => \&show_help, 'i|id!' => \$options->{ID}, 'y|ignore-case!' => \$options->{IGNORE_CASE}, @@ -9535,13 +11223,18 @@ sub get_options { 'N|log-line-number!' => \$options->{LOG_LINE_NUMBER}, 'p|page-number!' => \$options->{PAGE_NUMBER}, 'P|pager!' => \$options->{REQUEST_PAGER}, + 'show-encodings' => \&show_encodings, 'show-config' => \&show_configuration, 'V|version' => \&show_version, 'w|word-regexp!' => \$options->{WORD_REGEXP}) or - fail_with_error('problems while parsing options'); + fail_with_error('problems while parsing options'); - fail_with_error("unknown colorize mode @{[quote_literal($options->{COLORIZE_MODE})]}") - unless $options->{COLORIZE_MODE} =~ m/^(?:always|auto|never)$/i + if ($options->{COLORIZE_MODE}) { + fail_with_error("unknown colorize mode @{[quote_literal($options->{COLORIZE_MODE})]}") + unless $options->{COLORIZE_MODE} =~ m/^(?:always|auto|never)$/i; + } else { + $options->{COLORIZE_MODE} = 'auto'; + } } @@ -9565,14 +11258,27 @@ sub do_colorize { sub main { $OUTPUT_IS_REDIRECTED = -t STDOUT ? 0 : 1; - my $options = {%$default_options}; my $configuration = {%$default_configuration}; + my $options = {%$default_options}; + debug_print(Data::Dumper::Dumper(['Default Configuration', $configuration])); + debug_print(Data::Dumper::Dumper(['Default Options', $options])); + + my $user_options = {}; + my $user_configuration = {}; + get_options($user_options, $user_configuration); + debug_print(Data::Dumper::Dumper(['User Configuration', $user_configuration])); + debug_print(Data::Dumper::Dumper(['User Options', $user_options])); + while (my ($key, $value) = each %$user_options) { + $options->{$key} = $value if $value; + } + while (my ($key, $value) = each %$user_configuration) { + $configuration->{$key} = $value if $value; + } + debug_print(Data::Dumper::Dumper(['Final Configuration', $configuration])); + debug_print(Data::Dumper::Dumper(['Final Options', $options])); - get_options($options, $configuration); $options->{COLORIZE_OUTPUT} = do_colorize($options->{COLORIZE_MODE}); initialize_highlighting_from_configuration($configuration); - debug_print(Data::Dumper::Dumper($configuration)); - debug_print(Data::Dumper::Dumper($options)); my $id_regexp; if ($options->{SHOW_ALL_IDS}) { @@ -9584,17 +11290,18 @@ sub main { $id_regexp = shift @ARGV; } - if ($options->{REQUEST_PAGER} && $OUTPUT_IS_REDIRECTED) { + if ($user_options->{REQUEST_PAGER} && $OUTPUT_IS_REDIRECTED) { issue_warning("option @{[quote_literal('--pager')]} ignored because output is redirected"); } my $use_pager = $options->{REQUEST_PAGER} && !$OUTPUT_IS_REDIRECTED; + my $match_count; if ($use_pager) { - redirect_and_scan_files($options, $configuration, $id_regexp, \@ARGV); + $match_count = redirect_and_scan_files($options, $configuration, $id_regexp, \@ARGV); } else { - scan_files($options, $configuration, $id_regexp, \@ARGV); + $match_count = scan_files($options, $configuration, $id_regexp, \@ARGV); } - exit ($MATCH_COUNT == 0); + exit ($match_count == 0); } @@ -9615,7 +11322,7 @@ main(); =head1 NAME -typog-grep - grep for typog-inspect elements in LaTeX log files +typog-grep - specialized grep for typog-inspect elements in LaTeX log files =head1 SYNOPSIS @@ -9628,9 +11335,70 @@ typog-grep - grep for typog-inspect elements in LaTeX log files =back -The first form shows all C<E<lt>typog-inspect id="I<ID>" ...E<gt>> elements in F<LOG-FILE>. +The first form, ``discovery mode'', shows all I<ID>s of + +=begin text + +<typog-inspect id="ID" ...> + +=end text + +=begin man + +.RS +.EX +<typog-inspect id="\fI\,ID\/\fP" ...> +.EE +.RE + +=end man + +=begin texinfo + +@example +<typog-inspect id="@var{ID}" ...> +@end example +@noindent + +=end texinfo + +Z<> +elements in F<LOG-FILE>. + +The second form shows the contents, I<LOG-DATA>, of the elements -The second form shows the contents of C<E<lt>typog-inspect id="I<ID>" ...E<gt>> elements +=begin text + +<typog-inspect id="ID" ...> +LOG-DATA +</typog-inspect> + +=end text + +=begin man + +.RS +.EX +<typog-inspect id="\fI\,ID\/\fP" ...> +\fILOG-DATA\fP +</typog-inspect> +.EE +.RE + +=end man + +=begin texinfo + +@example +<typog-inspect id="@var{ID}" ...> +@var{LOG-DATA} +</typog-inspect> +@end example +@noindent + +=end texinfo + +Z<> whose I<ID>s match I<REGEXP> in F<LOG-FILE>. If no F<LOG-FILE> is given read from F<stdin>. @@ -9639,57 +11407,101 @@ The S<filename C<->> is synonymous to F<stdin>. =head1 DESCRIPTION -B<typog-grep> is a tailored post-processor for LaTeX log files -and the C<typoginspect> environment as provided by S<package typog>. +B<typog-grep> is a tailored post-processor for LaTeX S<F<log> files> +and the C<typoginspect> environment as provided by the S<LaTeX package typog>. It shares more with the venerable L<B<sgrep>|https://www.cs.helsinki.fi/u/jjaakkol/sgrep.html> than with S<POSIX L<B<grep>|https://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html>>. -The LaTeX user brackets her text in +In the LaTeX source file the user brackets her text or code +in a C<typoginspect> environment: + +=begin text + +\begin{typoginspect}{ID} + TEXT-OR-CODE-TO-INVESTIGATE +\end{typoginspect} + +=end text + +=begin man + +.RS +.EX +\ebegin{typoginspect}{\fI\,ID\/\fP} +\fITEXT-OR-CODE-TO-INVESTIGATE\fP +\eend{typoginspect} +.EE +.RE - \begin{typoginspect}{ID} - Text and code to investigate - \end{typoginspect} +=end man + +=begin texinfo + +@example +@backslashchar{}begin@lbracechar{}typoginspect@rbracechar{}@lbracechar{}@var{ID}@rbracechar{} +@var{TEXT-OR-CODE-TO-INVESTIGATE} +@backslashchar{}end@lbracechar{}typoginspect@rbracechar{} +@end example +@noindent + +=end texinfo +Z<> where I<ID> is used to identify one or more bracketed snippets. I<ID> does not have to be unique. The I<REGEXP> mechanism makes it easy to select groups of related I<ID>s if they are named accordingly. -In F<LOG-FILE> the environment shows up, packed with tracing information, as +In F<LOG-FILE> the result of the environment shows up, +packed with tracing information, as -=begin texinfo +=begin text -@display -@relax +<typog-inspect id="ID" job="JOB-NAME" line="LINE-NUMBER" page="PAGE-NUMBER"> + LOG-DATA +</typog-inspect> -=end texinfo +=end text + +=begin man - <typog-inspect id="ID" job="JOB-NAME" line="LINE-NUMBER" page="PAGE-NUMBER"> - Trace Data - </typog-inspect> +.RS +.EX +<typog-inspect id="\fI\,ID\/\fP" job="\fI\,JOB-NAME\/\fP" line="\fI\,LINE-NUMBER\/\fP" page="\fI\,PAGE-NUMBER\/\fP"> +\fILOG-DATA\fP +</typog-inspect> +.EE +.RE + +=end man =begin texinfo -@end display -@relax +@example +<typog-inspect id="@var{ID}" job="@var{JOB-NAME}" line="@var{LINE-NUMBER}" page="@var{PAGE-NUMBER}"> +@var{LOG-DATA} +</typog-inspect> +@end example +@noindent =end texinfo +Z<> where all the capital-letter sequences are meta-variables and in particular I<JOB-NAME> is the expansion of C<\jobname>, I<LINE-NUMBER> is the LaTeX source file line number of the beginning of the C<typoginspect> environment, and I<PAGE-NUMBER> is the page where -the output of S<C<Text and code to investigate>> occurs. +the output of S<C<TEXT-OR-CODE-TO-INVESTIGATE>> occurs. B<typog-grep> reveals the contents of F<LOG-FILE> between C<E<lt>typog-inspect id="I<ID>" ...E<gt>> -and C<E<lt>/typog-inspectE<gt>> excluding the XML-tags. +and C<E<lt>/typog-inspectE<gt>> excluding the XML-tags themselves. Access the I<JOB-NAME>, I<LINE-NUMBER>, and I<PAGE-NUMBER> with the commandline options -B<--job-name>, B<--line-number>, and B<--page-number>, respectively. +B<--job-name>, B<--line-number>, and B<--page-number>, respectively. Use B<--id> to show the name of the IDs that matched I<REGEXP>. C<typoginspect> environments can be nested. @@ -9707,11 +11519,18 @@ The list of options is sorted by the names of the long options. =item B<-a>, B<--all>, B<--any> ID-discovery mode: -Show all C<typog-inspect> elements independent of any matching patterns. +Discover all C<typog-inspect> elements independent of any matching patterns +and print their I<ID>s. +The results are printed in their order of occurrence in the respective F<LOG-FILE>s. +Pipe the output into B<sort> to get alphabetically ordered I<ID>s. + +Augment with options +B<--job-name>, B<--line-number>, B<--log-line-number>, or S<B<--page-number>> +for more information. =item B<--color>, B<colour> I<WHEN> -Colorize specific log contents for the matching ids. +Colorize specific log contents for the matching I<ID>s. The S<argument I<WHEN>> determines when to apply color: C<always>, C<never>, S<or C<auto>>. The setting C<auto> checks whether standard output has been redirected. @@ -9720,29 +11539,45 @@ This is the default. =item B<-C>, B<--config> I<KEY>=I<VALUE>[:I<KEY>=I<VALUE>[:...]] Set one or more configuration I<KEY> to I<VALUE> pairs. -See S<Sec. CONFIGURATION> below for a description of all available configuration items. -Use option B<--show-config> to display the default configuration. +See section L</CONFIGURATION> for a description +of all available configuration items. +Use S<option B<--show-config>> to display the default configuration. =item B<--debug> Turn on debug output on F<stderr>. +=item B<-E>, B<--encoding> I<ENCODING> + +Set the I<ENCODING> of F<LOG-FILE> for the translation to UTF-8. +The default is unset. + +Use this option to get rid of pesky +S<"E<lt>I<HEX-DIGITS>E<gt>" escapes> on UTF-8 terminals. +See S<option B<--show-encodings>> for the known encodings and +Encode::Supported for a summary of all encodings. +See also S<section L</Some Common Encodings>>. + +Apply L<B<iconv>|https://pubs.opengroup.org/onlinepubs/9699919799/utilities/iconv.html> +(POSIX) or L<B<recode>|https://github.com/rrthomas/recode/> (GNU) on F<LOG-FILE> +before this tool to avoid having to use S<option B<--encoding>>. + =item B<-h>, B<--help> Display brief help then exit. =item B<-i>, B<--[no-]id> -Print the actual id name that matched I<REGEXP>. -Control the appearance of the matching id with configuration S<item C<id-heading>>. +Print the actual ID-name that matched I<REGEXP>. +Control the appearance of the matching I<ID> with configuration S<item C<id-heading>>. =item B<-y>, B<--[no-]ignore-case> -Match ids while ignoring case distinctions in patterns and data. +Match I<ID>s while ignoring case distinctions in patterns and data. =item B<-j>, B<--[no-]job-name> -Print the C<\jobname> that B<tex> associated with the input file. +Print the C<\jobname> that B<latex> associated with the input file. =item B<-n>, B<--[no-]line-number> @@ -9766,6 +11601,10 @@ Redirect output from F<stdout> to the configured pager. Show the default configuration and exit. +=item B<--show-encodings> + +Show all known encodings and exit. + =item B<-V>, B<--version> Show version information and exit. @@ -9789,26 +11628,26 @@ S<Default: C<%s:>.> =item C<id-heading>=C<0>E<verbar>C<1> -Choose between printing the matching ids with S<option B<--id>>: +Choose between printing the matching I<ID>s with S<option B<--id>>: S<Inline (C<0>)> or heading before the matching data (C<1>). S<Default: C<0>.> =item C<id-heading-format>=I<FORMAT> -Control the I<FORMAT> for printing matching ids in heading-mode, +Control the I<FORMAT> for printing matching I<ID>s in heading-mode, where I<FORMAT> is passed to Perl's C<printf>. S<Default: C<--E<gt> %s E<lt>-->.> =item C<id-indent>=I<INDENT> Indentation of nested typog-inspect tags. -Only used in ``discovery'' mode (first form), i.e., if B<--all> is active. +Only used in ``discovery mode'' (first form), i.e., if S<B<--all>> is active. S<Default: 8.> =item C<id-max-length>=I<MAXIMUM-LENGTH> -Set the maximum length of a matching id for printing. -It a matching id exceeds this length it will be truncated +Set the maximum length of a matching I<ID> for printing. +It a matching I<ID> exceeds this length it will be truncated and the last three characters (short of I<MAXIMUM-LENGTH>) will be replaced by dots. S<Default: 40.> @@ -9874,11 +11713,11 @@ Color of lines with horizontal S<breakpoints C<@@>>. =item C<id-color> -Color of matching ids when printed inline. +Color of matching I<ID>s when printed inline. =item C<id-heading-color> -Color of matching ids when printed in heading form. +Color of matching I<ID>s when printed in heading form. =item C<line-break-pass-color> @@ -9947,15 +11786,93 @@ C<bold>, C<dark>, C<italic>, C<underline>, C<reverse> =back +=head2 Some Common Encodings + +The following list shows some encodings +that are suitable for S<option B<--encoding>>. + +=over 4 + +=item Latin-1, Western European + +C<iso-8859-1>, C<cp850>, C<cp860>, C<cp1252> + +=item Latin-2, Central European + +C<iso-8859-2>, C<cp852>, C<cp1250> + +=item Latin-3, South European (Esperanto, Maltese) + +C<iso-8859-3> + +=item Latin-4, North European (Baltics) + +C<iso-8859-4> + +=item Cyrillics + +C<iso-8859-5>, C<cp855>, C<cp866> (Ukrainian), C<cp1251> + +=item Arabic + +C<iso-8859-6>, C<cp864>, C<cp1006> (Farsi), C<cp1256> + +=item Greek + +C<iso-8859-7>, C<cp737>, C<cp1253> + +=item Hebrew + +C<iso-8859-8>, C<cp862>, C<cp1255> + +=item Turkish + +C<iso-8859-9>, C<cp857>, C<cp1254> + +=item Nordic + +C<iso-8859-10>, C<cp865>, C<cp861> (Icelandic) + +=item Thai + +C<iso-8859-11>, C<cp874> + +=item Baltic + +C<iso-8859-13>, C<cp775>, C<cp1257> + +=item Celtic + +C<iso-8859-14> + +=item Latin-9 (sometimes called Latin0) + +C<iso-8859-15> + +=item Latin-10 + +C<iso-8859-16> + +=back + + =head1 EXIT STATUS The exit status is 0 if at least one I<ID> matched I<REGEXP>, 1 if no I<ID> matched I<REGEXP>, and 2 if an error occurred. +=head1 CAVEATS + +The end tag C<< </typog-inspect> >> sometimes gets placed too early in the output and the trace +I<seems> truncated. However, LaTeX reliably logs the requested the trace information, but the +write operations for trace data and the code which is used to print the S<end tag> are not +synchronized. + + =head1 SEE ALSO -B<grep>(1), B<printf>(3), B<Term::ANSIColor>(pm) +B<grep>(1), B<printf>(3), B<Encode::Supported>(pm), B<Term::ANSIColor>(pm) =cut |