Debian Codegraph @

texmf-dist/source/latex/oberdiek/setouterhbox.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: setouterhbox.dtx
4 % Version: 2016/05/16 v1.8
5 % Info: Set hbox in outer horizontal mode
6 %
7 % Copyright (C)
8 % 2005-2007 Heiko Oberdiek
9 % 2016-2019 Oberdiek Package Support Group
10 % https://github.com/ho-tex/oberdiek/issues
11 %
12 % This work may be distributed and/or modified under the
13 % conditions of the LaTeX Project Public License, either
14 % version 1.3c of this license or (at your option) any later
15 % version. This version of this license is in
16 % https://www.latex-project.org/lppl/lppl-1-3c.txt
17 % and the latest version of this license is in
18 % https://www.latex-project.org/lppl.txt
19 % and version 1.3 or later is part of all distributions of
20 % LaTeX version 2005/12/01 or later.
21 %
22 % This work has the LPPL maintenance status "maintained".
23 %
24 % The Current Maintainers of this work are
25 % Heiko Oberdiek and the Oberdiek Package Support Group
26 % https://github.com/ho-tex/oberdiek/issues
27 %
28 % The Base Interpreter refers to any `TeX-Format',
29 % because some files are installed in TDS:tex/generic//.
30 %
31 % This work consists of the main source file setouterhbox.dtx
32 % and the derived files
33 % setouterhbox.sty, setouterhbox.pdf, setouterhbox.ins, setouterhbox.drv,
34 % setouterhbox-example.tex, setouterhbox-test1.tex,
35 % setouterhbox-test2.tex.
36 %
37 % Distribution:
38 % CTAN:macros/latex/contrib/oberdiek/setouterhbox.dtx
39 % CTAN:macros/latex/contrib/oberdiek/setouterhbox.pdf
40 %
41 % Unpacking:
42 % (a) If setouterhbox.ins is present:
43 % tex setouterhbox.ins
44 % (b) Without setouterhbox.ins:
45 % tex setouterhbox.dtx
46 % (c) If you insist on using LaTeX
47 % latex \let\install=y\input{setouterhbox.dtx}
48 % (quote the arguments according to the demands of your shell)
49 %
50 % Documentation:
51 % (a) If setouterhbox.drv is present:
52 % latex setouterhbox.drv
53 % (b) Without setouterhbox.drv:
54 % latex setouterhbox.dtx; ...
55 % The class ltxdoc loads the configuration file ltxdoc.cfg
56 % if available. Here you can specify further options, e.g.
57 % use A4 as paper format:
58 % \PassOptionsToClass{a4paper}{article}
59 %
60 % Program calls to get the documentation (example):
61 % pdflatex setouterhbox.dtx
62 % makeindex -s gind.ist setouterhbox.idx
63 % pdflatex setouterhbox.dtx
64 % makeindex -s gind.ist setouterhbox.idx
65 % pdflatex setouterhbox.dtx
66 %
67 % Installation:
68 % TDS:tex/generic/oberdiek/setouterhbox.sty
69 % TDS:doc/latex/oberdiek/setouterhbox.pdf
70 % TDS:doc/latex/oberdiek/setouterhbox-example.tex
71 % TDS:source/latex/oberdiek/setouterhbox.dtx
72 %
73 %<*ignore>
74 \begingroup
75 \catcode123=1 %
76 \catcode125=2 %
77 \def\x{LaTeX2e}%
78 \expandafter\endgroup
79 \ifcase 0\ifx\install y1\fi\expandafter
80 \ifx\csname processbatchFile\endcsname\relax\else1\fi
81 \ifx\fmtname\x\else 1\fi\relax
82 \else\csname fi\endcsname
83 %</ignore>
84 %<*install>
85 \input docstrip.tex
86 \Msg{************************************************************************}
87 \Msg{* Installation}
88 \Msg{* Package: setouterhbox 2016/05/16 v1.8 Set hbox in outer horizontal mode (HO)}
89 \Msg{************************************************************************}
90
91 \keepsilent
92 \askforoverwritefalse
93
94 \let\MetaPrefix\relax
95 \preamble
96
97 This is a generated file.
98
99 Project: setouterhbox
100 Version: 2016/05/16 v1.8
101
102 Copyright (C)
103 2005-2007 Heiko Oberdiek
104 2016-2019 Oberdiek Package Support Group
105
106 This work may be distributed and/or modified under the
107 conditions of the LaTeX Project Public License, either
108 version 1.3c of this license or (at your option) any later
109 version. This version of this license is in
110 https://www.latex-project.org/lppl/lppl-1-3c.txt
111 and the latest version of this license is in
112 https://www.latex-project.org/lppl.txt
113 and version 1.3 or later is part of all distributions of
114 LaTeX version 2005/12/01 or later.
115
116 This work has the LPPL maintenance status "maintained".
117
118 The Current Maintainers of this work are
119 Heiko Oberdiek and the Oberdiek Package Support Group
120 https://github.com/ho-tex/oberdiek/issues
121
122
123 The Base Interpreter refers to any `TeX-Format',
124 because some files are installed in TDS:tex/generic//.
125
126 This work consists of the main source file setouterhbox.dtx
127 and the derived files
128 setouterhbox.sty, setouterhbox.pdf, setouterhbox.ins, setouterhbox.drv,
129 setouterhbox-example.tex, setouterhbox-test1.tex,
130 setouterhbox-test2.tex.
131
132 \endpreamble
133 \let\MetaPrefix\DoubleperCent
134
135 \generate{%
136 \file{setouterhbox.ins}{\from{setouterhbox.dtx}{install}}%
137 \file{setouterhbox.drv}{\from{setouterhbox.dtx}{driver}}%
138 \usedir{tex/generic/oberdiek}%
139 \file{setouterhbox.sty}{\from{setouterhbox.dtx}{package}}%
140 \usedir{doc/latex/oberdiek}%
141 \file{setouterhbox-example.tex}{\from{setouterhbox.dtx}{example}}%
142 % \usedir{doc/latex/oberdiek/test}%
143 % \file{setouterhbox-test1.tex}{\from{setouterhbox.dtx}{test1}}%
144 % \file{setouterhbox-test2.tex}{\from{setouterhbox.dtx}{test2}}%
145 }
146
147 \catcode32=13\relax% active space
148 \let =\space%
149 \Msg{************************************************************************}
150 \Msg{*}
151 \Msg{* To finish the installation you have to move the following}
152 \Msg{* file into a directory searched by TeX:}
153 \Msg{*}
154 \Msg{* setouterhbox.sty}
155 \Msg{*}
156 \Msg{* To produce the documentation run the file `setouterhbox.drv'}
157 \Msg{* through LaTeX.}
158 \Msg{*}
159 \Msg{* Happy TeXing!}
160 \Msg{*}
161 \Msg{************************************************************************}
162
163 \endbatchfile
164 %</install>
165 %<*ignore>
166 \fi
167 %</ignore>
168 %<*driver>
169 \NeedsTeXFormat{LaTeX2e}
170 \ProvidesFile{setouterhbox.drv}%
171 [2016/05/16 v1.8 Set hbox in outer horizontal mode (HO)]%
172 \documentclass{ltxdoc}
173 \usepackage{holtxdoc}[2011/11/22]
174 \begin{document}
175 \DocInput{setouterhbox.dtx}%
176 \end{document}
177 %</driver>
178 % \fi
179 %
180 %
181 %
182 % \GetFileInfo{setouterhbox.drv}
183 %
184 % \title{The \xpackage{setouterhbox} package}
185 % \date{2016/05/16 v1.8}
186 % \author{Heiko Oberdiek\thanks
187 % {Please report any issues at \url{https://github.com/ho-tex/oberdiek/issues}}}
188 %
189 % \maketitle
190 %
191 % \begin{abstract}
192 % If math stuff is set in an \cs{hbox}, then TeX
193 % performs some optimization and omits the implicit
194 % penalties \cs{binoppenalty} and \cs{relpenalty}.
195 % This packages tries to put stuff into an \cs{hbox}
196 % without getting lost of those penalties.
197 % \end{abstract}
198 %
199 % \tableofcontents
200 %
201 % \section{Documentation}
202 %
203 % \subsection{Introduction}
204 %
205 % There is a situation in \xpackage{hyperref}'s driver for dvips
206 % where the user wants to have links that can be broken across
207 % lines. However dvips doesn't support the feature. With option
208 % \xoption{breaklinks} \xpackage{hyperref} sets the links as
209 % usual, put them in a box and write the link data with
210 % box dimensions into the appropriate \cs{special}s.
211 % Then, however, it does not set the complete unbreakable
212 % box, but it unwrappes the material inside to allow line
213 % breaks. Of course line breaking and glue setting will falsify
214 % the link dimensions, but line breaking was more important
215 % for the user.
216 %
217 % \subsection{Acknowledgement}
218 %
219 % Jonathan Fine, Donald Arsenau and me discussed the problem
220 % in the newsgroup \xnewsgroup{comp.text.tex} where Damian
221 % Menscher has started the thread, see \cite{newsstart}.
222 %
223 % The discussion was productive and generated many ideas
224 % and code examples. In order to have a more permanent
225 % result I wrote this package and tried to implement
226 % most of the ideas, a kind of summary of the discussion.
227 % Thus I want and have to thank Jonathan Fine and Donald Arsenau
228 % very much.
229 %
230 % Two weeks later David Kastrup (posting in
231 % \xnewsgroup{comp.text.tex}, \cite{kastrup})
232 % remembered an old article of Michael Downes (\cite{downes})
233 % in TUGboat, where Michael Downes already presented the
234 % method we discuss here. Nowadays we have \eTeX\ that extends
235 % the tool set of a \TeX\ macro programmer. Especially useful
236 % \eTeX\ was in this package for detecting and dealing with
237 % erroneous situations.
238 %
239 % However also nowadays a perfect solution for the problem
240 % is still missing at macro level. Probably someone has
241 % to go deep in the internals of the \TeX\ compiler to
242 % implement a switch that let penalties stay where otherwise
243 % \TeX\ would remove them for optimization reasons.
244 %
245 % \subsection{Usage}
246 %
247 % \paragraph{Package loading.}
248 % \LaTeX: as usually:
249 % \begin{quote}
250 % |\usepackage{setouterhbox}|
251 % \end{quote}
252 % The package can also be included directly, thus \plainTeX\ users
253 % write:
254 % \begin{quote}
255 % |\input setouterhbox.sty|
256 % \end{quote}
257 %
258 % \paragraph{Register allocation.}
259 % The material will be put into a box, thus we need to know these
260 % box number. If you need to allocate a new box register:
261 % \begin{description}
262 % \item[\LaTeX:] |\newsavebox{\|\meta{name}|}|
263 % \item[\plainTeX:] |\newbox\|\meta{name}
264 % \end{description}
265 % Then |\|\meta{name} is a command that held the box number.
266 %
267 % \paragraph{Box wrapping.}
268 % \LaTeX\ users put the material in the box with an environment
269 % similar to \texttt{lrbox}. The environment \texttt{setouterhbox}
270 % uses the same syntax and offers the same features, such
271 % as verbatim stuff inside:
272 % \begin{quote}
273 % |\begin{setouterhbox}{|\meta{box number}|}|\dots
274 % |\end{setouterhbox}|
275 % \end{quote}
276 % Users with \plainTeX\ do not have environments, they use instead:
277 % \begin{quote}
278 % |\setouterhbox{|\meta{box number}|}|\dots|\endsetouterhbox|
279 % \end{quote}
280 % In both cases the material is put into an \cs{hbox} and assigned
281 % to the given box, denoted by \meta{box number}. Note the
282 % assignment is local, the same way \texttt{lrbox} behaves.
283 %
284 % \paragraph{Unwrapping.}
285 % The box material is ready for unwrapping:
286 % \begin{quote}
287 % |\unhbox|\meta{box number}
288 % \end{quote}
289 %
290 % \subsection{Option \xoption{hyperref}}
291 %
292 % Package url uses math mode for typesetting urls.
293 % Break points are inserted by \cs{binoppenalty} and
294 % \cs{relpenalty}. Unhappily these break points are
295 % removed, if \xpackage{hyperref}
296 % is used with option {breaklinks}
297 % and drivers that depend on \xoption{pdfmark}:
298 % \xoption{dvips}, \xoption{vtexpdfmark}, \xoption{textures},
299 % and \xoption{dvipsone}.
300 % Thus the option \xoption{hyperref} enables the method
301 % of this package to avoid the removal of \cs{relpenalty}
302 % and \cs{binoppenalty}. Thus you get more break points.
303 % However, the link areas are still wrong for these
304 % drivers, because they are not supporting broken
305 % links.
306 %
307 % Note, you need version 2006/08/16 v6.75c of package \xpackage{hyperref},
308 % because starting with this version the necessary hook is provided
309 % that package \xpackage{setouterhbox} uses.
310 % \begin{quote}
311 % |\usepackage[|\dots|]{hyperref}[2006/08/16]|\\
312 % |\usepackage[hyperref]{setouterhbox}|
313 % \end{quote}
314 % Package order does not matter.
315 %
316 % \subsection{Example}
317 %
318 % \begin{macrocode}
319 %<*example>
320 \documentclass[a5paper]{article}
321 \usepackage{url}[2005/06/27]
322 \usepackage{setouterhbox}
323
324 \newsavebox{\testbox}
325
326 \setlength{\parindent}{0pt}
327 \setlength{\parskip}{2em}
328
329 \begin{document}
330 \raggedright
331
332 \url{http://this.is.a.very.long.host.name/followed/%
333 by/a/very_long_long_long_path.html}%
334
335 \sbox\testbox{%
336 \url{http://this.is.a.very.long.host.name/followed/%
337 by/a/very_long_long_long_path.html}%
338 }%
339 \unhbox\testbox
340
341 \begin{setouterhbox}{\testbox}%
342 \url{http://this.is.a.very.long.host.name/followed/%
343 by/a/very_long_long_long_path.html}%
344 \end{setouterhbox}
345 \unhbox\testbox
346
347 \end{document}
348 %</example>
349 % \end{macrocode}
350 %
351 % \StopEventually{
352 % }
353 %
354 % \section{Implementation}
355 %
356 % Internal macros are prefixed by \cs{setouterhbox}, |@| is
357 % not used inside names, thus we do not need to care of its
358 % catcode if we are not using it as \LaTeX\ package.
359 %
360 % \subsection{Package start stuff}
361 %
362 % \begin{macrocode}
363 %<*package>
364 % \end{macrocode}
365 %
366 % Prevent reloading more than one, necessary for \plainTeX:
367 % Reload check, especially if the package is not used with \LaTeX.
368 % \begin{macrocode}
369 \begingroup\catcode61\catcode48\catcode32=10\relax%
370 \catcode13=5 % ^^M
371 \endlinechar=13 %
372 \catcode35=6 % #
373 \catcode39=12 % '
374 \catcode44=12 % ,
375 \catcode45=12 % -
376 \catcode46=12 % .
377 \catcode58=12 % :
378 \catcode64=11 % @
379 \catcode123=1 % {
380 \catcode125=2 % }
381 \expandafter\let\expandafter\x\csname [email protected]\endcsname
382 \ifx\x\relax % plain-TeX, first loading
383 \else
384 \def\empty{}%
385 \ifx\x\empty % LaTeX, first loading,
386 % variable is initialized, but \ProvidesPackage not yet seen
387 \else
388 \expandafter\ifx\csname PackageInfo\endcsname\relax
389 \def\x#1#2{%
390 \immediate\write-1{Package #1 Info: #2.}%
391 }%
392 \else
393 \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
394 \fi
395 \x{setouterhbox}{The package is already loaded}%
396 \aftergroup\endinput
397 \fi
398 \fi
399 \endgroup%
400 % \end{macrocode}
401 % Package identification:
402 % \begin{macrocode}
403 \begingroup\catcode61\catcode48\catcode32=10\relax%
404 \catcode13=5 % ^^M
405 \endlinechar=13 %
406 \catcode35=6 % #
407 \catcode39=12 % '
408 \catcode40=12 % (
409 \catcode41=12 % )
410 \catcode44=12 % ,
411 \catcode45=12 % -
412 \catcode46=12 % .
413 \catcode47=12 % /
414 \catcode58=12 % :
415 \catcode64=11 % @
416 \catcode91=12 % [
417 \catcode93=12 % ]
418 \catcode123=1 % {
419 \catcode125=2 % }
420 \expandafter\ifx\csname ProvidesPackage\endcsname\relax
421 \def\x#1#2#3[#4]{\endgroup
422 \immediate\write-1{Package: #3 #4}%
423 \xdef#1{#4}%
424 }%
425 \else
426 \def\x#1#2[#3]{\endgroup
427 #2[{#3}]%
428 \ifx#1\@undefined
429 \xdef#1{#3}%
430 \fi
431 \ifx#1\relax
432 \xdef#1{#3}%
433 \fi
434 }%
435 \fi
436 \expandafter\x\csname [email protected]\endcsname
437 \ProvidesPackage{setouterhbox}%
438 [2016/05/16 v1.8 Set hbox in outer horizontal mode (HO)]%
439 % \end{macrocode}
440 %
441 % \begin{macrocode}
442 \begingroup\catcode61\catcode48\catcode32=10\relax%
443 \catcode13=5 % ^^M
444 \endlinechar=13 %
445 \catcode123=1 % {
446 \catcode125=2 % }
447 \catcode64=11 % @
448 \def\x{\endgroup
449 \expandafter\edef\csname setouterhboxAtEnd\endcsname{%
450 \endlinechar=\the\endlinechar\relax
451 \catcode13=\the\catcode13\relax
452 \catcode32=\the\catcode32\relax
453 \catcode35=\the\catcode35\relax
454 \catcode61=\the\catcode61\relax
455 \catcode64=\the\catcode64\relax
456 \catcode123=\the\catcode123\relax
457 \catcode125=\the\catcode125\relax
458 }%
459 }%
460 \x\catcode61\catcode48\catcode32=10\relax%
461 \catcode13=5 % ^^M
462 \endlinechar=13 %
463 \catcode35=6 % #
464 \catcode64=11 % @
465 \catcode123=1 % {
466 \catcode125=2 % }
467 \def\TMP@EnsureCode#1#2{%
468 \edef\setouterhboxAtEnd{%
469 \setouterhboxAtEnd
470 \catcode#1=\the\catcode#1\relax
471 }%
472 \catcode#1=#2\relax
473 }
474 \TMP@EnsureCode{40}{12}% (
475 \TMP@EnsureCode{41}{12}% )
476 \TMP@EnsureCode{44}{12}% ,
477 \TMP@EnsureCode{45}{12}% -
478 \TMP@EnsureCode{46}{12}% .
479 \TMP@EnsureCode{47}{12}% /
480 \TMP@EnsureCode{58}{12}% :
481 \TMP@EnsureCode{60}{12}% <
482 \TMP@EnsureCode{62}{12}% >
483 \TMP@EnsureCode{91}{12}% [
484 \TMP@EnsureCode{93}{12}% ]
485 \TMP@EnsureCode{96}{12}% `
486 \edef\setouterhboxAtEnd{\setouterhboxAtEnd\noexpand\endinput}
487 % \end{macrocode}
488 %
489 % \subsection{Interface macros}
490 %
491 % \begin{macro}{\setouterhboxBox}
492 % The method requires a global box assignment. To be on the
493 % safe side, a new box register is allocated for this
494 % global box assignment.
495 % \begin{macrocode}
496 \newbox\setouterhboxBox
497 % \end{macrocode}
498 % \end{macro}
499 %
500 % \begin{macro}{\setouterhboxFailure}
501 % Error message for both \plainTeX\ and \LaTeX
502 % \begin{macrocode}
503 \begingroup\expandafter\expandafter\expandafter\endgroup
504 \expandafter\ifx\csname RequirePackage\endcsname\relax
505 \input infwarerr.sty\relax
506 \else
507 \RequirePackage{infwarerr}[2016/05/16]%
508 \fi
509 \edef\setouterhboxFailure#1#2{%
510 \expandafter\noexpand\csname @PackageError\endcsname
511 {setouterhbox}{#1}{#2}%
512 }
513 % \end{macrocode}
514 % \end{macro}
515 %
516 % \subsection{Main part}
517 %
518 % eTeX provides much better means for checking
519 % error conditions. Thus lines marked by "E" are executed
520 % if eTeX is available, otherwise the lines marked by "T" are
521 % used.
522 % \begin{macrocode}
523 \begingroup\expandafter\expandafter\expandafter\endgroup
524 \expandafter\ifx\csname lastnodetype\endcsname\relax
525 \catcode`T=9 % ignore
526 \catcode`E=14 % comment
527 \else
528 \catcode`T=14 % comment
529 \catcode`E=9 % ignore
530 \fi
531 % \end{macrocode}
532 %
533 % \begin{macro}{\setouterhboxRemove}
534 % Remove all kern, glue, and penalty nodes;
535 % poor man's version, if \eTeX\ is not available
536 % \begin{macrocode}
537 \def\setouterhboxRemove{%
538 E \ifnum\lastnodetype<11 %
539 E \else
540 E \ifnum\lastnodetype>13 %
541 E \else
542 \unskip\unkern\unpenalty
543 E \expandafter\expandafter\expandafter\setouterhboxRemove
544 E \fi
545 E \fi
546 }%
547 % \end{macrocode}
548 % \end{macro}
549 %
550 % \begin{macro}{\setouterhbox}
551 % Passing the box contents by macro parameter would prevent
552 % catcode changes in the box contents like by \cs{verb}.
553 % Also \cs{bgroup} and \cs{egroup} does not work, because stuff
554 % has to be added at the begin and end of the box, thus
555 % the syntax
556 % |\setouterhbox{|\meta{box number}|}|\dots|\endsetouterhbox|
557 % is used. Also we automatically get an environment \texttt{setouterhbox}
558 % if \LaTeX\ is used.
559 % \begin{macrocode}
560 \def\setouterhbox#1{%
561 \begingroup
562 \def\setouterhboxNum{#1}%
563 \setbox0\vbox\bgroup
564 T \kern.123pt\relax % marker
565 T \kern0pt\relax % removed by \setouterhboxRemove
566 \begingroup
567 \everypar{}%
568 \noindent
569 }
570 % \end{macrocode}
571 % \end{macro}
572 % \begin{macro}{\endsetouterhbox}
573 % Most of the work is done in the end part, thus the heart of
574 % the method follows:
575 % \begin{macrocode}
576 \def\endsetouterhbox{%
577 \endgroup
578 % \end{macrocode}
579 % Omit the first pass to get the penalties
580 % of the second pass.
581 % \begin{macrocode}
582 \pretolerance-1 %
583 % \end{macrocode}
584 % We don't want a third pass with \cs{emergencystretch}.
585 % \begin{macrocode}
586 \tolerance10000 %
587 \hsize\maxdimen
588 % \end{macrocode}
589 % Line is not underfull:
590 % \begin{macrocode}
591 \parfillskip 0pt plus 1filll\relax
592 \leftskip0pt\relax
593 % \end{macrocode}
594 % Suppress underful \cs{hbox} warnings,
595 % is explicit line breaks are used.
596 % \begin{macrocode}
597 \rightskip0pt plus 1fil\relax
598 \everypar{}%
599 % \end{macrocode}
600 % Ensure that there is a paragraph and
601 % prevents \cs{endgraph} from eating terminal glue:
602 % \begin{macrocode}
603 \kern0pt%
604 \endgraf
605 \setouterhboxRemove
606 E \ifnum\lastnodetype=1 %
607 E \global\setbox\setouterhboxBox\lastbox
608 E \loop
609 E \setouterhboxRemove
610 E \ifnum\lastnodetype=1 %
611 E \setbox0=\lastbox
612 E \global\setbox\setouterhboxBox=\hbox{%
613 E \unhbox0 %
614 % \end{macrocode}
615 % Remove \cs{rightskip}, a penalty with -10000 is part of the previous line.
616 % \begin{macrocode}
617 E \unskip
618 E \unhbox\setouterhboxBox
619 E }%
620 E \repeat
621 E \else
622 E \setouterhboxFailure{%
623 E Something is wrong%
624 E }{%
625 E Could not find expected line.%
626 E \MessageBreak
627 E (\string\lastnodetype: \number\lastnodetype, expected: 1)%
628 E }%
629 E \fi
630 E \setouterhboxRemove
631 T \global\setbox\setouterhboxBox\lastbox
632 T \loop
633 T \setouterhboxRemove
634 T \setbox0=\lastbox
635 T \ifcase\ifvoid0 1\else0\fi
636 T \global\setbox\setouterhboxBox=\hbox{%
637 T \unhbox0 %
638 % \end{macrocode}
639 % Remove \cs{rightskip}, a penalty with -10000 is part of the previous line.
640 % \begin{macrocode}
641 T \unskip
642 T \unhbox\setouterhboxBox
643 T }%
644 T \repeat
645 T \ifdim.123pt=\lastkern
646 T \else
647 T \setouterhboxFailure{%
648 T Something is wrong%
649 T }{%
650 T Unexpected stuff was detected before the line.%
651 T }%
652 T \fi
653 T \egroup
654 T \ifcase \ifnum\wd0=0 \else 1\fi
655 T \ifdim\ht0=.123pt \else 1\fi
656 T \ifnum\dp0=0 \else 1\fi
657 T 0 %
658 E \ifnum\lastnodetype=-1 %
659 % \end{macrocode}
660 % There was just one line that we have caught.
661 % \begin{macrocode}
662 \else
663 \setouterhboxFailure{%
664 Something is wrong%
665 }{%
666 After fetching the line there is more unexpected stuff.%
667 E \MessageBreak
668 E (\string\lastnodetype: \number\lastnodetype, expected: -1)%
669 }%
670 \fi
671 E \egroup
672 \expandafter\endgroup
673 \expandafter\setouterhboxFinish\expandafter{%
674 \number\setouterhboxNum
675 }%
676 }
677 % \end{macrocode}
678 % \end{macro}
679 %
680 % \subsection{Environment support}
681 %
682 % Check \cs{@currenvir} for the case that \cs{setouterhbox}
683 % was called as environment. Then the box assignment
684 % must be put after the \cs{endgroup} of |\end{|\dots|}|.
685 % \begin{macrocode}
686 \def\setouterhboxCurr{setouterhbox}
687 \def\setouterhboxLast#1{%
688 \setbox#1\hbox{%
689 \unhbox\setouterhboxBox
690 \unskip % remove \rightskip glue
691 \unskip % remove \parfillskip glue
692 \unpenalty % remove paragraph ending \penalty 10000
693 \unkern % remove explicit kern inserted above
694 }%
695 }
696 % \end{macrocode}
697 % \begin{macro}{\setouterhboxFinish}
698 % |#1| is an explicit number.
699 % \begin{macrocode}
700 \def\setouterhboxFinish#1{%
701 \begingroup\expandafter\expandafter\expandafter\endgroup
702 \expandafter\ifx\csname @currenvir\endcsname\setouterhboxCurr
703 \aftergroup\setouterhboxLast
704 \aftergroup{%
705 \setouterhboxAfter #1\NIL
706 \aftergroup}%
707 \else
708 \setouterhboxLast{#1}%
709 \fi
710 }
711 % \end{macrocode}
712 % \end{macro}
713 % \begin{macro}{\setouterhboxAfter}
714 % |#1| is an explicit number.
715 % \begin{macrocode}
716 \def\setouterhboxAfter#1#2\NIL{%
717 \aftergroup#1%
718 \ifx\\#2\\%
719 \else
720 \setouterhboxReturnAfterFi{%
721 \setouterhboxAfter#2\NIL
722 }%
723 \fi
724 }
725 % \end{macrocode}
726 % \end{macro}
727 % \begin{macro}{\setouterhboxReturnAfterFi}
728 % A utility macro to get tail recursion.
729 % \begin{macrocode}
730 \long\def\setouterhboxReturnAfterFi#1\fi{\fi#1}
731 % \end{macrocode}
732 % \end{macro}
733 % Restore catcodes we have need to distinguish between
734 % the implementation with and without \eTeX.
735 % \begin{macrocode}
736 \catcode69=11\relax % E
737 \catcode84=11\relax % T
738 % \end{macrocode}
739 %
740 % \subsection{Option \xoption{hyperref}}
741 % \begin{macrocode}
742 \begingroup
743 \def\x{LaTeX2e}%
744 \expandafter\endgroup
745 \ifx\x\fmtname
746 \else
747 \expandafter\setouterhboxAtEnd
748 \fi%
749 % \end{macrocode}
750 % \begin{macro}{\Hy@setouterhbox}
751 % \cs{Hy@setouterhbox} is the internal hook that \xpackage{hyperref}
752 % uses since 2006/02/12 v6.75a.
753 % \begin{macrocode}
754 \DeclareOption{hyperref}{%
755 \long\def\Hy@setouterhbox#1#2{%
756 \setouterhbox{#1}#2\endsetouterhbox
757 }%
758 }
759 % \end{macrocode}
760 % \end{macro}
761 % \begin{macrocode}
762 \ProcessOptions\relax
763 % \end{macrocode}
764 %
765 % \begin{macrocode}
766 \setouterhboxAtEnd%
767 %</package>
768 % \end{macrocode}
769 %% \section{Installation}
770 %
771 % \subsection{Download}
772 %
773 % \paragraph{Package.} This package is available on
774 % CTAN\footnote{\CTANpkg{setouterhbox}}:
775 % \begin{description}
776 % \item[\CTAN{macros/latex/contrib/oberdiek/setouterhbox.dtx}] The source file.
777 % \item[\CTAN{macros/latex/contrib/oberdiek/setouterhbox.pdf}] Documentation.
778 % \end{description}
779 %
780 %
781 % \paragraph{Bundle.} All the packages of the bundle `oberdiek'
782 % are also available in a TDS compliant ZIP archive. There
783 % the packages are already unpacked and the documentation files
784 % are generated. The files and directories obey the TDS standard.
785 % \begin{description}
786 % \item[\CTANinstall{install/macros/latex/contrib/oberdiek.tds.zip}]
787 % \end{description}
788 % \emph{TDS} refers to the standard ``A Directory Structure
789 % for \TeX\ Files'' (\CTANpkg{tds}). Directories
790 % with \xfile{texmf} in their name are usually organized this way.
791 %
792 % \subsection{Bundle installation}
793 %
794 % \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the
795 % TDS tree (also known as \xfile{texmf} tree) of your choice.
796 % Example (linux):
797 % \begin{quote}
798 % |unzip oberdiek.tds.zip -d ~/texmf|
799 % \end{quote}
800 %
801 % \subsection{Package installation}
802 %
803 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
804 % \docstrip\ archive. The files are extracted by running the
805 % \xfile{.dtx} through \plainTeX:
806 % \begin{quote}
807 % \verb|tex setouterhbox.dtx|
808 % \end{quote}
809 %
810 % \paragraph{TDS.} Now the different files must be moved into
811 % the different directories in your installation TDS tree
812 % (also known as \xfile{texmf} tree):
813 % \begin{quote}
814 % \def\t{^^A
815 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
816 % setouterhbox.sty & tex/generic/oberdiek/setouterhbox.sty\\
817 % setouterhbox.pdf & doc/latex/oberdiek/setouterhbox.pdf\\
818 % setouterhbox-example.tex & doc/latex/oberdiek/setouterhbox-example.tex\\
819 % setouterhbox.dtx & source/latex/oberdiek/setouterhbox.dtx\\
820 % \end{tabular}^^A
821 % }^^A
822 % \sbox0{\t}^^A
823 % \ifdim\wd0>\linewidth
824 % \begingroup
825 % \advance\linewidth by\leftmargin
826 % \advance\linewidth by\rightmargin
827 % \edef\x{\endgroup
828 % \def\noexpand\lw{\the\linewidth}^^A
829 % }\x
830 % \def\lwbox{^^A
831 % \leavevmode
832 % \hbox to \linewidth{^^A
833 % \kern-\leftmargin\relax
834 % \hss
835 % \usebox0
836 % \hss
837 % \kern-\rightmargin\relax
838 % }^^A
839 % }^^A
840 % \ifdim\wd0>\lw
841 % \sbox0{\small\t}^^A
842 % \ifdim\wd0>\linewidth
843 % \ifdim\wd0>\lw
844 % \sbox0{\footnotesize\t}^^A
845 % \ifdim\wd0>\linewidth
846 % \ifdim\wd0>\lw
847 % \sbox0{\scriptsize\t}^^A
848 % \ifdim\wd0>\linewidth
849 % \ifdim\wd0>\lw
850 % \sbox0{\tiny\t}^^A
851 % \ifdim\wd0>\linewidth
852 % \lwbox
853 % \else
854 % \usebox0
855 % \fi
856 % \else
857 % \lwbox
858 % \fi
859 % \else
860 % \usebox0
861 % \fi
862 % \else
863 % \lwbox
864 % \fi
865 % \else
866 % \usebox0
867 % \fi
868 % \else
869 % \lwbox
870 % \fi
871 % \else
872 % \usebox0
873 % \fi
874 % \else
875 % \lwbox
876 % \fi
877 % \else
878 % \usebox0
879 % \fi
880 % \end{quote}
881 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
882 % TDS installing feature, then some files can already be in the right
883 % place, see the documentation of \docstrip.
884 %
885 % \subsection{Refresh file name databases}
886 %
887 % If your \TeX~distribution
888 % (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh
889 % these. For example, \TeX\,Live\ users run \verb|texhash| or
890 % \verb|mktexlsr|.
891 %
892 % \subsection{Some details for the interested}
893 %
894 % \paragraph{Unpacking with \LaTeX.}
895 % The \xfile{.dtx} chooses its action depending on the format:
896 % \begin{description}
897 % \item[\plainTeX:] Run \docstrip\ and extract the files.
898 % \item[\LaTeX:] Generate the documentation.
899 % \end{description}
900 % If you insist on using \LaTeX\ for \docstrip\ (really,
901 % \docstrip\ does not need \LaTeX), then inform the autodetect routine
902 % about your intention:
903 % \begin{quote}
904 % \verb|latex \let\install=y\input{setouterhbox.dtx}|
905 % \end{quote}
906 % Do not forget to quote the argument according to the demands
907 % of your shell.
908 %
909 % \paragraph{Generating the documentation.}
910 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
911 % the documentation. The process can be configured by the
912 % configuration file \xfile{ltxdoc.cfg}. For instance, put this
913 % line into this file, if you want to have A4 as paper format:
914 % \begin{quote}
915 % \verb|\PassOptionsToClass{a4paper}{article}|
916 % \end{quote}
917 % An example follows how to generate the
918 % documentation with pdf\LaTeX:
919 % \begin{quote}
920 %\begin{verbatim}
921 %pdflatex setouterhbox.dtx
922 %makeindex -s gind.ist setouterhbox.idx
923 %pdflatex setouterhbox.dtx
924 %makeindex -s gind.ist setouterhbox.idx
925 %pdflatex setouterhbox.dtx
926 %\end{verbatim}
927 % \end{quote}
928 %
929 % \begin{thebibliography}{9}
930 %
931 % \bibitem{newsstart}
932 % Damian Menscher, \Newsgroup{comp.text.tex},
933 % \textit{overlong lines in List of Figures},
934 % \nolinkurl{<[email protected]>},
935 % 23rd September 2005.
936 % \url{https://groups.google.com/group/comp.text.tex/msg/79648d4cf1f8bc13}
937 %
938 % \bibitem{kastrup}
939 % David Kastrup, \Newsgroup{comp.text.tex},
940 % \textit{Re: ANN: outerhbox.sty -- collect horizontal material,
941 % for unboxing into a paragraph},
942 % \nolinkurl{<[email protected]>},
943 % 7th October 2005.
944 % \url{https://groups.google.com/group/comp.text.tex/msg/7cf0a345ef932e52}
945 %
946 % \bibitem{downes}
947 % Michael Downes, \textit{Line breaking in \cs{unhbox}ed Text},
948 % TUGboat 11 (1990), pp. 605--612.
949 %
950 % \bibitem{hyperref}
951 % Sebastian Rahtz, Heiko Oberdiek:
952 % \textit{The \xpackage{hyperref} package};
953 % 2006/08/16 v6.75c;
954 % \CTANpkg{hyperref}.
955 %
956 % \end{thebibliography}
957 %
958 % \begin{History}
959 % \begin{Version}{2005/10/05 v1.0}
960 % \item
961 % First version.
962 % \end{Version}
963 % \begin{Version}{2005/10/07 v1.1}
964 % \item
965 % Option \xoption{hyperref} added.
966 % \end{Version}
967 % \begin{Version}{2005/10/18 v1.2}
968 % \item
969 % Support for explicit line breaks added.
970 % \end{Version}
971 % \begin{Version}{2006/02/12 v1.3}
972 % \item
973 % DTX format.
974 % \item
975 % Documentation extended.
976 % \end{Version}
977 % \begin{Version}{2006/08/26 v1.4}
978 % \item
979 % Date of hyperref updated.
980 % \end{Version}
981 % \begin{Version}{2007/04/26 v1.5}
982 % \item
983 % Use of package \xpackage{infwarerr}.
984 % \end{Version}
985 % \begin{Version}{2007/05/17 v1.6}
986 % \item
987 % Standard header part for generic files.
988 % \end{Version}
989 % \begin{Version}{2007/09/09 v1.7}
990 % \item
991 % Catcode section added.
992 % \end{Version}
993 % \begin{Version}{2016/05/16 v1.8}
994 % \item
995 % Documentation updates.
996 % \end{Version}
997 % \end{History}
998 %
999 % \PrintIndex
1000 %
1001 % \Finale
1002 \endinput