| 1 |
% \iffalse |
| 2 |
%% File: soul-ori.dtx |
| 3 |
% Copyright (C) 1998--2003 Melchior FRANZ |
| 4 |
% Copyright (C) 2021-2026 Oberdiek Package Support Group |
| 5 |
% https://github.com/ho-tex/soul/issues |
| 6 |
% |
| 7 |
% COPYRIGHT NOTICE: |
| 8 |
% This package is free software that can be redistributed and/or modified |
| 9 |
% under the terms of the LaTeX Project Public License as specified |
| 10 |
% in the file macros/latex/base/lppl.txt on any CTAN archive server, |
| 11 |
% such as ftp://ftp.dante.de/. |
| 12 |
% |
| 13 |
%% Original author data: |
| 14 |
%% ==================================================================== |
| 15 |
%% @LaTeX-package-file{ |
| 16 |
%% author = "Melchior FRANZ", |
| 17 |
%% version = "2.4", |
| 18 |
%% date = "17 November 2003", |
| 19 |
%% filename = "soul.dtx", |
| 20 |
%% address = "Melchior FRANZ |
| 21 |
%% Rieder Hauptstrasse 52 |
| 22 |
%% A-5212 SCHNEEGATTERN |
| 23 |
%% AUSTRIA", |
| 24 |
%% telephone = "++43 7746 3109", |
| 25 |
%% URL = "http://www.unet.univie.ac.at/~a8603365/", |
| 26 |
%% email = "[email protected]", |
| 27 |
%% codetable = "ISO/ASCII", |
| 28 |
%% keywords = "spacing out, letterspacing, underlining, striking out, |
| 29 |
%% highlighting", |
| 30 |
%% supported = "yes", |
| 31 |
%% docstring = "This article describes the `soul' package, which |
| 32 |
%% provides hyphenatable letterspacing (spacing out), |
| 33 |
%% underlining, and some derivatives. |
| 34 |
%% All features are based upon a common mechanism |
| 35 |
%% that allows to typeset text syllable by syllable, |
| 36 |
%% where the excellent TeX hyphenation algorithm is |
| 37 |
%% used to find the proper hyphenation points. |
| 38 |
%% Two examples show how to use the provided interface to |
| 39 |
%% implement things such as `an-a-lyz-ing syl-la-bles'. |
| 40 |
%% Although the package is optimized for LaTeX2e, |
| 41 |
%% it works with Plain TeX and with other |
| 42 |
%% packages, too.", |
| 43 |
%% } |
| 44 |
%% ==================================================================== |
| 45 |
% |
| 46 |
% |
| 47 |
% |
| 48 |
% |
| 49 |
% |
| 50 |
%<*driver> |
| 51 |
\def\fileversion{3.2} |
| 52 |
\def\filedate{2026-03-06} |
| 53 |
% |
| 54 |
\documentclass{ltxdoc} |
| 55 |
% |
| 56 |
% |
| 57 |
% |
| 58 |
\makeatletter\let\SOUL@sethyphenchar\relax\makeatother |
| 59 |
\IfFileExists{soul.sty}{% |
| 60 |
\usepackage{soul}[2002/01/10] |
| 61 |
\expandafter\ifx\csname sloppyword\endcsname\relax % old version? |
| 62 |
\def\sloppyword{\textbf{?? [obsolete soul version]}} |
| 63 |
\fi |
| 64 |
\let\SOULSTYfound\active |
| 65 |
}{% |
| 66 |
\GenericWarning{soul.dtx}{% |
| 67 |
Package file `soul.sty' couldn't be found. You should however find^^J^^A |
| 68 |
a file `soul.ins' in the current directory. If you type "tex soul.ins"^^J^^A |
| 69 |
on the command line, `soul.sty' will be generated. After that |
| 70 |
run "latex soul.dtx" again and you won't see this message again. |
| 71 |
}% |
| 72 |
}% |
| 73 |
% |
| 74 |
% |
| 75 |
% |
| 76 |
\usepackage{hyperref} |
| 77 |
\hypersetup{ |
| 78 |
bookmarksopen, |
| 79 |
colorlinks, |
| 80 |
pdftitle={The soul-ori package}, |
| 81 |
pdfauthor={Melchior FRANZ}, |
| 82 |
pdfsubject={Version 3.2}, |
| 83 |
pdfkeywords={space out, letterspacing, underlining, overstriking, highlighting} |
| 84 |
} |
| 85 |
\usepackage{graphicx,color} |
| 86 |
\pdfstringdefDisableCommands{% |
| 87 |
\let\so\relax |
| 88 |
\let\caps\relax |
| 89 |
\let\ul\relax |
| 90 |
\let\st\relax |
| 91 |
\let\hl\relax |
| 92 |
\def\soul{soul}% |
| 93 |
\def\TeX{TeX}} |
| 94 |
% |
| 95 |
% |
| 96 |
% |
| 97 |
%\RecordChanges |
| 98 |
% |
| 99 |
\begin{document} |
| 100 |
\setcounter{tocdepth}{2} |
| 101 |
\DocInput{soul-ori.dtx} |
| 102 |
\end{document} |
| 103 |
%</driver> |
| 104 |
% \fi |
| 105 |
% |
| 106 |
% \title{The \texttt{soul-ori} package} |
| 107 |
% |
| 108 |
% \author{Melchior \caps{FRANZ}} |
| 109 |
% |
| 110 |
% \date{November 17, 2003} |
| 111 |
% |
| 112 |
%^^A===================================================== |
| 113 |
% |
| 114 |
%^^A These messy macros allow to typeset the `example' sections |
| 115 |
%^^A conveniently. You'd better ignore them. I do! :-) |
| 116 |
% |
| 117 |
% \makeatletter |
| 118 |
% |
| 119 |
% \def\squarebull{\rule[.2ex]{.8ex}{.8ex}} |
| 120 |
% |
| 121 |
% \newenvironment{examples} |
| 122 |
% {\parindent\z@\small\fontencoding{OT1}\selectfont} |
| 123 |
% {\rule{\hsize}{.4pt}} |
| 124 |
% |
| 125 |
% \def\soultest#1|{\bgroup\rule[.5ex]{\hsize}{.4pt}\par |
| 126 |
% \parbox[t]{.34\hsize}{\raggedright\textit{#1\unskip.}}% |
| 127 |
% \hspace{1.5em}$\vtop\bgroup\hb@[email protected]\hsize\bgroup |
| 128 |
% \llap{\squarebull\hspace{.4em}}\soulttest} |
| 129 |
% |
| 130 |
% {\catcode`\|=13\gdef\soulttest{% |
| 131 |
% \bgroup\def\do##1{\catcode`##1=12}\dospecials\ttfamily |
| 132 |
% \catcode`\|=13\unskip\def|{\hss\egroup\egroup\soultttest}}} |
| 133 |
% |
| 134 |
% \def\soultttest#1{\hbox{\vtop{\hsize.4\hsize\hbadness\@M |
| 135 |
% \leavevmode\llap{\squarebull\hspace{.4em}}#1\null}}% |
| 136 |
% \egroup$\hspace{1.5em}\parbox[t]{1mm}{\hyphenpenalty-\@M |
| 137 |
% \exhyphenpenalty-\@M\hbadness\@M\hfuzz\maxdimen |
| 138 |
% \strut\llap{\squarebull\hspace{.4em}}#1\null}% |
| 139 |
% \goodbreak\vspace{2ex} |
| 140 |
% \egroup} |
| 141 |
% |
| 142 |
% \newcommand*\DescribeOption[1]{\marginpar{\raggedleft\textsf{#1}\ignorespaces}} |
| 143 |
% |
| 144 |
% |
| 145 |
%^^A similar to the `description' environment |
| 146 |
% |
| 147 |
% \def\describemacro{^^A |
| 148 |
% \bgroup |
| 149 |
% \let\do\@makeother |
| 150 |
% \dospecials |
| 151 |
% \catcode`{=1 |
| 152 |
% \catcode`}=2 |
| 153 |
% \SOUL@@@descmacro |
| 154 |
% } |
| 155 |
% |
| 156 |
% \def\SOUL@@@descmacro#1{^^A |
| 157 |
% \texttt{#1}^^A |
| 158 |
% \DescribeMacro{#1}^^A |
| 159 |
% \expandafter\edef\expandafter\x\expandafter{\expandafter\@gobble#1}^^A |
| 160 |
% \expandafter\label{cmd:\x}^^A |
| 161 |
% \egroup |
| 162 |
% } |
| 163 |
% |
| 164 |
% |
| 165 |
% \def\SOUL@@@verbitem[#1: {^^A |
| 166 |
% \bgroup |
| 167 |
% \let\do\@makeother |
| 168 |
% \dospecials |
| 169 |
% \SOUL@@@verbscan{#1}^^A |
| 170 |
% } |
| 171 |
% |
| 172 |
% \def\SOUL@@@verbscan#1#2]{^^A |
| 173 |
% \egroup |
| 174 |
% \goodbreak |
| 175 |
% \def\@currentlabel{\S\,\the\SOUL@@@itemnr}^^A |
| 176 |
% \label{par:#1}^^A |
| 177 |
% \SOUL@@@item[\textbf{\@currentlabel\hskip.6em#1:}]\hfil\break |
| 178 |
% Example: \texttt{#2}\hfil\break^^A |
| 179 |
% \advance\SOUL@@@itemnr1 |
| 180 |
% } |
| 181 |
% |
| 182 |
% \let\SOUL@@@item\item |
| 183 |
% \newcount\SOUL@@@itemnr |
| 184 |
% |
| 185 |
% \newenvironment{verblist}[1]{^^A |
| 186 |
% \SOUL@@@itemnr=#1 |
| 187 |
% \list{}{^^A |
| 188 |
% \settowidth{\labelwidth}{\indent\indent}^^A |
| 189 |
% \leftmargin\labelwidth |
| 190 |
% \advance\leftmargin\labelsep |
| 191 |
% \def\makelabel##1{##1}^^A |
| 192 |
% \let\item\SOUL@@@verbitem |
| 193 |
% }^^A |
| 194 |
% }{^^A |
| 195 |
% \endlist |
| 196 |
% } |
| 197 |
% |
| 198 |
% \newenvironment{labeling}[1]{^^A |
| 199 |
% \list{}{^^A |
| 200 |
% \settowidth{\labelwidth}{\textbf{#1}}^^A |
| 201 |
% \leftmargin\labelwidth\advance\leftmargin\labelsep |
| 202 |
% \def\makelabel##1{\textbf{##1}\hfil}^^A |
| 203 |
% }^^A |
| 204 |
% }{^^A |
| 205 |
% \endlist |
| 206 |
% } |
| 207 |
% |
| 208 |
% \newenvironment{syntax}{^^A |
| 209 |
% \par\medskip\def\<##1>{$\langle$\syn{##1}$\rangle$}^^A |
| 210 |
% \indent\begin{tabular}{l}^^A |
| 211 |
% }{^^A |
| 212 |
% \end{tabular}^^A |
| 213 |
% \noindentafter\medbreak |
| 214 |
% } |
| 215 |
% |
| 216 |
% |
| 217 |
% \newenvironment{example}[1][.9\textwidth] |
| 218 |
% {\par\medskip\indent\begin{tabular}{p{#1}l}} |
| 219 |
% {\end{tabular}\noindentafter\medbreak} |
| 220 |
% |
| 221 |
% \newcommand*\noindentafter{^^A |
| 222 |
% \global\everypar{{\setbox\z@\lastbox}\everypar{}}} |
| 223 |
% |
| 224 |
% \newcommand*\errsquare{\leavevmode\vrule height.8em depth.2em width1em\relax} |
| 225 |
% |
| 226 |
% |
| 227 |
% \ifx\SOULSTYfound\active |
| 228 |
%^^A analyze syllables---described somewhere below |
| 229 |
% |
| 230 |
% \DeclareRobustCommand*\sy{^^A |
| 231 |
% \SOUL@setup |
| 232 |
% \def\SOUL@preamble{\lefthyphenmin0\righthyphenmin0}^^A |
| 233 |
% \def\SOUL@everysyllable{\the\SOUL@syllable}^^A |
| 234 |
% \def\SOUL@everyspace##1{##1\space}^^A |
| 235 |
% \def\SOUL@everyhyphen{^^A |
| 236 |
% \discretionary{^^A |
| 237 |
% \SOUL@setkern\SOUL@hyphkern |
| 238 |
% \SOUL@sethyphenchar |
| 239 |
% }{}{^^A |
| 240 |
% \hbox{\kern1pt$\cdot$}^^A |
| 241 |
% }^^A |
| 242 |
% }^^A |
| 243 |
% \def\SOUL@everyexhyphen##1{^^A |
| 244 |
% \SOUL@setkern\SOUL@hyphkern |
| 245 |
% \hbox{##1}^^A |
| 246 |
% \discretionary{}{}{^^A |
| 247 |
% \SOUL@setkern\SOUL@charkern |
| 248 |
% }^^A |
| 249 |
% }^^A |
| 250 |
% \SOUL@} |
| 251 |
% |
| 252 |
%^^A analyze the engine---described somewhere below, too |
| 253 |
% |
| 254 |
% \DeclareRobustCommand*\an{^^A |
| 255 |
% \def\SOUL@preamble{$^{^P}$}^^A |
| 256 |
% \def\SOUL@everyspace##1{##1\texttt{\char`\ }}^^A |
| 257 |
% \def\SOUL@postamble{$^{^E}$}^^A |
| 258 |
% \def\SOUL@everyhyphen{$^{^-}$}^^A |
| 259 |
% \def\SOUL@everyexhyphen##1{##1$^{^=}$}^^A |
| 260 |
% \def\SOUL@everysyllable{$^{^S}$}^^A |
| 261 |
% \def\SOUL@everytoken{\the\SOUL@token$^{^T}$}^^A |
| 262 |
% \def\SOUL@everylowerthan{$^{^L}$}^^A |
| 263 |
% \SOUL@} |
| 264 |
% |
| 265 |
%^^A magazine-like (truly awful) paragraphs |
| 266 |
%^^A If you know what you're doing, you can copy it to your personal `soul.cfg' file. |
| 267 |
% |
| 268 |
% \DeclareRobustCommand*\magstylepar{\SOUL@sosetup |
| 269 |
% \def\SOUL@preamble{^^A |
| 270 |
% \edef\SOUL@soletterskip{\z@\@plus\fontdimen2\font\@minus\z@}^^A |
| 271 |
% \edef\SOUL@soinnerskip{\the\fontdimen2\font |
| 272 |
% \@plus\the\fontdimen3\font\@minus\the\fontdimen4\font}^^A |
| 273 |
% \let\SOUL@soouterskip\SOUL@soinnerskip |
| 274 |
% \SOUL@sopreamble}^^A |
| 275 |
% \lefthyphenmin2\righthyphenmin2\SOUL@} |
| 276 |
% |
| 277 |
%\else |
| 278 |
% |
| 279 |
%^^A The package has not been found, so we're providing some dummies, just |
| 280 |
%^^A to avoid all these `Undefined command sequence' messages. |
| 281 |
% |
| 282 |
% \def\SOUL@@@X#1{\textbf{??}}% |
| 283 |
% \let\so\SOUL@@@X |
| 284 |
% \let\textso\SOUL@@@X |
| 285 |
% \let\caps\SOUL@@@X |
| 286 |
% \let\textcaps\SOUL@@@X |
| 287 |
% \let\ul\SOUL@@@X |
| 288 |
% \let\textul\SOUL@@@X |
| 289 |
% \let\st\SOUL@@@X |
| 290 |
% \let\textst\SOUL@@@X |
| 291 |
% \let\hl\SOUL@@@X |
| 292 |
% \let\texthl\SOUL@@@X |
| 293 |
% \let\sy\SOUL@@@X |
| 294 |
% \let\an\SOUL@@@X |
| 295 |
% \let\magstylepar\SOUL@@@X |
| 296 |
% \let\sloppyword\SOUL@@@X |
| 297 |
% \def\sodef#1#2#3#4{\let#1\relax\SOUL@@@X}% |
| 298 |
% \fi |
| 299 |
% |
| 300 |
% \newcommand*\xpath{^^A |
| 301 |
% \bgroup |
| 302 |
% \let\do\@makeother |
| 303 |
% \dospecials |
| 304 |
% \catcode`\{=1 |
| 305 |
% \catcode`\}=2 |
| 306 |
% \def\{{\char"7B}^^A |
| 307 |
% \def\}{\char"7D}^^A |
| 308 |
% \SOUL@@@code |
| 309 |
% } |
| 310 |
% |
| 311 |
% \newcommand*\SOUL@@@code[1]{\normalfont\texttt{#1}\egroup} |
| 312 |
% |
| 313 |
% \let\cs\xpath |
| 314 |
% \let\option\textsf |
| 315 |
% \def\package#1{{\normalfont\texttt{#1}}} |
| 316 |
% \let\program\texttt |
| 317 |
% \let\bibtitle\textit |
| 318 |
% \let\syn\textit |
| 319 |
% |
| 320 |
% \sodef\person{\scshape}{0.06em}{0.45em}{0.4em} |
| 321 |
% \sodef\SOUL@@@versal{\upshape}{0.125em}{0.4583em}{0.5833em} |
| 322 |
% \DeclareRobustCommand*\versal[1]{^^A |
| 323 |
% \MakeUppercase{\SOUL@@@versal{#1}}^^A |
| 324 |
% } |
| 325 |
% |
| 326 |
% \def\ConTeXt{Con\TeX t} |
| 327 |
% \def\CTAN{{\small\caps{CTAN}}} |
| 328 |
% \def\soul{\package{soul-ori}} |
| 329 |
% |
| 330 |
% ^^A set some parameters as used in Plain TeX |
| 331 |
% \def\plainsetup{^^A |
| 332 |
% \pretolerance100 |
| 333 |
% \tolerance200 |
| 334 |
% \hbadness1000 |
| 335 |
% \linepenalty10 |
| 336 |
% \hyphenpenalty50 |
| 337 |
% \exhyphenpenalty50 |
| 338 |
% \doublehyphendemerits10000 |
| 339 |
% \finalhyphendemerits5000 |
| 340 |
% \adjdemerits10000 |
| 341 |
% \hfuzz.1pt |
| 342 |
% \overfullrule5pt |
| 343 |
% } |
| 344 |
% |
| 345 |
% \def\FIXME#1{\message{<FIXME>}#1} |
| 346 |
% |
| 347 |
% \makeatother |
| 348 |
% |
| 349 |
% |
| 350 |
% \lefthyphenmin2 |
| 351 |
% \righthyphenmin3 |
| 352 |
% \hyphenation{Le-se-ty-po-gra-phie Ver-bin-dung fak-si-mi-le} |
| 353 |
% |
| 354 |
% |
| 355 |
%^^A===================================================== |
| 356 |
% |
| 357 |
% |
| 358 |
% \changes{v1.0}{1998/10/16}{Initial version}% |
| 359 |
%^^A due to an error in the documentation of v1.0, there's no v1.1 :-( |
| 360 |
% \changes{v1.1a}{1998/12/08}{fixed a bunch of bugs; `magstylepar command |
| 361 |
% banned; `caps introduced; `so and `caps recognize following spaces; |
| 362 |
% error message added; `so parameters are mandatory} |
| 363 |
% |
| 364 |
% \changes{v1.2}{1999/01/11}{fixed the newline bug; added the `\(>\) command} |
| 365 |
% |
| 366 |
% \changes{v1.3}{1999/05/15}{changed allowhyphen, preambles; added a paragraph |
| 367 |
% in the `features' section} |
| 368 |
% |
| 369 |
% \changes{v2.0}{2002/01/03}{(almost) complete rewrite} |
| 370 |
% |
| 371 |
% \changes{v2.1}{2002/01/10}{Happy (64th) birthday, Don! |
| 372 |
% ``The now-traditional fix for the |
| 373 |
% now-traditional brown-paper-bag major release.'' |
| 374 |
% as Eric S. RAYMOND commented on his CML2.0.1 release. ;-)} |
| 375 |
% |
| 376 |
% \changes{v2.2}{2002/05/12}{fixed a couple of bugs; added support for |
| 377 |
% the Plain TeX color.sty wrapper} |
| 378 |
% |
| 379 |
% \changes{v2.3}{2002/05/29}{compatibility with cmbright/ccfonts} |
| 380 |
% |
| 381 |
% \changes{v2.4}{2003/11/17}{Fix the font bug. Fix a scanner bug. |
| 382 |
% Other bugfixes; change caps set handling; add footnote and |
| 383 |
% textsuperscript support} |
| 384 |
% |
| 385 |
% \changes{v2.5}{2021/12/14}{Allocate new registers, see issue 1 +2 at https://github.com/drehscheibe/soul, |
| 386 |
% renamed to soul-ori, to allow to merge it with soulutf8} |
| 387 |
% |
| 388 |
% \changes{v3.0}{2023/02/18}{the package has been merged with soulutf8} |
| 389 |
% |
| 390 |
% |
| 391 |
% |
| 392 |
% \maketitle |
| 393 |
% |
| 394 |
% |
| 395 |
% |
| 396 |
% \begin{abstract} |
| 397 |
% This article describes the \soul\ package^^A |
| 398 |
%^^A%% |
| 399 |
% \footnote{This file has version number \fileversion, last revised \filedate.}, |
| 400 |
%^^A%% |
| 401 |
% which provides \so{hyphenatable letterspacing (spacing out),} \ul{underlining} |
| 402 |
% and some derivatives such as \st{overstriking} and highlighting. |
| 403 |
% Although the package is optimized for \LaTeXe, it also works with |
| 404 |
% Plain \TeX\ and with other flavors of \TeX\ like, for instance, \ConTeXt. |
| 405 |
% By the way, the package name |soul| is only a combination |
| 406 |
% of the two macro names \cs{\so} (space out) and \cs{\ul} |
| 407 |
% (underline)---nothing poetic at all.^^A :-( |
| 408 |
% \end{abstract} |
| 409 |
% |
| 410 |
% |
| 411 |
% {\setlength\parskip{0pt}\tableofcontents } |
| 412 |
% \addtocontents{toc}{\protect\begin{multicols}{2}} |
| 413 |
% |
| 414 |
% |
| 415 |
% |
| 416 |
% |
| 417 |
% |
| 418 |
% |
| 419 |
% |
| 420 |
% |
| 421 |
% |
| 422 |
% \section{Typesetting rules} |
| 423 |
% \label{sec:typesetting} |
| 424 |
% |
| 425 |
% There are several possibilities to emphasize parts of a paragraph, |
| 426 |
% not all of which are considered good style. While underlining |
| 427 |
% is commonly rejected, experts dispute about whether letterspacing |
| 428 |
% should be used or not, and in which cases. If you are not interested |
| 429 |
% in such debates, you may well skip to the next section. |
| 430 |
% |
| 431 |
% |
| 432 |
% \subsection*{Theory \dots} |
| 433 |
% \label{sec:theory} |
| 434 |
% |
| 435 |
% To understand the experts' arguments we have to know about the |
| 436 |
% conception of \emph{page grayness.} The sum of all characters on |
| 437 |
% a page represents a certain amount of grayness, provided that |
| 438 |
% the letters are printed black onto white paper. |
| 439 |
% |
| 440 |
% \person{Jan Tschichold} \cite{Tschichold}, a well known and recognized |
| 441 |
% typographer, accepts only forms of emphasizing, which do not disturb this |
| 442 |
% grayness. This is only true of italic shape, caps, and |
| 443 |
% caps-and-small-caps fonts, but not of ordinary letterspacing, underlining, |
| 444 |
% bold face type and so on, all of which appear as either dark or light |
| 445 |
% spots in the text area. In his opinion emphasized text shall not catch the eye when |
| 446 |
% running over the text, but rather when actually reading the respective words. |
| 447 |
% |
| 448 |
% Other, less restrictive typographers \cite{Willberg} call this kind of emphasizing |
| 449 |
% `integrated' or `aesthetic', while they describe `active' emphasizing apart from it, |
| 450 |
% which actually \emph{has} to catch the reader's eye. To the latter group belong commonly |
| 451 |
% despised things like letterspacing, demibold face type and even underlined and colored text. |
| 452 |
% |
| 453 |
% On the other hand, \person{Tschichold} suggests |
| 454 |
% to space out caps and caps-and-small-caps fonts on title pages, headings and running headers from |
| 455 |
% 1\,pt up to 2\,pt. |
| 456 |
% Even in running text legibility of uppercase letters should be improved with slight |
| 457 |
% letterspacing, since (the Roman) majuscules don't look right, if they are spaced |
| 458 |
% like (the Carolingian) minuscules.\footnote{This suggestion is followed throughout this article, |
| 459 |
% although Prof.~\person{Knuth} already considered slight letterspacing with his |cmcsc| fonts.} |
| 460 |
% |
| 461 |
% |
| 462 |
% |
| 463 |
%\subsection*{\dots\ and Practice} |
| 464 |
% |
| 465 |
% However, in the last centuries letterspacing was excessively used, |
| 466 |
% underlining at least sometimes, because capitals and italic shape could |
| 467 |
% not be used together with the \emph{Fraktur} font and other black-letter fonts, |
| 468 |
% which are sometimes also called ``old German'' fonts. |
| 469 |
% This tradition is widely continued until today. The same limitations apply still today |
| 470 |
% to many languages with non-latin glyphs, which is why letterspacing has a strong |
| 471 |
% tradition in eastern countries where Cyrillic fonts are used. |
| 472 |
% |
| 473 |
% The \person{Duden} \cite{Duden}, a well known German dictionary, explains how to space out properly: |
| 474 |
% \emph{Punctuation marks are spaced out like letters, except quotation marks and periods. |
| 475 |
% Numbers are never spaced out. The German syllable \mbox{\emph{-sche}} is not spaced |
| 476 |
% out in cases like \emph{``der {\so{Virchow{sche}}} Versuch''}\footnote{the \person{Virchow} experiment}. |
| 477 |
% In the old German \emph{Fraktur} fonts the ligatures \emph{|ch|, |ck|, |sz|~(\ss)} and~\emph{|tz|} are |
| 478 |
% not broken within spaced out text.} |
| 479 |
% |
| 480 |
% While some books follow all these rules \cite{Muszynski}, others don't |
| 481 |
% \cite{Reglement}. In fact, most books in my personal library do \emph{not} space out commas. |
| 482 |
% |
| 483 |
% |
| 484 |
% |
| 485 |
% |
| 486 |
% |
| 487 |
% |
| 488 |
% |
| 489 |
% |
| 490 |
% |
| 491 |
% \section{Short introduction and common rules} |
| 492 |
% |
| 493 |
% The \soul\ package provides five commands that are aimed at emphasizing |
| 494 |
% text parts. Each of the commands takes one argument that can either be |
| 495 |
% the text itself or the name of a macro that contains text (e.\,g.~|\so\text|)^^A |
| 496 |
% ^^A |
| 497 |
% \footnote{See~\ref{par:Unexpandable material in command sequences} for |
| 498 |
% some additional information about the latter mode.}^^A |
| 499 |
% ^^A |
| 500 |
% . |
| 501 |
% See table~\ref{tab:survey} for a complete command survey. |
| 502 |
% |
| 503 |
% {\catcode`\|=12 |
| 504 |
% \begin{center} |
| 505 |
% \begin{tabular}{r@{\hspace{1.5em}}l} |
| 506 |
% \verb+\so{letterspacing}+&\so{letterspacing}\\ |
| 507 |
% \verb+\caps{CAPITALS, Small Capitals}+&\caps{CAPITALS, Small Capitals}\\ |
| 508 |
% \verb+\ul{underlining}+&\ul{underlining}\\ |
| 509 |
% \verb+\st{overstriking}+&\st{overstriking}\\ |
| 510 |
% \verb+\hl{highlighting}+&highlighting\footnotemark\\ |
| 511 |
% \end{tabular} |
| 512 |
% \end{center} |
| 513 |
% \footnotetext{The look of highlighting is nowhere demonstrated |
| 514 |
% in this documentation, because it requires a Postscript aware |
| 515 |
% output driver and would come out as ugly black bars on other |
| 516 |
% devices, looking very much like censoring bars. Think of it as |
| 517 |
% the effect of one of those coloring text markers.} |
| 518 |
% } |
| 519 |
% |
| 520 |
% \noindent |
| 521 |
% The \cs{\hl} command does only highlight if the \package{color} package |
| 522 |
% was loaded, otherwise it falls back to underlining.\footnote{Note that |
| 523 |
% you can also use \LaTeX's \package{color} package with Plain \TeX. |
| 524 |
% See~\ref{sec:plain} for details.} The highlighting |
| 525 |
% color is by default yellow, underlines and overstriking lines are by |
| 526 |
% default black. The colors can be changed using the following commands: |
| 527 |
% |
| 528 |
% {\catcode`\|=12 |
| 529 |
% \begin{center} |
| 530 |
% \begin{tabular}{r@{\hspace{1.5em}}l} |
| 531 |
% \verb+\setulcolor{red}+&set underlining color\\ |
| 532 |
% \verb+\setstcolor{green}+&set overstriking color\\ |
| 533 |
% \verb+\sethlcolor{blue}+&set highlighting color\\ |
| 534 |
% \end{tabular} |
| 535 |
% \end{center} |
| 536 |
% } |
| 537 |
% |
| 538 |
% \noindent |
| 539 |
% |\setulcolor{}| and |\setstcolor{}| turn coloring off. |
| 540 |
% There are only few colors predefined by the \package{color} |
| 541 |
% package, but you can easily add custom color definitions. |
| 542 |
% See the \package{color} package documentation~\cite{color} for further |
| 543 |
% information. |
| 544 |
% |
| 545 |
% \begin{example} |
| 546 |
% |\usepackage{color,soul}|\\ |
| 547 |
% |\definecolor{lightblue}{rgb}{.90,.95,1}|\\ |
| 548 |
% |\sethlcolor{lightblue}|\\ |
| 549 |
% |...|\\ |
| 550 |
% |\hl{this is highlighted in light blue color}|\\ |
| 551 |
% \end{example} |
| 552 |
% |
| 553 |
% |
| 554 |
% |
| 555 |
% |
| 556 |
% |
| 557 |
% |
| 558 |
% |
| 559 |
% \subsection[Some things work]{Some things work \dots} |
| 560 |
% |
| 561 |
% The following examples may look boring and redundant, because they describe |
| 562 |
% nothing else than common \LaTeX\ notation with a few exceptions, but this is |
| 563 |
% only the half story: The \soul\ package has to pre-process the argument |
| 564 |
% before it can split it into characters and syllables, and all described |
| 565 |
% constructs are only allowed because the package explicitly implements them. |
| 566 |
% |
| 567 |
% \begin{verblist}{1} |
| 568 |
% \item[Accents: \so{na\"\i ve}] |
| 569 |
% Accents can be used naturally. |
| 570 |
% Support for the following accents is built-in: |\`|, |\'|, |\^|, |\"|, |\~|, |
| 571 |
% |\=|, |\.|, |\u|, |\v|, |\H|, |\t|, |\c|, |\d|, |\b|, and |\r|. Additionally, |
| 572 |
% if the \package{german} package \cite{german} is loaded you can also use the |"| |
| 573 |
% accent command and write |\so{na"ive}|. See section~\ref{sec:soulaccent} for how to add |
| 574 |
% further accents. |
| 575 |
% \item[Quotes: \so{``quotes''}] |
| 576 |
% The \soul\ package recognizes the quotes ligatures |``|, |''| and |,,|. |
| 577 |
% The Spanish ligatures |!`| and |?`| are not recognized and have, thus, |
| 578 |
% to be written enclosed in braces like in |\caps{{!`}Hola!}|. |
| 579 |
% \item[Mathematics: \so{foo$x^3$bar}] |
| 580 |
% Mathematic formulas are allowed, as long as they are |
| 581 |
% surrounded by~\texttt\$. Note that the \LaTeX\ |
| 582 |
% equivalent |\(...\)| does not work. |
| 583 |
% \item[Hyphens and dashes: \so{re-sent}] |
| 584 |
% Explicit hyphens as well as en-dashes~(|--|), em-dashes~(|---|) |
| 585 |
% and the |\slash| command work as usual. |
| 586 |
% \item[Newlines: \so{new\\line}] |
| 587 |
% The |\\|~command fills the current line with white space |
| 588 |
% and starts a new line. Spaces or linebreaks afterwards are ignored. |
| 589 |
% Unlike the original \LaTeX\ command \soul's version does not handle |
| 590 |
% optional parameters like in |\\*[1ex]|. |
| 591 |
% \item[Breaking lines: \so{foo\linebreak bar}] |
| 592 |
% The \cs{\linebreak} command breaks the line without |
| 593 |
% filling it with white space at the end. \soul's version |
| 594 |
% does not handle optional parameters like in |\linebreak[1]|. |
| 595 |
% \cs{\break} can be used as a synonym. |
| 596 |
% \item[Unbreakable spaces: \so{don't~break}] |
| 597 |
% The |~|~command sets an unbreakable space. |
| 598 |
% \item[Grouping: \so{Virchow{sche}}] |
| 599 |
% A pair of braces can be used to let a group of characters |
| 600 |
% be seen as one entity, so that \soul\ does |
| 601 |
% for instance not space it out. The contents must, however, |
| 602 |
% not contain potential hyphenation points. (See~\ref{par:Protecting}) |
| 603 |
% \item[Protecting: \so{foo \mbox{little} bar}] |
| 604 |
% An \cs{\mbox} also lets \soul\ see the contents as one |
| 605 |
% item, but these may even contain hyphenation points. \cs{\hbox} can |
| 606 |
% be used as a synonym. |
| 607 |
% \item[Omitting: \so{\soulomit{foo}}] |
| 608 |
% The contents of \cs{\soulomit} bypass the soul core and are typeset |
| 609 |
% as is, without being letterspaced or underlined. Hyphenation points are |
| 610 |
% allowed within the argument. The current font remains active, but can be |
| 611 |
% overridden with \cs{\normalfont} etc. |
| 612 |
% \item[Font switching commands: \so{foo \texttt{bar}}] |
| 613 |
% All standard \TeX\ and \LaTeX\ font switching commands are allowed, as |
| 614 |
% well as the \package{yfonts} package \cite{yfonts} font commands like \cs{\textfrak} etc. |
| 615 |
% Further commands have to be registered using the \cs{\soulregister} |
| 616 |
% command (see section~\ref{sec:soulregister}). |
| 617 |
% \item[Breaking up ligatures: \ul{Auf{}lage}] |
| 618 |
% Use |{}| or \cs{\null} to break up ligatures like `fl' in \cs{\ul}, \cs{\st} and \cs{\hl} |
| 619 |
% arguments. |
| 620 |
% This doesn't make sense for \cs{\so} and \cs{\caps}, though, because they break up |
| 621 |
% every unprotected (ungrouped\slash unboxed) ligature, anyway, and would |
| 622 |
% then just add undesirable extra space around the additional item. |
| 623 |
% \end{verblist} |
| 624 |
% |
| 625 |
% |
| 626 |
% |
| 627 |
% |
| 628 |
% \subsection{\dots\ others don't} |
| 629 |
% |
| 630 |
% Although the new \soul\ is much more robust and forgiving than |
| 631 |
% versions prior to~2.0, there are |
| 632 |
% still some things that are not allowed in arguments. |
| 633 |
% This is due to the complex engine, which has to read and inspect every |
| 634 |
% character before it can hand it over to \TeX's paragraph builder. |
| 635 |
% |
| 636 |
% \begin{verblist}{20} |
| 637 |
% \item[Grouping hyphenatable material: \so{foo {little} bar}] |
| 638 |
% Grouped characters must not contain hyphenation points. Instead of |
| 639 |
% |\so{foo {little}}| write |\so{foo \mbox{little}}|. You get a |
| 640 |
% \texttt{`Re\-con\-struction failed'} error and a black square like |
| 641 |
% \errsquare\ in the \caps{DVI} file where you violated this rule. |
| 642 |
% \item[Discretionary hyphens: \so{Zu\discretionary{k-}{}{c}ker}] |
| 643 |
% The argument must not contain discretionary hyphens. Thus, you have to |
| 644 |
% handle cases like the German word |Zu\discretionary{k-}{}{c}ker| by yourself. |
| 645 |
% \item[Nested soul commands: \ul{foo \so{bar} baz}] |
| 646 |
% \soul\ commands must not be nested. If you really |
| 647 |
% need such, put the inner stuff in a box and use this box. It will, of |
| 648 |
% course, not get broken then.\\ |
| 649 |
% \null\qquad|\newbox\anyboxname|\\ |
| 650 |
% \null\qquad|\sbox\anyboxname{ \so{the worst} }|\\ |
| 651 |
% \null\qquad|\ul{This is by far{\usebox\anyboxname}example!}|\\ |
| 652 |
% yields:\\ |
| 653 |
% \newbox\anyboxname |
| 654 |
% \sbox\anyboxname{ \so{the worst} } |
| 655 |
% \null\qquad\ul{This is by far{\usebox\anyboxname}example!} |
| 656 |
% \item[Leaking font switches: \def\foo{\bf bar} \so{\foo baz}] |
| 657 |
% A hidden font switching command that leaks into its neighborship |
| 658 |
% causes a \texttt{`Reconstruction failed'} error. To avoid this either |
| 659 |
% register the `container' (|\soulregister{\foo}{0}|), or limit its |
| 660 |
% scope as in |\def\foo{{\bf bar}}|. Note that both |
| 661 |
% solutions yield slightly different results. |
| 662 |
% \item[Material that needs expansion: \so{\romannumeral\year}] |
| 663 |
% In this example \cs{\so} would try to put space between \cs{\romannumeral} |
| 664 |
% and \cs{\year}, which can, of course, not work. |
| 665 |
% You have to expand the argument before you feed it to \soul, or even better: |
| 666 |
% Wrap the material up in a command sequence and let \soul\ expand it: |
| 667 |
% |\def\x{\romannumeral\year}| |\so\x|. \soul\ tries hard to expand |
| 668 |
% enough, yet not too much. |
| 669 |
% \item[Unexpandable material in command sequences: \def\foo{\bar} \so\foo] |
| 670 |
% Some macros might not be expandable in an \cs{\edef} definition^^A |
| 671 |
% \footnote{Try \texttt{\string\edef\string\x\char`\{\string\copyright\char`\}}. |
| 672 |
% Yet \texttt{\string\copyright} works in \soul\ arguments, because it is |
| 673 |
% explicitly taken care of by the package} |
| 674 |
% and have to be protected with \cs{\noexpand} in front. This is automatically done |
| 675 |
% for the following tokens: |~|, \cs{\,}, \cs{\TeX}, \cs{\LaTeX}, |
| 676 |
% \cs{\S}, \cs{\slash}, \cs{\textregistered}, \cs{\textcircled}, and \cs{\copyright}, |
| 677 |
% as well as for all registered fonts and accents. Instead of putting \cs{\noexpand} |
| 678 |
% manually in front of such commands, as in |\def\foo{foo {\noexpand\bar} bar}| |\so\foo|, |
| 679 |
% you can also register them as special (see section \ref{sec:soulregister}). |
| 680 |
% \item[Other weird stuff: \so{foo \verb|\bar| baz}] |
| 681 |
% \soul\ arguments must not contain \LaTeX\ environments, command definitions, |
| 682 |
% and fancy stuff like |\vadjust|. \soul's |\footnote| command replacement |
| 683 |
% does not support optional arguments. As long as you are writing simple, |
| 684 |
% ordinary `horizontal' material, you are on the safe side. |
| 685 |
% \end{verblist} |
| 686 |
% |
| 687 |
% |
| 688 |
% |
| 689 |
% |
| 690 |
% |
| 691 |
% |
| 692 |
% |
| 693 |
% \begin{table} |
| 694 |
% \begin{center} |
| 695 |
% \catcode`\|=12 |
| 696 |
% \newcommand*\pref[1]{{\footnotesize\pageref{cmd:#1}}} |
| 697 |
% \newcommand*\Ast{\rlap{$^\ast$}} |
| 698 |
% \let\m\cs |
| 699 |
% \let\ti\textit |
| 700 |
% \begin{tabular}{r@{\hspace{.6em}}c@{\hspace{.6em}}l} |
| 701 |
% &\hbox to0pt{\hss\footnotesize page\hss}&\\[.5ex] |
| 702 |
% \verb+\so{letterspacing}+& \pref{so} &\so{letterspacing}\\ |
| 703 |
% \verb+\caps{CAPITALS, Small Capitals}+& \pref{caps} &\caps{CAPITALS, Small Capitals}\\ |
| 704 |
% \verb+\ul{underlining}+& \pref{ul} &\ul{underlining}\\ |
| 705 |
% \verb+\st{striking out}+& \pref{st} &\st{striking out}\\ |
| 706 |
% \verb+\hl{highlighting}+& \pref{hl} &highlighting\\ |
| 707 |
% \\ |
| 708 |
% \verb+\soulaccent{\cs}+& \pref{soulaccent} &\ti{add accent} \cs{\cs} \ti{to accent list}\\ |
| 709 |
% \verb+\soulregister{\cs}{0}+& \pref{soulregister} &\ti{register command} \m{\cs}\\ |
| 710 |
% \verb+\sloppyword{text}+& \pref{sloppyword} &\ti{typeset} \m{text} \ti{with stretchable spaces}\\ |
| 711 |
% \\ |
| 712 |
% \verb+\sodef\cs{1em}{2em}{3em}+& \pref{sodef} &\ti{define new spacing command} \m{\cs}\\ |
| 713 |
% \verb+\resetso+& \pref{resetso} &\ti{reset} \m{\so} \ti{dimensions}\\ |
| 714 |
% \verb+\capsdef{////}{1em}{2em}{3em}+\Ast& \pref{capsdef} &\ti{define (default)} \m{\caps} \ti{data entry}\\ |
| 715 |
% \verb+\capssave{name}+\Ast& \pref{capssave} &\ti{save} \m{\caps} \ti{database under name} \rlap{\texttt{name}}\\ |
| 716 |
% \verb+\capsselect{name}+\Ast& \pref{capssave} &\ti{restore} \m{\caps} \ti{database of name} \rlap{\texttt{name}}\\ |
| 717 |
% \verb+\capsreset+\Ast& \pref{capsreset} &\ti{clear caps database}\\ |
| 718 |
% \verb+\setul{1ex}{2ex}+& \pref{setul} &\ti{set} \m{\ul} \ti{dimensions}\\ |
| 719 |
% \verb+\resetul+& \pref{resetul} &\ti{reset} \m{\ul} \ti{dimensions}\\ |
| 720 |
% \verb+\setuldepth{y}+& \pref{setuldepth} &\ti{set underline depth to depth of an} y\\ |
| 721 |
% \verb+\setuloverlap{1pt}+& \pref{setuloverlap} &\ti{set underline overlap width}\\ |
| 722 |
% \verb+\setulcolor{red}+& \pref{setulcolor} &\ti{set underline color}\\ |
| 723 |
% \verb+\setstcolor{green}+& \pref{setstcolor} &\ti{set overstriking color}\\ |
| 724 |
% \verb+\sethlcolor{blue}+& \pref{sethlcolor} &\ti{set highlighting color}\\ |
| 725 |
% \end{tabular} |
| 726 |
% \caption{List of all available commands. The number points to the |
| 727 |
% page where the command is described. Those marked |
| 728 |
% with a little asterisk are only available when the package |
| 729 |
% is used together with \LaTeX, because they rely on the |
| 730 |
% \emph{New Font Selection Scheme (NFSS)} used in \LaTeX.} |
| 731 |
% \label{tab:survey} |
| 732 |
% \end{center} |
| 733 |
% \end{table} |
| 734 |
% |
| 735 |
% |
| 736 |
% |
| 737 |
% |
| 738 |
% |
| 739 |
% |
| 740 |
% |
| 741 |
% \subsection{Troubleshooting} |
| 742 |
% |
| 743 |
% Unfortunately, there's just one helpful error message provided by |
| 744 |
% the \soul\ package, that actually describes the underlying problem. All other |
| 745 |
% messages are generated directly by \TeX\ and show the low-level |
| 746 |
% commands that \TeX\ wasn't happy with. They'll hardly point you |
| 747 |
% to the violated rule as described in the paragraphs above. |
| 748 |
% If you get such a mysterious error message for a line that contains |
| 749 |
% a \soul\ statement, then comment that statement out and see if the message |
| 750 |
% still appears. |
| 751 |
% \texttt{`Incomplete }\cs{\ifcat}\texttt{'} is such a non-obvious message. |
| 752 |
% If the message doesn't appear now, then check the argument for |
| 753 |
% violations of the rules as listed in~\S\S\,20--26. |
| 754 |
% |
| 755 |
% |
| 756 |
% |
| 757 |
% \subsubsection{\texttt{`Reconstruction failed'}} |
| 758 |
% |
| 759 |
% This message appears, if \ref{par:Grouping hyphenatable material} or |
| 760 |
% \ref{par:Leaking font switches} was |
| 761 |
% violated. It is caused by the fact that the reconstruction pass |
| 762 |
% couldn't collect tokens with an overall width of the syllable that |
| 763 |
% was measured by the analyzer. This does either occur when you |
| 764 |
% grouped hyphenatable text or used an unregistered command |
| 765 |
% that influences the syllable width. Font switching commands belong |
| 766 |
% to the latter group. See the above cited sections for how to fix |
| 767 |
% these problems. |
| 768 |
% |
| 769 |
% |
| 770 |
% |
| 771 |
% \subsubsection{Missing characters} |
| 772 |
% |
| 773 |
% If you have redefined the internal font as described in section \ref{sec:internalfont}, |
| 774 |
% you may notice that some characters are omitted without any error message |
| 775 |
% being shown. This happens if you have chosen, let's say, a font with |
| 776 |
% only 128~characters like the |cmtt10| font, but are using characters |
| 777 |
% that aren't represented in this font, e.\,g.~characters with codes |
| 778 |
% greater than~127. |
| 779 |
% |
| 780 |
% |
| 781 |
% |
| 782 |
% |
| 783 |
% |
| 784 |
% |
| 785 |
% |
| 786 |
% |
| 787 |
% |
| 788 |
% \section{\so{Letterspacing}} |
| 789 |
% |
| 790 |
% \subsection{How it works} |
| 791 |
% \label{sec:so} |
| 792 |
% |
| 793 |
% The base macro for letterspacing is called \describemacro{\so}. |
| 794 |
% It typesets the given argument with \syn{inter-letter space} |
| 795 |
% between every two characters, \syn{inner space} between words |
| 796 |
% and \syn{outer space} before and after the spaced out text. |
| 797 |
% If we let ``$\cdot$'' stand for \syn{inter-letter space}, ``$\ast$'' |
| 798 |
% for \syn{inner spaces} and ``$\bullet$'' for \syn{outer |
| 799 |
% spaces,} then the input on the left side of the following table |
| 800 |
% will yield the schematic output on the right side: |
| 801 |
% |
| 802 |
% \begin{center} |
| 803 |
% \def\.{$\cdot$} |
| 804 |
% \def\-{\kern1pt$\ast$\kern1pt} |
| 805 |
% \def\*{$\bullet$} |
| 806 |
% \def\_{\texttt{\char"20}} |
| 807 |
% \begin{tabular}{ccc} |
| 808 |
% 1.& \verb*|XX\so{aaa bbb ccc}YY|& \textsf{XXa\.a\.a\-b\.b\.b\-c\.c\.cYY}\\ |
| 809 |
% 2.& \verb*|XX \so{aaa bbb ccc} YY|& \textsf{XX\*a\.a\.a\-b\.b\.b\-c\.c\.c\*\kern-1ptYY}\\ |
| 810 |
% 3.& \verb*|XX {\so{aaa bbb ccc}} YY|& \textsf{XX\*a\.a\.a\-b\.b\.b\-c\.c\.c\*\kern-1ptYY}\\ |
| 811 |
% 4.& \verb*|XX \null{\so{aaa bbb ccc}}{} YY|& \textsf{XX\_a\.a\.a\-b\.b\.b\-c\.c\.c\_YY}\\ |
| 812 |
% \end{tabular} |
| 813 |
% \end{center} |
| 814 |
% ^^A* % fool vim (fixes syntax highlighting) |
| 815 |
% |
| 816 |
% \noindent |
| 817 |
% Case~1 shows how letterspacing macros (\cs{\so} and \cs{\caps}) behave if |
| 818 |
% they aren't following or followed by a space: they omit outer space around |
| 819 |
% the \soul\ statement. Case~2 is what you'll mostly need---letterspaced |
| 820 |
% text amidst running text. Following and leading space get replaced by |
| 821 |
% \syn{outer space}. It doesn't matter if there are opening braces before |
| 822 |
% or closing braces afterwards. \soul\ can see through both of them (case~3). |
| 823 |
% Note that leading space has to be at least |5sp| wide to be recognized as |
| 824 |
% space, because \LaTeX\ uses tiny spaces generated by |\hskip1sp| as marker. |
| 825 |
% Case~4 shows how to enforce normal spaces instead of \syn{outer spaces:} |
| 826 |
% Preceding space can be hidden by |\kern0pt| or \cs{\null} or any character. |
| 827 |
% Following space can also be hidden by any token, but note that a typical macro name |
| 828 |
% like \cs{\relax} or \cs{\null} would also hide the space thereafter. |
| 829 |
% |
| 830 |
% |
| 831 |
% The values are predefined for typesetting facsimiles mainly with |
| 832 |
% \emph{Fraktur} fonts. |
| 833 |
% You can define your own spacing |
| 834 |
% macros or overwrite the original \cs{\so} meaning using the macro |
| 835 |
% \describemacro{\sodef}: |
| 836 |
% |
| 837 |
% \begin{syntax} |
| 838 |
% |\sodef|\<cmd>|{|\<font>|}{|\<inter-letter space>|}{|\<inner space>|}{|\<outer space>|}| |
| 839 |
% \end{syntax} |
| 840 |
% |
| 841 |
% The space dimensions, all of which are mandatory, should be defined in terms of |em| |
| 842 |
% letting them grow and shrink with the respective fonts. |
| 843 |
% |
| 844 |
% \begin{example} |
| 845 |
% |\sodef\an{}{.4em}{1em plus1em}{2em plus.1em minus.1em}| |
| 846 |
% \end{example} |
| 847 |
% |
| 848 |
% After that you can type `|\an{example}|' to get |
| 849 |
% {\sodef\an{}{.4em}{1em plus1em}{2em plus.1em minus.1em}^^A |
| 850 |
% `\an{example}'.} |
| 851 |
% The \describemacro{\resetso} command resets \cs{\so} |
| 852 |
% to the default values. |
| 853 |
% |
| 854 |
% |
| 855 |
% |
| 856 |
% |
| 857 |
% \subsection{Some examples} |
| 858 |
% |
| 859 |
%^^A===================================================== |
| 860 |
% \begin{examples} |
| 861 |
% |
| 862 |
% \soultest{Ordinary text} |
| 863 |
% |\so{electrical industry}| |
| 864 |
% {\so{electrical industry}} |
| 865 |
% |
| 866 |
% \soultest{Use \texttt{\string\-} to mark hyphenation points} |
| 867 |
% |\so{man\-u\-script}| |
| 868 |
% {\so{man\-u\-script}} |
| 869 |
% |
| 870 |
% \soultest{Accents are recognized} |
| 871 |
% |\so{le th\'e\^atre}| |
| 872 |
% {\so{le th\'e\^atre}} |
| 873 |
% |
| 874 |
% \soultest{\texttt{\string\mbox} and \texttt{\string\hbox} protect material that |
| 875 |
% contains hyphenation points. The contents are treated as one, unbreakable entity} |
| 876 |
% |\so{just an \mbox{example}}| |
| 877 |
% {\so{just an \mbox{example}}} |
| 878 |
% |
| 879 |
% \soultest{Punctuation marks are spaced out, if they are |
| 880 |
% put into the group} |
| 881 |
% |\so{inside.} \& \so{outside}.| |
| 882 |
% {\so{inside.} \& \so{outside}.} |
| 883 |
% |
| 884 |
% \soultest{Space-out skips may be removed by typing \texttt{\string\<}. |
| 885 |
% It's, however, desirable to put the quotation marks out of |
| 886 |
% the argument} |
| 887 |
% |\so{``\<Pennsylvania\<''}| |
| 888 |
% {\so{``\<Pennsylvania\<''}} |
| 889 |
% |
| 890 |
% \soultest{Numbers should never be spaced out} |
| 891 |
% |\so{1\<3 December {1995}}| |
| 892 |
% {\so{1\<3 December {1995}}} |
| 893 |
% |
| 894 |
% \soultest{Explicit hyphens like |-|, |--| and |---| are recognized. |
| 895 |
% \texttt{\string\slash} outputs a slash and enables \TeX\ to break the line |
| 896 |
% afterwards} |
| 897 |
% |\so{input\slash output}| |
| 898 |
% {\so{input\slash output}} |
| 899 |
% |
| 900 |
% \soultest{To keep \TeX\ from breaking lines between the hyphen and `jet' |
| 901 |
% you have to protect the hyphen. This is no \soul\ restriction |
| 902 |
% but normal \TeX\ behavior} |
| 903 |
% |\so{\dots and \mbox{-}jet}| |
| 904 |
% {\so{\dots and \mbox{-}jet}} |
| 905 |
% |
| 906 |
% \soultest{The \texttt{\~} command inhibits line breaks} |
| 907 |
% |\so{unbreakable~space}| |
| 908 |
% {\so{unbreakable~space}} |
| 909 |
% |
| 910 |
% \soultest{\texttt{\string\\} works as usual. Additional arguments |
| 911 |
% like \texttt{*} or vertical space are not accepted, though} |
| 912 |
% |\so{broken\\line}| |
| 913 |
% {\so{broken\\line}} |
| 914 |
% |
| 915 |
% \soultest{\texttt{\string\break} breaks the line without filling it with white space} |
| 916 |
% |\so{pretty awful\break test}| |
| 917 |
% {\so{pretty awful\break test}} |
| 918 |
% |
| 919 |
% \end{examples} |
| 920 |
%^^A===================================================== |
| 921 |
% |
| 922 |
% |
| 923 |
% |
| 924 |
% |
| 925 |
% |
| 926 |
% |
| 927 |
% |
| 928 |
% |
| 929 |
% |
| 930 |
% |
| 931 |
% |
| 932 |
% \subsection[Typesetting \caps{caps-and-small-caps} fonts] |
| 933 |
% {Typesetting capitals-and-small-capitals fonts} |
| 934 |
% |
| 935 |
% There is a special letterspacing command called \describemacro{\caps}, |
| 936 |
% which differs from \cs{\so} in that it switches to caps-and-small-caps |
| 937 |
% font shape, defines only slight spacing and is able to select spacing |
| 938 |
% value sets from a database. This is a requirement for high-quality |
| 939 |
% typesetting \cite{Tschichold}. The following lines show the effect |
| 940 |
% of \cs{\caps} in comparison with the normal textfont and with |
| 941 |
% small-capitals shape: |
| 942 |
% |
| 943 |
% \def\sampletext{DONAUDAMPFSCHIFFAHRTSGESELLSCHAFT} |
| 944 |
% \medskip\noindent |
| 945 |
% \begin{tabular}{rl} |
| 946 |
% |\normalfont|&\sampletext\\ |
| 947 |
% |\scshape|&{\scshape\sampletext}\\ |
| 948 |
% |\caps|&\caps\sampletext\\ |
| 949 |
% ^^A|\person|&\person\sampletext\\ |
| 950 |
% \end{tabular} |
| 951 |
% |
| 952 |
% \medbreak\noindent |
| 953 |
% The \cs{\caps} font database is by default empty, i.\,e., it contains |
| 954 |
% just a single default entry, which yields the result as shown in the |
| 955 |
% example above. |
| 956 |
% New font entries may be added \emph{on top} of this list using the \describemacro{\capsdef} |
| 957 |
% command, which takes five arguments: The first argument describes the font with |
| 958 |
% \emph{encoding, family, series, shape,} and \emph{size,}^^A |
| 959 |
% \footnote{as defined by the \caps{NFSS}, the ``New Font Selection Scheme''} |
| 960 |
% each optionally |
| 961 |
% (e.\,g.~|OT1/cmr/m/n/10| for this very font, or only |/ppl///12| for all |
| 962 |
% \emph{palatino} fonts at size 12\,pt). The \emph{size} entry may also contain |
| 963 |
% a size range (\texttt{5-10}), where zero is assumed for an omitted lower |
| 964 |
% boundary (\texttt{-10}) and a very, very big number for an omitted upper |
| 965 |
% boundary (\texttt{5-}). The |
| 966 |
% upper boundary is not included in the range, so, in the example below, all |
| 967 |
% fonts with sizes greater or equal 5\,pt and smaller than 15\,pt are accepted |
| 968 |
% ($5\,\mbox{pt}\le size<15\,\mbox{pt}$). |
| 969 |
% The second argument may contain font switching commands such as \cs{\scshape}, |
| 970 |
% it may as well be empty or contain debugging commands (e.\,g.~|\message{*}|). |
| 971 |
% The remaining three, mandatory arguments are the spaces as described in |
| 972 |
% section~\ref{sec:so}. |
| 973 |
% |
| 974 |
% \begin{example} |
| 975 |
% |\capsdef{T1/ppl/m/n/5-15}{\scshape}{.16em}{.4em}{.2em}| |
| 976 |
% \end{example} |
| 977 |
% |
| 978 |
% The \cs{\caps} command goes through the data list from top to bottom |
| 979 |
% and picks up the first matching set, so the order of definition is essential. |
| 980 |
% The last added entry is examined first, while the pre-defined default entry |
| 981 |
% will be examined last and will match any font, if no entry was taken before. |
| 982 |
% |
| 983 |
% To override the default values, just define a new default entry using |
| 984 |
% the identifier |{////}|. This entry should be defined first, because no |
| 985 |
% entry after it can be reached. |
| 986 |
% |
| 987 |
% The \cs{\caps} database can be cleared with the \describemacro{\capsreset} |
| 988 |
% command and will only contain the default entry thereafter. The |
| 989 |
% \describemacro{\capssave} command saves the whole current database |
| 990 |
% under the given name. \describemacro{\capsselect} restores such a database. |
| 991 |
% This allows to predefine different groups of \cs{\caps} data sets: |
| 992 |
% |
| 993 |
% \begin{example} |
| 994 |
% |\capsreset|\\ |
| 995 |
% |\capsdef{/cmss///12}{}{12pt}{23pt}{34pt}|\\ |
| 996 |
% |\capsdef{/cmss///}{}{1em}{2em}{3em}|\\ |
| 997 |
% |...|\\ |
| 998 |
% |\capssave{wide}|\\ |
| 999 |
% \end{example} |
| 1000 |
% \indent |
| 1001 |
% \begin{example} |
| 1002 |
% |%---------------------------------------|\\ |
| 1003 |
% |\capsreset|\\ |
| 1004 |
% |\capsdef{/cmss///}{}{.1em}{.2em}{.3em}|\\ |
| 1005 |
% |...|\\ |
| 1006 |
% |\capssave{narrow}|\\ |
| 1007 |
% \end{example} |
| 1008 |
% \indent |
| 1009 |
% \begin{example} |
| 1010 |
% |%---------------------------------------|\\ |
| 1011 |
% |{\capsselect{wide}|\\ |
| 1012 |
% |\title{\caps{Yet Another Silly Example}}|\\ |
| 1013 |
% |}|\\ |
| 1014 |
% \end{example} |
| 1015 |
% |
| 1016 |
% See the `|example.cfg|' file for a detailed example. |
| 1017 |
% If you have defined a bunch of sets for different fonts and sizes, |
| 1018 |
% you may lose control over what fonts are used by the package. With the |
| 1019 |
% package option \DescribeOption{capsdefault}\option{capsdefault} selected, |
| 1020 |
% \cs{\caps} prints its argument underlined, if no set was specified for a |
| 1021 |
% particular font and the default set had to be used. |
| 1022 |
% |
| 1023 |
% |
| 1024 |
% |
| 1025 |
% |
| 1026 |
% |
| 1027 |
% |
| 1028 |
% |
| 1029 |
% |
| 1030 |
% |
| 1031 |
% |
| 1032 |
% |
| 1033 |
% \subsection{Typesetting Fraktur} |
| 1034 |
% \label{sec:fraktur} |
| 1035 |
% |
| 1036 |
% Black letter fonts^^A |
| 1037 |
%^^A%% |
| 1038 |
% \footnote{See the great black letter fonts, which \person{Yannis Haralambous} |
| 1039 |
% kindly provided, and the \package{oldgerm} and \package{yfonts} package~\cite{yfonts} |
| 1040 |
% as their \LaTeX\ interfaces.} |
| 1041 |
%^^A%% |
| 1042 |
% deserve some additional considerations. As stated in section~\ref{sec:typesetting}, |
| 1043 |
% the ligatures |ch|, |ck|, |sz|~(\cs{\ss}), and~|tz| have to remain unbroken in spaced out |
| 1044 |
% \emph{Fraktur} text. This may look strange at first glance, but you'll get used to it: |
| 1045 |
% |
| 1046 |
% \begin{example} |
| 1047 |
% |\textfrak{\so{S{ch}u{tz}vorri{ch}tung}}| |
| 1048 |
% \end{example} |
| 1049 |
% |
| 1050 |
% You already know that grouping keeps the |soul| mechanism from separating such ligatures. |
| 1051 |
% This is quite important for |s:|, |a*|, and~|"a|. As hyphenation is stronger than |
| 1052 |
% grouping, especially the |sz| may cause an error, if hyphenation happens to occur between |
| 1053 |
% the letters |s| and~|z|. (\TeX\ hyphenates the German word |auszer| wrongly like |
| 1054 |
% |aus-zer| instead of like |au-szer|, because the German hyphenation patterns |
| 1055 |
% do, for good reason, not see |sz| as `\cs{\ss}'.) In such cases you can protect tokens with the |
| 1056 |
% sequence e.\,g.~|\mbox{sz}| or a properly defined command. The \cs{\ss} command, |
| 1057 |
% which is defined by the \package{yfonts} package, and similar commands will suffice as well. |
| 1058 |
% |
| 1059 |
% |
| 1060 |
% |
| 1061 |
% |
| 1062 |
% |
| 1063 |
% |
| 1064 |
% |
| 1065 |
% \subsection{Dirty tricks} |
| 1066 |
% \label{sec:dirtytricks} |
| 1067 |
% |
| 1068 |
% Narrow columns are hard to set, because they don't allow much spacing |
| 1069 |
% flexibility, hence long words often cause overfull boxes. A macro |
| 1070 |
% could use \cs{\so} to insert stretchability between the single |
| 1071 |
% characters. Table~\ref{tab:dirtytricks} shows some text typeset with such |
| 1072 |
% a macro at the left side and under \emph{plain} conditions at |
| 1073 |
% the right side, both with a width of~6\,pc. |
| 1074 |
% |
| 1075 |
% \def\sampletext{Some magazines and newspapers prefer this kind of spacing |
| 1076 |
% because it reduces hyphenation problems to a minimum\<. Unfortunately\<, such |
| 1077 |
% paragraphs aren't especially beautiful\<.} |
| 1078 |
% \newbox\dirtytrick |
| 1079 |
% \setbox\dirtytrick\vbox{ |
| 1080 |
% \batchmode ^^A we don't want to see all these overfull boxes ... |
| 1081 |
% \leavevmode\hspace{0ptplus1fil} |
| 1082 |
% \hbox{\parindent0pt\plainsetup\let\<\relax |
| 1083 |
% \vtop{\hsize6pc\raggedright\sampletext}\hskip1em |
| 1084 |
% \vtop{\hsize6pc\magstylepar\sampletext}\hskip1em |
| 1085 |
% \vtop{\hsize6pc\sampletext}\hss} |
| 1086 |
% \errorstopmode} |
| 1087 |
% |
| 1088 |
% \begin{table} |
| 1089 |
% \begin{center} |
| 1090 |
% \overfullrule5pt |
| 1091 |
% \usebox\dirtytrick |
| 1092 |
% \caption{Ragged-right, magazine style (using \soul), and block-aligned |
| 1093 |
% in comparison. But, frankly, none of them is really acceptable. |
| 1094 |
% (Don't do this at home, children!)} |
| 1095 |
% \label{tab:dirtytricks} |
| 1096 |
% \end{center} |
| 1097 |
% \end{table} |
| 1098 |
% |
| 1099 |
% |
| 1100 |
% |
| 1101 |
% |
| 1102 |
% |
| 1103 |
% |
| 1104 |
% |
| 1105 |
% \section{\ul{Underlining}} |
| 1106 |
% |
| 1107 |
% The underlining macros are my answer to Prof.~\person{Knuth'{\normalfont s}} |
| 1108 |
% exercise 18.26 from his \TeX{}book~\cite{DEK}. \texttt{:-)} Most of what |
| 1109 |
% is said about the macro \describemacro{\ul} is also true of the |
| 1110 |
% striking out macro \describemacro{\st} and the highlighting macro \describemacro{\hl}, |
| 1111 |
% both of which are in fact derived from the former. |
| 1112 |
% |
| 1113 |
% |
| 1114 |
% |
| 1115 |
% |
| 1116 |
% \subsection{Settings} |
| 1117 |
% |
| 1118 |
% \subsubsection{Underline depth and thickness} |
| 1119 |
% |
| 1120 |
% The predefined \syn{underline depth} and \syn{thickness} |
| 1121 |
% work well with most fonts. They can be changed using the macro \describemacro{\setul}. |
| 1122 |
% |
| 1123 |
% \begin{syntax} |
| 1124 |
% |\setul{|\<underline depth>|}{|\<underline thickness>|}| |
| 1125 |
% \end{syntax} |
| 1126 |
% |
| 1127 |
% Either dimension can be omitted, in which case there has to be |
| 1128 |
% an empty pair of braces. |
| 1129 |
% Both values should be defined in terms of |ex|, letting them |
| 1130 |
% grow and shrink with the respective fonts. |
| 1131 |
% The \describemacro{\resetul} command restores the standard values. |
| 1132 |
% |
| 1133 |
% Another way to set the \syn{underline depth} is to use the macro |
| 1134 |
% \describemacro{\setuldepth}. It sets the depth such that the |
| 1135 |
% underline's upper edge lies 1\,pt beneath the given argument's |
| 1136 |
% deepest depth. If the argument is empty, all |
| 1137 |
% letters---i.\,e.\ all characters whose \cs{\catcode} currently |
| 1138 |
% equals 11---are taken. Examples: |
| 1139 |
% |
| 1140 |
% \begin{example} |
| 1141 |
% |\setuldepth{ygp}|\\ |
| 1142 |
% |\setuldepth\strut|\\ |
| 1143 |
% |\setuldepth{}|\\ |
| 1144 |
% \end{example} |
| 1145 |
% |
| 1146 |
% |
| 1147 |
% |
| 1148 |
% \subsubsection{Line color} |
| 1149 |
% |
| 1150 |
% The underlines are by default black. The color can be changed by |
| 1151 |
% using the \describemacro{\setulcolor} command. It takes one argument that can be any |
| 1152 |
% of the color specifiers as described in the |color| package. This package |
| 1153 |
% has to be loaded explicitly. |
| 1154 |
% |
| 1155 |
% \indent |
| 1156 |
% \begin{example} |
| 1157 |
% |\documentclass{article}|\\ |
| 1158 |
% |\usepackage{color,soul}|\\ |
| 1159 |
% |\definecolor{darkblue}{rgb}{0,0,0.5}|\\ |
| 1160 |
% |\setulcolor{darkblue}|\\ |
| 1161 |
% \end{example} |
| 1162 |
% |
| 1163 |
% \indent |
| 1164 |
% \begin{example} |
| 1165 |
% |\begin{document}|\\ |
| 1166 |
% |...|\\ |
| 1167 |
% |\ul{Cave: remove all the underlines!}|\\ |
| 1168 |
% |...|\\ |
| 1169 |
% |\end{document}|\\ |
| 1170 |
% \end{example} |
| 1171 |
% |
| 1172 |
% |
| 1173 |
% The colors for overstriking lines and highlighting are likewise set |
| 1174 |
% with \describemacro{\setstcolor} (default: black) and \describemacro{\sethlcolor} |
| 1175 |
% (default: yellow). If the \package{color} package wasn't loaded, |
| 1176 |
% underlining and overstriking color are black, while highlighting |
| 1177 |
% is replaced by underlining. |
| 1178 |
% |
| 1179 |
% |
| 1180 |
% |
| 1181 |
% |
| 1182 |
% |
| 1183 |
% |
| 1184 |
% |
| 1185 |
% \subsubsection{The \program{dvips} problem} |
| 1186 |
% \label{sec:dvips} |
| 1187 |
% |
| 1188 |
% \ul{Underlining}, \st{striking out} and highlighting build up |
| 1189 |
% their lines with many short line segments. If you used the `\program{dvips}' |
| 1190 |
% program with default settings, you would get little gaps on some places, because |
| 1191 |
% the \emph{maxdrift} parameter allows the single objects to drift |
| 1192 |
% this many pixels from their real positions. |
| 1193 |
% \bigbreak |
| 1194 |
% |
| 1195 |
% \noindent |
| 1196 |
% There are two ways to avoid the problem, where the \soul\ package |
| 1197 |
% chooses the second by default: |
| 1198 |
% \begin{enumerate} |
| 1199 |
% \item |
| 1200 |
% Set the \emph{maxdrift} value to zero, e.\,g.: |dvips -e 0 file.dvi|. |
| 1201 |
% This is probably not a good idea, since the letters may then no longer be |
| 1202 |
% spaced equally on low resolution printers. |
| 1203 |
% \item |
| 1204 |
% Let the lines stick out by a certain amount on each side so that they |
| 1205 |
% overlap. This overlap amount can be set using the \describemacro{\setuloverlap} |
| 1206 |
% command. It is set to 0.25\,pt by default. |\setuloverlap{0pt}| turns overlapping off. |
| 1207 |
% \end{enumerate} |
| 1208 |
% |
| 1209 |
% |
| 1210 |
% |
| 1211 |
% |
| 1212 |
% |
| 1213 |
% |
| 1214 |
% \subsection{Some examples} |
| 1215 |
% |
| 1216 |
%^^A===================================================== |
| 1217 |
% \begin{examples} |
| 1218 |
% |
| 1219 |
% \soultest{Ordinary text} |
| 1220 |
% |\ul{electrical industry}| |
| 1221 |
% {\ul{electrical industry}} |
| 1222 |
% |
| 1223 |
% \soultest{Use \texttt{\string\-} to mark hyphenation points} |
| 1224 |
% |\ul{man\-u\-script}| |
| 1225 |
% {\ul{man\-u\-script}} |
| 1226 |
% |
| 1227 |
% \soultest{Accents are recognized} |
| 1228 |
% |\ul{le th\'e\^atre}| |
| 1229 |
% {\ul{le th\'e\^atre}} |
| 1230 |
% |
| 1231 |
% \soultest{\texttt{\string\mbox} and \texttt{\string\hbox} protect material that |
| 1232 |
% contains hyphenation points. The contents are treated as one, unbreakable entity} |
| 1233 |
% |\ul{just an \mbox{example}}| |
| 1234 |
% {\ul{just an \mbox{example}}} |
| 1235 |
% |
| 1236 |
% \soultest{Explicit hyphens like |-|, |--| and |---| are recognized. |
| 1237 |
% \texttt{\string\slash} outputs a slash and enables \TeX\ to break the line |
| 1238 |
% afterwards} |
| 1239 |
% |\ul{input\slash output}| |
| 1240 |
% {\ul{input\slash output}} |
| 1241 |
% |
| 1242 |
% \soultest{To keep \TeX\ from breaking lines between the hyphen and `jet' |
| 1243 |
% you have to protect the hyphen. This is no \soul\ restriction |
| 1244 |
% but normal \TeX\ behavior} |
| 1245 |
% |\ul{\dots and \mbox{-}jet}| |
| 1246 |
% {\ul{\dots and \mbox{-}jet}} |
| 1247 |
% |
| 1248 |
% \soultest{The \texttt{\~} command inhibits line breaks} |
| 1249 |
% |\ul{unbreakable~space}| |
| 1250 |
% {\ul{unbreakable~space}} |
| 1251 |
% |
| 1252 |
% \soultest{\texttt{\string\\} works as usual. Additional arguments |
| 1253 |
% like \texttt{*} or vertical space are not accepted, though} |
| 1254 |
% |\ul{broken\\line}| |
| 1255 |
% {\ul{broken\\line}} |
| 1256 |
% |
| 1257 |
% \soultest{\texttt{\string\break} breaks the line without filling it with white space} |
| 1258 |
% |\ul{pretty awful\break test}| |
| 1259 |
% {\ul{pretty awful\break test}} |
| 1260 |
% |
| 1261 |
% \soultest{Italic correction needs to be set manually} |
| 1262 |
% |\ul{foo \emph{bar\/} baz}| |
| 1263 |
% {\ul{foo \emph{bar\/} baz}} |
| 1264 |
% |
| 1265 |
% \end{examples} |
| 1266 |
%^^A===================================================== |
| 1267 |
% |
| 1268 |
% |
| 1269 |
% |
| 1270 |
% |
| 1271 |
% |
| 1272 |
% |
| 1273 |
% |
| 1274 |
% |
| 1275 |
% |
| 1276 |
% |
| 1277 |
% |
| 1278 |
% |
| 1279 |
% |
| 1280 |
% \section{Customization} |
| 1281 |
% |
| 1282 |
% \subsection{Adding accents} |
| 1283 |
% \label{sec:soulaccent} |
| 1284 |
% |
| 1285 |
% The \soul\ scanner generally sees every input token separately. |
| 1286 |
% It has to be taught that some tokens belong together. For accents this is done |
| 1287 |
% by registering them via the \describemacro{\soulaccent} macro. |
| 1288 |
% |
| 1289 |
% \begin{syntax} |
| 1290 |
% |\soulaccent{|\<accent command>|}| |
| 1291 |
% \end{syntax} |
| 1292 |
% |
| 1293 |
% The standard accents, however, are already pre-registered: |
| 1294 |
% |\`|, |\'|, |\^|, |\"|, |\~|, |\=|, |\.|, |\u|, |\v|, |\H|, |\t|, |
| 1295 |
% |\c|, |\d|, |\b|, and |\r|. If used together with the \package{german} |
| 1296 |
% package, \soul\ automatically adds the |"| command. |
| 1297 |
% Let's assume you have defined |\%| to put some weird accent on |
| 1298 |
% the next character. Simply put the following line into your |soul.cfg| |
| 1299 |
% file (see section~\ref{sec:config}): |
| 1300 |
% |
| 1301 |
% \begin{example} |
| 1302 |
% |\soulaccent{\%}| |
| 1303 |
% \end{example} |
| 1304 |
% |
| 1305 |
% Note that active characters like the |"| command have already |
| 1306 |
% to be \cs{\active} when they are stored or they won't be recognized |
| 1307 |
% later. This can be done temporarily, as in |{\catcode\`"\active\soulaccent{"}}|. |
| 1308 |
% |
| 1309 |
% |
| 1310 |
% |
| 1311 |
% |
| 1312 |
% \subsection{Adding font commands} |
| 1313 |
% \label{sec:soulregister} |
| 1314 |
% |
| 1315 |
% To convince \soul\ not to feed font switching (or other) |
| 1316 |
% commands to the analyzer, but rather to execute them immediately, |
| 1317 |
% they have to be registered, too. The \describemacro{\soulregister} macro |
| 1318 |
% takes the name of a command name and either |0| or |1| for the number |
| 1319 |
% of arguments: |
| 1320 |
% |
| 1321 |
% \begin{syntax} |
| 1322 |
% |\soulregister{|\<command name>|}{|\<number of arguments>|}| |
| 1323 |
% \end{syntax} |
| 1324 |
% |
| 1325 |
% If \cs{\bf} and \cs{\emph} weren't already registered, you would |
| 1326 |
% write the following into your |soul.cfg| configuration file: |
| 1327 |
% |
| 1328 |
% \begin{example} |
| 1329 |
% |\soulregister{\bf}{0} % {\bf foo}| \\ |
| 1330 |
% |\soulregister{\emph}{1} % \emph{bar}|\\ |
| 1331 |
% \end{example} |
| 1332 |
% |
| 1333 |
% |
| 1334 |
% All standard \TeX\ and \LaTeX\ font commands, as well as the |
| 1335 |
% \package{yfonts} commands are already pre-registered: |
| 1336 |
% |
| 1337 |
% \begin{example} |
| 1338 |
% |\em, \rm, \bf, \it, \tt, \sc, \sl, \sf, \emph, \textrm,|\\ |
| 1339 |
% |\textsf, \texttt, \textmd, \textbf, \textup, \textsl,|\\ |
| 1340 |
% |\textit, \textsc, \textnormal, \rmfamily, \sffamily,|\\ |
| 1341 |
% |\ttfamily, \mdseries, \upshape, \slshape, \itshape,|\\ |
| 1342 |
% |\scshape, \normalfont, \tiny, \scriptsize, \footnotesize,|\\ |
| 1343 |
% |\small, \normalsize, \large, \Large, \LARGE, \huge, \Huge,|\\ |
| 1344 |
% |\MakeUppercase, \textsuperscript, \footnote,|\\ |
| 1345 |
% |\textfrak, \textswab, \textgoth, \frakfamily,|\\ |
| 1346 |
% |\swabfamily, \gothfamily|\\ |
| 1347 |
% \end{example} |
| 1348 |
% |
| 1349 |
% You can also register other commands as fonts, so the |
| 1350 |
% analyzer won't see them. This may be necessary for some |
| 1351 |
% macros that \soul\ refuses to typeset correctly. |
| 1352 |
% But note, that \cs{\so} and \cs{\caps} won't put their |
| 1353 |
% letter-skips around then. |
| 1354 |
% |
| 1355 |
% |
| 1356 |
% |
| 1357 |
% |
| 1358 |
% |
| 1359 |
% |
| 1360 |
% \subsection{Changing the internal font} |
| 1361 |
% \label{sec:internalfont} |
| 1362 |
% |
| 1363 |
% The \soul\ package uses the |ectt1000| font while it analyzes |
| 1364 |
% the syllables. This font is used, because it |
| 1365 |
% has 256~mono-spaced characters without any kerning. |
| 1366 |
% It belongs to \person{J\"org Knappen'\textrm{s}} |
| 1367 |
% \caps{EC}-fonts, which should be part of every modern \TeX\ installation. |
| 1368 |
% If \TeX\ reports ``\texttt{I can't find file `ectt1000'}'' you don't |
| 1369 |
% seem to have this font installed. It is recommended that |
| 1370 |
% you install at least the file |ectt1000.tfm| which has less than 1.4\,kB\null. |
| 1371 |
% Alternatively, you can let the \soul\ package use the |cmtt10| font that |
| 1372 |
% is part of any installation, or some other mono-spaced font: |
| 1373 |
% |
| 1374 |
% \begin{example} |
| 1375 |
% |\font\SOUL@tt=cmtt10| |
| 1376 |
% \end{example} |
| 1377 |
% |
| 1378 |
% Note, however, that \soul\ does only handle characters, |
| 1379 |
% for which the internal font has a character with the same |
| 1380 |
% character code. As |cmtt10| contains only characters with codes |
| 1381 |
% 0 to~127, you can't typeset characters with codes 128 to~255. |
| 1382 |
% These 8-bit character codes are used by many fonts with non-ascii |
| 1383 |
% glyphs. So the |cmtt10| font will, for example, not work for |T2A| |
| 1384 |
% encoded cyrillic characters. |
| 1385 |
% |
| 1386 |
% |
| 1387 |
% |
| 1388 |
% |
| 1389 |
% |
| 1390 |
% |
| 1391 |
% |
| 1392 |
% \subsection{The configuration file} |
| 1393 |
% \label{sec:config} |
| 1394 |
% |
| 1395 |
% If you want to change the predefined settings or add new features, |
| 1396 |
% then create a file named `|soul.cfg|' and put it in a directory, where \TeX\ |
| 1397 |
% can find it. This configuration file will then be loaded |
| 1398 |
% at the end of the |soul.sty| file, so you may redefine |
| 1399 |
% any settings or commands therein, select package options and even |
| 1400 |
% introduce new ones. But if you intend to give |
| 1401 |
% your documents to others, don't forget to give them the |
| 1402 |
% required configuration files, too! That's how such a file |
| 1403 |
% could look like: |
| 1404 |
% |
| 1405 |
% \indent |
| 1406 |
% \begin{example} |
| 1407 |
% |% define macros for logical markup|\\ |
| 1408 |
% |\sodef\person{\scshape}{0.125em}{0.4583em}{0.5833em}|\\ |
| 1409 |
% \\ |
| 1410 |
% |\sodef\SOUL@@@versal{\upshape}{0.125em}{0.4583em}{0.5833em}|\\ |
| 1411 |
% |\DeclareRobustCommand*\versal[1]{%|\\ |
| 1412 |
% | \MakeUppercase{\SOUL@@@versal{#1}}%|\\ |
| 1413 |
% |}|\\ |
| 1414 |
% \end{example} |
| 1415 |
% |
| 1416 |
% \indent |
| 1417 |
% \begin{example} |
| 1418 |
% |% load the color package and set|\\ |
| 1419 |
% |% a different highlighting color|\\ |
| 1420 |
% |\RequirePackage{color}|\\ |
| 1421 |
% |\definecolor{lightblue}{rgb}{.90,.95,1}|\\ |
| 1422 |
% |\sethlcolor{lightblue}|\\ |
| 1423 |
% |\endinput| |
| 1424 |
% \end{example} |
| 1425 |
% |
| 1426 |
% You can safely use the |\SOUL@@@| namespace for internal macros---it |
| 1427 |
% won't be used by the \soul\ package in the future. |
| 1428 |
% |
| 1429 |
% |
| 1430 |
% |
| 1431 |
% |
| 1432 |
% |
| 1433 |
% |
| 1434 |
% |
| 1435 |
% |
| 1436 |
% |
| 1437 |
% |
| 1438 |
% \section{Miscellaneous} |
| 1439 |
% |
| 1440 |
% \subsection{Using \soul\ with other flavors of \TeX} |
| 1441 |
% \label{sec:plain} |
| 1442 |
% |
| 1443 |
% This documentation describes how to use \soul\ together |
| 1444 |
% with \LaTeXe, for which it is optimized. It works, however, with |
| 1445 |
% all other flavors of \TeX, too. There are just some minor restrictions |
| 1446 |
% for Non-\LaTeX\ use: |
| 1447 |
% |
| 1448 |
% The \cs{\caps} command doesn't use a database, it is only a dumb |
| 1449 |
% definition with fixed values. It switches to \cs{\capsfont}, which---unless |
| 1450 |
% defined explicitly like in the following example---won't really change |
| 1451 |
% the used font at all. The commands \cs{\capsreset} and \cs{\capssave} |
| 1452 |
% do nothing. |
| 1453 |
% |
| 1454 |
% \begin{example} |
| 1455 |
% |\font\capsfont=cmcsc10|\\ |
| 1456 |
% |\caps{Tschichold}|\\ |
| 1457 |
% \end{example} |
| 1458 |
% |
| 1459 |
% None of the commands are made `robust', so they have to be |
| 1460 |
% explicitly protected in fragile environments like in \cs{\write} |
| 1461 |
% statements. |
| 1462 |
% To make use of colored underlines or highlighting you have to |
| 1463 |
% use the \package{color} package wrapper from \caps{CTAN}^^A |
| 1464 |
% \footnote{\texttt{CTAN:/macros/plain/graphics/\char`\{miniltx.tex,color.tex\char`\}}}, |
| 1465 |
% instead of the \package{color} package directly: |
| 1466 |
% |
| 1467 |
% \begin{example} |
| 1468 |
% |\input color|\\ |
| 1469 |
% |\input soul.sty|\\ |
| 1470 |
% |\hl{highlighted}|\\ |
| 1471 |
% |\bye|\\ |
| 1472 |
% \end{example} |
| 1473 |
% |
| 1474 |
% The \option{capsdefault} package option is mapped to a simple command |
| 1475 |
% \describemacro{\capsdefault}. |
| 1476 |
% |
| 1477 |
% |
| 1478 |
% |
| 1479 |
% |
| 1480 |
% |
| 1481 |
% |
| 1482 |
% |
| 1483 |
% \subsection{Using \soul\ commands for logical markup} |
| 1484 |
% \label{sec:markup} |
| 1485 |
% |
| 1486 |
% It's generally a bad idea to use font style commands like \cs{\textsc} |
| 1487 |
% in running text. There should always be some reasoning behind changing |
| 1488 |
% the style, such as ``names of persons shall be typeset in a caps-and-small-caps |
| 1489 |
% font''. So you declare in your text just that some words are the name of a |
| 1490 |
% person, while you define in the preamble or, even better, in a separate |
| 1491 |
% style file how to deal with persons: |
| 1492 |
% |
| 1493 |
% \begin{example} |
| 1494 |
% |\newcommand*\person{\textsc}|\\ |
| 1495 |
% |...|\\ |
| 1496 |
% |``I think it's a beautiful day to go to the zoo and feed|\\ |
| 1497 |
% |the ducks. To the lions.'' --~\person{Brian Kantor}|\\ |
| 1498 |
% \end{example} |
| 1499 |
% |
| 1500 |
% It's quite simple to use \soul\ commands that way: |
| 1501 |
% |
| 1502 |
% \begin{example} |
| 1503 |
% |\newcommand\comment*{\ul} % or \let\comment=\ul|\\ |
| 1504 |
% |\sodef\person{\scshape}{0.125em}{0.4583em}{0.5833em}|\\ |
| 1505 |
% \end{example} |
| 1506 |
% |
| 1507 |
% Letterspacing commands like \cs{\so} and \cs{\caps} have to |
| 1508 |
% check whether they are followed by white space, in which case |
| 1509 |
% they replace that space by \syn{outer space}. Note that \soul\ |
| 1510 |
% does look through closing braces. Hence you can conveniently bury |
| 1511 |
% a \soul\ command within another macro like in the following |
| 1512 |
% example. Use any other token to hide following space if necessary, |
| 1513 |
% for example the \cs{\null} macro. |
| 1514 |
% |
| 1515 |
% \begin{example} |
| 1516 |
% |\DeclareRobustCommand*\versal[1]{%|\\ |
| 1517 |
% | \MakeUppercase{\SOUL@@@versal{#1}}%|\\ |
| 1518 |
% |}|\\ |
| 1519 |
% |\sodef\SOUL@@@versal{\upshape}{0.125em}{0.4583em}{0.5833em}|\\ |
| 1520 |
% \end{example} |
| 1521 |
% |
| 1522 |
% |
| 1523 |
% But what if the \soul\ command is for some reason not the last one |
| 1524 |
% in that macro definition and thus cannot look ahead at the following token? |
| 1525 |
% |
| 1526 |
% |
| 1527 |
% \begin{example} |
| 1528 |
% |\newcommand*\somsg[1]{\so{#1}\message{#1}}|\\ |
| 1529 |
% |...|\\ |
| 1530 |
% |foo \somsg{bar} baz % wrong spacing after `bar'!|\\ |
| 1531 |
% \end{example} |
| 1532 |
% |
| 1533 |
% In this case you won't get the following space replaced by \emph{outer space} |
| 1534 |
% because when \soul\ tries to look ahead, it only sees the token |
| 1535 |
% \cs{\message} and consequently decides that there is no space to replace. |
| 1536 |
% You can get around this by explicitly calling the space scanner again. |
| 1537 |
% |
| 1538 |
% \begin{example} |
| 1539 |
% |\newcommand*\somsg[1]{{%|\\ |
| 1540 |
% | \so{#1}%|\\ |
| 1541 |
% | \message{bar}%|\\ |
| 1542 |
% | \let\\\SOUL@socheck|\\ |
| 1543 |
% | \\%|\\ |
| 1544 |
% |}}|\\ |
| 1545 |
% \end{example} |
| 1546 |
% |
| 1547 |
% However, \cs{\SOUL@socheck} can't be used directly, because it would discard |
| 1548 |
% any normal space. \cs{\\} doesn't have this problem. |
| 1549 |
% The additional pair of braces avoids that its definition leaks out |
| 1550 |
% of this macro. In the example above you could, of course, simply |
| 1551 |
% have put \cs{\message} in front, so you hadn't needed to |
| 1552 |
% use the scanner macro \cs{\SOUL@socheck} at all. |
| 1553 |
% |
| 1554 |
% Many packages do already offer logical markup commands that default |
| 1555 |
% to some standard \LaTeX\ font commands or to \cs{\relax}. One example |
| 1556 |
% is the \package{jurabib} package~\cite{jurabib}, which makes the use of |
| 1557 |
% \soul\ a challenge. This package implements lots of |
| 1558 |
% formatting macros. Let's have a look at one of them, \cs{\jbauthorfont}, |
| 1559 |
% which is used to typeset author names in citations. |
| 1560 |
% The attempt to simply |
| 1561 |
% define |\let\jbauthorfont\caps| fails, because the macro isn't directly |
| 1562 |
% applied to the author name as in |\jbauthorfont{Don Knuth}|, but |
| 1563 |
% to another command sequence: |\jbauthorfont{\jb@@author}|. Not even |
| 1564 |
% \cs{\jb@@author} contains the name, but instead further commands that |
| 1565 |
% at last yield the requested name. That's why we have to expand |
| 1566 |
% the contents first. This is quite tricky, because we must not |
| 1567 |
% expand too much, either. Fortunately, we can offer the contents |
| 1568 |
% wrapped up in yet another macro, so that \soul\ knows that it has to |
| 1569 |
% use its own macro expansion mechanism: |
| 1570 |
% |
| 1571 |
% \begin{example} |
| 1572 |
% |\renewcommand*\jbauthorfont[1]{{%|\\ |
| 1573 |
% | \def\x{#1}%|\\ |
| 1574 |
% | \caps\x|\\ |
| 1575 |
% |}}|\\ |
| 1576 |
% \end{example} |
| 1577 |
% |
| 1578 |
% Some additional kerning after |\caps\x| wouldn't hurt, because |
| 1579 |
% the look-ahead scanner is blinded by further commands that follow |
| 1580 |
% in the \package{jurabib} package. Now we run into the next problem: |
| 1581 |
% cited names may contain commands |
| 1582 |
% that must not get expanded. We have to register them as special |
| 1583 |
% command: |
| 1584 |
% |
| 1585 |
% \begin{example} |
| 1586 |
% |\soulregister\jbbtasep{0}|\\ |
| 1587 |
% |...|\\ |
| 1588 |
% \end{example} |
| 1589 |
% |
| 1590 |
% But such registered commands bypass \soul's kernel and we don't |
| 1591 |
% get the correct spacing before and afterwards. So we end up |
| 1592 |
% redefining \cs{\jbbtasep}, whereby you should, of course, use |
| 1593 |
% variables instead of numbers: |
| 1594 |
% |
| 1595 |
% \begin{example} |
| 1596 |
% |\renewcommand*\jbbtasep{%|\\ |
| 1597 |
% | \kern.06em|\\ |
| 1598 |
% | \slash|\\ |
| 1599 |
% | \hskip.06em|\\ |
| 1600 |
% | \allowbreak|\\ |
| 1601 |
% |}|\\ |
| 1602 |
% \end{example} |
| 1603 |
% |
| 1604 |
% Another problem arises: bibliography entries that must not get |
| 1605 |
% teared apart are supposed to be enclosed in additional braces. |
| 1606 |
% This, however, won't work with \soul\ because of |
| 1607 |
% \ref{par:Grouping hyphenatable material}. A simple trick will |
| 1608 |
% get you around that problem: define a dummy command that only |
| 1609 |
% outputs its argument, and register that command: |
| 1610 |
% |
| 1611 |
% \begin{example} |
| 1612 |
% |\newcommand*\together[1]{#1}|\\ |
| 1613 |
% |\soulregister\together{1}|\\ |
| 1614 |
% \end{example} |
| 1615 |
% |
| 1616 |
% Now you can write ``|Author = {\together{Don Knuth}}|'' and |
| 1617 |
% \package{jurabib} won't dare to reorder the parts of the name. |
| 1618 |
% And what if some name shouldn't get letterspaced at all? Overriding |
| 1619 |
% a conventional font style like \cs{\textbf} that was globally |
| 1620 |
% set is trivial, you just have to specify the style that you |
| 1621 |
% prefer in that very bibliography entry. In our example, if we |
| 1622 |
% wanted to keep \soul\ from letterspacing a particular entry, |
| 1623 |
% although they are all formatted by our \cs{\jbauthorfont} |
| 1624 |
% and hence fed to \cs{\caps}, we'd use the following construction: |
| 1625 |
% |
| 1626 |
% \begin{example} |
| 1627 |
% |Author = {\soulomit{\normalfont\huge Donald E. Knuth}}|\\ |
| 1628 |
% \end{example} |
| 1629 |
% |
| 1630 |
% The \package{jurabib} package is probably one of the more |
| 1631 |
% demanding packages to collaborate with \soul. Everything else |
| 1632 |
% can just become easier. |
| 1633 |
% |
| 1634 |
% |
| 1635 |
% |
| 1636 |
% |
| 1637 |
% |
| 1638 |
% |
| 1639 |
% |
| 1640 |
% |
| 1641 |
% \subsection{Typesetting long words in narrow columns} |
| 1642 |
% \label{sec:sloppyword} |
| 1643 |
% |
| 1644 |
% Narrow columns are best set |flushleft|, because not even the best |
| 1645 |
% hyphenation algorithm can guarantee acceptable line breaks without |
| 1646 |
% overly stretched spaces. |
| 1647 |
% However, in some rare cases one may be \emph{forced} to typeset |
| 1648 |
% block aligned. When typesetting in languages like German, where |
| 1649 |
% there are really long words, the \describemacro{\sloppyword} macro |
| 1650 |
% might help a little bit. It adds enough stretchability between the |
| 1651 |
% single characters to make the hyphenation algorithm happy, but |
| 1652 |
% is still not as ugly as the example in section~\ref{sec:dirtytricks} |
| 1653 |
% demonstrates. In the following example the left column was typeset |
| 1654 |
% as ``|Die \sloppyword{Donau...novelle} wird ...|'': |
| 1655 |
% |
| 1656 |
% \begin{center} |
| 1657 |
% \def\word{Do\-nau\-dampf\-schiff\-fahrts\-ge\-sell\-schafts\-^^A |
| 1658 |
% ka\-pi\-t\"ans\-wit\-wen\-pen\-si\-ons\-ge\-setz\-no\-vel\-le} |
| 1659 |
% \begin{minipage}{1.5in} |
| 1660 |
% \plainsetup |
| 1661 |
% Die |
| 1662 |
% \expandafter\sloppyword\expandafter{\word} |
| 1663 |
% wird mit sofortiger Wirkung au\ss er Kraft gesetzt. |
| 1664 |
% \end{minipage} |
| 1665 |
% \hspace{1em} |
| 1666 |
% \batchmode |
| 1667 |
% \begin{minipage}{1.5in} |
| 1668 |
% \plainsetup |
| 1669 |
% Die \word\ wird mit sofortiger Wirkung au\ss er Kraft gesetzt. |
| 1670 |
% \end{minipage} |
| 1671 |
% \errorstopmode |
| 1672 |
% \end{center} |
| 1673 |
% |
| 1674 |
% |
| 1675 |
% |
| 1676 |
% |
| 1677 |
% |
| 1678 |
% |
| 1679 |
% |
| 1680 |
% \subsection{Using \soul\ commands in section headings} |
| 1681 |
% |
| 1682 |
% Letterspacing was often used for section titles in the past, |
| 1683 |
% mostly centered and with a closing period. The following example |
| 1684 |
% shows how to achieve this using the \package{titlesec} |
| 1685 |
% package \cite{titlesec}: |
| 1686 |
% |
| 1687 |
% \begin{example} |
| 1688 |
% |\newcommand*\periodafter[2]{#1{#2}.}|\\ |
| 1689 |
% |\titleformat{\section}[block]|\\ |
| 1690 |
% | {\normalfont\centering}|\\ |
| 1691 |
% | {\thesection.}|\\ |
| 1692 |
% | {.66em}|\\ |
| 1693 |
% | {\periodafter\so}|\\ |
| 1694 |
% |...|\\ |
| 1695 |
% |\section{Von den Maassen und Maassst\"aben}|\\ |
| 1696 |
% \end{example} |
| 1697 |
% |
| 1698 |
% \bigbreak |
| 1699 |
% This yields the following output: |
| 1700 |
% |
| 1701 |
% \bigskip |
| 1702 |
% \newbox\examplebox |
| 1703 |
% \sbox\examplebox{ |
| 1704 |
% \begin{minipage}{.9\textwidth} |
| 1705 |
% \small |
| 1706 |
% \bigskip |
| 1707 |
% \begin{center} |
| 1708 |
% \so{1\<. Von den Maassen und Maassst\"aben}. |
| 1709 |
% \bigskip |
| 1710 |
% \end{center} |
| 1711 |
% \end{minipage}} |
| 1712 |
% \fbox{\usebox\examplebox} |
| 1713 |
% \bigbreak |
| 1714 |
% |
| 1715 |
% \noindent |
| 1716 |
% The \cs{\periodafter} macro adds a period to the title, but not to |
| 1717 |
% the entry in the table of contents. It takes the name of a command as |
| 1718 |
% argument, that shall be applied to the title, for example~\cs{\so}. |
| 1719 |
% Here's a more complicated and complete example: |
| 1720 |
% |
| 1721 |
% \begin{example} |
| 1722 |
% |\documentclass{article}|\\ |
| 1723 |
% |\usepackage[latin1]{inputenc}|\\ |
| 1724 |
% |\usepackage[T1]{fontenc}|\\ |
| 1725 |
% |\usepackage{german,soul}|\\ |
| 1726 |
% |\usepackage[indentfirst]{titlesec}|\\ |
| 1727 |
% \end{example} |
| 1728 |
% |
| 1729 |
% \indent |
| 1730 |
% \begin{example} |
| 1731 |
% |\newcommand*\sectitle[1]{%|\\ |
| 1732 |
% | \MakeUppercase{\so{#1}.}\\[.66ex]|\\ |
| 1733 |
% | \rule{13mm}{.4pt}}|\\ |
| 1734 |
% |\newcommand*\periodafter[2]{#1{#2.}}|\\ |
| 1735 |
% \end{example} |
| 1736 |
% |
| 1737 |
% \indent |
| 1738 |
% \begin{example} |
| 1739 |
% |\titleformat{\section}[display]|\\ |
| 1740 |
% | {\normalfont\centering}|\\ |
| 1741 |
% | {\S. \thesection.}|\\ |
| 1742 |
% | {2ex}|\\ |
| 1743 |
% | {\sectitle}|\\ |
| 1744 |
% \end{example} |
| 1745 |
% |
| 1746 |
% \indent |
| 1747 |
% \begin{example} |
| 1748 |
% |\titleformat{\subsection}[block]|\\ |
| 1749 |
% | {\normalfont\centering\bfseries}|\\ |
| 1750 |
% | {\thesection.}|\\ |
| 1751 |
% | {.66em}|\\ |
| 1752 |
% | {\periodafter\relax}|\\ |
| 1753 |
% \end{example} |
| 1754 |
% |
| 1755 |
% \indent |
| 1756 |
% \begin{example} |
| 1757 |
% |\begin{document}|\\ |
| 1758 |
% |\section{Von den Maassen und Maassst\"aben}|\\ |
| 1759 |
% |\subsection{Das L\"angenmaass im Allgemeinen}|\\ |
| 1760 |
% \\ |
| 1761 |
% |Um L\"angen genau messen und vergleichen zu k\"onnen,|\\ |
| 1762 |
% |bedarf es einer gewissen, bestimmten Einheit, mit der|\\ |
| 1763 |
% |man untersucht, wie oft sie selbst, oder ihre Theile,|\\ |
| 1764 |
% |in der zu bestimmenden L\"ange enthalten sind.|\\ |
| 1765 |
% |...|\\ |
| 1766 |
% |\end{document}| |
| 1767 |
% \end{example} |
| 1768 |
% |
| 1769 |
% \bigbreak |
| 1770 |
% This example gives you roughly the following output, |
| 1771 |
% which is a facsimile from~\cite{Muszynski}. |
| 1772 |
% |
| 1773 |
% \bigskip |
| 1774 |
% \sbox\examplebox{ |
| 1775 |
% \begin{minipage}{.9\textwidth} |
| 1776 |
% \small |
| 1777 |
% \bigskip |
| 1778 |
% \begin{center} |
| 1779 |
% \S. 1.\\[2ex] |
| 1780 |
% \so{VON DEN MAASSEN UND MAASSST\"ABEN}.\\[.66ex] |
| 1781 |
% \rule{12mm}{.4pt}\\[1.66ex] |
| 1782 |
% \textbf{1. Das L\"angenmaass im Allgemeinen.}\\[.66em] |
| 1783 |
% \end{center} |
| 1784 |
% \leavevmode\qquad |
| 1785 |
% Um L\"angen genau messen und vergleichen zu k\"onnen, |
| 1786 |
% bedarf es einer gewissen, bestimmten Einheit, mit der |
| 1787 |
% man untersucht, wie oft sie selbst, oder ihre Theile, |
| 1788 |
% in der zu bestimmenden L\"ange enthalten sind. |
| 1789 |
% \bigskip |
| 1790 |
% \end{minipage}} |
| 1791 |
% \fbox{\usebox\examplebox} |
| 1792 |
% \bigbreak |
| 1793 |
% |
| 1794 |
% \noindent |
| 1795 |
% Note that the definition of \cs{\periodafter} decides if |
| 1796 |
% the closing period shall be spaced out with the title (1), or |
| 1797 |
% follow without space (2): |
| 1798 |
% |
| 1799 |
% \begin{example} |
| 1800 |
% 1.\qquad|\newcommand*\periodafter[2]{#1{#2.}}|\\ |
| 1801 |
% 2.\qquad|\newcommand*\periodafter[2]{#1{#2}.}|\\ |
| 1802 |
% \end{example} |
| 1803 |
% |
| 1804 |
% |
| 1805 |
% |
| 1806 |
% \noindent |
| 1807 |
% If you need to underline section titles, you can easily |
| 1808 |
% do it with the help of the \package{titlesec} package. The following |
| 1809 |
% example underlines the section title, but not the section |
| 1810 |
% number: |
| 1811 |
% |
| 1812 |
% \begin{example} |
| 1813 |
% |\titleformat{\section}|\\ |
| 1814 |
% | {\LARGE\titlefont}|\\ |
| 1815 |
% | {\thesection}|\\ |
| 1816 |
% | {.66em}|\\ |
| 1817 |
% | {\ul}|\\ |
| 1818 |
% \end{example} |
| 1819 |
% |
| 1820 |
% \noindent |
| 1821 |
% The \cs{\titlefont} command is provided by the \caps{``\small{KOMA}}~script'' |
| 1822 |
% package. You can write |\normalfont\sffamily\bfseries| instead. |
| 1823 |
% The following example does additionally underline the section number: |
| 1824 |
% |
| 1825 |
% \begin{example} |
| 1826 |
% |\titleformat{\section}|\\ |
| 1827 |
% | {\LARGE\titlefont}|\\ |
| 1828 |
% | {\ul{\thesection{\kern.66em}}}|\\ |
| 1829 |
% | {0pt}|\\ |
| 1830 |
% | {\ul}|\\ |
| 1831 |
% \end{example} |
| 1832 |
% |
| 1833 |
% |
| 1834 |
% |
| 1835 |
% |
| 1836 |
% |
| 1837 |
% |
| 1838 |
% |
| 1839 |
% |
| 1840 |
% |
| 1841 |
% |
| 1842 |
% |
| 1843 |
% \section{How the package works} |
| 1844 |
% |
| 1845 |
% \subsection{The kernel} |
| 1846 |
% \so{Letterspacing,} \ul{underlining}, \st{striking out} and highlighting |
| 1847 |
% use the same kernel. It lets a \emph{word scanner} run over the given argument, |
| 1848 |
% which inspects every token. If a token is a command registered via \cs{\soulregister}, |
| 1849 |
% it is executed immediately. Other tokens are only counted and trigger some action |
| 1850 |
% when a certain number is reached (quotes and dashes). Three subsequent `|-|', for example, |
| 1851 |
% trigger |\SOUL@everyexhyphen{---}|. A third group leads to special actions, |
| 1852 |
% like |\mbox| that starts reading-in a whole group to protect its contents and let them be |
| 1853 |
% seen as one entity. All other tokens, mostly characters and digits, are collected in |
| 1854 |
% a word register, which is passed to the analyzer, whenever a whole word was read in. |
| 1855 |
% |
| 1856 |
% The analyzer typesets the word in a 1\,sp ($=\frac1{65536}$\,pt) wide \cs{\vbox}, |
| 1857 |
% hence encouraging \TeX\ to break lines at every possible hyphenation point. It |
| 1858 |
% uses the mono-spaced \cs{\SOUL@tt} font (|ectt1000|), so as to avoid any inter-character |
| 1859 |
% kerning. Now the \cs{\vbox} is decomposed splitting off \cs{\hbox} after \cs{\hbox} |
| 1860 |
% from the bottom. All boxes, each of which contains one syllable, are pushed onto a |
| 1861 |
% stack, which is provided by \TeX's grouping mechanism. When returning from the |
| 1862 |
% recursion, box after box is fetched from the stack, its width measured and fed to the |
| 1863 |
%``reconstructor''. |
| 1864 |
% |
| 1865 |
% This reconstruction macro (\cs{\SOUL@dosyllable}) starts to read tokens |
| 1866 |
% from the just analyzed word until the given syllable |
| 1867 |
% width is obtained. This is repeated for each syllable. Every time the engine |
| 1868 |
% reaches a relevant state, the corresponding driver macro is executed |
| 1869 |
% and, if necessary, provided with some data. There is a macro that is |
| 1870 |
% executed for each token, one for each syllable, one for each space etc\null. |
| 1871 |
% |
| 1872 |
% The engine itself doesn't know how to letterspace or to underline. It |
| 1873 |
% just tells the selected driver about the structure of the given argument. |
| 1874 |
% There's a default driver (\cs{\SOUL@setup}) that does only set the |
| 1875 |
% interface macros to a reasonable default state, but doesn't really do anything. |
| 1876 |
% Further drivers can safely inherit these settings and only need to |
| 1877 |
% redefine what they want to change. |
| 1878 |
% |
| 1879 |
% |
| 1880 |
% |
| 1881 |
% |
| 1882 |
% |
| 1883 |
% \subsection{The interface} |
| 1884 |
% \label{sec:interface} |
| 1885 |
% |
| 1886 |
% \subsubsection{The registers} |
| 1887 |
% |
| 1888 |
% The package offers eight interface macros that can be used to define |
| 1889 |
% the required actions. Some of the macros receive data as macro parameter |
| 1890 |
% or in special \emph{token} or \emph{dimen} registers. Here is a list of |
| 1891 |
% all available registers: |
| 1892 |
% |
| 1893 |
% \begin{labeling}{\hspace{.36\hsize}} |
| 1894 |
% \item[\texttt{\string\SOUL@token}] |
| 1895 |
% This token register contains the current token. It has to be used as |\the\SOUL@token|. |
| 1896 |
% The macro \cs{\SOUL@gettoken} reads the next token into \cs{\SOUL@token} and |
| 1897 |
% can be used in any interface macro. If you don't want to lose the old meaning, |
| 1898 |
% you have to save it explicitly. \cs{\SOUL@puttoken} pushes the token |
| 1899 |
% back into the queue, without changing \cs{\SOUL@token}. You can only |
| 1900 |
% put one token back, otherwise you get an error message. |
| 1901 |
% \item[\texttt{\string\SOUL@lasttoken}] |
| 1902 |
% This token register contains the last token. |
| 1903 |
% \item[\texttt{\string\SOUL@syllable}] |
| 1904 |
% This token register contains all tokens that were already collected for |
| 1905 |
% the current syllable. When used in \cs{\SOUL@everysyllable}, it |
| 1906 |
% contains the \emph{whole} syllable. |
| 1907 |
% \item[\texttt{\string\SOUL@charkern}] |
| 1908 |
% This dimen register contains the kerning value between the current and the next character. |
| 1909 |
% Since most character pairs don't require a kerning value to be applied and the |
| 1910 |
% output in the logfile shouldn't be cluttered with |\kern0pt| it is |
| 1911 |
% recommended to write |\SOUL@setkern\SOUL@charkern|, which sets |
| 1912 |
% kerning for non-zero values only. |
| 1913 |
% \item[\texttt{\string\SOUL@hyphkern}] |
| 1914 |
% This dimen register contains the kerning value between the current character |
| 1915 |
% and the hyphen character or, when used in \cs{\SOUL@everyexhyphen}, the |
| 1916 |
% kerning between the last character and the explicit hyphen. |
| 1917 |
% \end{labeling} |
| 1918 |
% |
| 1919 |
% |
| 1920 |
% |
| 1921 |
% |
| 1922 |
% |
| 1923 |
% |
| 1924 |
% \subsubsection{The interface macros} |
| 1925 |
% |
| 1926 |
% The following list describes each of the interface macros and which |
| 1927 |
% registers it can rely on. The mark between label and description |
| 1928 |
% will be used in section \ref{sec:interfaceexamples} to show when |
| 1929 |
% the macros are executed. The addition |#1| means that the macro |
| 1930 |
% takes one argument. |
| 1931 |
% |
| 1932 |
% \begin{labeling}{\hspace{.36\hsize}} |
| 1933 |
% \def\m#1{\leavevmode\llap{\hbox to1em{\hss#1\hss}\hskip.7em}} |
| 1934 |
% \item[\texttt{\string\SOUL@preamble}]\m{$P$}^^A |
| 1935 |
% executed once at the beginning |
| 1936 |
% \item[\texttt{\string\SOUL@postamble}]\m{$E$}^^A |
| 1937 |
% executed once at the end |
| 1938 |
% \item[\texttt{\string\SOUL@everytoken}]\m{$T$}^^A |
| 1939 |
% executed after scanning a token; It gets that |
| 1940 |
% token in \cs{\SOUL@token} and has to care for inserting |
| 1941 |
% the kerning value \cs{\SOUL@charkern} between this and the next character. |
| 1942 |
% To look at the next character, execute \cs{\SOUL@gettoken}, which |
| 1943 |
% replaces \cs{\SOUL@token} by the next token. This token has to |
| 1944 |
% be put back into the queue using \cs{\SOUL@puttoken}. |
| 1945 |
% \item[\texttt{\string\SOUL@everysyllable}]\m{$S$}^^A |
| 1946 |
% This macro is executed after scanning a whole syllable. It gets the |
| 1947 |
% syllable in \cs{\SOUL@syllable}. |
| 1948 |
% \item[\texttt{\string\SOUL@everyhyphen}]\m{$-$}^^A |
| 1949 |
% This macro is executed at every implicit hyphenation point. |
| 1950 |
% It is responsible for setting the hyphen and will likely do this |
| 1951 |
% in a \cs{\discretionary} statement. It has to care about the |
| 1952 |
% kerning values. The registers \cs{\SOUL@lasttoken}, \cs{\SOUL@syllable}, |
| 1953 |
% \cs{\SOUL@charkern} and \cs{\SOUL@hyphkern} contain useful information. |
| 1954 |
% Note that \cs{\discretionary} inserts \cs{\exhyphenpenalty} |
| 1955 |
% if the first part of the discretionary is empty, and |
| 1956 |
% \cs{\hyphenpenalty} else. |
| 1957 |
% \item[\texttt{\string\SOUL@everyexhyphen\#1}]\m{$=$}^^A |
| 1958 |
% This macro is executed at every explicit hyphenation point. The |
| 1959 |
% hyphen `character' (one of hyphen, en-dash, em-dash or \cs{\slash}) |
| 1960 |
% is passed as parameter |#1|. A minimal implementation |
| 1961 |
% would be |{#1\penalty\exhyphenpenalty}|. The kerning value |
| 1962 |
% between the last character and the hyphen is passed in \cs{\SOUL@hyphkern}, |
| 1963 |
% that between the hyphen and the next character in \cs{\SOUL@charkern}. |
| 1964 |
% The last syllable can be found in \cs{\SOUL@syllable}, the last |
| 1965 |
% character in \cs{\SOUL@lasttoken}. |
| 1966 |
% \item[\texttt{\string\SOUL@everyspace\#1}]\m{\texttt{\char`\ }}^^A |
| 1967 |
% This macro is executed between every two words. It is responsible for |
| 1968 |
% setting the space. The engine submits a \cs{\penalty} setting as |
| 1969 |
% parameter |#1| that should be put in front of the space. The |
| 1970 |
% macro should at least do |{#1\space}|. Further information can be found in |
| 1971 |
% \cs{\SOUL@lasttoken} and \cs{\SOUL@syllable}. Note that this macro does not |
| 1972 |
% care for the leading and trailing space. This is the job of |
| 1973 |
% \cs{\SOUL@preamble} and \cs{\SOUL@postamble}. |
| 1974 |
% \end{labeling} |
| 1975 |
% |
| 1976 |
% |
| 1977 |
% |
| 1978 |
% |
| 1979 |
% |
| 1980 |
% |
| 1981 |
% \subsubsection{Some examples} |
| 1982 |
% \label{sec:interfaceexamples} |
| 1983 |
% |
| 1984 |
% The above list's middle column shows a mark that indicates in the |
| 1985 |
% following examples, when the respective macros are executed:\nopagebreak |
| 1986 |
% |
| 1987 |
% \begin{labeling}{\hspace{.36\hsize}} |
| 1988 |
% \item[\normalfont\an{word}] |
| 1989 |
% \cs{\SOUL@everytoken}$^T$ is executed for every token. \cs{\SOUL@everysyllable}$^S$ |
| 1990 |
% is \emph{additionally} executed for every syllable. You will mostly just |
| 1991 |
% want to use either of them. |
| 1992 |
% \item[\normalfont\an{one two}] |
| 1993 |
% The macro |\SOUL@everyspace| is executed at every space within |
| 1994 |
% the \soul\ argument. It has to take one argument, that can either |
| 1995 |
% be empty or contain a penalty, that should be applied to the space. |
| 1996 |
% \item[\normalfont\an{example}\kern-1em] |
| 1997 |
% The macro |\SOUL@everyhyphen| is executed at every possible |
| 1998 |
% implicit hyphenation point. |
| 1999 |
% \item[\normalfont\an{beta-test}] |
| 2000 |
% Explicit hyphens trigger \cs{\SOUL@everyexhyphen}. |
| 2001 |
% \end{labeling} |
| 2002 |
% |
| 2003 |
% |
| 2004 |
% |
| 2005 |
% \bigbreak |
| 2006 |
% \noindent |
| 2007 |
% It's only natural that these examples, too, |
| 2008 |
% were automatically typeset by the |soul| package |
| 2009 |
% using a special driver: |
| 2010 |
% |
| 2011 |
% \begin{example} |
| 2012 |
% |\DeclareRobustCommand*\an{%|\\ |
| 2013 |
% | \def\SOUL@preamble{$^{^P}$}%|\\ |
| 2014 |
% | \def\SOUL@everyspace##1{##1\texttt{\char`\ }}%|\\ |
| 2015 |
% | \def\SOUL@postamble{$^{^E}$}%|\\ |
| 2016 |
% | \def\SOUL@everyhyphen{$^{^-}$}%|\\ |
| 2017 |
% | \def\SOUL@everyexhyphen##1{##1$^{^=}$}%|\\ |
| 2018 |
% | \def\SOUL@everysyllable{$^{^S}$}%|\\ |
| 2019 |
% | \def\SOUL@everytoken{\the\SOUL@token$^{^T}$}%|\\ |
| 2020 |
% | \def\SOUL@everylowerthan{$^{^L}$}%|\\ |
| 2021 |
% | \SOUL@}|\\ |
| 2022 |
% \end{example} |
| 2023 |
% |
| 2024 |
% |
| 2025 |
% |
| 2026 |
% |
| 2027 |
% |
| 2028 |
% |
| 2029 |
% |
| 2030 |
% |
| 2031 |
% \subsection{A driver example} |
| 2032 |
% |
| 2033 |
% Let's define a \soul\ driver that allows to typeset text |
| 2034 |
% with a \cs{\cdot} at every potential hyphenation point. The name of |
| 2035 |
% the macro shall be \cs{\sy} (for \emph{syllables}). |
| 2036 |
% Since the \soul\ mechanism is highly fragile, we use the \LaTeX\ |
| 2037 |
% command \cs{\DeclareRobustCommand}, so that the \cs{\sy} macro |
| 2038 |
% can be used even in section headings etc. The \cs{\SOUL@setup} |
| 2039 |
% macro sets all interface macros to reasonable default definitions. |
| 2040 |
% This could of course be done manually, too. As we won't |
| 2041 |
% make use of \cs{\SOUL@everytoken} and \cs{\SOUL@postamble} |
| 2042 |
% and both default to \cs{\relax}, anyway, we don't have to |
| 2043 |
% define them here. |
| 2044 |
% |
| 2045 |
% \begin{example} |
| 2046 |
% |\DeclareRobustCommand*\sy{%|\\ |
| 2047 |
% | \SOUL@setup|\\ |
| 2048 |
% \end{example} |
| 2049 |
% |
| 2050 |
% We only set \cs{\lefthyphenmin} and \cs{\righthyphenmin} to zero |
| 2051 |
% at the beginning. All changes are restored automatically, |
| 2052 |
% so there's nothing to do at the end. |
| 2053 |
% |
| 2054 |
% \begin{example} |
| 2055 |
% | \def\SOUL@preamble{\lefthyphenmin=0 \righthyphenmin=0 }%|\\ |
| 2056 |
% \end{example} |
| 2057 |
% |
| 2058 |
% We only want simple spaces. Note that these are not provided |
| 2059 |
% by default! \cs{\SOUL@everyspace} may get a penalty to be |
| 2060 |
% applied to that space, so we set it before. |
| 2061 |
% |
| 2062 |
% \begin{example} |
| 2063 |
% | \def\SOUL@everyspace##1{##1\space}%|\\ |
| 2064 |
% \end{example} |
| 2065 |
% |
| 2066 |
% There's nothing to do for \cs{\SOUL@everytoken}, we rather let |
| 2067 |
% \cs{\SOUL@everysyllable} handle a whole syllable at once. |
| 2068 |
% This has the advantage, that we don't have to deal with |
| 2069 |
% kerning values, because \TeX\ takes care of that. |
| 2070 |
% |
| 2071 |
% \begin{example} |
| 2072 |
% | \def\SOUL@everysyllable{\the\SOUL@syllable}%|\\ |
| 2073 |
% \end{example} |
| 2074 |
% |
| 2075 |
% The \TeX\ primitive \cs{\discretionary} |
| 2076 |
% takes three arguments: 1.~pre-hyphen material |
| 2077 |
% 2.~post-hyphen material, and 3.~no-hyphenation material. |
| 2078 |
% |
| 2079 |
% \begin{example} |
| 2080 |
% | \def\SOUL@everyhyphen{%|\\ |
| 2081 |
% | \discretionary{%|\\ |
| 2082 |
% | \SOUL@setkern\SOUL@hyphkern|\\ |
| 2083 |
% | \SOUL@sethyphenchar|\\ |
| 2084 |
% | }{}{%|\\ |
| 2085 |
% | \hbox{\kern1pt$\cdot$}%|\\ |
| 2086 |
% | }%|\\ |
| 2087 |
% | }%|\\ |
| 2088 |
%\end{example} |
| 2089 |
% |
| 2090 |
% Explicit hyphens like dashes and slashes shall be set normally. |
| 2091 |
% We just have to care for kerning. The hyphen has to be put in |
| 2092 |
% a box, because, as \cs{\hyphenchar}, it would yield its own, internal |
| 2093 |
% \cs{\discretionary}. We need to set ours instead, though. |
| 2094 |
% |
| 2095 |
% \begin{example} |
| 2096 |
% | \def\SOUL@everyexhyphen##1{%|\\ |
| 2097 |
% | \SOUL@setkern\SOUL@hyphkern|\\ |
| 2098 |
% | \hbox{##1}%|\\ |
| 2099 |
% | \discretionary{}{}{%|\\ |
| 2100 |
% | \SOUL@setkern\SOUL@charkern|\\ |
| 2101 |
% | }%|\\ |
| 2102 |
% | }%|\\ |
| 2103 |
% \end{example} |
| 2104 |
% |
| 2105 |
% Now that the interface macros are defined, we can start the scanner. |
| 2106 |
% |
| 2107 |
% \begin{example} |
| 2108 |
% | \SOUL@|\\ |
| 2109 |
% |}|\\ |
| 2110 |
% \end{example} |
| 2111 |
% |
| 2112 |
% \hyphenation{al-go-rithm lin-guists ex-cel-lent} ^^A correct? |
| 2113 |
% \noindent |
| 2114 |
% \emph{\sy{This little macro will hardly be good enough |
| 2115 |
% for linguists, although it uses {\TeX's} excellent hyphenation algorithm, |
| 2116 |
% but it is at least a nice alternative to the}} \cs{\showhyphens} \emph{\sy{command}.} |
| 2117 |
% |
| 2118 |
% |
| 2119 |
% |
| 2120 |
% |
| 2121 |
% |
| 2122 |
% |
| 2123 |
% |
| 2124 |
% \section*{Acknowledgements} |
| 2125 |
% |
| 2126 |
% A big thank you goes to \person{Stefan Ulrich} for his tips and bug reports |
| 2127 |
% during the development of versions 1.\lower2pt\hbox{*} and for his lessons on high quality |
| 2128 |
% typesetting. The \cs{\caps} mechanism was very much influenced by his |
| 2129 |
% suggestions. Thanks to \person{Alexander Shibakov} and \person{Frank Mittelbach,} |
| 2130 |
% who sent me a couple of bug reports and feature requests, and finally encouraged |
| 2131 |
% me to (almost) completely rewrite \soul. \person{Thorsten Manegold} contributed |
| 2132 |
% a series of bug reports, helping to fix \soul's macro expander and hence making |
| 2133 |
% it work together with the \package{jurabib} package. |
| 2134 |
% Thanks to \person{Axel Reichert, Anshuman Pandey,} and \person{Peter Kreynin} for |
| 2135 |
% detailed bug reports. |
| 2136 |
% \person{Rowland McDonnel} gave useful hints for how to improve the documentation, |
| 2137 |
% but I'm afraid he will still not be satisfied, and rightfully so. If only documentation |
| 2138 |
% writing weren't that boring.~~\texttt{;-)} |
| 2139 |
% |
| 2140 |
% |
| 2141 |
% |
| 2142 |
% |
| 2143 |
% |
| 2144 |
% |
| 2145 |
% |
| 2146 |
% \begin{thebibliography}{00} |
| 2147 |
% \raggedright |
| 2148 |
% |
| 2149 |
% \bibitem{jurabib}{\person{Berger, Jens:} \bibtitle{The jurabib package.} \CTAN-Archive, 2002, v0.52h.} |
| 2150 |
% |
| 2151 |
% \bibitem{titlesec}{\person{Bezos, Javier:} \bibtitle{The titlesec and titletoc package.} |
| 2152 |
% \CTAN-Archive, 1999, v2.1.} |
| 2153 |
% |
| 2154 |
% \bibitem{color}{\person{Carlisle, D. P.:} \bibtitle{The color package.} \CTAN-Archive, 1997, v1.0d.} |
| 2155 |
% |
| 2156 |
% \bibitem{Duden}{Duden, Volume 1. \bibtitle{Die Rechtschreibung.} Bibliographisches Institut, |
| 2157 |
% Mann\-heim--\hskip0pt Wien--Z\"urich, 1986, 19th~edition.} |
| 2158 |
% |
| 2159 |
% \bibitem{DEK}{\person{Knuth, Donald E.:} \bibtitle{The \TeX book.} |
| 2160 |
% Addison--Wesley Publishing Company, Reading/Massachusetts, 1989, 16th~edition.} |
| 2161 |
% |
| 2162 |
% \bibitem{Muszynski}{\person{Muszynski, Carl} and \person{P\v rihoda, Eduard:} |
| 2163 |
% \bibtitle{Die Terrainlehre in Verbindung mit der Darstellung, Beurtheilung und |
| 2164 |
% Beschreibung des Terrains vom milit\"arischen |
| 2165 |
% Standpunkte.} |
| 2166 |
% L.\,W.~Seidel \&\ Sohn, Wien, 1872.} |
| 2167 |
% |
| 2168 |
% \bibitem{Reglement}{Normalverordnungsblatt f\"ur das k.\,u.\,k.~Heer. |
| 2169 |
% \bibtitle{Exercier-Reglement f\"ur die k.\,u.\,k.~Cavallerie, I. Theil.} |
| 2170 |
% Wien, k.\,k.~Hof- und Staatsdruckerei, 1898, 4th~edition.} |
| 2171 |
% |
| 2172 |
% \bibitem{german}{\person{Raichle, Bernd:} \bibtitle{The german package.} \CTAN-Archive, 1998, v2.5e.} |
| 2173 |
% |
| 2174 |
% \bibitem{yfonts}{\person{Schmidt, Walter:} \bibtitle{Ein Makropaket f\"ur die gebrochenen |
| 2175 |
% Schriften.} \CTAN-Archive, 1998, v1.2.} |
| 2176 |
% |
| 2177 |
% \bibitem{Tschichold}{\person{Tschichold, Jan:} \bibtitle{Ausgew\"ahlte Aufs\"atze \"uber Fragen |
| 2178 |
% der Gestalt des Buches und der Typographie.} Birkh\"auser, Basel, |
| 2179 |
% 1987, 2nd~edition.} |
| 2180 |
% |
| 2181 |
% \bibitem{Willberg}{\person{Willberg, Hans Peter} and \person{Forssmann, Friedrich:} |
| 2182 |
% \bibtitle{Lesetypographie.} H. Schmidt, Mainz, 1997.} |
| 2183 |
% |
| 2184 |
% \end{thebibliography} |
| 2185 |
% |
| 2186 |
% |
| 2187 |
% \StopEventually{\addtocontents{toc}{\protect\end{multicols}}} |
| 2188 |
% |
| 2189 |
% |
| 2190 |
% |
| 2191 |
% |
| 2192 |
% |
| 2193 |
% |
| 2194 |
% |
| 2195 |
% |
| 2196 |
%^^A max 72 columns |
| 2197 |
%^^A-------------------------------------------------------------------- |
| 2198 |
% |
| 2199 |
% |
| 2200 |
% |
| 2201 |
% |
| 2202 |
% \section{The implementation} |
| 2203 |
% |
| 2204 |
% \subsection*{The package preamble} |
| 2205 |
% |
| 2206 |
% This piece of code makes sure that the package is only loaded |
| 2207 |
% once. While this is guaranteed by \LaTeX, we have to do it |
| 2208 |
% manually for all other flavors of \TeX. |
| 2209 |
% \begin{macrocode} |
| 2210 |
%<*package> |
| 2211 |
% \end{macrocode} |
| 2212 |
% \begin{macrocode} |
| 2213 |
\expandafter\ifx\csname SOUL@\endcsname\relax\else |
| 2214 |
\expandafter\endinput |
| 2215 |
\fi |
| 2216 |
% \end{macrocode} |
| 2217 |
% |
| 2218 |
% |
| 2219 |
% |
| 2220 |
% |
| 2221 |
%^^A-------------------------------------------------------------------- |
| 2222 |
% |
| 2223 |
% |
| 2224 |
% |
| 2225 |
% |
| 2226 |
% \noindent |
| 2227 |
% Fake some of the \LaTeX\ commands if we were loaded by another flavor |
| 2228 |
% of \TeX. This might break some previously loaded packages, though, |
| 2229 |
% if e.\,g.~\cs{\mbox} was already in use. But we don't care \dots |
| 2230 |
% |
| 2231 |
% \begin{macrocode} |
| 2232 |
\ifx\documentclass\SOULundefined |
| 2233 |
\chardef\atcode=\catcode`@ |
| 2234 |
\catcode`\@=11 |
| 2235 |
\def\DeclareRobustCommand*{\def} |
| 2236 |
\let\newcommand\DeclareRobustCommand |
| 2237 |
\def\DeclareOption#1#2{\expandafter\def\csname#1\endcsname{#2}} |
| 2238 |
\def\PackageError#1#2#3{{% |
| 2239 |
\newlinechar`^^J% |
| 2240 |
\errorcontextlines\z@ |
| 2241 |
\edef\\{\errhelp{#3}}\\% |
| 2242 |
\errmessage{Package #1 error: #2}% |
| 2243 |
}} |
| 2244 |
\def\@height{height} |
| 2245 |
\def\@depth{depth} |
| 2246 |
\def\@width{width} |
| 2247 |
\def\@plus{plus} |
| 2248 |
\def\@minus{minus} |
| 2249 |
\font\SOUL@tt=ectt1000 |
| 2250 |
\let\@xobeysp\space |
| 2251 |
\let\linebreak\break |
| 2252 |
\let\mbox\hbox |
| 2253 |
\def\RawParEnd{} |
| 2254 |
% \end{macrocode} |
| 2255 |
% |
| 2256 |
% |
| 2257 |
% |
| 2258 |
% |
| 2259 |
%^^A-------------------------------------------------------------------- |
| 2260 |
% |
| 2261 |
% |
| 2262 |
% |
| 2263 |
% |
| 2264 |
% \noindent |
| 2265 |
% \soul\ tries to be a good \LaTeX\ citizen if used under \LaTeX\ and |
| 2266 |
% declares itself properly. Most command sequences in the package |
| 2267 |
% are protected by the |SOUL@| namespace, all other macros are first |
| 2268 |
% defined to be empty. This will give us an error message \emph{now} |
| 2269 |
% if one of those was already used by another package. |
| 2270 |
% |
| 2271 |
% \begin{macrocode} |
| 2272 |
\else |
| 2273 |
\NeedsTeXFormat{LaTeX2e} |
| 2274 |
\ProvidesPackage{soul-ori} |
| 2275 |
[2026-03-06 v3.2 letterspacing/underlining (mf)] |
| 2276 |
\newfont\SOUL@tt{ectt1000} |
| 2277 |
\newcommand*\sodef{} |
| 2278 |
\newcommand*\resetso{} |
| 2279 |
\newcommand*\capsdef{} |
| 2280 |
\newcommand*\capsfont{} |
| 2281 |
\newcommand*\setulcolor{} |
| 2282 |
\newcommand*\setuloverlap{} |
| 2283 |
\newcommand*\setul{} |
| 2284 |
\newcommand*\resetul{} |
| 2285 |
\newcommand*\setuldepth{} |
| 2286 |
\newcommand*\setstcolor{} |
| 2287 |
\newcommand*\sethlcolor{} |
| 2288 |
\newcommand*\so{} |
| 2289 |
\newcommand*\ul{} |
| 2290 |
\newcommand*\st{} |
| 2291 |
\newcommand*\hl{} |
| 2292 |
\newcommand*\caps{} |
| 2293 |
\newcommand*\soulaccent{} |
| 2294 |
\newcommand*\soulregister{} |
| 2295 |
\newcommand*\soulfont{} |
| 2296 |
\newcommand*\soulomit{} |
| 2297 |
\fi |
| 2298 |
% \end{macrocode} |
| 2299 |
% |
| 2300 |
% |
| 2301 |
% |
| 2302 |
% |
| 2303 |
%^^A-------------------------------------------------------------------- |
| 2304 |
% |
| 2305 |
% |
| 2306 |
% |
| 2307 |
% |
| 2308 |
% \noindent |
| 2309 |
% Other packages wouldn't be happy if we reserved piles of \cs{\newtoks} and |
| 2310 |
% \cs{\newdimen}, so we try to get away with their \cs{\...def} counterparts |
| 2311 |
% where possible. |
| 2312 |
% Local registers are always even, while global ones are odd---this is a |
| 2313 |
% \TeX\ convention. |
| 2314 |
% |
| 2315 |
% \begin{macrocode} |
| 2316 |
\newtoks\SOUL@word |
| 2317 |
\newtoks\SOUL@lasttoken |
| 2318 |
\newtoks\SOUL@syllable |
| 2319 |
\newtoks\SOUL@cmds |
| 2320 |
\newtoks\SOUL@buffer |
| 2321 |
\newtoks\SOUL@token |
| 2322 |
\newdimen\SOUL@syllgoal |
| 2323 |
\newdimen\SOUL@syllwidth |
| 2324 |
\newdimen\SOUL@charkern |
| 2325 |
\newdimen\SOUL@hyphkern |
| 2326 |
\newdimen\SOUL@dimen |
| 2327 |
\newdimen\SOUL@dimeni |
| 2328 |
\newcount\SOUL@minus |
| 2329 |
\newcount\SOUL@comma |
| 2330 |
\newcount\SOUL@apo |
| 2331 |
\newcount\SOUL@grave |
| 2332 |
\newskip\SOUL@spaceskip |
| 2333 |
\newif\ifSOUL@ignorespaces |
| 2334 |
% \end{macrocode} |
| 2335 |
% |
| 2336 |
% |
| 2337 |
% |
| 2338 |
% |
| 2339 |
%^^A-------------------------------------------------------------------- |
| 2340 |
% |
| 2341 |
% |
| 2342 |
% |
| 2343 |
% |
| 2344 |
% ^^A\FIXME{\newpage} |
| 2345 |
% \begin{macro}{\soulomit} |
| 2346 |
% \begin{macro}{\SOUL@ignorem} |
| 2347 |
% \begin{macro}{\SOUL@ignore} |
| 2348 |
% \begin{macro}{\SOUL@stopm} |
| 2349 |
% \begin{macro}{\SOUL@stop} |
| 2350 |
% \begin{macro}{\SOUL@relaxm} |
| 2351 |
% \begin{macro}{\SOUL@lowerthanm} |
| 2352 |
% \begin{macro}{\SOUL@hyphenhintm} |
| 2353 |
% These macros are used as markers. To be able to check for such a |
| 2354 |
% marker with \cs{\ifx} we have also to create a macro that contains |
| 2355 |
% the marker. \cs{\SOUL@spc} shall contain a normal space with a |
| 2356 |
% \cs{\catcode} of~10. |
| 2357 |
% |
| 2358 |
% \begin{macrocode} |
| 2359 |
\def\soulomit#1{#1} |
| 2360 |
\def\SOUL@stopM{\SOUL@stop} |
| 2361 |
\let\SOUL@stop\relax |
| 2362 |
\def\SOUL@lowerthan{} |
| 2363 |
\def\SOUL@lowerthanM{\<} |
| 2364 |
\def\SOUL@hyphenhintM{\-} |
| 2365 |
\def\SOUL@n*{\let\SOUL@spc= }\SOUL@n* % |
| 2366 |
% \end{macrocode} |
| 2367 |
% \end{macro} |
| 2368 |
% \end{macro} |
| 2369 |
% \end{macro} |
| 2370 |
% \end{macro} |
| 2371 |
% \end{macro} |
| 2372 |
% \end{macro} |
| 2373 |
% \end{macro} |
| 2374 |
% \end{macro} |
| 2375 |
% |
| 2376 |
% |
| 2377 |
% |
| 2378 |
% |
| 2379 |
%^^A-------------------------------------------------------------------- |
| 2380 |
% |
| 2381 |
% |
| 2382 |
% |
| 2383 |
% |
| 2384 |
% \subsection{The kernel} |
| 2385 |
% |
| 2386 |
% \begin{macro}{\SOUL@} |
| 2387 |
% This macro is the entry to \soul. Using it does only make |
| 2388 |
% sense after setting up a \soul\ driver. The next token after |
| 2389 |
% the \soul\ command will be assigned to \cs{\SOUL@@}. This can be |
| 2390 |
% some text enclosed in braces, or the name of a macro that contains text. |
| 2391 |
% |
| 2392 |
% \begin{macrocode} |
| 2393 |
\def\SOUL@{% |
| 2394 |
\futurelet\SOUL@@\SOUL@expand |
| 2395 |
} |
| 2396 |
% \end{macrocode} |
| 2397 |
% \end{macro} |
| 2398 |
% |
| 2399 |
% |
| 2400 |
% |
| 2401 |
% |
| 2402 |
%^^A-------------------------------------------------------------------- |
| 2403 |
% |
| 2404 |
% |
| 2405 |
% |
| 2406 |
% |
| 2407 |
% \begin{macro}{\SOUL@expand} |
| 2408 |
% If the first token after the \soul\ command was an opening |
| 2409 |
% brace we start scanning. Otherwise, |
| 2410 |
% if the first token was a macro name, we expand that macro and |
| 2411 |
% call \cs{\SOUL@} with its contents again. Unfortunately, we have to |
| 2412 |
% exclude some macros therein from expansion. |
| 2413 |
% |
| 2414 |
% \begin{macrocode} |
| 2415 |
\def\SOUL@expand{% |
| 2416 |
\ifcat\bgroup\noexpand\SOUL@@ |
| 2417 |
\let\SOUL@n\SOUL@start |
| 2418 |
\else |
| 2419 |
\bgroup |
| 2420 |
\def\\##1##2{\def##2{\noexpand##2}}% |
| 2421 |
\the\SOUL@cmds |
| 2422 |
\SOUL@buffer={% |
| 2423 |
\\\TeX\\\LaTeX\\\soulomit\\\mbox\\\hbox\\\textregistered |
| 2424 |
\\\slash\\\textcircled\\\copyright\\\S\\\,\\\<\\\>\\~% |
| 2425 |
\\\\% |
| 2426 |
}% |
| 2427 |
\def\\##1{\def##1{\noexpand##1}}% |
| 2428 |
\the\SOUL@buffer |
| 2429 |
\let\protect\noexpand |
| 2430 |
\xdef\SOUL@n##1{\noexpand\SOUL@start{\SOUL@@}}% |
| 2431 |
\egroup |
| 2432 |
\fi |
| 2433 |
\SOUL@n |
| 2434 |
} |
| 2435 |
\long\def\SOUL@start#1{{% |
| 2436 |
\let\<\SOUL@lowerthan |
| 2437 |
\let\>\empty |
| 2438 |
\def\soulomit{\noexpand\soulomit}% |
| 2439 |
\gdef\SOUL@eventuallyexhyphen##1{}% |
| 2440 |
\let\SOUL@soeventuallyskip\relax |
| 2441 |
\SOUL@spaceskip=\fontdimen\tw@\font\@plus\fontdimen\thr@@\font |
| 2442 |
\@minus\fontdimen4\font |
| 2443 |
\SOUL@ignorespacesfalse |
| 2444 |
\leavevmode |
| 2445 |
\SOUL@preamble |
| 2446 |
\SOUL@lasttoken={}% |
| 2447 |
\SOUL@word={}% |
| 2448 |
\SOUL@minus\z@ |
| 2449 |
\SOUL@comma\z@ |
| 2450 |
\SOUL@apo\z@ |
| 2451 |
\SOUL@grave\z@ |
| 2452 |
\SOUL@do{#1}% |
| 2453 |
\SOUL@postamble |
| 2454 |
}} |
| 2455 |
\long\def\SOUL@do#1{% |
| 2456 |
\SOUL@scan#1\SOUL@stop |
| 2457 |
} |
| 2458 |
% \end{macrocode} |
| 2459 |
% \end{macro} |
| 2460 |
% |
| 2461 |
% |
| 2462 |
% |
| 2463 |
% |
| 2464 |
%^^A-------------------------------------------------------------------- |
| 2465 |
% |
| 2466 |
% |
| 2467 |
% |
| 2468 |
% |
| 2469 |
% \subsection{The scanner} |
| 2470 |
% |
| 2471 |
% \begin{macro}{\SOUL@scan} |
| 2472 |
% This is the entry point for the scanner. It calls \cs{\SOUL@eval} |
| 2473 |
% and will in turn be called by \cs{\SOUL@eval} again for every |
| 2474 |
% new token to be scanned. |
| 2475 |
% |
| 2476 |
% \begin{macrocode} |
| 2477 |
\def\SOUL@scan{% |
| 2478 |
\futurelet\SOUL@@\SOUL@eval |
| 2479 |
} |
| 2480 |
% \end{macrocode} |
| 2481 |
% \end{macro} |
| 2482 |
% |
| 2483 |
% |
| 2484 |
% |
| 2485 |
% |
| 2486 |
%^^A-------------------------------------------------------------------- |
| 2487 |
% |
| 2488 |
% |
| 2489 |
% |
| 2490 |
% |
| 2491 |
% \begin{macro}{\SOUL@eval} |
| 2492 |
% And here it is: the scanner's heart. It cares for quotes and dashes |
| 2493 |
% ligatures and handles all commands that must not be fed to the |
| 2494 |
% analyzer. |
| 2495 |
% |
| 2496 |
% \begin{macrocode} |
| 2497 |
\def\SOUL@eval{% |
| 2498 |
\def\SOUL@n*##1{\SOUL@scan}% |
| 2499 |
\if\noexpand\SOUL@@\SOUL@spc |
| 2500 |
\else |
| 2501 |
\SOUL@ignorespacesfalse |
| 2502 |
\fi |
| 2503 |
\ifnum\SOUL@minus=\thr@@ |
| 2504 |
\SOUL@flushminus |
| 2505 |
\else\ifnum\SOUL@comma=\tw@ |
| 2506 |
\SOUL@flushcomma |
| 2507 |
\else\ifnum\SOUL@apo=\tw@ |
| 2508 |
\SOUL@flushapo |
| 2509 |
\else\ifnum\SOUL@grave=\tw@ |
| 2510 |
\SOUL@flushgrave |
| 2511 |
\fi\fi\fi\fi |
| 2512 |
\ifx\SOUL@@-\else\SOUL@flushminus\fi |
| 2513 |
\ifx\SOUL@@,\else\SOUL@flushcomma\fi |
| 2514 |
\ifx\SOUL@@'\else\SOUL@flushapo\fi |
| 2515 |
\ifx\SOUL@@`\else\SOUL@flushgrave\fi |
| 2516 |
\ifx\SOUL@@-% |
| 2517 |
\advance\SOUL@minus\@ne |
| 2518 |
\else\ifx\SOUL@@,% |
| 2519 |
\advance\SOUL@comma\@ne |
| 2520 |
\else\ifx\SOUL@@'% |
| 2521 |
\advance\SOUL@apo\@ne |
| 2522 |
\else\ifx\SOUL@@`% |
| 2523 |
\advance\SOUL@grave\@ne |
| 2524 |
\else |
| 2525 |
\SOUL@flushminus |
| 2526 |
\SOUL@flushcomma |
| 2527 |
\SOUL@flushapo |
| 2528 |
\SOUL@flushgrave |
| 2529 |
\ifx\SOUL@@\SOUL@stop |
| 2530 |
\def\SOUL@n*{% |
| 2531 |
\SOUL@doword |
| 2532 |
\SOUL@eventuallyexhyphen\null |
| 2533 |
}% |
| 2534 |
\else\ifx\SOUL@@\par |
| 2535 |
\def\SOUL@n*\par{\par\leavevmode\SOUL@scan}% |
| 2536 |
\else\if\noexpand\SOUL@@\SOUL@spc |
| 2537 |
\SOUL@doword |
| 2538 |
\SOUL@eventuallyexhyphen\null |
| 2539 |
\ifSOUL@ignorespaces |
| 2540 |
\else |
| 2541 |
\SOUL@everyspace{}% |
| 2542 |
\fi |
| 2543 |
\def\SOUL@n* {\SOUL@scan}% |
| 2544 |
\else\ifx\SOUL@@\\% |
| 2545 |
\SOUL@doword |
| 2546 |
\SOUL@eventuallyexhyphen\null |
| 2547 |
\SOUL@everyspace{\unskip\nobreak\hfil\break}% |
| 2548 |
\SOUL@ignorespacestrue |
| 2549 |
\else\ifx\SOUL@@~% |
| 2550 |
\SOUL@doword |
| 2551 |
\SOUL@eventuallyexhyphen\null |
| 2552 |
\SOUL@everyspace{\nobreak}% |
| 2553 |
\else\ifx\SOUL@@\slash |
| 2554 |
\SOUL@doword |
| 2555 |
\SOUL@eventuallyexhyphen{/}% |
| 2556 |
\SOUL@exhyphen{/}% |
| 2557 |
\else\ifx\SOUL@@\mbox |
| 2558 |
\def\SOUL@n*{\SOUL@addprotect}% |
| 2559 |
\else\ifx\SOUL@@\hbox |
| 2560 |
\def\SOUL@n*{\SOUL@addprotect}% |
| 2561 |
\else\ifx\SOUL@@\soulomit |
| 2562 |
\def\SOUL@n*\soulomit##1{% |
| 2563 |
\SOUL@doword |
| 2564 |
{\spaceskip\SOUL@spaceskip##1}% |
| 2565 |
\SOUL@scan |
| 2566 |
}% |
| 2567 |
\else\ifx\SOUL@@\break |
| 2568 |
\SOUL@doword |
| 2569 |
\break |
| 2570 |
\else\ifx\SOUL@@\linebreak |
| 2571 |
\SOUL@doword |
| 2572 |
\SOUL@everyspace{\linebreak}% |
| 2573 |
\else\ifcat\bgroup\noexpand\SOUL@@ |
| 2574 |
\def\SOUL@n*{\SOUL@addgroup{}}% |
| 2575 |
\else\ifcat$\noexpand\SOUL@@ |
| 2576 |
\def\SOUL@n*{\SOUL@addmath}% |
| 2577 |
\else |
| 2578 |
\def\SOUL@n*{\SOUL@dotoken}% |
| 2579 |
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi |
| 2580 |
\fi\fi\fi\fi |
| 2581 |
\SOUL@n*% |
| 2582 |
} |
| 2583 |
% \end{macrocode} |
| 2584 |
% \end{macro} |
| 2585 |
% |
| 2586 |
% |
| 2587 |
% |
| 2588 |
% |
| 2589 |
%^^A-------------------------------------------------------------------- |
| 2590 |
% |
| 2591 |
% |
| 2592 |
% |
| 2593 |
% |
| 2594 |
% \begin{macro}{\SOUL@flushminus} |
| 2595 |
% \begin{macro}{\SOUL@flushcomma} |
| 2596 |
% \begin{macro}{\SOUL@flushapo} |
| 2597 |
% \begin{macro}{\SOUL@flushgrave} |
| 2598 |
% As their names imply, these macros flush special tokens or token |
| 2599 |
% groups to the word register. They don't do anything if the respective |
| 2600 |
% counter equals zero. \cs{\SOUL@minus} does also flush the word |
| 2601 |
% register, because hyphens disturb the analyzer. |
| 2602 |
% |
| 2603 |
% \begin{macrocode} |
| 2604 |
\def\SOUL@flushminus{% |
| 2605 |
\ifcase\SOUL@minus |
| 2606 |
\else |
| 2607 |
\SOUL@doword |
| 2608 |
\SOUL@eventuallyexhyphen{-}% |
| 2609 |
\ifcase\SOUL@minus |
| 2610 |
\or |
| 2611 |
\SOUL@exhyphen{-}% |
| 2612 |
\or |
| 2613 |
\SOUL@exhyphen{--}% |
| 2614 |
\or |
| 2615 |
\SOUL@exhyphen{---}% |
| 2616 |
\fi |
| 2617 |
\SOUL@minus\z@ |
| 2618 |
\fi |
| 2619 |
} |
| 2620 |
\def\SOUL@flushcomma{% |
| 2621 |
\ifcase\SOUL@comma |
| 2622 |
\or |
| 2623 |
\edef\x{\SOUL@word={\the\SOUL@word,}}\x |
| 2624 |
\or |
| 2625 |
\edef\x{\SOUL@word={\the\SOUL@word{{,,}}}}\x |
| 2626 |
\fi |
| 2627 |
\SOUL@comma\z@ |
| 2628 |
} |
| 2629 |
\def\SOUL@flushapo{% |
| 2630 |
\ifcase\SOUL@apo |
| 2631 |
\or |
| 2632 |
\edef\x{\SOUL@word={\the\SOUL@word'}}\x |
| 2633 |
\or |
| 2634 |
\edef\x{\SOUL@word={\the\SOUL@word{{''}}}}\x |
| 2635 |
\fi |
| 2636 |
\SOUL@apo\z@ |
| 2637 |
} |
| 2638 |
\def\SOUL@flushgrave{% |
| 2639 |
\ifcase\SOUL@grave |
| 2640 |
\or |
| 2641 |
\edef\x{\SOUL@word={\the\SOUL@word`}}\x |
| 2642 |
\or |
| 2643 |
\edef\x{\SOUL@word={\the\SOUL@word{{``}}}}\x |
| 2644 |
\fi |
| 2645 |
\SOUL@grave\z@ |
| 2646 |
} |
| 2647 |
% \end{macrocode} |
| 2648 |
% \end{macro} |
| 2649 |
% \end{macro} |
| 2650 |
% \end{macro} |
| 2651 |
% \end{macro} |
| 2652 |
% |
| 2653 |
% |
| 2654 |
% |
| 2655 |
% |
| 2656 |
%^^A-------------------------------------------------------------------- |
| 2657 |
% |
| 2658 |
% |
| 2659 |
% |
| 2660 |
% |
| 2661 |
% \begin{macro}{\SOUL@dotoken} |
| 2662 |
% Command sequences from the \cs{\SOUL@cmds} list are handed over |
| 2663 |
% to \cs{\SOUL@docmd}, everything else is added to \cs{\SOUL@word}, |
| 2664 |
% which will be fed to the analyzer every time a word is completed. |
| 2665 |
% Since \emph{robust} commands come with an additional space, we |
| 2666 |
% have also to examine if there's a space variant. Otherwise we |
| 2667 |
% couldn't detect pre-expanded formerly robust commands. |
| 2668 |
% |
| 2669 |
% \begin{macrocode} |
| 2670 |
\def\SOUL@dotoken#1{% |
| 2671 |
\def\SOUL@@{\SOUL@addtoken{#1}}% |
| 2672 |
\def\\##1##2{% |
| 2673 |
\edef\SOUL@x{\string#1}% |
| 2674 |
\edef\SOUL@n{\string##2}% |
| 2675 |
\ifx\SOUL@x\SOUL@n |
| 2676 |
\def\SOUL@@{\SOUL@docmd{##1}{#1}}% |
| 2677 |
\else |
| 2678 |
\edef\SOUL@n{\string##2\space}% |
| 2679 |
\ifx\SOUL@x\SOUL@n |
| 2680 |
\def\SOUL@@{\SOUL@docmd{##1}{#1}}% |
| 2681 |
\fi |
| 2682 |
\fi |
| 2683 |
}% |
| 2684 |
\the\SOUL@cmds |
| 2685 |
\SOUL@@ |
| 2686 |
} |
| 2687 |
% \end{macrocode} |
| 2688 |
% \end{macro} |
| 2689 |
% |
| 2690 |
% |
| 2691 |
% |
| 2692 |
% |
| 2693 |
%^^A-------------------------------------------------------------------- |
| 2694 |
% |
| 2695 |
% |
| 2696 |
% |
| 2697 |
% |
| 2698 |
% \begin{macro}{\SOUL@docmd} |
| 2699 |
% Here we deal with commands that were registered with \cs{\soulregister} |
| 2700 |
% or \cs{\soulaccent} or were already predefined in \cs{\SOUL@cmds}. |
| 2701 |
% Commands with identifier |9| are accents that are put in a |
| 2702 |
% group with their argument. Identifier |8| is reserved for the \cs{\footnote} |
| 2703 |
% command, and |7| for the \cs{\textsuperscript} or similar commands. |
| 2704 |
% The others are mostly (but not necessarily) |
| 2705 |
% font switching commands, which may (|1|) or may not (|0|) take |
| 2706 |
% an argument. A registered command leads to the current word |
| 2707 |
% buffer being flushed to the analyzer, after which the command |
| 2708 |
% itself is executed. |
| 2709 |
% |
| 2710 |
% Font switching commands which take an argument need special |
| 2711 |
% treatment: They need to increment the level counter, so that |
| 2712 |
% \cs{\SOUL@eval} knows where to stop scanning. Furthermore the |
| 2713 |
% scanner has to be enabled to see the next token after the opening |
| 2714 |
% brace. |
| 2715 |
% |
| 2716 |
% |
| 2717 |
% \begin{macrocode} |
| 2718 |
\def\SOUL@docmd#1#2{% |
| 2719 |
\ifx9#1% |
| 2720 |
\def\SOUL@@{\SOUL@addgroup{#2}}% |
| 2721 |
\else\ifx8#1% |
| 2722 |
\SOUL@doword |
| 2723 |
\def\SOUL@@##1{% |
| 2724 |
\SOUL@token={\footnotemark}% |
| 2725 |
\SOUL@everytoken |
| 2726 |
\SOUL@syllable={\footnotemark}% |
| 2727 |
\SOUL@everysyllable |
| 2728 |
\footnotetext{##1}% |
| 2729 |
\SOUL@doword |
| 2730 |
\SOUL@scan |
| 2731 |
}% |
| 2732 |
\else\ifx7#1% |
| 2733 |
\SOUL@doword |
| 2734 |
\def\SOUL@@##1{% |
| 2735 |
\SOUL@token={#2{##1}}% |
| 2736 |
\SOUL@everytoken |
| 2737 |
\SOUL@syllable={#2{##1}}% |
| 2738 |
\SOUL@everysyllable |
| 2739 |
\SOUL@doword |
| 2740 |
\SOUL@scan |
| 2741 |
}% |
| 2742 |
\else\ifx1#1% |
| 2743 |
\SOUL@doword |
| 2744 |
\def\SOUL@@##1{% |
| 2745 |
#2{\protect\SOUL@do{##1}}% |
| 2746 |
\SOUL@scan |
| 2747 |
}% |
| 2748 |
\else |
| 2749 |
\SOUL@doword |
| 2750 |
#2% |
| 2751 |
\let\SOUL@@\SOUL@scan |
| 2752 |
\fi\fi\fi\fi |
| 2753 |
\SOUL@@ |
| 2754 |
} |
| 2755 |
% \end{macrocode} |
| 2756 |
% \end{macro} |
| 2757 |
% |
| 2758 |
% |
| 2759 |
% |
| 2760 |
% |
| 2761 |
%^^A-------------------------------------------------------------------- |
| 2762 |
% |
| 2763 |
% |
| 2764 |
% |
| 2765 |
% |
| 2766 |
% \begin{macro}{\SOUL@addgroup} |
| 2767 |
% \begin{macro}{\SOUL@addmath} |
| 2768 |
% \begin{macro}{\SOUL@addprotect} |
| 2769 |
% \begin{macro}{\SOUL@addtoken} |
| 2770 |
% The macro names say it all. Each of these macros adds some |
| 2771 |
% token to the word buffer \cs{\SOUL@word}. Setting \cs{\protect} |
| 2772 |
% is necessary to make things like |\so{{a\itshape b}}| work. |
| 2773 |
% |
| 2774 |
% \begin{macrocode} |
| 2775 |
\def\SOUL@addgroup#1#2{% |
| 2776 |
{\let\protect\noexpand |
| 2777 |
\edef\x{\global\SOUL@word={\the\SOUL@word{{\noexpand#1#2}}}}\x}% |
| 2778 |
\SOUL@scan |
| 2779 |
} |
| 2780 |
\def\SOUL@addmath$#1${% |
| 2781 |
{\let\protect\noexpand |
| 2782 |
\edef\x{\global\SOUL@word={\the\SOUL@word{{\hbox{$#1$}}}}}\x}% |
| 2783 |
\SOUL@scan |
| 2784 |
} |
| 2785 |
\def\SOUL@addprotect#1#2{% |
| 2786 |
{\let\protect\noexpand |
| 2787 |
\edef\x{\global\SOUL@word={\the\SOUL@word{{\hbox{#2}}}}}\x}% |
| 2788 |
\SOUL@scan |
| 2789 |
} |
| 2790 |
\def\SOUL@addtoken#1{% |
| 2791 |
\edef\x{\SOUL@word={\the\SOUL@word\noexpand#1}}\x |
| 2792 |
\SOUL@scan |
| 2793 |
} |
| 2794 |
% \end{macrocode} |
| 2795 |
% \end{macro} |
| 2796 |
% \end{macro} |
| 2797 |
% \end{macro} |
| 2798 |
% \end{macro} |
| 2799 |
% |
| 2800 |
% |
| 2801 |
% |
| 2802 |
% |
| 2803 |
%^^A-------------------------------------------------------------------- |
| 2804 |
% |
| 2805 |
% |
| 2806 |
% |
| 2807 |
% |
| 2808 |
% \begin{macro}{\SOUL@exhyphen} |
| 2809 |
% Dealing with explicit hyphens can't be done before we know the |
| 2810 |
% following character, because we need to know if a kerning value |
| 2811 |
% has to be inserted, hence we delay the \cs{\SOUL@everyexhyphen} call. |
| 2812 |
% Unfortunately, the word scanner has no look-ahead mechanism. |
| 2813 |
% |
| 2814 |
% \begin{macrocode} |
| 2815 |
\def\SOUL@exhyphen#1{% |
| 2816 |
\SOUL@getkern{\the\SOUL@lasttoken}{\SOUL@hyphkern}{#1}% |
| 2817 |
\gdef\SOUL@eventuallyexhyphen##1{% |
| 2818 |
\SOUL@getkern{#1}{\SOUL@charkern}{##1}% |
| 2819 |
\SOUL@everyexhyphen{#1}% |
| 2820 |
\gdef\SOUL@eventuallyexhyphen####1{}% |
| 2821 |
}% |
| 2822 |
} |
| 2823 |
% \end{macrocode} |
| 2824 |
% \end{macro} |
| 2825 |
% |
| 2826 |
% |
| 2827 |
% |
| 2828 |
% |
| 2829 |
%^^A-------------------------------------------------------------------- |
| 2830 |
% |
| 2831 |
% |
| 2832 |
% |
| 2833 |
% |
| 2834 |
% \begin{macro}{\SOUL@cmds} |
| 2835 |
% Here is a list of pre-registered commands that the analyzer |
| 2836 |
% cannot handle, so the scanner has to look after them. Every |
| 2837 |
% entry consists of a handle (\cs{\\}), an identifier and the |
| 2838 |
% macro name. The class identifier can be |9| for accents, |
| 2839 |
% |8| for the \cs{\footnote} command, |7| for the |
| 2840 |
% \cs{\textsuperscript} command, |
| 2841 |
% |0| for commands without arguments and |1| for commands that |
| 2842 |
% take one argument. Commands with two or more arguments are |
| 2843 |
% not supported. |
| 2844 |
% |
| 2845 |
% \begin{macrocode} |
| 2846 |
\SOUL@cmds={% |
| 2847 |
\\9\`\\9\'\\9\^\\9\"\\9\~\\9\=\\9\.% |
| 2848 |
\\9\u\\9\v\\9\H\\9\t\\9\c\\9\d\\9\b\\9\r |
| 2849 |
\\1\emph\\1\textrm\\1\textsf\\1\texttt\\1\textmd\\1\textbf |
| 2850 |
\\1\textup\\1\textsl\\1\textit\\1\textsc\\1\textnormal |
| 2851 |
\\0\rmfamily\\0\sffamily\\0\ttfamily\\0\mdseries\\0\upshape |
| 2852 |
\\0\slshape\\0\itshape\\0\scshape\\0\normalfont |
| 2853 |
\\0\em\\0\rm\\0\bf\\0\it\\0\tt\\0\sc\\0\sl\\0\sf |
| 2854 |
\\0\tiny\\0\scriptsize\\0\footnotesize\\0\small |
| 2855 |
\\0\normalsize\\0\large\\0\Large\\0\LARGE\\0\huge\\0\Huge |
| 2856 |
\\1\MakeUppercase\\7\textsuperscript\\8\footnote |
| 2857 |
\\1\textfrak\\1\textswab\\1\textgoth |
| 2858 |
\\0\frakfamily\\0\swabfamily\\0\gothfamily |
| 2859 |
} |
| 2860 |
% \end{macrocode} |
| 2861 |
% \end{macro} |
| 2862 |
% |
| 2863 |
% |
| 2864 |
% |
| 2865 |
% |
| 2866 |
%^^A-------------------------------------------------------------------- |
| 2867 |
% |
| 2868 |
% |
| 2869 |
% |
| 2870 |
% |
| 2871 |
% \begin{macro}{\soulregister} |
| 2872 |
% \begin{macro}{\soulfont} |
| 2873 |
% \begin{macro}{\soulaccent} |
| 2874 |
% Register a font switching command (or some other command) for the |
| 2875 |
% scanner. The first argument is the macro name, the second is |
| 2876 |
% the number of arguments (|0|~or~|1|). Example: |\soulregister{\bold}{0}|. |
| 2877 |
% \cs{\soulaccent} has only one argument---the accent macro name. |
| 2878 |
% Example: |\soulaccent{\~}|. It is a shortcut for |\soulregister{\~}{9}|. |
| 2879 |
% The \cs{\soulfont} command is a synonym for \cs{\soulregister} |
| 2880 |
% and is kept for compatibility reasons. |
| 2881 |
% |
| 2882 |
% \begin{macrocode} |
| 2883 |
\def\soulregister#1#2{{% |
| 2884 |
\edef\x{\global\SOUL@cmds={\the\SOUL@cmds |
| 2885 |
\noexpand\\#2\noexpand#1}}\x |
| 2886 |
}} |
| 2887 |
\def\soulaccent#1{\soulregister{#1}9} |
| 2888 |
\let\soulfont\soulregister |
| 2889 |
% \end{macrocode} |
| 2890 |
% \end{macro} |
| 2891 |
% \end{macro} |
| 2892 |
% \end{macro} |
| 2893 |
% |
| 2894 |
% |
| 2895 |
% |
| 2896 |
% |
| 2897 |
%^^A-------------------------------------------------------------------- |
| 2898 |
% |
| 2899 |
% |
| 2900 |
% |
| 2901 |
% |
| 2902 |
% \subsection{The analyzer} |
| 2903 |
% |
| 2904 |
% \begin{macro}{\SOUL@doword} |
| 2905 |
% The only way to find out, where a given word can be broken into |
| 2906 |
% syllables, is to let \TeX\ actually typeset the word under conditions |
| 2907 |
% that enforce every possible hyphenation. The result is a paragraph with one |
| 2908 |
% line for every syllable. |
| 2909 |
% |
| 2910 |
% \changes{v3.2}{2026-03-06}{Added explicit \cs{RawParEnd} for issue \#14,\#15,\#16} |
| 2911 |
% \begin{macrocode} |
| 2912 |
\def\SOUL@doword{% |
| 2913 |
\edef\x{\the\SOUL@word}% |
| 2914 |
\ifx\x\empty |
| 2915 |
\else |
| 2916 |
\SOUL@buffer={}% |
| 2917 |
\setbox\z@\vbox{% |
| 2918 |
\SOUL@tt |
| 2919 |
\hyphenchar\font`\- |
| 2920 |
\hfuzz\maxdimen |
| 2921 |
\hbadness\@M |
| 2922 |
\pretolerance\m@ne |
| 2923 |
\tolerance\@M |
| 2924 |
\leftskip\z@ |
| 2925 |
\rightskip\z@ |
| 2926 |
\hsize1sp |
| 2927 |
\everypar{}% |
| 2928 |
\parfillskip\z@\@plus1fil |
| 2929 |
\hyphenpenalty-\@M |
| 2930 |
\noindent |
| 2931 |
\hskip\z@ |
| 2932 |
\relax |
| 2933 |
\the\SOUL@word |
| 2934 |
\RawParEnd}% |
| 2935 |
\let\SOUL@errmsg\SOUL@error |
| 2936 |
\let\-\relax |
| 2937 |
\count@\m@ne |
| 2938 |
\SOUL@analyze |
| 2939 |
\SOUL@word={}% |
| 2940 |
\fi |
| 2941 |
} |
| 2942 |
% \end{macrocode} |
| 2943 |
% \end{macro} |
| 2944 |
% |
| 2945 |
% |
| 2946 |
% |
| 2947 |
% |
| 2948 |
%^^A-------------------------------------------------------------------- |
| 2949 |
% |
| 2950 |
% |
| 2951 |
% |
| 2952 |
% |
| 2953 |
% \noindent |
| 2954 |
% We store the hyphen width of the |ectt1000| font, |
| 2955 |
% because we will need it in |\SOUL@doword|. (|ectt1000| is a mono-spaced |
| 2956 |
% font, so every other character would have worked, too.) |
| 2957 |
% |
| 2958 |
% \begin{macrocode} |
| 2959 |
\setbox\z@\hbox{\SOUL@tt-} |
| 2960 |
\newdimen\SOUL@ttwidth |
| 2961 |
\SOUL@ttwidth\wd\z@ |
| 2962 |
\def\SOUL@sethyphenchar{% |
| 2963 |
\ifnum\hyphenchar\font=\m@ne |
| 2964 |
\else |
| 2965 |
\char\hyphenchar\font |
| 2966 |
\fi |
| 2967 |
} |
| 2968 |
% \end{macrocode} |
| 2969 |
% |
| 2970 |
% |
| 2971 |
% |
| 2972 |
% |
| 2973 |
%^^A-------------------------------------------------------------------- |
| 2974 |
% |
| 2975 |
% |
| 2976 |
% |
| 2977 |
% |
| 2978 |
% \begin{macro}{\SOUL@analyze} |
| 2979 |
% This macro decomposes the box that |\SOUL@doword| has built. |
| 2980 |
% Because we have to start at the bottom, we put every |
| 2981 |
% syllable onto the stack and execute ourselves recursively. If there |
| 2982 |
% are no syllables left, we return from the recursion and pick syllable |
| 2983 |
% after syllable from the stack again---this time from top to bottom---and |
| 2984 |
% hand the syllable width |\SOUL@syllgoal| over to |\SOUL@dosyllable|. |
| 2985 |
% All but the last syllable end with the hyphen character, hence |
| 2986 |
% we subtract the hyphen width accordingly. After processing a |
| 2987 |
% syllable we calculate the hyphen kern (i.\,e.~the kerning amount |
| 2988 |
% between the last character and the hyphen). This might be needed |
| 2989 |
% by \cs{\SOUL@everyhyphen}, which we call now. |
| 2990 |
% |
| 2991 |
% \begin{macrocode} |
| 2992 |
\def\SOUL@analyze{{% |
| 2993 |
\setbox\z@\vbox{% |
| 2994 |
\unvcopy\z@ |
| 2995 |
\unskip |
| 2996 |
\unpenalty |
| 2997 |
\global\setbox\@ne=\lastbox}% |
| 2998 |
\ifvoid\@ne |
| 2999 |
\else |
| 3000 |
\setbox\@ne\hbox{\unhbox\@ne}% |
| 3001 |
\SOUL@syllgoal=\wd\@ne |
| 3002 |
\advance\count@\@ne |
| 3003 |
\SOUL@analyze |
| 3004 |
\SOUL@syllwidth\z@ |
| 3005 |
\SOUL@syllable={}% |
| 3006 |
\ifnum\count@>\z@ |
| 3007 |
\advance\SOUL@syllgoal-\SOUL@ttwidth |
| 3008 |
\SOUL@dosyllable |
| 3009 |
\SOUL@getkern{\the\SOUL@lasttoken}{\SOUL@hyphkern}% |
| 3010 |
{\SOUL@sethyphenchar}% |
| 3011 |
\SOUL@everyhyphen |
| 3012 |
\else |
| 3013 |
\SOUL@dosyllable |
| 3014 |
\fi |
| 3015 |
\fi |
| 3016 |
}} |
| 3017 |
% \end{macrocode} |
| 3018 |
% \end{macro} |
| 3019 |
% |
| 3020 |
% |
| 3021 |
% |
| 3022 |
% |
| 3023 |
%^^A-------------------------------------------------------------------- |
| 3024 |
% |
| 3025 |
% |
| 3026 |
% |
| 3027 |
% |
| 3028 |
% \begin{macro}{\SOUL@dosyllable} |
| 3029 |
% This macro typesets token after token from \cs{\SOUL@word} |
| 3030 |
% until \cs{\SOUL@syllwidth} has reached |
| 3031 |
% the requested width \cs{\SOUL@syllgoal}. Furthermore the kerning |
| 3032 |
% values are prepared in case \cs{\SOUL@everytoken} needs them. |
| 3033 |
% The \cs{\<} command used by \cs{\so} and \cs{\caps} needs some |
| 3034 |
% special treatment: It has to be checked for, even before |
| 3035 |
% we can end a syllable. |
| 3036 |
% |
| 3037 |
% \begin{macrocode} |
| 3038 |
\def\SOUL@dosyllable{% |
| 3039 |
\SOUL@gettoken |
| 3040 |
\SOUL@eventuallyexhyphen{\the\SOUL@token}% |
| 3041 |
\edef\x{\the\SOUL@token}% |
| 3042 |
\ifx\x\SOUL@hyphenhintM |
| 3043 |
\let\SOUL@n\SOUL@dosyllable |
| 3044 |
\else\ifx\x\SOUL@lowerthanM |
| 3045 |
\SOUL@gettoken |
| 3046 |
\SOUL@getkern{\the\SOUL@lasttoken}{\SOUL@charkern} |
| 3047 |
{\the\SOUL@token}% |
| 3048 |
\SOUL@everylowerthan |
| 3049 |
\SOUL@puttoken |
| 3050 |
\let\SOUL@n\SOUL@dosyllable |
| 3051 |
\else\ifdim\SOUL@syllwidth=\SOUL@syllgoal |
| 3052 |
\SOUL@everysyllable |
| 3053 |
\SOUL@puttoken |
| 3054 |
\let\SOUL@n\relax |
| 3055 |
\else\ifx\x\SOUL@stopM |
| 3056 |
\SOUL@errmsg |
| 3057 |
\global\let\SOUL@errmsg\relax |
| 3058 |
\let\SOUL@n\relax |
| 3059 |
\else |
| 3060 |
\setbox\tw@\hbox{\SOUL@tt\the\SOUL@token}% |
| 3061 |
\advance\SOUL@syllwidth\wd\tw@ |
| 3062 |
\global\SOUL@lasttoken=\SOUL@token |
| 3063 |
\SOUL@gettoken |
| 3064 |
\SOUL@getkern{\the\SOUL@lasttoken}{\SOUL@charkern} |
| 3065 |
{\the\SOUL@token}% |
| 3066 |
\SOUL@puttoken |
| 3067 |
\global\SOUL@token=\SOUL@lasttoken |
| 3068 |
\SOUL@everytoken |
| 3069 |
\edef\x{\SOUL@syllable={\the\SOUL@syllable\the\SOUL@token}}\x |
| 3070 |
\let\SOUL@n\SOUL@dosyllable |
| 3071 |
\fi\fi\fi\fi |
| 3072 |
\SOUL@n |
| 3073 |
} |
| 3074 |
% \end{macrocode} |
| 3075 |
% \end{macro} |
| 3076 |
% |
| 3077 |
% |
| 3078 |
% |
| 3079 |
% |
| 3080 |
%^^A-------------------------------------------------------------------- |
| 3081 |
% |
| 3082 |
% |
| 3083 |
% |
| 3084 |
% |
| 3085 |
% \begin{macro}{\SOUL@gettoken} |
| 3086 |
% Provide the next token in \cs{\SOUL@token}. If there's already one |
| 3087 |
% in the buffer, use that one first. |
| 3088 |
% |
| 3089 |
% \begin{macrocode} |
| 3090 |
\def\SOUL@gettoken{% |
| 3091 |
\edef\x{\the\SOUL@buffer}% |
| 3092 |
\ifx\x\empty |
| 3093 |
\SOUL@nexttoken |
| 3094 |
\else |
| 3095 |
\global\SOUL@token=\SOUL@buffer |
| 3096 |
\global\SOUL@buffer={}% |
| 3097 |
\fi |
| 3098 |
} |
| 3099 |
% \end{macrocode} |
| 3100 |
% \end{macro} |
| 3101 |
% |
| 3102 |
% |
| 3103 |
% |
| 3104 |
% |
| 3105 |
%^^A-------------------------------------------------------------------- |
| 3106 |
% |
| 3107 |
% |
| 3108 |
% |
| 3109 |
% |
| 3110 |
% \begin{macro}{\SOUL@puttoken} |
| 3111 |
% The possibility to put tokens back makes the scanner design much |
| 3112 |
% cleaner. There's only room for one token, though, so we issue |
| 3113 |
% an error message if \cs{\SOUL@puttoken} is told to put a token |
| 3114 |
% back while the buffer is still in use. Note that \cs{\SOUL@debug} |
| 3115 |
% is actually undefined. This won't hurt as it can only happen |
| 3116 |
% during driver design. No user will ever see this message. |
| 3117 |
% |
| 3118 |
% \begin{macrocode} |
| 3119 |
\def\SOUL@puttoken{% |
| 3120 |
\edef\x{\the\SOUL@buffer}% |
| 3121 |
\ifx\x\empty |
| 3122 |
\global\SOUL@buffer=\SOUL@token |
| 3123 |
\global\SOUL@token={}% |
| 3124 |
\else |
| 3125 |
\SOUL@debug{puttoken called twice}% |
| 3126 |
\fi |
| 3127 |
} |
| 3128 |
% \end{macrocode} |
| 3129 |
% \end{macro} |
| 3130 |
% |
| 3131 |
% |
| 3132 |
% |
| 3133 |
% |
| 3134 |
%^^A-------------------------------------------------------------------- |
| 3135 |
% |
| 3136 |
% |
| 3137 |
% |
| 3138 |
% |
| 3139 |
% \begin{macro}{\SOUL@nexttoken} |
| 3140 |
% \begin{macro}{\SOUL@splittoken} |
| 3141 |
% If the word buffer \cs{\SOUL@word} is empty, deliver a \cs{\SOUL@stop}, |
| 3142 |
% otherwise take the next token. |
| 3143 |
% |
| 3144 |
% \begin{macrocode} |
| 3145 |
\def\SOUL@nexttoken{% |
| 3146 |
\edef\x{\the\SOUL@word}% |
| 3147 |
\ifx\x\empty |
| 3148 |
\SOUL@token={\SOUL@stop}% |
| 3149 |
\else |
| 3150 |
\expandafter\SOUL@splittoken\the\SOUL@word\SOUL@stop |
| 3151 |
\fi |
| 3152 |
} |
| 3153 |
\def\SOUL@splittoken#1#2\SOUL@stop{% |
| 3154 |
\global\SOUL@token={#1}% |
| 3155 |
\global\SOUL@word={#2}% |
| 3156 |
} |
| 3157 |
% \end{macrocode} |
| 3158 |
% \end{macro} |
| 3159 |
% \end{macro} |
| 3160 |
% |
| 3161 |
% |
| 3162 |
% |
| 3163 |
% |
| 3164 |
%^^A-------------------------------------------------------------------- |
| 3165 |
% |
| 3166 |
% |
| 3167 |
% |
| 3168 |
% |
| 3169 |
% \begin{macro}{\SOUL@getkern} |
| 3170 |
% Assign the kerning value between the first and the third argument |
| 3171 |
% to the second, which has to be a \cs{\dimen} register. |
| 3172 |
% |\SOUL@getkern{A}{\dimen0}{V}| will assign the kerning value |
| 3173 |
% between `A' and `V' to |\dimen0|. |
| 3174 |
% |
| 3175 |
% \begin{macrocode} |
| 3176 |
\def\SOUL@getkern#1#2#3{% |
| 3177 |
\setbox\tw@\hbox{#1#3}% |
| 3178 |
#2\wd\tw@ |
| 3179 |
\setbox\tw@\hbox{#1\null#3}% |
| 3180 |
\advance#2-\wd\tw@ |
| 3181 |
} |
| 3182 |
% \end{macrocode} |
| 3183 |
% \end{macro} |
| 3184 |
% |
| 3185 |
% |
| 3186 |
% |
| 3187 |
% |
| 3188 |
%^^A-------------------------------------------------------------------- |
| 3189 |
% |
| 3190 |
% |
| 3191 |
% |
| 3192 |
% |
| 3193 |
% \begin{macro}{\SOUL@setkern} |
| 3194 |
% Set a kerning value if it doesn't equal 0\,pt. Of course, we could |
| 3195 |
% also set a zero value, but that would needlessly clutter the |
| 3196 |
% logfile. |
| 3197 |
% |
| 3198 |
% \begin{macrocode} |
| 3199 |
\def\SOUL@setkern#1{\ifdim#1=\z@\else\kern#1\fi} |
| 3200 |
% \end{macrocode} |
| 3201 |
% \end{macro} |
| 3202 |
% |
| 3203 |
% |
| 3204 |
% |
| 3205 |
% |
| 3206 |
%^^A-------------------------------------------------------------------- |
| 3207 |
% |
| 3208 |
% |
| 3209 |
% |
| 3210 |
% |
| 3211 |
% \begin{macro}{\SOUL@error} |
| 3212 |
% This error message will be shown once for every word that couldn't |
| 3213 |
% be reconstructed by \cs{\SOUL@dosyllable}. |
| 3214 |
% |
| 3215 |
% \begin{macrocode} |
| 3216 |
\def\SOUL@error{% |
| 3217 |
\vrule\@height.8em\@depth.2em\@width1em |
| 3218 |
\PackageError{soul}{Reconstruction failed}{% |
| 3219 |
I came across hyphenatable material enclosed in group |
| 3220 |
braces,^^Jwhich I can't handle. Either drop the braces or |
| 3221 |
make the material^^Junbreakable using an \string\mbox\space |
| 3222 |
(\string\hbox). Note that a space^^Jalso counts as possible |
| 3223 |
hyphenation point. See page 4 of the manual.^^JI'm leaving |
| 3224 |
a black square so that you can see where I am right now.% |
| 3225 |
}% |
| 3226 |
} |
| 3227 |
% \end{macrocode} |
| 3228 |
% \end{macro} |
| 3229 |
% |
| 3230 |
% |
| 3231 |
% |
| 3232 |
% |
| 3233 |
%^^A-------------------------------------------------------------------- |
| 3234 |
% |
| 3235 |
% |
| 3236 |
% |
| 3237 |
% |
| 3238 |
% \begin{macro}{\SOUL@setup} |
| 3239 |
% This is a null driver, that will be used as the basis for |
| 3240 |
% other drivers. These have then to redefine only interface commands |
| 3241 |
% that shall differ from the default. |
| 3242 |
% |
| 3243 |
% \begin{macrocode} |
| 3244 |
\def\SOUL@setup{% |
| 3245 |
\let\SOUL@preamble\relax |
| 3246 |
\let\SOUL@postamble\relax |
| 3247 |
\let\SOUL@everytoken\relax |
| 3248 |
\let\SOUL@everysyllable\relax |
| 3249 |
\def\SOUL@everyspace##1{##1\space}% |
| 3250 |
\let\SOUL@everyhyphen\relax |
| 3251 |
\def\SOUL@everyexhyphen##1{##1}% |
| 3252 |
\let\SOUL@everylowerthan\relax |
| 3253 |
} |
| 3254 |
\SOUL@setup |
| 3255 |
% \end{macrocode} |
| 3256 |
% \end{macro} |
| 3257 |
% |
| 3258 |
% |
| 3259 |
% |
| 3260 |
% |
| 3261 |
%^^A-------------------------------------------------------------------- |
| 3262 |
% |
| 3263 |
% |
| 3264 |
% |
| 3265 |
% |
| 3266 |
% \subsection{The \so{letterspacing} driver} |
| 3267 |
% |
| 3268 |
% \begin{macro}{\SOUL@sosetletterskip} |
| 3269 |
% A handy helper macro that sets the inter-letter skip with a |
| 3270 |
% draconian \cs{\penalty}. |
| 3271 |
% |
| 3272 |
% \begin{macrocode} |
| 3273 |
\def\SOUL@sosetletterskip{\nobreak\hskip\SOUL@soletterskip} |
| 3274 |
% \end{macrocode} |
| 3275 |
% \end{macro} |
| 3276 |
% |
| 3277 |
% |
| 3278 |
% |
| 3279 |
% |
| 3280 |
%^^A-------------------------------------------------------------------- |
| 3281 |
% |
| 3282 |
% |
| 3283 |
% |
| 3284 |
% |
| 3285 |
% \begin{macro}{\SOUL@sopreamble} |
| 3286 |
% If letterspacing (\cs{\so} or \cs{\caps}) follows a white space, we |
| 3287 |
% replace it with our \syn{outer space}. \LaTeX\ uses |\hskip1sp| as |
| 3288 |
% marker in tabular entries, so we ignore tiny skips. |
| 3289 |
% |
| 3290 |
% \begin{macrocode} |
| 3291 |
\def\SOUL@sopreamble{% |
| 3292 |
\ifdim\lastskip>5sp |
| 3293 |
\unskip |
| 3294 |
\hskip\SOUL@soouterskip |
| 3295 |
\fi |
| 3296 |
\spaceskip\SOUL@soinnerskip |
| 3297 |
} |
| 3298 |
% \end{macrocode} |
| 3299 |
% \end{macro} |
| 3300 |
% |
| 3301 |
% |
| 3302 |
% |
| 3303 |
% |
| 3304 |
%^^A-------------------------------------------------------------------- |
| 3305 |
% |
| 3306 |
% |
| 3307 |
% |
| 3308 |
% |
| 3309 |
% \begin{macro}{\SOUL@sopostamble} |
| 3310 |
% Start the look-ahead scanner \cs{\SOUL@socheck} outside the \cs{\SOUL@} |
| 3311 |
% scope. That's why we make the \syn{outer space} globally available in |
| 3312 |
% \cs{\skip@}. |
| 3313 |
% |
| 3314 |
% \begin{macrocode} |
| 3315 |
\def\SOUL@sopostamble{% |
| 3316 |
\global\skip@=\SOUL@soouterskip |
| 3317 |
\aftergroup\SOUL@socheck |
| 3318 |
} |
| 3319 |
% \end{macrocode} |
| 3320 |
% \end{macro} |
| 3321 |
% |
| 3322 |
% |
| 3323 |
% |
| 3324 |
% |
| 3325 |
%^^A-------------------------------------------------------------------- |
| 3326 |
% |
| 3327 |
% |
| 3328 |
% |
| 3329 |
% |
| 3330 |
% \begin{macro}{\SOUL@socheck} |
| 3331 |
% \begin{macro}{\SOUL@sodoouter} |
| 3332 |
% Read the next token after the \soul\ command into \cs{\SOUL@@} |
| 3333 |
% and examine it. If it's some kind of space, replace it with |
| 3334 |
% \syn{outer space} and the appropriate penalty, else if it's |
| 3335 |
% a closing brace, continue scanning. If it is neither: do nothing. |
| 3336 |
% |
| 3337 |
% \begin{macrocode} |
| 3338 |
\def\SOUL@socheck{% |
| 3339 |
\futurelet\SOUL@@\SOUL@sodoouter |
| 3340 |
} |
| 3341 |
\def\SOUL@sodoouter{% |
| 3342 |
\def\SOUL@n*##1{\hskip\skip@}% |
| 3343 |
\ifcat\egroup\noexpand\SOUL@@ |
| 3344 |
\unkern |
| 3345 |
\egroup |
| 3346 |
\def\SOUL@n*{\afterassignment\SOUL@socheck\let\SOUL@x=}% |
| 3347 |
\else\ifx\SOUL@spc\SOUL@@ |
| 3348 |
\def\SOUL@n* {\hskip\skip@}% |
| 3349 |
\else\ifx~\SOUL@@ |
| 3350 |
\def\SOUL@n*~{\nobreak\hskip\skip@}% |
| 3351 |
\else\ifx\ \SOUL@@ |
| 3352 |
\else\ifx\space\SOUL@@ |
| 3353 |
\else\ifx\@xobeysp\SOUL@@ |
| 3354 |
\else |
| 3355 |
\def\SOUL@n*{}% |
| 3356 |
\let\SOUL@@\relax |
| 3357 |
\fi\fi\fi\fi\fi\fi |
| 3358 |
\SOUL@n*% |
| 3359 |
} |
| 3360 |
% \end{macrocode} |
| 3361 |
% \end{macro} |
| 3362 |
% \end{macro} |
| 3363 |
% |
| 3364 |
% |
| 3365 |
% |
| 3366 |
% |
| 3367 |
%^^A-------------------------------------------------------------------- |
| 3368 |
% |
| 3369 |
% |
| 3370 |
% |
| 3371 |
% |
| 3372 |
% \begin{macro}{\SOUL@soeverytoken} |
| 3373 |
% Typeset the token and put an unbreakable inter-letter skip |
| 3374 |
% thereafter. If the token is \cs{\<} then remove the last skip instead. |
| 3375 |
% Gets the character kerning value between the actual and the |
| 3376 |
% next token in \cs{\SOUL@charkern}. |
| 3377 |
% |
| 3378 |
% \begin{macrocode} |
| 3379 |
\def\SOUL@soeverytoken{% |
| 3380 |
\edef\x{\the\SOUL@token}% |
| 3381 |
\ifx\x\SOUL@lowerthanM |
| 3382 |
\else |
| 3383 |
\global\let\SOUL@soeventuallyskip\SOUL@sosetletterskip |
| 3384 |
\the\SOUL@token |
| 3385 |
\SOUL@gettoken |
| 3386 |
\edef\x{\the\SOUL@token}% |
| 3387 |
\ifx\x\SOUL@stopM |
| 3388 |
\else |
| 3389 |
\SOUL@setkern\SOUL@charkern |
| 3390 |
\SOUL@sosetletterskip |
| 3391 |
\SOUL@puttoken |
| 3392 |
\fi |
| 3393 |
\fi |
| 3394 |
} |
| 3395 |
% \end{macrocode} |
| 3396 |
% \end{macro} |
| 3397 |
% |
| 3398 |
% |
| 3399 |
% |
| 3400 |
% |
| 3401 |
%^^A-------------------------------------------------------------------- |
| 3402 |
% |
| 3403 |
% |
| 3404 |
% |
| 3405 |
% |
| 3406 |
% \begin{macro}{\SOUL@soeveryspace} |
| 3407 |
% This macro sets an \syn{inner space}. The argument may contain |
| 3408 |
% penalties and is used for the |~| command. This construction was |
| 3409 |
% needed to make colored underlines work, without having to put |
| 3410 |
% any of the coloring commands into the core. |\kern\z@| prevents |
| 3411 |
% in subsequent \cs{\so} commands that the second discards the |
| 3412 |
% \syn{outer space} of the first. To remove the space simply |
| 3413 |
% use |\unkern\unskip|. |
| 3414 |
% |
| 3415 |
% \begin{macrocode} |
| 3416 |
\def\SOUL@soeveryspace#1{#1\space\kern\z@} |
| 3417 |
% \end{macrocode} |
| 3418 |
% \end{macro} |
| 3419 |
% |
| 3420 |
% |
| 3421 |
% |
| 3422 |
% |
| 3423 |
%^^A-------------------------------------------------------------------- |
| 3424 |
% |
| 3425 |
% |
| 3426 |
% |
| 3427 |
% |
| 3428 |
% \begin{macro}{\SOUL@soeveryhyphen} |
| 3429 |
% Sets implicit hyphens. The kerning value between the current token |
| 3430 |
% and the hyphen character is passed in \cs{\SOUL@hyphkern}. |
| 3431 |
% |
| 3432 |
% \begin{macrocode} |
| 3433 |
\def\SOUL@soeveryhyphen{% |
| 3434 |
\discretionary{% |
| 3435 |
\unkern |
| 3436 |
\SOUL@setkern\SOUL@hyphkern |
| 3437 |
\SOUL@sethyphenchar |
| 3438 |
}{}{}% |
| 3439 |
} |
| 3440 |
% \end{macrocode} |
| 3441 |
% \end{macro} |
| 3442 |
% |
| 3443 |
% |
| 3444 |
% |
| 3445 |
% |
| 3446 |
%^^A-------------------------------------------------------------------- |
| 3447 |
% |
| 3448 |
% |
| 3449 |
% |
| 3450 |
% |
| 3451 |
% \begin{macro}{\SOUL@soeveryexhyphen} |
| 3452 |
% Sets the explicit hyphen that is passed as argument. |
| 3453 |
% \cs{\SOUL@soeventuallyskip} equals \cs{\SOUL@sosetletterskip}, |
| 3454 |
% except when a \cs{\<} had been detected. This is necessary because |
| 3455 |
% \cs{\SOUL@soeveryexhyphen} wouldn't know otherwise, that it |
| 3456 |
% follows a~\cs{\<}. |
| 3457 |
% |
| 3458 |
% \begin{macrocode} |
| 3459 |
\def\SOUL@soeveryexhyphen#1{% |
| 3460 |
\SOUL@setkern\SOUL@hyphkern |
| 3461 |
\SOUL@soeventuallyskip |
| 3462 |
\hbox{#1}% |
| 3463 |
\discretionary{}{}{% |
| 3464 |
\SOUL@setkern\SOUL@charkern |
| 3465 |
}% |
| 3466 |
\SOUL@sosetletterskip |
| 3467 |
\global\let\SOUL@soeventuallyskip\relax |
| 3468 |
} |
| 3469 |
% \end{macrocode} |
| 3470 |
% \end{macro} |
| 3471 |
% |
| 3472 |
% |
| 3473 |
% |
| 3474 |
% |
| 3475 |
%^^A-------------------------------------------------------------------- |
| 3476 |
% |
| 3477 |
% |
| 3478 |
% |
| 3479 |
% |
| 3480 |
% \begin{macro}{\SOUL@soeverylowerthan} |
| 3481 |
% Let \cs{\<} remove the last inter-letter skip. Set the kerning value |
| 3482 |
% between the token before and that after the \cs{\<} command. |
| 3483 |
% |
| 3484 |
% |
| 3485 |
% \begin{macrocode} |
| 3486 |
\def\SOUL@soeverylowerthan{% |
| 3487 |
\unskip |
| 3488 |
\unpenalty |
| 3489 |
\global\let\SOUL@soeventuallyskip\relax |
| 3490 |
\SOUL@setkern\SOUL@charkern |
| 3491 |
} |
| 3492 |
% \end{macrocode} |
| 3493 |
% \end{macro} |
| 3494 |
% |
| 3495 |
% |
| 3496 |
% |
| 3497 |
% |
| 3498 |
%^^A-------------------------------------------------------------------- |
| 3499 |
% |
| 3500 |
% |
| 3501 |
% |
| 3502 |
% |
| 3503 |
% \begin{macro}{\SOUL@sosetup} |
| 3504 |
% Override all interface macros by our letterspacing versions. The |
| 3505 |
% only unused macro is \cs{\SOUL@everysyllable}. |
| 3506 |
% |
| 3507 |
% \begin{macrocode} |
| 3508 |
\def\SOUL@sosetup{% |
| 3509 |
\SOUL@setup |
| 3510 |
\let\SOUL@preamble\SOUL@sopreamble |
| 3511 |
\let\SOUL@postamble\SOUL@sopostamble |
| 3512 |
\let\SOUL@everytoken\SOUL@soeverytoken |
| 3513 |
\let\SOUL@everyspace\SOUL@soeveryspace |
| 3514 |
\let\SOUL@everyhyphen\SOUL@soeveryhyphen |
| 3515 |
\let\SOUL@everyexhyphen\SOUL@soeveryexhyphen |
| 3516 |
\let\SOUL@everylowerthan\SOUL@soeverylowerthan |
| 3517 |
} |
| 3518 |
% \end{macrocode} |
| 3519 |
% \end{macro} |
| 3520 |
% |
| 3521 |
% |
| 3522 |
% |
| 3523 |
% |
| 3524 |
%^^A-------------------------------------------------------------------- |
| 3525 |
% |
| 3526 |
% |
| 3527 |
% |
| 3528 |
% |
| 3529 |
% \begin{macro}{\SOUL@setso} |
| 3530 |
% A handy macro for internal use. |
| 3531 |
% |
| 3532 |
% \begin{macrocode} |
| 3533 |
\def\SOUL@setso#1#2#3{% |
| 3534 |
\def\SOUL@soletterskip{#1}% |
| 3535 |
\def\SOUL@soinnerskip{#2}% |
| 3536 |
\def\SOUL@soouterskip{#3}% |
| 3537 |
} |
| 3538 |
% \end{macrocode} |
| 3539 |
% \end{macro} |
| 3540 |
% |
| 3541 |
% |
| 3542 |
% |
| 3543 |
% |
| 3544 |
%^^A-------------------------------------------------------------------- |
| 3545 |
% |
| 3546 |
% |
| 3547 |
% |
| 3548 |
% |
| 3549 |
% \begin{macro}{\sodef} |
| 3550 |
% This macro assigns the letterspacing skips as well as an optional |
| 3551 |
% font switching command to a command sequence name. \cs{\so} itself |
| 3552 |
% will be defined using this macro. |
| 3553 |
% |
| 3554 |
% \begin{macrocode} |
| 3555 |
\def\sodef#1#2#3#4#5{% |
| 3556 |
\DeclareRobustCommand*#1{\SOUL@sosetup |
| 3557 |
\def\SOUL@preamble{% |
| 3558 |
\SOUL@setso{#3}{#4}{#5}% |
| 3559 |
#2% |
| 3560 |
\SOUL@sopreamble |
| 3561 |
}% |
| 3562 |
\SOUL@ |
| 3563 |
}% |
| 3564 |
} |
| 3565 |
% \end{macrocode} |
| 3566 |
% \end{macro} |
| 3567 |
% |
| 3568 |
% |
| 3569 |
% |
| 3570 |
% |
| 3571 |
%^^A-------------------------------------------------------------------- |
| 3572 |
% |
| 3573 |
% |
| 3574 |
% |
| 3575 |
% |
| 3576 |
% \begin{macro}{\resetso} |
| 3577 |
% Let \cs{\resetso} define reasonable default values for letterspacing. |
| 3578 |
% |
| 3579 |
% \begin{macrocode} |
| 3580 |
\def\resetso{% |
| 3581 |
\sodef\textso{}{.25em}{.65em\@plus.08em\@minus.06em}% |
| 3582 |
{.55em\@plus.275em\@minus.183em}% |
| 3583 |
} |
| 3584 |
\resetso |
| 3585 |
% \end{macrocode} |
| 3586 |
% \end{macro} |
| 3587 |
% |
| 3588 |
% |
| 3589 |
% |
| 3590 |
% |
| 3591 |
%^^A-------------------------------------------------------------------- |
| 3592 |
% |
| 3593 |
% |
| 3594 |
% |
| 3595 |
% |
| 3596 |
% \begin{macro}{\sloppyword} |
| 3597 |
% Set up a letterspacing macro that inserts slightly stretchable |
| 3598 |
% space between the characters. This can be used to typeset long |
| 3599 |
% words in narrow columns, where ragged paragraphs are undesirable. |
| 3600 |
% See section~\ref{sec:sloppyword}. |
| 3601 |
% |
| 3602 |
% \begin{macrocode} |
| 3603 |
\sodef\sloppyword{% |
| 3604 |
\linepenalty10 |
| 3605 |
\hyphenpenalty10 |
| 3606 |
\adjdemerits\z@ |
| 3607 |
\doublehyphendemerits\z@ |
| 3608 |
\finalhyphendemerits\z@ |
| 3609 |
\emergencystretch.1em}% |
| 3610 |
{\z@\@plus.1em}% |
| 3611 |
{.33em\@plus.11em\@minus.11em}% |
| 3612 |
{.33em\@plus.11em\@minus.11em} |
| 3613 |
% \end{macrocode} |
| 3614 |
% \end{macro} |
| 3615 |
% |
| 3616 |
% |
| 3617 |
% |
| 3618 |
% |
| 3619 |
%^^A-------------------------------------------------------------------- |
| 3620 |
% |
| 3621 |
% |
| 3622 |
% |
| 3623 |
% |
| 3624 |
% \subsection[The \caps{caps} driver]{The caps driver} |
| 3625 |
% |
| 3626 |
% \begin{macro}{\caps} |
| 3627 |
% Unless run under \LaTeX, make \cs{\caps} just another simple letterspacing |
| 3628 |
% macro that selects a font \cs{\capsfont} (defaulting to \cs{\relax}) but |
| 3629 |
% doesn't have any special capabilities. |
| 3630 |
% |
| 3631 |
% \begin{macrocode} |
| 3632 |
\ifx\documentclass\@undefined |
| 3633 |
\let\capsfont\relax |
| 3634 |
\let\capsreset\relax |
| 3635 |
\def\capsdef#1#2#3#4#5{} |
| 3636 |
\def\capssave#1{} |
| 3637 |
\def\capsselect#1{} |
| 3638 |
\sodef\textcaps{\capsfont} |
| 3639 |
{.028em\@plus.005em\@minus.01em}% |
| 3640 |
{.37em\@plus.1667em\@minus.111em}% |
| 3641 |
{.37em\@plus.1em\@minus.14em} |
| 3642 |
% \end{macrocode} |
| 3643 |
% \end{macro} |
| 3644 |
% |
| 3645 |
% |
| 3646 |
% |
| 3647 |
% |
| 3648 |
%^^A-------------------------------------------------------------------- |
| 3649 |
% |
| 3650 |
% |
| 3651 |
% |
| 3652 |
% |
| 3653 |
% \begin{macro}{\capsreset} |
| 3654 |
% \dots\ else, if run under \LaTeX\ prepare a set of macros that |
| 3655 |
% maintain a database with certain letterspacing values for different |
| 3656 |
% fonts. \cs{\capsreset} clears the database and inserts a default rule. |
| 3657 |
% |
| 3658 |
% \begin{macrocode} |
| 3659 |
\else |
| 3660 |
\DeclareRobustCommand*\capsreset{% |
| 3661 |
\let\SOUL@capsbase\empty |
| 3662 |
\SOUL@capsdefault |
| 3663 |
} |
| 3664 |
% \end{macrocode} |
| 3665 |
% \end{macro} |
| 3666 |
% |
| 3667 |
% |
| 3668 |
% |
| 3669 |
% |
| 3670 |
%^^A-------------------------------------------------------------------- |
| 3671 |
% |
| 3672 |
% |
| 3673 |
% |
| 3674 |
% |
| 3675 |
% \begin{macro}{\capsdef} |
| 3676 |
% Add an entry to the database, which is of course nothing else than |
| 3677 |
% a \TeX\ macro. See section ``List macros'' of appendix~D in the |
| 3678 |
% \TeX{}book~\cite{DEK} for details. |
| 3679 |
% |
| 3680 |
% \begin{macrocode} |
| 3681 |
\def\capsdef#1#2#3#4#5{{% |
| 3682 |
\toks\z@{\\{#1/#2/#3/#4/#5}}% |
| 3683 |
\toks\tw@=\expandafter{\SOUL@capsbase}% |
| 3684 |
\xdef\SOUL@capsbase{\the\toks\z@\the\toks\tw@}% |
| 3685 |
}} |
| 3686 |
% \end{macrocode} |
| 3687 |
% \end{macro} |
| 3688 |
% |
| 3689 |
% |
| 3690 |
% |
| 3691 |
% |
| 3692 |
%^^A-------------------------------------------------------------------- |
| 3693 |
% |
| 3694 |
% |
| 3695 |
% |
| 3696 |
% |
| 3697 |
% \begin{macro}{\capssave} |
| 3698 |
% \begin{macro}{\capsselect} |
| 3699 |
% Save the current database in a macro within the |SOUL@| namespace |
| 3700 |
% and let |\capsselect| restore this database. |
| 3701 |
% |
| 3702 |
% \begin{macrocode} |
| 3703 |
\DeclareRobustCommand*\capssave[1]{% |
| 3704 |
\expandafter\global\expandafter\let |
| 3705 |
\csname SOUL@db@#1\endcsname\SOUL@capsbase |
| 3706 |
} |
| 3707 |
\DeclareRobustCommand*\capsselect[1]{% |
| 3708 |
\expandafter\let\expandafter\SOUL@capsbase |
| 3709 |
\csname SOUL@db@#1\endcsname |
| 3710 |
} |
| 3711 |
% \end{macrocode} |
| 3712 |
% \end{macro} |
| 3713 |
% \end{macro} |
| 3714 |
% |
| 3715 |
% |
| 3716 |
% |
| 3717 |
% |
| 3718 |
%^^A-------------------------------------------------------------------- |
| 3719 |
% |
| 3720 |
% |
| 3721 |
% |
| 3722 |
% |
| 3723 |
% \begin{macro}{\SOUL@capsfind} |
| 3724 |
% \begin{macro}{\SOUL@caps} |
| 3725 |
% Go through the database entries and pick the first entry that matches |
| 3726 |
% the currently active font. Then define an internal macro that uses |
| 3727 |
% the respective spacing values in a macro that is equivalent to the |
| 3728 |
% \cs{\textso} command. |
| 3729 |
% |
| 3730 |
% \begin{macrocode} |
| 3731 |
\def\SOUL@capsfind#1/#2/#3/#4/#5/#6/#7/#8/#9/{% |
| 3732 |
\let\SOUL@match=1% |
| 3733 |
\SOUL@chk{#1}\f@encoding |
| 3734 |
\SOUL@chk{#2}\f@family |
| 3735 |
\SOUL@chk{#3}\f@series |
| 3736 |
\SOUL@chk{#4}\f@shape |
| 3737 |
\SOUL@dimchk{#5}\f@size |
| 3738 |
\if\SOUL@match1% |
| 3739 |
\let\\\@gobble |
| 3740 |
\gdef\SOUL@caps{% |
| 3741 |
\SOUL@sosetup |
| 3742 |
\def\SOUL@preamble{\SOUL@setso{#7}{#8}{#9}#6% |
| 3743 |
\SOUL@sopreamble}% |
| 3744 |
\SOUL@}% |
| 3745 |
\fi |
| 3746 |
} |
| 3747 |
% \end{macrocode} |
| 3748 |
% \end{macro} |
| 3749 |
% \end{macro} |
| 3750 |
% |
| 3751 |
% |
| 3752 |
% |
| 3753 |
% |
| 3754 |
%^^A-------------------------------------------------------------------- |
| 3755 |
% |
| 3756 |
% |
| 3757 |
% |
| 3758 |
% |
| 3759 |
% \begin{macro}{\SOUL@chk} |
| 3760 |
% Sets the \cs{\SOUL@match} flag if both parameters are equal. |
| 3761 |
% This is used for all \caps{\small NFSS} elements except the font size. |
| 3762 |
% |
| 3763 |
% \begin{macrocode} |
| 3764 |
\def\SOUL@chk#1#2{% |
| 3765 |
\if$#1$% |
| 3766 |
\else |
| 3767 |
\def\SOUL@n{#1}% |
| 3768 |
\ifx#2\SOUL@n\else\let\SOUL@match=0\fi |
| 3769 |
\fi |
| 3770 |
} |
| 3771 |
% \end{macrocode} |
| 3772 |
% \end{macro} |
| 3773 |
% |
| 3774 |
% |
| 3775 |
% |
| 3776 |
% |
| 3777 |
%^^A-------------------------------------------------------------------- |
| 3778 |
% |
| 3779 |
% |
| 3780 |
% |
| 3781 |
% |
| 3782 |
% \begin{macro}{\SOUL@dimchk} |
| 3783 |
% \begin{macro}{\SOUL@rangechk} |
| 3784 |
% We do not only want to check if a given font size |#1| matches |#2|, |
| 3785 |
% but also if it fits into a given range. An omitted lower boundary |
| 3786 |
% is replaced by \cs{\z@} and an omitted upper boundary by \cs{\maxdimen}. |
| 3787 |
% The first of a series of \cs{\SOUL@chk} and \cs{\SOUL@dimchk} |
| 3788 |
% statements, which detects that the arguments don't match, sets the |
| 3789 |
% \cs{\SOUL@match} flag to zero. A value of~1 indicates that an |
| 3790 |
% entry in the font database matches the currently used font. |
| 3791 |
% |
| 3792 |
% \begin{macrocode} |
| 3793 |
\def\SOUL@dimchk#1#2{\if$#1$\else\SOUL@rangechk{#2}#1--\@ne\@@\fi} |
| 3794 |
\def\SOUL@rangechk#1#2-#3-#4\@@{% |
| 3795 |
\count@=#4% |
| 3796 |
\ifnum\count@>\z@ |
| 3797 |
\ifdim#1\p@=#2\p@\else\let\SOUL@match=0\fi |
| 3798 |
\else |
| 3799 |
\SOUL@dimen=\if$#2$\z@\else#2\p@\fi |
| 3800 |
\ifdim#1\p@<\SOUL@dimen\let\SOUL@match=0\fi |
| 3801 |
\SOUL@dimen=\if$#3$\maxdimen\else#3\p@\fi |
| 3802 |
\ifdim#1\p@<\SOUL@dimen\else\let\SOUL@match=0\fi |
| 3803 |
\fi |
| 3804 |
} |
| 3805 |
% \end{macrocode} |
| 3806 |
% \end{macro} |
| 3807 |
% \end{macro} |
| 3808 |
% |
| 3809 |
% |
| 3810 |
% |
| 3811 |
% |
| 3812 |
%^^A-------------------------------------------------------------------- |
| 3813 |
% |
| 3814 |
% |
| 3815 |
% |
| 3816 |
% |
| 3817 |
% \begin{macro}{\textcaps} |
| 3818 |
% Find a matching entry in the database and start the letterspacing |
| 3819 |
% mechanism with the given spacing values. |
| 3820 |
% |
| 3821 |
% \begin{macrocode} |
| 3822 |
\DeclareRobustCommand*\textcaps{{% |
| 3823 |
\def\\##1{\expandafter\SOUL@capsfind##1/}% |
| 3824 |
\SOUL@capsbase |
| 3825 |
\aftergroup\SOUL@caps |
| 3826 |
}} |
| 3827 |
% \end{macrocode} |
| 3828 |
% \end{macro} |
| 3829 |
% |
| 3830 |
% |
| 3831 |
% |
| 3832 |
% |
| 3833 |
%^^A-------------------------------------------------------------------- |
| 3834 |
% |
| 3835 |
% |
| 3836 |
% |
| 3837 |
% |
| 3838 |
% \begin{macro}{\SOUL@capsdefault} |
| 3839 |
% Define a default database entry and a default font. |
| 3840 |
% |
| 3841 |
% \begin{macrocode} |
| 3842 |
\def\SOUL@capsdefault{% |
| 3843 |
\capsdef{////}% |
| 3844 |
\SOUL@capsdfltfnt |
| 3845 |
{.028em\@plus.005em\@minus.01em}% |
| 3846 |
{.37em\@plus.1667em\@minus.1em}% |
| 3847 |
{.37em\@plus.111em\@minus.14em}% |
| 3848 |
} |
| 3849 |
\let\SOUL@capsdfltfnt\scshape |
| 3850 |
\capsreset |
| 3851 |
\fi |
| 3852 |
% \end{macrocode} |
| 3853 |
% \end{macro} |
| 3854 |
% |
| 3855 |
% |
| 3856 |
% |
| 3857 |
% |
| 3858 |
%^^A-------------------------------------------------------------------- |
| 3859 |
% |
| 3860 |
% |
| 3861 |
% |
| 3862 |
% |
| 3863 |
% \subsection{The \ul{underlining} driver} |
| 3864 |
% |
| 3865 |
% \begin{macro}{\SOUL@ulleaders} |
| 3866 |
% This macro sets the underline under the following \cs{\hskip}. |
| 3867 |
% |
| 3868 |
% \begin{macrocode} |
| 3869 |
\newdimen\SOUL@uldp |
| 3870 |
\newdimen\SOUL@ulht |
| 3871 |
\def\SOUL@ulleaders{% |
| 3872 |
\leaders\hrule\@depth\SOUL@uldp\@height\SOUL@ulht\relax |
| 3873 |
} |
| 3874 |
% \end{macrocode} |
| 3875 |
% \end{macro} |
| 3876 |
% |
| 3877 |
% |
| 3878 |
% |
| 3879 |
% |
| 3880 |
%^^A-------------------------------------------------------------------- |
| 3881 |
% |
| 3882 |
% |
| 3883 |
% |
| 3884 |
% |
| 3885 |
% \begin{macro}{\SOUL@ulunderline} |
| 3886 |
% Set an underline under the given material. It draws the line first, |
| 3887 |
% and the given material afterwards. This is needed for highlighting, |
| 3888 |
% but gives less than optimal results for colored overstriking, which, |
| 3889 |
% however, will hardly ever be used, anyway. |
| 3890 |
% \changes{v3.1}{2023/05/04}{added a kern after leaders to guard against an unskip, issue \#8} |
| 3891 |
% \begin{macrocode} |
| 3892 |
\def\SOUL@ulunderline#1{{% |
| 3893 |
\setbox\z@\hbox{#1}% |
| 3894 |
\SOUL@dimen=\wd\z@ |
| 3895 |
\SOUL@dimeni=\SOUL@uloverlap |
| 3896 |
\advance\SOUL@dimen2\SOUL@dimeni |
| 3897 |
\rlap{% |
| 3898 |
\null |
| 3899 |
\kern-\SOUL@dimeni |
| 3900 |
\SOUL@ulcolor{\SOUL@ulleaders\hskip\SOUL@dimen\kern\z@}% |
| 3901 |
}% |
| 3902 |
\unhcopy\z@ |
| 3903 |
}} |
| 3904 |
% \end{macrocode} |
| 3905 |
% \end{macro} |
| 3906 |
% |
| 3907 |
% |
| 3908 |
% |
| 3909 |
% |
| 3910 |
%^^A-------------------------------------------------------------------- |
| 3911 |
% |
| 3912 |
% |
| 3913 |
% |
| 3914 |
% |
| 3915 |
% \begin{macro}{\SOUL@ulpreamble} |
| 3916 |
% Just set up the line dimensions and the space skip. Normally, |
| 3917 |
% \cs{\spaceskip} is unset and not used by \TeX. We need it, though, |
| 3918 |
% because we feed it to the \cs{\leaders} primitive. |
| 3919 |
% |
| 3920 |
% \begin{macrocode} |
| 3921 |
\def\SOUL@ulpreamble{% |
| 3922 |
\SOUL@uldp=\SOUL@uldepth |
| 3923 |
\SOUL@ulht=-\SOUL@uldp |
| 3924 |
\advance\SOUL@uldp\SOUL@ulthickness |
| 3925 |
\spaceskip\SOUL@spaceskip |
| 3926 |
} |
| 3927 |
% \end{macrocode} |
| 3928 |
% \end{macro} |
| 3929 |
% |
| 3930 |
% |
| 3931 |
% |
| 3932 |
% |
| 3933 |
%^^A-------------------------------------------------------------------- |
| 3934 |
% |
| 3935 |
% |
| 3936 |
% |
| 3937 |
% |
| 3938 |
% \begin{macro}{\SOUL@uleverysyllable} |
| 3939 |
% By using \cs{\SOUL@everysyllable} we don't have to care about |
| 3940 |
% kerning values and get better results for highlighting, where |
| 3941 |
% negative kerning values would otherwise cut off characters. |
| 3942 |
% |
| 3943 |
% \begin{macrocode} |
| 3944 |
\def\SOUL@uleverysyllable{% |
| 3945 |
\SOUL@ulunderline{% |
| 3946 |
\the\SOUL@syllable |
| 3947 |
\SOUL@setkern\SOUL@charkern |
| 3948 |
}% |
| 3949 |
} |
| 3950 |
% \end{macrocode} |
| 3951 |
% \end{macro} |
| 3952 |
% |
| 3953 |
% |
| 3954 |
% |
| 3955 |
% |
| 3956 |
%^^A-------------------------------------------------------------------- |
| 3957 |
% |
| 3958 |
% |
| 3959 |
% |
| 3960 |
% |
| 3961 |
% \begin{macro}{\SOUL@uleveryspace} |
| 3962 |
% Set a given penalty and an underlined \cs{\space} equivalent. |
| 3963 |
% The \cs{\null} prevents a nasty gap in |\textfrak| |{a \textswab{b}}|, |
| 3964 |
% while it doesn't seem to hurt in all other cases. I didn't investigate |
| 3965 |
% this. |
| 3966 |
% \changes{v3.1}{2023/05/04}{added a kern after leaders to guard against an unskip, issue \#8} |
| 3967 |
% \begin{macrocode} |
| 3968 |
\def\SOUL@uleveryspace#1{% |
| 3969 |
\SOUL@ulcolor{% |
| 3970 |
#1% |
| 3971 |
\SOUL@ulleaders |
| 3972 |
\hskip\spaceskip |
| 3973 |
\kern\z@ |
| 3974 |
}% |
| 3975 |
\null |
| 3976 |
} |
| 3977 |
% \end{macrocode} |
| 3978 |
% \end{macro} |
| 3979 |
% |
| 3980 |
% |
| 3981 |
% |
| 3982 |
% |
| 3983 |
%^^A-------------------------------------------------------------------- |
| 3984 |
% |
| 3985 |
% |
| 3986 |
% |
| 3987 |
% |
| 3988 |
% \begin{macro}{\SOUL@uleveryhyphen} |
| 3989 |
% If hyphenation takes place, output an underlined hyphen with the |
| 3990 |
% required hyphen kerning value. |
| 3991 |
% |
| 3992 |
% \begin{macrocode} |
| 3993 |
\def\SOUL@uleveryhyphen{% |
| 3994 |
\discretionary{% |
| 3995 |
\unkern |
| 3996 |
\SOUL@ulunderline{% |
| 3997 |
\SOUL@setkern\SOUL@hyphkern |
| 3998 |
\SOUL@sethyphenchar |
| 3999 |
}% |
| 4000 |
}{}{}% |
| 4001 |
} |
| 4002 |
% \end{macrocode} |
| 4003 |
% \end{macro} |
| 4004 |
% |
| 4005 |
% |
| 4006 |
% |
| 4007 |
% |
| 4008 |
%^^A-------------------------------------------------------------------- |
| 4009 |
% |
| 4010 |
% |
| 4011 |
% |
| 4012 |
% |
| 4013 |
% \begin{macro}{\SOUL@uleveryexhyphen} |
| 4014 |
% Underline the given hyphen, en-dash, em-dash or \cs{\slash} and care |
| 4015 |
% for kerning. |
| 4016 |
% |
| 4017 |
% \begin{macrocode} |
| 4018 |
\def\SOUL@uleveryexhyphen#1{% |
| 4019 |
\SOUL@setkern\SOUL@hyphkern |
| 4020 |
\SOUL@ulunderline{#1}% |
| 4021 |
\discretionary{}{}{% |
| 4022 |
\SOUL@setkern\SOUL@charkern |
| 4023 |
}% |
| 4024 |
} |
| 4025 |
% \end{macrocode} |
| 4026 |
% \end{macro} |
| 4027 |
% |
| 4028 |
% |
| 4029 |
% |
| 4030 |
% |
| 4031 |
%^^A-------------------------------------------------------------------- |
| 4032 |
% |
| 4033 |
% |
| 4034 |
% |
| 4035 |
% |
| 4036 |
% \begin{macro}{\SOUL@ulcolor} |
| 4037 |
% \begin{macro}{\setulcolor} |
| 4038 |
% Define the underline color or turn off coloring, in which case the lines are not |
| 4039 |
% just colored black, but remain uncolored. This makes them appear |
| 4040 |
% black, nevertheless, and has the advantage, that no Postscript |
| 4041 |
% \cs{\specials} are cluttering the output. |
| 4042 |
% |
| 4043 |
% \begin{macrocode} |
| 4044 |
\let\SOUL@ulcolor\relax |
| 4045 |
\def\setulcolor#1{% |
| 4046 |
\if$#1$ |
| 4047 |
\let\SOUL@ulcolor\relax |
| 4048 |
\else |
| 4049 |
\def\SOUL@ulcolor{\textcolor{#1}}% |
| 4050 |
\fi |
| 4051 |
} |
| 4052 |
% \end{macrocode} |
| 4053 |
% \end{macro} |
| 4054 |
% \end{macro} |
| 4055 |
% |
| 4056 |
% |
| 4057 |
% |
| 4058 |
% |
| 4059 |
%^^A-------------------------------------------------------------------- |
| 4060 |
% |
| 4061 |
% |
| 4062 |
% |
| 4063 |
% |
| 4064 |
% \begin{macro}{\setuloverlap} |
| 4065 |
% \begin{macro}{\SOUL@uloverlap} |
| 4066 |
% Set the overlap amount, that helps to avoid gaps on sloppy output |
| 4067 |
% devices. |
| 4068 |
% |
| 4069 |
% \begin{macrocode} |
| 4070 |
\def\setuloverlap#1{\def\SOUL@uloverlap{#1}} |
| 4071 |
\setuloverlap{.25pt} |
| 4072 |
% \end{macrocode} |
| 4073 |
% \end{macro} |
| 4074 |
% \end{macro} |
| 4075 |
% |
| 4076 |
% |
| 4077 |
% |
| 4078 |
% |
| 4079 |
%^^A-------------------------------------------------------------------- |
| 4080 |
% |
| 4081 |
% |
| 4082 |
% |
| 4083 |
% |
| 4084 |
% \begin{macro}{\SOUL@ulsetup} |
| 4085 |
% The underlining driver is quite simple. No need for \cs{\SOUL@postamble} |
| 4086 |
% and \cs{\SOUL@everytoken}. |
| 4087 |
% |
| 4088 |
% \begin{macrocode} |
| 4089 |
\def\SOUL@ulsetup{% |
| 4090 |
\SOUL@setup |
| 4091 |
\let\SOUL@preamble\SOUL@ulpreamble |
| 4092 |
\let\SOUL@everysyllable\SOUL@uleverysyllable |
| 4093 |
\let\SOUL@everyspace\SOUL@uleveryspace |
| 4094 |
\let\SOUL@everyhyphen\SOUL@uleveryhyphen |
| 4095 |
\let\SOUL@everyexhyphen\SOUL@uleveryexhyphen |
| 4096 |
} |
| 4097 |
% \end{macrocode} |
| 4098 |
% \end{macro} |
| 4099 |
% |
| 4100 |
% |
| 4101 |
% |
| 4102 |
% |
| 4103 |
%^^A-------------------------------------------------------------------- |
| 4104 |
% |
| 4105 |
% |
| 4106 |
% |
| 4107 |
% |
| 4108 |
% \begin{macro}{\SOUL@textul} |
| 4109 |
% Describing self-explanatory macros is \emph{so} boring! |
| 4110 |
% |
| 4111 |
% \begin{macrocode} |
| 4112 |
\DeclareRobustCommand*\textul{\SOUL@ulsetup\SOUL@} |
| 4113 |
% \end{macrocode} |
| 4114 |
% \end{macro} |
| 4115 |
% |
| 4116 |
% |
| 4117 |
% |
| 4118 |
% |
| 4119 |
%^^A-------------------------------------------------------------------- |
| 4120 |
% |
| 4121 |
% |
| 4122 |
% |
| 4123 |
% |
| 4124 |
% \begin{macro}{\setul} |
| 4125 |
% \begin{macro}{\SOUL@uldepth} |
| 4126 |
% \begin{macro}{\SOUL@ulthickness} |
| 4127 |
% Set the underlining dimensions. Either value may be omitted and |
| 4128 |
% lets the respective macro keep its current contents. |
| 4129 |
% |
| 4130 |
% \begin{macrocode} |
| 4131 |
\def\setul#1#2{% |
| 4132 |
\if$#1$\else\def\SOUL@uldepth{#1}\fi |
| 4133 |
\if$#2$\else\def\SOUL@ulthickness{#2}\fi |
| 4134 |
} |
| 4135 |
% \end{macrocode} |
| 4136 |
% \end{macro} |
| 4137 |
% \end{macro} |
| 4138 |
% \end{macro} |
| 4139 |
% |
| 4140 |
% |
| 4141 |
% |
| 4142 |
% |
| 4143 |
%^^A-------------------------------------------------------------------- |
| 4144 |
% |
| 4145 |
% |
| 4146 |
% |
| 4147 |
% |
| 4148 |
% \begin{macro}{\resetul} |
| 4149 |
% Set reasonable default values that fit most latin fonts. |
| 4150 |
% |
| 4151 |
% \begin{macrocode} |
| 4152 |
\def\resetul{\setul{.65ex}{.1ex}} |
| 4153 |
\resetul |
| 4154 |
% \end{macrocode} |
| 4155 |
% \end{macro} |
| 4156 |
% |
| 4157 |
% |
| 4158 |
% |
| 4159 |
% |
| 4160 |
%^^A-------------------------------------------------------------------- |
| 4161 |
% |
| 4162 |
% |
| 4163 |
% |
| 4164 |
% |
| 4165 |
% \begin{macro}{\setuldepth} |
| 4166 |
% This macro sets all designated ``letters'' (\cs{\catcode=11}) or the |
| 4167 |
% given material in a box and sets the underlining dimensions according |
| 4168 |
% to the box depth. |
| 4169 |
% |
| 4170 |
% \begin{macrocode} |
| 4171 |
\def\setuldepth#1{{% |
| 4172 |
\def\SOUL@n{#1}% |
| 4173 |
\setbox\z@\hbox{% |
| 4174 |
\tracinglostchars\z@ |
| 4175 |
\ifx\SOUL@n\empty |
| 4176 |
\count@\z@ |
| 4177 |
\loop |
| 4178 |
\ifnum\catcode\count@=11\char\count@\fi |
| 4179 |
\ifnum\count@<\@cclv |
| 4180 |
\advance\count@\@ne |
| 4181 |
\repeat |
| 4182 |
\else |
| 4183 |
#1% |
| 4184 |
\fi |
| 4185 |
}% |
| 4186 |
\SOUL@dimen\dp\z@ |
| 4187 |
\advance\SOUL@dimen\p@ |
| 4188 |
\xdef\SOUL@uldepth{\the\SOUL@dimen}% |
| 4189 |
}} |
| 4190 |
% \end{macrocode} |
| 4191 |
% \end{macro} |
| 4192 |
% |
| 4193 |
% |
| 4194 |
% |
| 4195 |
% |
| 4196 |
%^^A-------------------------------------------------------------------- |
| 4197 |
% |
| 4198 |
% |
| 4199 |
% |
| 4200 |
% |
| 4201 |
% \subsection{The \st{overstriking} driver} |
| 4202 |
% |
| 4203 |
% \begin{macro}{\SOUL@stpreamble} |
| 4204 |
% Striking out is just underlining with a raised line of a different |
| 4205 |
% color. Hence we only need to define the preamble accordingly and |
| 4206 |
% let the underlining preamble finally do its job. Not that colored |
| 4207 |
% overstriking was especially useful, but we want at least to keep |
| 4208 |
% it black while we might want to set underlines in some fancy color. |
| 4209 |
% |
| 4210 |
% \begin{macrocode} |
| 4211 |
\def\SOUL@stpreamble{% |
| 4212 |
\SOUL@dimen\SOUL@ulthickness |
| 4213 |
\SOUL@dimeni=-.5ex |
| 4214 |
\advance\[email protected]\SOUL@dimen |
| 4215 |
\edef\SOUL@uldepth{\the\SOUL@dimeni}% |
| 4216 |
\let\SOUL@ulcolor\SOUL@stcolor |
| 4217 |
\SOUL@ulpreamble |
| 4218 |
} |
| 4219 |
% \end{macrocode} |
| 4220 |
% \end{macro} |
| 4221 |
% |
| 4222 |
% |
| 4223 |
% |
| 4224 |
% |
| 4225 |
%^^A-------------------------------------------------------------------- |
| 4226 |
% |
| 4227 |
% |
| 4228 |
% |
| 4229 |
% |
| 4230 |
% \begin{macro}{\SOUL@stsetup} |
| 4231 |
% We re-use the whole underlining setup and just replace the preamble |
| 4232 |
% with our modified version. |
| 4233 |
% |
| 4234 |
% \begin{macrocode} |
| 4235 |
\def\SOUL@stsetup{% |
| 4236 |
\SOUL@ulsetup |
| 4237 |
\let\SOUL@preamble\SOUL@stpreamble |
| 4238 |
} |
| 4239 |
% \end{macrocode} |
| 4240 |
% \end{macro} |
| 4241 |
% |
| 4242 |
% |
| 4243 |
% |
| 4244 |
% |
| 4245 |
%^^A-------------------------------------------------------------------- |
| 4246 |
% |
| 4247 |
% |
| 4248 |
% |
| 4249 |
% |
| 4250 |
% \begin{macro}{\textst} |
| 4251 |
% These pretzels are making me thirsty \dots |
| 4252 |
% |
| 4253 |
% \begin{macrocode} |
| 4254 |
\DeclareRobustCommand*\textst{\SOUL@stsetup\SOUL@} |
| 4255 |
% \end{macrocode} |
| 4256 |
% \end{macro} |
| 4257 |
% |
| 4258 |
% |
| 4259 |
% |
| 4260 |
% |
| 4261 |
%^^A-------------------------------------------------------------------- |
| 4262 |
% |
| 4263 |
% |
| 4264 |
% |
| 4265 |
% |
| 4266 |
% \begin{macro}{\SOUL@stcolor} |
| 4267 |
% \begin{macro}{\setstcolor} |
| 4268 |
% Set the overstriking color. This won't be used often, but is required |
| 4269 |
% in cases, where the underlines are colored. You wouldn't want to |
| 4270 |
% overstrike in the same color. Note that overstriking lines are |
| 4271 |
% drawn \emph{beneath} the text, hence bright colors won't look good. |
| 4272 |
% |
| 4273 |
% \begin{macrocode} |
| 4274 |
\let\SOUL@stcolor\relax |
| 4275 |
\def\setstcolor#1{% |
| 4276 |
\if$#1$ |
| 4277 |
\let\SOUL@stcolor\relax |
| 4278 |
\else |
| 4279 |
\def\SOUL@stcolor{\textcolor{#1}}% |
| 4280 |
\fi |
| 4281 |
} |
| 4282 |
% \end{macrocode} |
| 4283 |
% \end{macro} |
| 4284 |
% \end{macro} |
| 4285 |
% |
| 4286 |
% |
| 4287 |
% |
| 4288 |
% |
| 4289 |
%^^A-------------------------------------------------------------------- |
| 4290 |
% |
| 4291 |
% |
| 4292 |
% |
| 4293 |
% |
| 4294 |
% \subsection{The highlighting driver} |
| 4295 |
% |
| 4296 |
% \begin{macro}{\SOUL@hlpreamble} |
| 4297 |
% This is nothing else than overstriking with very thick lines. |
| 4298 |
% |
| 4299 |
% \begin{macrocode} |
| 4300 |
\def\SOUL@hlpreamble{% |
| 4301 |
\setul{}{2.5ex}% |
| 4302 |
\let\SOUL@stcolor\SOUL@hlcolor |
| 4303 |
\SOUL@stpreamble |
| 4304 |
} |
| 4305 |
% \end{macrocode} |
| 4306 |
% \end{macro} |
| 4307 |
% |
| 4308 |
% |
| 4309 |
% |
| 4310 |
% |
| 4311 |
%^^A-------------------------------------------------------------------- |
| 4312 |
% |
| 4313 |
% |
| 4314 |
% |
| 4315 |
% |
| 4316 |
% \begin{macro}{\SOUL@hlsetup} |
| 4317 |
% No need to re-invent the wheel. Just use the overstriking setup |
| 4318 |
% with a different preamble. |
| 4319 |
% |
| 4320 |
% \begin{macrocode} |
| 4321 |
\def\SOUL@hlsetup{% |
| 4322 |
\SOUL@stsetup |
| 4323 |
\let\SOUL@preamble\SOUL@hlpreamble |
| 4324 |
} |
| 4325 |
% \end{macrocode} |
| 4326 |
% \end{macro} |
| 4327 |
% |
| 4328 |
% |
| 4329 |
% |
| 4330 |
% |
| 4331 |
%^^A-------------------------------------------------------------------- |
| 4332 |
% |
| 4333 |
% |
| 4334 |
% |
| 4335 |
% |
| 4336 |
% \begin{macro}{\texthl} |
| 4337 |
% \begin{macro}{\sethlcolor} |
| 4338 |
% \begin{macro}{\SOUL@hlcolor} |
| 4339 |
% Define the highlighting macro and the color setting macro with a |
| 4340 |
% simple default color. Yellow isn't really pleasing, but it's already |
| 4341 |
% predefined by the \package{color} package. |
| 4342 |
% |
| 4343 |
% \begin{macrocode} |
| 4344 |
\DeclareRobustCommand*\texthl{\SOUL@hlsetup\SOUL@} |
| 4345 |
\def\sethlcolor#1{\if$#1$\else\def\SOUL@hlcolor{\textcolor{#1}}\fi} |
| 4346 |
\sethlcolor{yellow} |
| 4347 |
% \end{macrocode} |
| 4348 |
% \end{macro} |
| 4349 |
% \end{macro} |
| 4350 |
% \end{macro} |
| 4351 |
% |
| 4352 |
% |
| 4353 |
% |
| 4354 |
% |
| 4355 |
%^^A-------------------------------------------------------------------- |
| 4356 |
% |
| 4357 |
% |
| 4358 |
% |
| 4359 |
% |
| 4360 |
% \subsection*{The package postamble} |
| 4361 |
% |
| 4362 |
% \begin{macro}{\so} |
| 4363 |
% \begin{macro}{\ul} |
| 4364 |
% \begin{macro}{\st} |
| 4365 |
% \begin{macro}{\hl} |
| 4366 |
% \begin{macro}{\caps} |
| 4367 |
% OK, I lied. The short macro names are just abbreviations for their |
| 4368 |
% longer counterpart. Some people might be used to |\text*| style commands |
| 4369 |
% to select a certain font. And then it doesn't hurt to reserve |
| 4370 |
% these early enough. |
| 4371 |
% |
| 4372 |
% \begin{macrocode} |
| 4373 |
\let\so\textso |
| 4374 |
\let\ul\textul |
| 4375 |
\let\st\textst |
| 4376 |
\let\hl\texthl |
| 4377 |
\let\caps\textcaps |
| 4378 |
% \end{macrocode} |
| 4379 |
% \end{macro} |
| 4380 |
% \end{macro} |
| 4381 |
% \end{macro} |
| 4382 |
% \end{macro} |
| 4383 |
% \end{macro} |
| 4384 |
% |
| 4385 |
% |
| 4386 |
% |
| 4387 |
% |
| 4388 |
%^^A-------------------------------------------------------------------- |
| 4389 |
% |
| 4390 |
% |
| 4391 |
% |
| 4392 |
% |
| 4393 |
% \noindent |
| 4394 |
% When used in an environment other than \LaTeX\ and the \package{german} |
| 4395 |
% package was already loaded, define the double quotes as accent. |
| 4396 |
% |
| 4397 |
% \begin{macrocode} |
| 4398 |
\ifx\documentclass\@undefined |
| 4399 |
\ifx\mdqoff\@undefined |
| 4400 |
\else |
| 4401 |
\soulaccent{"}% |
| 4402 |
\fi |
| 4403 |
\catcode`\@=\atcode |
| 4404 |
% \end{macrocode} |
| 4405 |
% |
| 4406 |
% |
| 4407 |
% |
| 4408 |
% |
| 4409 |
%^^A-------------------------------------------------------------------- |
| 4410 |
% |
| 4411 |
% |
| 4412 |
% |
| 4413 |
% |
| 4414 |
% \noindent |
| 4415 |
% If we have been loaded by a \LaTeX\ environment and the \package{color} |
| 4416 |
% package wasn't also loaded, we disable all colors. Then we add the umlaut accent |
| 4417 |
% |"| if the \package{german} package is present. The quotes character has to |
| 4418 |
% be \cs{\catcode}'d \cs{\active} now, or it won't get recognized later. |
| 4419 |
% The \option{capsdefault} |
| 4420 |
% option overrides the \cs{\caps} driver and lets \cs{\SOUL@} set an underline. |
| 4421 |
% Finally load the local configuration, process the |capsdefault| |
| 4422 |
% option and exit. |
| 4423 |
% |
| 4424 |
% \begin{macrocode} |
| 4425 |
\else |
| 4426 |
\bgroup |
| 4427 |
\catcode`\"\active |
| 4428 |
\AtBeginDocument{% |
| 4429 |
\@ifundefined{color}{% |
| 4430 |
\let\SOUL@color\relax |
| 4431 |
\let\setulcolor\@gobble |
| 4432 |
\let\setstcolor\@gobble |
| 4433 |
\let\sethlcolor\@gobble |
| 4434 |
\let\hl\ul |
| 4435 |
}{} |
| 4436 |
\@ifundefined{mdqoff}{}{\soulaccent{"}} |
| 4437 |
} |
| 4438 |
\egroup |
| 4439 |
\DeclareOption{capsdefault}{% |
| 4440 |
\AtBeginDocument{% |
| 4441 |
\def\SOUL@capsdfltfnt#1{% |
| 4442 |
\SOUL@ulsetup |
| 4443 |
\SOUL@ulpreamble |
| 4444 |
\scshape |
| 4445 |
}% |
| 4446 |
}% |
| 4447 |
} |
| 4448 |
\InputIfFileExists{soul.cfg}% |
| 4449 |
{\PackageInfo{soul}{Local config file soul.cfg used}}{} |
| 4450 |
\ProcessOptions |
| 4451 |
\fi |
| 4452 |
\endinput |
| 4453 |
% \end{macrocode} |
| 4454 |
% |
| 4455 |
% \begin{macrocode} |
| 4456 |
%</package> |
| 4457 |
% \end{macrocode} |
| 4458 |
% |
| 4459 |
% |
| 4460 |
%^^A-------------------------------------------------------------------- |
| 4461 |
% |
| 4462 |
% |
| 4463 |
% |
| 4464 |
% |
| 4465 |
% \vspace{2explus1fill} |
| 4466 |
%\begin{verbatim} |
| 4467 |
%$Id$ |
| 4468 |
%\end{verbatim} |
| 4469 |
% \Finale |
| 4470 |
% |
| 4471 |
% |
| 4472 |
% ^^A.E.I.O.U.^^ |
| 4473 |
%^^A vim:ts=4:sw=4:et |