| 1 |
% Copyright 1994 Michael John Downes |
| 2 |
% Copyright 2013 TeX Users Group |
| 3 |
% This file is part of the dialogl package, released under the LPPL; |
| 4 |
% see dialogl.ins for details. |
| 5 |
% |
| 6 |
% Customizations for the articles/documentation codialog.tex, |
| 7 |
% dia-driv.tex, lis-driv.tex. |
| 8 |
% |
| 9 |
% Here is the main problem. I want to allow users to print out this |
| 10 |
% document on US letter-size paper (8.5x11 inches) or on A4 paper |
| 11 |
% (210x297 mm). And in order to fit maximum text on minimum paper |
| 12 |
% (save the trees) I want to print with small margins and |
| 13 |
% two-column layout (or even three-column, in the case of landscape |
| 14 |
% printing, if that were feasible; but I don't want to assume that |
| 15 |
% the user has Frank's multicol package). But the verbatim examples |
| 16 |
% in the document consist in many cases of lines from TeX screen |
| 17 |
% output, which can be up to 79 characters in length. It is |
| 18 |
% difficult to give two columns wide enough to accommodate |
| 19 |
% 80-character lines printed in cmtt unless the size is cut down |
| 20 |
% very small. Then we encounter the difficulty that the |
| 21 |
% lowest-common-denominator set of TeX fonts includes cmtt10, |
| 22 |
% cmtt9, cmtt8, but not cmtt7 or any smaller sizes of cmtt. Well, |
| 23 |
% perhaps that's just as well since things start to get a little |
| 24 |
% hard to read anyway once you get down that small. |
| 25 |
% |
| 26 |
% But anyway there it is: How to fit two columns of text, each of |
| 27 |
% minimum width approximately 80 cmtt characters, into the |
| 28 |
% rectangles provided by US letter paper and A4 paper, while trying |
| 29 |
% to keep a decent line length for readability in the neighborhood |
| 30 |
% of two or three alphabets. |
| 31 |
% |
| 32 |
% It seems that one part of the answer is to print the 80-character |
| 33 |
% verbatim lines in a smaller point size than the main text. |
| 34 |
|
| 35 |
% 8.5in = 614.295pt. |
| 36 |
% 11in = 794.96999pt. |
| 37 |
% 210mm = 597.50787pt. |
| 38 |
% 297mm = 845.04684pt. |
| 39 |
|
| 40 |
% 80 characters, cmtt10: 419.99634pt. |
| 41 |
% 80 characters, cmtt8: 340.00488pt. |
| 42 |
% 76 characters, cmtt8: 323.00464pt. |
| 43 |
% 70 characters, cmtt8: 297.50427pt. |
| 44 |
|
| 45 |
% Assume that minimum margins all around are 22pt, approx 8mm / |
| 46 |
% 0.3in. And that desired gutter margin between columns is 6pt. |
| 47 |
% Then subtract 50pt from paper width and divide by 2 to get |
| 48 |
% available column width: 210mm 274pt, 8.5in 282pt, 11in 372pt, |
| 49 |
% 297mm 397pt. |
| 50 |
% |
| 51 |
% Standard \headheight, \headsep are 12pt, 25pt. So next we look for |
| 52 |
% minimum bounding rectangle for landscape, two-column printing: |
| 53 |
% textheight limited by A4 short dimension = 210mm = 598pt. |
| 54 |
% Subtract 44pt for margins, then another 37pt for running head, |
| 55 |
% that leaves textheight of 517pt. |
| 56 |
% |
| 57 |
% Similarly for textwidth: Limited by the 11in long dimension of US |
| 58 |
% letter size paper; subtract 50pt for margins and gutter, that |
| 59 |
% leaves 745pt, or 372pt per column. |
| 60 |
|
| 61 |
\newcommand{\notthatsloppy}{\tolerance9999 \pretolerance3333 |
| 62 |
\hbadness\tolerance |
| 63 |
% The tolerance settings will eliminate most hyphenation unless we |
| 64 |
% ameliorate the hyphen penalties. |
| 65 |
\hyphenpenalty-100 \exhyphenpenalty-150 |
| 66 |
\emergencystretch 3pc } |
| 67 |
|
| 68 |
% But then we'd better patch \raggedright up a litt.e |
| 69 |
\toks@\expandafter{\raggedright \hyphenpenalty100 \exhyphenpenalty150 } |
| 70 |
\edef\raggedright{\the\toks@} |
| 71 |
|
| 72 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 73 |
\pagestyle{headings} |
| 74 |
\let\sectionmark\@gobble |
| 75 |
\def\@oddhead{\hfil{\small\rhtitle}\hfil\thepage} |
| 76 |
\let\@evenhead\@oddhead |
| 77 |
\def\title#1{\gdef\@title{#1}\uppercase{\gdef\rhtitle{#1}}} |
| 78 |
|
| 79 |
% Default layout is twocolumn, landscape, squeeze inside A4/US |
| 80 |
% constraints |
| 81 |
\def\defaultlayout{% |
| 82 |
% \hoffset and \voffset are assumed to be -1in (see below) |
| 83 |
% 210mm is A4 width, 11in is US-letter paper height |
| 84 |
\textwidth11in \textheight210mm |
| 85 |
\oddsidemargin30pt \evensidemargin\oddsidemargin |
| 86 |
\advance\textwidth -2\oddsidemargin |
| 87 |
\topmargin25pt |
| 88 |
\advance\textheight-2\topmargin |
| 89 |
\advance\textheight-\headheight \advance\textheight -\headsep |
| 90 |
\let\Huge\large \let\huge\large \let\LARGE\large \let\Large\large |
| 91 |
% \scaleup \normalsize |
| 92 |
\@twocolumntrue |
| 93 |
} |
| 94 |
|
| 95 |
% Twocolumn, portrait, squeeze inside A4/US |
| 96 |
% constraints |
| 97 |
\def\portraitlayout{% |
| 98 |
% \hoffset and \voffset are assumed to be -1in (see below) |
| 99 |
% 210mm is A4 width, 11in is US-letter paper height |
| 100 |
\textheight11in \textwidth210mm |
| 101 |
\oddsidemargin30pt \evensidemargin\oddsidemargin |
| 102 |
\advance\textwidth -2\oddsidemargin |
| 103 |
\topmargin25pt |
| 104 |
\advance\textheight-2\topmargin |
| 105 |
\advance\textheight-\headheight \advance\textheight -\headsep |
| 106 |
\let\Huge\large \let\huge\large \let\LARGE\large \let\Large\large |
| 107 |
% \scaleup \normalsize |
| 108 |
\@twocolumntrue |
| 109 |
\def\vffont{\footnotesize\tt}% |
| 110 |
\def\verbatimfont{\small\tt}% |
| 111 |
} |
| 112 |
|
| 113 |
% If the multicol package is loaded (via the doc package) we want to |
| 114 |
% use that instead of the standard twocolumn option. |
| 115 |
\def\multicoldefaultlayout{\defaultlayout\@twocolumnfalse} |
| 116 |
\def\multicolportraitlayout{\portraitlayout\@twocolumnfalse} |
| 117 |
|
| 118 |
% Cancel the margins normally supplied by DVI drivers: |
| 119 |
\hoffset-1in \voffset-1in |
| 120 |
|
| 121 |
% Set \hfuzz higher than normal in preference to dealing with |
| 122 |
% insoluble hyphenation/line-breaking problems. |
| 123 |
\hfuzz20pt |
| 124 |
|
| 125 |
% Set sloppiness of paragraphs very high because of the narrow |
| 126 |
% column width and the frequency of difficult to break terms, but |
| 127 |
% not so carelessly high as LaTeX's \sloppy command would give. |
| 128 |
\notthatsloppy |
| 129 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 130 |
|
| 131 |
\def\scaleup{% |
| 132 |
\let\tiny\scriptsize \let\scriptsize\footnotesize |
| 133 |
\let\footnotesize\small \let\small\normalsize |
| 134 |
\let\normalsize\large \let\large\Large |
| 135 |
} |
| 136 |
|
| 137 |
\def\scaledown{% |
| 138 |
\let\Huge\large \let\huge\large |
| 139 |
\let\LARGE\large \let\Large\normalsize |
| 140 |
\let\large\normalsize \let\normalsize\small |
| 141 |
\let\small\footnotesize \let\footnotesize\scriptsize |
| 142 |
\let\scriptsize\tiny |
| 143 |
} |
| 144 |
% |
| 145 |
% Add protection built-in for \TeX and others |
| 146 |
\newcommand{\ams}{{\the\textfont2 A\kern-.1667em% |
| 147 |
\lower.5ex\hbox{M}\kern-.125emS\kern.05em}} |
| 148 |
\def\tex/{\protect\TeX\@} |
| 149 |
\def\amstex/{\protect\ams-\tex/} |
| 150 |
\def\latex/{\protect\LaTeX\@} |
| 151 |
\def\plaintex/{{\sc plain}\thinspace\tex/} |
| 152 |
\def\eplain/{{\sc Eplain}} |
| 153 |
\def\texbook/{{\it The \tex/book}} |
| 154 |
\def\tugboat/{{\it TUGboat}} |
| 155 |
\def\return/{{\sc return}} |
| 156 |
\def\mf/{{\sf METAFONT\@}} |
| 157 |
\def\mfbook/{{\it The \mf/book}} |
| 158 |
\def\ascii/{{\sc ascii}} |
| 159 |
|
| 160 |
\newcommand{\ndash}{--} |
| 161 |
\newcommand{\mdash}{---} |
| 162 |
\newcommand{\btext}{\mbox} |
| 163 |
|
| 164 |
\newcommand{\5}{\penalty500 } |
| 165 |
\newcommand{\underscore}{{\ntt\string _}} |
| 166 |
|
| 167 |
% Define some ltugboat.sty commands |
| 168 |
\let\Dash\mdash |
| 169 |
\let\dash\ndash |
| 170 |
\def\TB{\texbook/} |
| 171 |
\def\TUB{{\sl TUGboat\/}} |
| 172 |
\def\TeXhax{{\ntt TeXhax}} |
| 173 |
|
| 174 |
\@ifundefined{selectfont}{% |
| 175 |
\def\normalfont{}% |
| 176 |
}{% |
| 177 |
\@ifundefined{default@family}{% |
| 178 |
\@ifundefined{normalfont}{% |
| 179 |
\def\normalfont{}% ?? don't think this case can ever happen. |
| 180 |
}{}% |
| 181 |
}{% |
| 182 |
\def\normalfont{\fontfamily\default@family |
| 183 |
\fontseries\default@series \fontshape\default@shape \selectfont}% |
| 184 |
}% |
| 185 |
} |
| 186 |
|
| 187 |
% Maybe I should now change instances of \normalshape to \upshape. |
| 188 |
% But this is what was used before. |
| 189 |
\@ifundefined{normalshape}{% |
| 190 |
\@ifundefined{upshape}{% |
| 191 |
\newcommand{\normalshape}{\rm}% |
| 192 |
}{% |
| 193 |
\newcommand{\normalshape}{\upshape}% |
| 194 |
}% |
| 195 |
}{} |
| 196 |
|
| 197 |
\def\ntt{\protect\normalfont\protect\tt} |
| 198 |
|
| 199 |
% Function called at the beginning of \cw etc. to allow line |
| 200 |
% breaks if several such objects occur contiguously. |
| 201 |
\newcommand{\prebreak}{\leavevmode\ifmmode\hbox\else |
| 202 |
\ifdim\lastskip=\z@\penalty9999 \fi\fi} |
| 203 |
|
| 204 |
% The \ifhmode test here is primarily to guard against math mode, |
| 205 |
% where an attempt to set \spacefactor would cause a TeX error. |
| 206 |
\newcommand{\postx}{\ifhmode\@\fi} |
| 207 |
|
| 208 |
% Control word |
| 209 |
\newcommand{\cw}[1]{\protect\prebreak{\ntt\bslash#1\protect\postx}} |
| 210 |
% Control symbol |
| 211 |
\newcommand{\cs}[1]{\protect\prebreak{\ntt\string#1}\protect\postx} |
| 212 |
\chardef\bslash=`\\ |
| 213 |
|
| 214 |
% Quoted character |
| 215 |
\newcommand{\qc}[1]{% |
| 216 |
\protect\prebreak{\ntt\escapechar-1 \string#1}\protect\postx} |
| 217 |
% Control character |
| 218 |
\newcommand{\ctrl}[1]{% |
| 219 |
\protect\prebreak{\ntt\string ^\string ^#1}\protect\postx} |
| 220 |
% Argument marker. Apply \string to #1 just in case it might be # |
| 221 |
% instead of a number 1--9. |
| 222 |
\renewcommand{\arg}[1]{% |
| 223 |
\protect\prebreak{\ntt\string ##\string#1}\protect\postx} |
| 224 |
\let\qarg\arg |
| 225 |
% File name. |
| 226 |
\newcommand{\fn}[1]{\leavevmode{\ntt#1}\protect\postx} |
| 227 |
\let\pkg\fn |
| 228 |
% Verbatim version of \ldots. |
| 229 |
\newcommand\verbdots{\leavevmode{\ntt...}\protect\postx} |
| 230 |
|
| 231 |
\newcommand{\units}[1]{\thinspace#1} |
| 232 |
|
| 233 |
% For `meta' angle bracket notation. |
| 234 |
\newcommand\m[1]{{\protect\the\textfont2 h{\it#1}i}} |
| 235 |
% For definitions of terminology. |
| 236 |
\newcommand{\term}[1]{\leavevmode{\it#1}} |
| 237 |
|
| 238 |
\def\eg.{e.g.\@} |
| 239 |
\def\ie.{i.e.\@} |
| 240 |
|
| 241 |
%\def\mjd#1{\errhelp{#1}\errmessage{\the\errhelp}} |
| 242 |
\def\mjd#1{} |
| 243 |
|
| 244 |
% ^^V at the beginning of a line serves as a substitute for |
| 245 |
% \begin{verbatim} ... \end{verbatim} in this documentation. Partly |
| 246 |
% done as an exercise to see if it was feasible; originally |
| 247 |
% motivated by the way I had converted comments in non-doc form to |
| 248 |
% doc form. |
| 249 |
\catcode`\^^V\active % for verbatim |
| 250 |
\def ^^V{\Vbtm} |
| 251 |
|
| 252 |
\def\activedef#1{\catcode`#1\active |
| 253 |
\begingroup\lccode`\~=`#1\lowercase{\endgroup \def ~}} |
| 254 |
|
| 255 |
\def\Vbtmsetup{\let\do\@makeother |
| 256 |
% Abandon \dospecials since it's too hard to make sure that it |
| 257 |
% includes things like @, |, +. |
| 258 |
\do\`\do\~\do\!\do\@\do\#\do\$\do\%\do\^\do\&\do\*\do\(\do\)\do\-% |
| 259 |
\do\_\do\=\do +\do\\\do\|\do\[\do\{\do\]\do\}\do\;\do\:\do\'\do\"% |
| 260 |
\do\,\do\<\do\.\do\>\do\/\do\?\do\ \do\^^M\do\^^I\do\^^J\do\^^L% |
| 261 |
\activedef\ {\kern.5em}% |
| 262 |
\activedef\'{\char`\'\kern\z@}% |
| 263 |
\Vbtmfont \frenchspacing |
| 264 |
} |
| 265 |
% |
| 266 |
\def\Vbtm{\par |
| 267 |
\begingroup \Vbtmsetup |
| 268 |
\activedef\^^M{\catcode`\%9 \catcode`\^7 |
| 269 |
\futurelet\next\moreVbtm}% |
| 270 |
\def\VbtmVbtm{\Vbtm}% for comparison with active ^^V. |
| 271 |
\def\moreVbtm{% |
| 272 |
\ifx\next \VbtmVbtm |
| 273 |
\def\next{\egroup\penalty9999 }% |
| 274 |
\else |
| 275 |
\def\next{\egroup\endgroup \futurelet\next\endVbtm}% |
| 276 |
\fi \next}% |
| 277 |
% Locally change \Vbtm to omit the above setup and just process a |
| 278 |
% single line. |
| 279 |
\def\Vbtm{\hbox\bgroup}% |
| 280 |
\Vbtmspace \Vbtmextra \Vbtm} |
| 281 |
% |
| 282 |
\def\endVbtm{% |
| 283 |
\begingroup |
| 284 |
% If the next token is a \par token, gobble it with \let. |
| 285 |
\ifx\next\par \aftergroup\let \aftergroup\next \fi |
| 286 |
\Vbtmspace \everypar{}\parskip0pt \noindent\endgroup |
| 287 |
}% |
| 288 |
|
| 289 |
\def\Vbtmfont{\verbatimfont} |
| 290 |
% |
| 291 |
\def\Vbtmspace{\medskip} |
| 292 |
\def\Vbtmextra{} |
| 293 |
% |
| 294 |
% Define a `usage' environment to draw a box around its contents, |
| 295 |
% for examples illustrating the usage of salient functions. |
| 296 |
\def\usage{\par \begingroup \Vbtmsetup \normalsize\tt |
| 297 |
% Requires definition of \meta from doc.sty: |
| 298 |
\activedef\<##1>{\meta{##1}}% |
| 299 |
\activedef\^^M{\catcode`\%9\catcode`\\\z@ \catcode`\{11 \catcode`\}11 |
| 300 |
\futurelet\next\moreusage}% |
| 301 |
\if@inlabel\leavevmode\fi \ifhmode\unskip \par\fi |
| 302 |
\addvspace\medskipamount |
| 303 |
\global\setbox\@ne\vbox\bgroup \everypar{}% |
| 304 |
\bgroup} |
| 305 |
% |
| 306 |
\expandafter\def\expandafter\moreusage\expandafter{% |
| 307 |
\expandafter\ifx\csname end{usage}\endcsname\next |
| 308 |
\egroup\egroup |
| 309 |
\fboxsep1.7pt \noindent\fbox{\box\@ne}% |
| 310 |
\endgroup |
| 311 |
\else |
| 312 |
\egroup |
| 313 |
\hbox\bgroup\expandafter\string |
| 314 |
\fi}% |
| 315 |
% |
| 316 |
\expandafter\def\csname end{usage}\endcsname{\end{usage}} |
| 317 |
\def\endusage{\par\nobreak\vskip\medskipamount |
| 318 |
% Since \endusage is called via \end, which adds an \endgroup, we |
| 319 |
% need to throw these two items beyond the \endgroup in order for |
| 320 |
% their local assignments not to be lost (\if@afterindent, |
| 321 |
% \everypar): |
| 322 |
\aftergroup\@afterindentfalse |
| 323 |
\aftergroup\@afterheading} |
| 324 |
|
| 325 |
\def\verbatimfont{\tt} |
| 326 |
\def\vffont{\small\tt} |
| 327 |
|
| 328 |
% Change verbatim environment to use \verbatimfont. |
| 329 |
|
| 330 |
\def\@verbatim{\trivlist \item[]\if@minipage\else\vskip\parskip\fi |
| 331 |
\leftskip\@totalleftmargin\rightskip\z@ |
| 332 |
\parindent\z@\parfillskip\z@ plus\columnwidth minus\columnwidth |
| 333 |
\parskip\z@skip |
| 334 |
\@@par |
| 335 |
\@tempswafalse \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par |
| 336 |
\penalty\interlinepenalty}% |
| 337 |
\obeylines |
| 338 |
\linepenalty\@M |
| 339 |
\verbatimfont \normalbaselineskip1.1em\relax \normalbaselines |
| 340 |
\catcode``=13 \@noligs \let\do\@makeother \dospecials} |
| 341 |
|
| 342 |
% Define a verbatim input command for printing example files. |
| 343 |
\def\verbatiminput#1{\begingroup |
| 344 |
\@verbatim \frenchspacing\@vobeyspaces |
| 345 |
\exhyphenpenalty\@M \hyphenpenalty\@M |
| 346 |
% Turn \hfuzz up high; if some lines in the file are a little long, |
| 347 |
% we don't want to hear about it. |
| 348 |
\hfuzz 5em\relax \vffont |
| 349 |
\input{#1}% |
| 350 |
\endverbatim |
| 351 |
\endgroup} |
| 352 |
|
| 353 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 354 |
% Misc. |
| 355 |
\setcounter{secnumdepth}{2} |
| 356 |
\newcommand{\secref}[1]{\S\ref{#1}} |
| 357 |
\renewcommand{\thetable}{\Alph{table}} |
| 358 |
|
| 359 |
% Change \l@section so we can allow wider room for `Appendix A' in |
| 360 |
% the appendix section of the table of contents. |
| 361 |
\renewcommand{\l@section}[2]{% |
| 362 |
\ifnum\c@tocdepth>\z@ |
| 363 |
\addpenalty{\@secpenalty}\addvspace{1.0emplus\p@}% |
| 364 |
\setlength\@tempdima{\tocsecwd}\begingroup \parindent\z@ |
| 365 |
\rightskip\@pnumwidth \parfillskip-\@pnumwidth \leavevmode \bf |
| 366 |
\advance\leftskip\@tempdima \hskip-\leftskip #1\nobreak \hfil\nobreak |
| 367 |
\hbox to\@pnumwidth{\hss#2}\par \endgroup |
| 368 |
\fi} |
| 369 |
\def\tocsecwd{1.5em} |
| 370 |
|
| 371 |
\toks@\expandafter{\appendix |
| 372 |
\addtocontents{toc}{\protect\changesecwd{6.5em}}} |
| 373 |
\edef\appendix{\the\toks@} |
| 374 |
\def\changesecwd{\gdef\tocsecwd} |
| 375 |
|
| 376 |
\def\resetleftmargin#1{\dimen@\@totalleftmargin |
| 377 |
\linewidth\columnwidth \advance\linewidth-\@totalleftmargin |
| 378 |
\edef\@tempa{\parshape2 \the\dimen@\space \the\linewidth\space}% |
| 379 |
\@totalleftmargin#1\relax |
| 380 |
\linewidth\columnwidth \advance\linewidth-\@totalleftmargin |
| 381 |
\@tempa \@totalleftmargin\linewidth \relax} |
| 382 |
|
| 383 |
% For raggedright parbox in tabular. |
| 384 |
\newcommand{\rp}{\let\PBS\\\raggedright\let\\\PBS} |
| 385 |
|
| 386 |
% \readnumber reads a number into #1, default #2. |
| 387 |
\def\readnumber#1#2{\begingroup |
| 388 |
\def\do##1##2{\catcode\fam=##2 \ifnum\fam<##1 \advance\fam 1 |
| 389 |
\expandafter\do \else\expandafter\@gobbletwo\fi{##1}{##2}}% |
| 390 |
\fam=0 \do{255}{9}\fam=`\0\relax \do{`\9}{12}% |
| 391 |
\global\read-1 to#1\endgroup |
| 392 |
\ifx#1\@empty\gdef#1{#2}\fi |
| 393 |
} |
| 394 |
|
| 395 |
\def\thebibliography#1{% |
| 396 |
\section*{References}% |
| 397 |
\small |
| 398 |
\list{\@biblabel{\arabic{enumiv}}}{% |
| 399 |
\settowidth\labelwidth{\@biblabel{#1}} |
| 400 |
\leftmargin2em |
| 401 |
\usecounter{enumiv}\let\p@enumiv\@empty |
| 402 |
\renewcommand\theenumiv{\arabic{enumiv}}}% |
| 403 |
\sloppy |
| 404 |
\clubpenalty4000\widowpenalty4000\sfcode`\.=\@m} |
| 405 |
|
| 406 |
% \writepage{Example} or \writepage{Table} |
| 407 |
\newcommand{\writepage}[1]{% |
| 408 |
\edef\temp{\write16{#1 \@currentlabel: Page \noexpand\thepage}}% |
| 409 |
\temp |
| 410 |
} |
| 411 |
|
| 412 |
% \reqspace{2in} means start a new page if the current page does not |
| 413 |
% have at least 2in of space available |
| 414 |
\newcommand{\reqspace}[1]{\vskip#1plus.2\textheight |
| 415 |
\penalty0\vskip-#1plus-.2\textheight\penalty0 } |
| 416 |
|
| 417 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 418 |
% Use {example}'s instead of {figure}'s. |
| 419 |
\let\example\figure |
| 420 |
\let\endexample\endfigure |
| 421 |
\expandafter\let\csname example*\expandafter\endcsname |
| 422 |
\csname figure*\endcsname |
| 423 |
\expandafter\let\csname endexample*\expandafter\endcsname |
| 424 |
\csname endfigure*\endcsname |
| 425 |
\@namedef{fnum@figure}{Example \thefigure} |
| 426 |
|
| 427 |
\def\theexample{\thefigure} |
| 428 |
|
| 429 |
\newenvironment{examplebox}% |
| 430 |
{% Can't use LaTeX \framebox because of embedded verbatim; can't |
| 431 |
%% embed this inside definition of \example without too much work. |
| 432 |
\vbox\bgroup\hrule |
| 433 |
\hbox to\hsize\bgroup\vrule \hfil |
| 434 |
\vbox\bgroup\advance\hsize-2em |
| 435 |
}{% |
| 436 |
\endgraf |
| 437 |
\kern3pt\egroup\hfil\vrule\egroup\hrule\egroup % finish off the frame |
| 438 |
} |
| 439 |
|
| 440 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 441 |
% Ordinary \DocInput doesn't handle standardized file headers |
| 442 |
% unless you enclose them in \iffalse ... \fi which I don't care to |
| 443 |
% do. So instead here's an alternate version of \DocInput, called |
| 444 |
% \hDocInput. |
| 445 |
|
| 446 |
\def\hDocInput#1{\MakePercentIgnore |
| 447 |
\begingroup \begingroup \lccode`\~=`\@ |
| 448 |
\lowercase{\endgroup\long\def ~}##1##{% |
| 449 |
\catcode`\==12 \skipfileheader{##1}}% |
| 450 |
\catcode`\@=\active \catcode`\==14 % comment |
| 451 |
\@@input#1 \MakePercentComment} |
| 452 |
|
| 453 |
\def\skipfileheader#1#2 {\endgroup |
| 454 |
\begingroup\catcode`\==9 \catcode`\ =9 \futurelet\0\endgroup |
| 455 |
} |
| 456 |
|
| 457 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 458 |
% Loosen up the float placement restrictions. |
| 459 |
\def\textfraction{0.02} |
| 460 |
\def\bottomfraction{0.98} |
| 461 |
\def\topfraction{0.98} |
| 462 |
\let\dbltopfraction=\topfraction |
| 463 |
\def\floatpagefraction{0.8} |
| 464 |
\let\dblfloatpagefraction=\floatpagefraction |
| 465 |
\setcounter{bottomnumber}{3} |
| 466 |
\setcounter{topnumber}{3} |
| 467 |
\setcounter{dbltopnumber}{3} |
| 468 |
|
| 469 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 470 |
\def\allowtthyphens{% |
| 471 |
{\small\tt\hyphenchar\font=45 \normalsize\tt\hyphenchar\font=45 |
| 472 |
\footnotesize\tt\hyphenchar\font=45 }} |
| 473 |
|
| 474 |
%%\renewcommand{\cw}[1]{\protect\prebreak{\ntt\bslash#1}\protect\postx |
| 475 |
%% \sh{#1}} |
| 476 |
%%% Control symbol |
| 477 |
%%\renewcommand{\cs}[1]{\protect\prebreak{\ntt\string#1}\protect\postx |
| 478 |
%% \sh{#1}} |
| 479 |
%%\renewcommand{\fn}[1]{\leavevmode{\ntt#1}\protect\postx\sh{#1}} |
| 480 |
%%\def\sh{\protect\showhyphens} |
| 481 |
|
| 482 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 483 |
% Fix up catcodes of the upper 128 characters just in case someone |
| 484 |
% has an early release of LaTeX2e. (pre June 1994 patch-level 2) |
| 485 |
\def\do{\catcode\count@\@tempa \advance\count@\@ne |
| 486 |
\ifnum\count@>\@cclv \expandafter\@gobble\fi \do} |
| 487 |
|
| 488 |
\count@=128 \chardef\@tempa=12 \do |
| 489 |
|
| 490 |
\def\mstrip#1->{} |
| 491 |
\def\jobswitch{% |
| 492 |
\def\@tempa{dia-driv}% |
| 493 |
\edef\@tempa{\expandafter\mstrip\meaning\@tempa}% |
| 494 |
\edef\@tempb{\jobname}% |
| 495 |
\ifx\@tempa\@tempb |
| 496 |
\dialogtrue \menustrue \grabhedrtrue |
| 497 |
\alltrue |
| 498 |
\else |
| 499 |
\csname\jobname true\endcsname |
| 500 |
\title{The {\tt\jobname} package}% |
| 501 |
\fi |
| 502 |
} |
| 503 |
|
| 504 |
\newif\ifdialog \newif\ifall \newif\ifmenus \newif\ifgrabhedr |
| 505 |
|
| 506 |
\endinput |
| 507 |
|
| 508 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 509 |
% Some old stuff from codialog.tex |
| 510 |
\typeout{% |
| 511 |
This document offers three printing options:^^J% |
| 512 |
(1) A4 (297 x 210 mm), two columns, landscape orientation,^^J% |
| 513 |
(2) US letter (11 x 8.5 inches), two columns, landscape orientation.^^J% |
| 514 |
(3) US letter (8.5 x 11 inches), one column, portrait orientation.^^J% |
| 515 |
} |
| 516 |
|
| 517 |
% \readnumber is defined in dialogm.sty |
| 518 |
\message{Enter the number for your choice (default 2): } |
| 519 |
\readnumber{\answer}{2} |
| 520 |
|
| 521 |
% \adjustlayout is defined in dialogm.sty |
| 522 |
\ifcase \answer\relax |
| 523 |
\typeout{Defaulting to US letter, landscape ...}% 0 |
| 524 |
\adjustlayout{11in}{8.5in}% |
| 525 |
\or \typeout{OK, using A4 layout ...}% 1 |
| 526 |
\adjustlayout{297mm}{210mm}% |
| 527 |
\or \typeout{OK, using 11x8.5 layout ...}% 2 |
| 528 |
\adjustlayout{11in}{8.5in}% |
| 529 |
\or \typeout{OK, using 8.5x11 layout ...}% 3 |
| 530 |
\adjustlayout{8.5in}{11in}% |
| 531 |
\else % 4,5,... |
| 532 |
\typeout{Defaulting to US letter, landscape ...}% |
| 533 |
\adjustlayout{11in}{8.5in}% |
| 534 |
\fi |
| 535 |
|
| 536 |
% Maybe better to offer the choices USL, USP, A4L, A4P? |