Debian Codegraph @

texmf-dist/source/latex/vwcol/vwcol.dtx

raw
1 % \iffalse
2 %<*internal>
3 \begingroup
4 %</internal>
5 %<*batchfile>
6 \input docstrip.tex
7 \keepsilent
8 \preamble
9 ___________________________________________________________
10
11 Copyright (C) 2008, 2015 Will Robertson
12 <[email protected]>
13
14 Distributable under the LaTeX Project Public License,
15 version 1.3c or higher (your choice). The latest version of
16 this license is at: http://www.latex-project.org/lppl.txt
17
18 This work is "maintained" (as per LPPL maintenance status)
19 by Will Robertson.
20
21 This work consists of the file vwcol.dtx
22 and the derived files vwcol.sty,
23 vwcol.ins, and
24 vwcol.pdf.
25 ___________________________________________________________
26 \endpreamble
27 \postamble
28 \endpostamble
29 \askforoverwritefalse
30 \generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
31 %</batchfile>
32 %<batchfile>\endbatchfile
33 %<*internal>
34 \nopreamble\nopostamble
35 \generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
36 \generate{\file{dtx-style.sty}{\from{\jobname.dtx}{dtx-style}}}
37 \endgroup
38 \immediate\write18{mv README.txt README}
39 \immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx}
40 \immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo}
41 %</internal>
42 %
43 %<*driver>
44 \documentclass{ltxdoc}
45 \EnableCrossrefs
46 \CodelineIndex
47 \RecordChanges
48 %\OnlyDescription
49 \usepackage{dtx-style}
50 \begin{document}
51 \DocInput{\jobname.dtx}
52 \end{document}
53 %</driver>
54 %
55 %
56 % \fi
57 %
58 % \GetFileInfo{\jobname.sty}
59 % \CheckSum{0}
60 % \makeatletter
61 %
62 % \title{The \pkg{vwcol} package}
63 % \author{Will Robertson}
64 % \date{\filedate \qquad \fileversion}
65 %
66 % \maketitle
67 %
68 % \section{Introduction}\seclabel{intro}
69 %
70 % This package provides an environment that allows paragraph text to be typeset into multiple columns of uneven width, with text that flows from one column to the next. The columns can not span over multiple pages.
71 %
72 % Due to difficulties with the processing of such a thing, little else \emph{besides} text is allowed within (feel free to experiment, but you're on your own). Here's an example:\footnote{Requires the \pkg{lipsum} package to print the sample text.}
73 % \begin{example}{firstline=2}
74 % \tiny
75 % \begin{vwcol}[widths={0.3,0.2,0.5}]
76 % \lipsum[1]
77 % \end{vwcol}
78 % \end{example}
79 %
80 % \section{Options}
81 %
82 % As shown above, at heart this package is quite simple. This section discusses the options that can be passed to the |vwcol| environment. The options are:
83 % \begin{description}[noitemsep,font=\ttfamily,leftmargin=6em,style=nextline]
84 % \item [widths] The number and size of the columns.
85 % \item [sep] The width of the space between the columns.
86 % \item [sidesep] Whether to add space on the outside of the columns (equiv.\ to the following two options together).
87 % \item [presep] Whether to add space before the columns.
88 % \item [postsep] Whether to add space after the columns.
89 % \item [rule] The width of the rule.
90 % \item [siderule] Whether to draw a rule on the outside of the columns (equiv.\ to the following two options together).
91 % \item [prerule] Whether to draw a rule before the columns.
92 % \item [postrule] Whether to draw a rule after the columns.
93 % \item [rulecolor] The colour of the rule.\footnote{Added in v0.2.}
94 % \item [justify] Paragraph justification within the columns.
95 % \item [indent] Indentation size within the columns (if relevant).
96 % \end{description}
97 % Paragraph options |justify| and |indent| are covered in \secref[vref]{para}, and some advanced options are discussed in \secref[vref]{advanced}.
98 %
99 % \bigskip
100 %
101 % \noindent\DescribeMacro{\vwcolsetup}
102 % This macro may be used to set the default values for the options (described subsequently) of the |vwcol| environment.
103 % \begin{example}{firstline=2}
104 % \tiny
105 % \vwcolsetup{widths={0.3,0.2,0.5},rule=2pt}
106 % \begin{vwcol}
107 % \lipsum[1]
108 % \end{vwcol}
109 % \end{example}
110 %
111 % \noindent\DescribeMacro{widths}
112 % This option must always be present (either as a default value previously set in \cmd\vwcolsetup\ or specified in the environment directly) and consists of any number of comma-separated lengths or ratios. Lengths set the column width to an explicit size, whereas a ratio (as above) sets the column width to a fraction of the available linewidth (leaving some space for some separation between the columns).
113 %
114 % As shown in the example in \secref{intro}, when the width ratios sum to 100\% then the multi-columns will span the entire line width regardless of the chosen separation between the columns. A set of widths may be any combination of ratios and lengths, but the total width should not exceed the linewidth available (a warning will be given if so).
115 %
116 % \bigskip\noindent\DescribeMacro{sep}
117 % The separation between the columns can be chosen as either
118 % a length, a ratio of the linewidth, or the keyword |fill|.
119 % The default is |sep=0.05| (\ie, 5\% of the linewidth).
120 % \begin{example}{firstline=2}
121 % \tiny
122 % \begin{vwcol}[widths={0.35,0.25,0.4},sep=5pt]
123 % \lipsum[1]
124 % \end{vwcol}
125 % \end{example}
126 %
127 % \noindent
128 % The keyword |fill| adds stretchable space between the columns so the multi-columns fill the entire linewidth (without altering the widths of the columns themselves):
129 %
130 % \begin{example}{firstline=2}
131 % \tiny
132 % \begin{vwcol}[widths={2cm,2cm,0.4},sep=fill]
133 % \lipsum[1]
134 % \end{vwcol}
135 % \end{example}
136 %
137 % \noindent
138 % If ratio column widths are used with a variable separation gap,
139 % then the separation gap is considered zero for the total width calculation.
140 % In this example, because the ratios for the column widths sum to 100\% there is no room left over
141 % for a separation gap:
142 % \begin{example}{firstline=2}
143 % \tiny
144 % \begin{vwcol}[widths={0.3,0.2,0.5},sep=fill]
145 % \lipsum[1]
146 % \end{vwcol}
147 % \end{example}
148 %
149 % \bigskip\noindent\DescribeMacro{presep}\DescribeMacro{postsep}\DescribeMacro{sidesep}
150 % These options control whether an extra separation is added before and/or after the multicolumns. |presep| (or |presep=true|) adds space before the columns (and |presep=false| suppresses it); |postsep| adds space after the columns; |sidesep| is a shorthand for activating both at once.
151 % \begin{example}{firstline=2}
152 % \tiny\par
153 % \begin{vwcol}[widths={0.3,0.25,0.4}]
154 % \lipsum[1]
155 % \end{vwcol}
156 %
157 % \setlength\fboxsep{0pt}
158 % \fbox{\begin{vwcol}[widths={0.3,0.25,0.4},sidesep]
159 % \lipsum[1]
160 % \end{vwcol}}
161 % \end{example}
162 %
163 % \bigskip\noindent\DescribeMacro{rule}
164 % The width of the rule is configurable (again, either a length or a ratio of the line width) and does not affect the separation gap. Use |rule=none| or |rule=0pt| to suppress drawing the rule. The default is |rule=0.4pt|.
165 % \begin{example}{firstline=2}
166 % \tiny
167 % \begin{vwcol}[widths={0.35,0.25,0.4}]
168 % \lipsum[1]
169 % \end{vwcol}
170 % \begin{vwcol}[widths={0.35,0.25,0.4},rule=0.02]
171 % \lipsum[1]
172 % \end{vwcol}
173 % \end{example}
174 %
175 % \bigskip\noindent\DescribeMacro{prerule}\DescribeMacro{postrule}\DescribeMacro{siderule}
176 % These options control whether extra vertical rules are added before and/or after the columns. |prerule| places a rule before the columns; |postrule| after them. (Again, |prerule=false| (\etc) turns this feature off.) And |siderule| is a shorthand to activate both. Using these options implicitly activates the relevant |presep| and/or |postsep| options, because you can't have the rule without the gap.
177 % \begin{example}{firstline=2}
178 % \par\tiny
179 % \begin{vwcol}[widths={0.35,0.25,0.4},siderule]
180 % \lipsum[1]
181 % \end{vwcol}
182 % \end{example}
183 %
184 % \bigskip\noindent\DescribeMacro{rulecolor}
185 % The colour of each rule.
186 % Either used a pre-defined name or define your own using \pkg{color} or \pkg{xcolor}.
187 % The \pkg{color} package is loaded by this package.
188 % \begin{example}{firstline=2}
189 % \tiny
190 % \vwcolsetup{widths={0.35,0.25,0.4},siderule,rule=2pt}
191 % \begin{vwcol}[rulecolor=red]
192 % \lipsum[6]
193 % \end{vwcol}
194 % \definecolor{myrulecol}{rgb}{0.1,0.6,0.3}
195 % \begin{vwcol}[rulecolor=myrulecol]
196 % \lipsum[6]
197 % \end{vwcol}
198 % \end{example}
199 %
200 %
201 % \section{Paragraph settings}\seclabel{para}
202 %
203 % \bigskip\noindent\DescribeMacro{justify}
204 % The justification to use; one of |ragged| (\emph{default}), |flush|, |raggedleft|, or |center|. These settings are made using the \pkg{ragged2e} package, with the result that hyphenation is enabled even in the ragged settings (this is a good thing!); due to a limitation of \TeX's \cmd\parshape, \LaTeX's ordinary \cmd\raggedright\ setting cannot be used.
205 % \begin{example}{firstline=2}
206 % \tiny
207 % \begin{vwcol}[widths={0.35,0.25,0.4}]
208 % \lipsum[66]
209 % \end{vwcol}
210 % \begin{vwcol}[widths={0.35,0.25,0.4},justify=flush]
211 % \lipsum[66]
212 % \end{vwcol}
213 % \begin{vwcol}[widths={0.35,0.25,0.4},justify=raggedleft]
214 % \lipsum[66]
215 % \end{vwcol}
216 % \begin{vwcol}[widths={0.35,0.25,0.4},justify=center]
217 % \lipsum[66]
218 % \end{vwcol}
219 % \end{example}
220 %
221 % \bigskip\noindent\DescribeMacro{indent}
222 % This option is used to set the paragraph indent for ragged right and justified paragraph shapes (by default |[indent=1.5em]|).
223 % \begin{example}{firstline=2}
224 % \tiny
225 % \begin{vwcol}[widths={0.35,0.25,0.4},indent=5em]
226 % \lipsum[66]\lipsum[66]
227 % \end{vwcol}
228 % \end{example}
229 % Note that the first column always begins with a \cmd\noindent. Let me know if you don't like this idea.
230 %
231 %
232 % \section{Advanced (read: not very useful) options}
233 % \seclabel{advanced}
234 %
235 % \bigskip\noindent\DescribeMacro{quiet}
236 % The \pkg{vwcol} package passes certain information about what it's doing via errors in compilation, warnings in the console output, and info in the |.log| file. Loading \pkg{vwcol} with the |[quiet]| option `demotes' the priority of these diagnostics: errors become warnings, warnings become info in the |.log| file, and info is suppressed entirely.
237 %
238 % \bigskip\noindent\DescribeMacro{lines}
239 % With the default |[lines=auto]|, the |vwcol| environment tries to
240 % estimate how much space is required but it will
241 % sometimes get it wrong. Pass an integer to the |lines| option to specify
242 % exactly how many
243 % lines to use (which will also save processing time), but if the value chosen
244 % is too small then text will be lost (and an error given):
245 % \begin{example}{firstline=2}
246 % \tiny
247 % \begin{vwcol}[widths={0.35,0.25,0.4},lines=4]
248 % \lipsum[1]
249 % \end{vwcol}
250 % \begin{vwcol}[widths={0.35,0.25,0.4},lines=11]
251 % \lipsum[1]
252 % \end{vwcol}
253 % \end{example}
254 % The rationale behind producing an error is that you really want to be alerted if text in your input is not making it into the output document (\cf\ with trying to insert a character that doesn't exist in the current font).
255 %
256 % \bigskip\noindent\DescribeMacro{maxrecursion}
257 % When the estimate number of
258 % lines is calculated, the value is sometimes too small. |vwcol| will increment
259 % the number of lines one-by-one at most |maxrecursion| times until the text completely fits into the columns. If it hits |maxrecursion|, then an error is reported explaining what's going on.
260 %
261 % The default is |5|, but I'd be surprised if you ever need to adjust this parameter.
262 %
263 % \section{Usage notes}
264 %
265 % If you want the |widths| ratios to use a different width to denote 100\% (instead of \cmd\linewidth), put the whole thing in a |minipage| or \cmd\parbox:
266 % \begin{example}{firstline=2}
267 % \tiny
268 % \begin{minipage}{0.8\linewidth}
269 % \begin{vwcol}[widths={0.3,0.7},indent=1.8em]
270 % \lipsum[66]\lipsum[66]
271 % \end{vwcol}
272 % \end{minipage}
273 % \end{example}
274 % \noindent (I might add an option to |vwcol| to allow this directly; \Eg, |[totalwidth=0.8\linewidth]|. Let me know if you like the idea.)
275 %
276 % The |vwcol| environment ends the previous paragraph at |\begin{vwcol}| and terminates the paragraph it is contained within at |\end{vwcol}|. This means you can't place two |vwcol| environments next to each other, for example (or next to anything else, for that matter). If you want to be able to do this, again, put them in |minipage|s or \cmd\parbox es:
277 % \begin{example}{firstline=2}
278 % \tiny
279 % \rule{0.1\linewidth-\fboxsep}{1ex}%
280 % %
281 % \fbox{\parbox{0.8\linewidth}{%
282 % \begin{vwcol}[widths={0.3,0.7},indent=1.8em]
283 % \lipsum[66]\lipsum[66]
284 % \end{vwcol}}}%
285 % %
286 % \rule{0.1\linewidth-\fboxsep}{1ex}%
287 % \end{example}
288 % \noindent (I might add an option to |vwcol| to allow this directly; \Eg, |[par=false]| or |[block=par]| vs.\ |[block=inline]|. Let me know if you like the idea.)
289 %
290 % Note in both of these cases that the \cmd\parindent\ length had to be redefined after |{minipage}| or \cmd\parbox\ defined it to zero inside themselves.
291 %
292 % \section{Acknowledgements}
293 %
294 % Many thanks to Flavio Costa for testing an early version of this package and especially for proof-reading this documentation. In large part due to him this manual makes much more sense |:)|
295 %
296 % \StopEventually{}
297 %
298 % \clearpage
299 % \part{\pkg{\jobname} implementation}
300 %\iffalse
301 %<*package>
302 %\fi
303 %
304 % \PrintChanges
305 %
306 % This is the package.
307 %
308 % \begin{macrocode}
309 \ProvidesPackage{vwcol}
310 [2015/02/10 v0.2 Variable-width multicolumn text]
311 % \end{macrocode}
312 %
313 % \section{Preamble}
314 %
315 % \subsection{Packages}
316 %
317 % \begin{macrocode}
318 \RequirePackage{calc}
319 \RequirePackage{color}
320 \RequirePackage{environ}[2008/06/18]
321 \RequirePackage{keyval}
322 \RequirePackage{ragged2e}
323 % \end{macrocode}
324 %
325 % \subsection{Things we need}
326 %
327 % \begin{macrocode}
328 \newlength\vwcol@sep
329 \newlength\vwcol@rule
330 \newlength\vwcol@totalwidth
331 \newlength\vwcol@averagewidth
332 \newlength\vwcol@parindent
333 % \end{macrocode}
334 %
335 % \begin{macrocode}
336 \newcount\vwcol@last
337 \newcount\vwcol@Ncols
338 \newcount\vwcol@Nlines
339 \newcount\vwcol@maxrecursion
340 % \end{macrocode}
341 %
342 % \begin{macrocode}
343 \newbox\vwcol@box
344 \newbox\vwcol@plainbox
345 \newbox\vwcol@outputbox
346 % \end{macrocode}
347 %
348 % \begin{macrocode}
349 \newif\if@vwcol@boxready
350 \newif\if@vwcol@prerule
351 \newif\if@vwcol@postrule
352 \newif\if@vwcol@presep
353 \newif\if@vwcol@postsep
354 % \end{macrocode}
355 %
356 % \subsection{Conveniences}
357 %
358 % Start error and warning text on a new line coz I think it looks better that way:
359 % \begin{macrocode}
360 \newcommand\vwcol@PackageError[2]{%
361 \PackageError{vwcol}{^^J\space\space#1}{#2}}
362 % \end{macrocode}
363 %
364 % \begin{macrocode}
365 \newcommand\vwcol@PackageWarning[1]{%
366 \PackageWarning{vwcol}{%
367 ^^J\space\space#1^^JThis warning occurred}}
368 % \end{macrocode}
369 %
370 % \begin{macrocode}
371 \newcommand\vwcol@PackageInfo[1]{%
372 \PackageWarning{vwcol}{%
373 ^^J\space\space#1^^JThis warning occurred}}
374 % \end{macrocode}
375 %
376 % \subsection{Package option}
377 %
378 % \begin{macrocode}
379 \DeclareOption{quiet}{%
380 \renewcommand\vwcol@PackageError[2]{%
381 \vwcol@PackageWarning{#1.}}%
382 \let\vwcol@PackageInfo\@gobble}
383 \ProcessOptions
384 % \end{macrocode}
385 %
386 % \section{Auxiliary macros}
387 %
388 % \begin{macro}{\vwcol@test@length}
389 % \darg{Rational number or length (\ie, with unit)}
390 % \darg{Multiplier for the rational (\eg, \cmd\linewidth)}
391 % This macro returns \cs{@tempswa} true if the input is a rational number (\eg, |0.1|, |1|, \etc) or false if it is a length (\eg, |2pt|, |3cm|). \note{Based on a similar macro by David Kastrup: \url{http://groups.google.com/group/comp.text.tex/msg/9bd5349ea2416c95}} \cs{@tempdima} contains the length corresponding to the rational number multiplier of |#2| or the length input, respectively.
392 % \begin{example}{}
393 % \vwcol@test@length{1}{\linewidth}
394 % \if@tempswa Rational\else Length\fi\\
395 % \vwcol@test@length{1cm}{\linewidth}
396 % \if@tempswa Rational\else Length\fi
397 % \end{example}
398 % \begin{macrocode}
399 \def\vwcol@test@length#1#2{%
400 \afterassignment\vwcol@test@@
401 \@tempdima=#1#2\@nil}
402 % \end{macrocode}
403 % The afterassignment macro:
404 % \begin{macrocode}
405 \def\vwcol@test@@#1\@nil{%
406 \ifx\@nil#1\@nil
407 \@tempswatrue
408 \else
409 \@tempswafalse
410 \fi}
411 % \end{macrocode}
412 % \end{macro}
413 % Actually, I don't use \cs{if@tempswa} in this package (I use \cmd\@tempdima\ directly), but I've left the conditional in there in case someone else finds it useful.
414 %
415 %
416 % \section{Environment options}
417 %
418 % \begin{macro}{\vwcolsetup}
419 % To set the defaults:
420 % \begin{macrocode}
421 \def\vwcolsetup{\setkeys{vwcol}}
422 % \end{macrocode}
423 % \end{macro}
424 %
425 % \paragraph{widths} The number and size of each column.
426 % \begin{macrocode}
427 \define@key{vwcol}{widths}{\def\vwcol@widths{#1}}
428 % \end{macrocode}
429 % No defaults.
430 %
431 % \paragraph{maxrecursion}
432 % Number of iterations used to estimate the number of lines.
433 % I doubt if it will ever need to be changed from the default.
434 % \begin{macrocode}
435 \define@key{vwcol}{maxrecursion}{\vwcol@maxrecursion=#1}
436 % \end{macrocode}
437 % Default:
438 % \begin{macrocode}
439 \vwcolsetup{maxrecursion=5}
440 % \end{macrocode}
441 %
442 % \paragraph{rule}
443 % The width of the intercolumn rule as a length or as a ratio of the total line width or as the keyword |none|.
444 % \begin{macrocode}
445 \define@key{vwcol}{rule}{%
446 \def\@tempa{#1}%
447 \def\@tempb{none}%
448 \ifx\@tempa\@tempb
449 \vwcol@rule=0pt
450 \else
451 \vwcol@test@length{#1}{\linewidth}%
452 \vwcol@rule=\@tempdima
453 \fi}
454 % \end{macrocode}
455 % Default:
456 % \begin{macrocode}
457 \vwcolsetup{rule=0.4pt}
458 % \end{macrocode}
459 %
460 % \paragraph{lines} The number of lines of text in each column or the keyword |auto|.
461 % \begin{macrocode}
462 \define@key{vwcol}{lines}{%
463 \def\@tempa{#1}%
464 \def\@tempb{auto}%
465 \ifx\@tempa\@tempb
466 \vwcol@Nlines=0
467 \else
468 \vwcol@Nlines=#1
469 \fi}
470 % \end{macrocode}
471 % Default:
472 % \begin{macrocode}
473 \vwcolsetup{lines=auto}
474 % \end{macrocode}
475 %
476 % \paragraph{sep} The distance between each column (including space taken up by the rule, if any) as a length or as a ratio or as the keyword |fill|.
477 % \begin{macrocode}
478 \define@key{vwcol}{sep}{%
479 \def\@tempa{#1}%
480 \def\@tempb{fill}%
481 \ifx\@tempa\@tempb
482 \vwcol@sep=1sp
483 \else
484 \vwcol@test@length{#1}{\linewidth}%
485 \vwcol@sep=\@tempdima
486 \fi}
487 % \end{macrocode}
488 % Default:
489 % \begin{macrocode}
490 \vwcolsetup{sep=0.05}
491 % \end{macrocode}
492 %
493 % \paragraph{presep}
494 % Whether to include a gap before the first column.
495 % \begin{macrocode}
496 \define@key{vwcol}{presep}[true]{%
497 \def\@tempa{#1}%
498 \def\@tempb{true}%
499 \ifx\@tempa\@tempb
500 \@vwcol@preseptrue
501 \else
502 \def\@tempb{false}%
503 \ifx\@tempa\@tempb
504 \@vwcol@presepfalse
505 \else
506 \vwcol@PackageWarning{%
507 '#1' not a valid option for option 'presep';
508 'true' or 'false' only.}%
509 \fi
510 \fi}
511 % \end{macrocode}
512 % Default:
513 % \begin{macrocode}
514 \vwcolsetup{presep=false}
515 % \end{macrocode}
516
517 %
518 % \paragraph{postsep}
519 % Whether to include a gap after the last column.
520 % \begin{macrocode}
521 \define@key{vwcol}{postsep}[true]{%
522 \def\@tempa{#1}%
523 \def\@tempb{true}%
524 \ifx\@tempa\@tempb
525 \@vwcol@postseptrue
526 \else
527 \def\@tempb{false}%
528 \ifx\@tempa\@tempb
529 \@vwcol@postsepfalse
530 \else
531 \vwcol@PackageWarning{%
532 '#1' not a valid option for option 'postsep';
533 'true' or 'false' only.}%
534 \fi
535 \fi}
536 % \end{macrocode}
537 % Default:
538 % \begin{macrocode}
539 \vwcolsetup{postsep=false}
540 % \end{macrocode}
541 %
542 % \paragraph{sidesep}
543 % Shorthand for setting both |presep| and |postsep| at once.
544 % \begin{macrocode}
545 \define@key{vwcol}{sidesep}[true]{%
546 \def\@tempa{#1}%
547 \def\@tempb{true}%
548 \ifx\@tempa\@tempb
549 \@vwcol@preseptrue
550 \@vwcol@postseptrue
551 \else
552 \def\@tempb{false}%
553 \ifx\@tempa\@tempb
554 \@vwcol@presepfalse
555 \@vwcol@postsepfalse
556 \else
557 \vwcol@PackageWarning{%
558 '#1' not a valid option for option 'sidesep';
559 'true' or 'false' only.}%
560 \fi
561 \fi}
562 % \end{macrocode}
563 %
564 % \paragraph{prerule}
565 % Whether to place a rule before the first column (implies |presep|).
566 % \begin{macrocode}
567 \define@key{vwcol}{prerule}[true]{%
568 \def\@tempa{#1}%
569 \def\@tempb{true}%
570 \ifx\@tempa\@tempb
571 \@vwcol@preseptrue
572 \@vwcol@preruletrue
573 \else
574 \def\@tempb{false}%
575 \ifx\@tempa\@tempb
576 \@vwcol@prerulefalse
577 \else
578 \vwcol@PackageWarning{%
579 '#1' not a valid option for option 'prerule';
580 'true' or 'false' only.}%
581 \fi
582 \fi}
583 % \end{macrocode}
584 % Default:
585 % \begin{macrocode}
586 \vwcolsetup{prerule=false}
587 % \end{macrocode}
588 %
589 % \paragraph{postrule}
590 % Whether to place a rule after the last column (implies |postsep|).
591 % \begin{macrocode}
592 \define@key{vwcol}{postrule}[true]{%
593 \def\@tempa{#1}%
594 \def\@tempb{true}%
595 \ifx\@tempa\@tempb
596 \@vwcol@postseptrue
597 \@vwcol@postruletrue
598 \else
599 \def\@tempb{false}%
600 \ifx\@tempa\@tempb
601 \@vwcol@postrulefalse
602 \else
603 \vwcol@PackageWarning{%
604 '#1' not a valid option for option 'postrule';
605 'true' or 'false' only.}%
606 \fi
607 \fi}
608 % \end{macrocode}
609 % Default:
610 % \begin{macrocode}
611 \vwcolsetup{postrule=false}
612 % \end{macrocode}
613 %
614 % \paragraph{siderule}
615 % Shorthand for setting |prerule| and |postrule| simultaneously.
616 % \begin{macrocode}
617 \define@key{vwcol}{siderule}[true]{%
618 \def\@tempa{#1}%
619 \def\@tempb{true}%
620 \ifx\@tempa\@tempb
621 \@vwcol@preseptrue
622 \@vwcol@postseptrue
623 \@vwcol@preruletrue
624 \@vwcol@postruletrue
625 \else
626 \def\@tempb{false}%
627 \ifx\@tempa\@tempb
628 \@vwcol@prerulefalse
629 \@vwcol@postrulefalse
630 \else
631 \vwcol@PackageWarning{%
632 '#1' not a valid option for option 'siderule';
633 'true' or 'false' only.}%
634 \fi
635 \fi}
636 % \end{macrocode}
637 %
638 % \paragraph{justify}
639 % The justification to use; one of |flush|/|ragged|/|raggedleft|/|center|.
640 % \begin{macrocode}
641 \define@key{vwcol}{justify}{%
642 \def\@tempa{#1}%
643 \def\@tempb{ragged}%
644 \ifx\@tempa\@tempb
645 \let\vwcol@justify\RaggedRight
646 \else
647 \def\@tempb{flush}%
648 \ifx\@tempa\@tempb
649 \let\vwcol@justify\justifying
650 \else
651 \def\@tempb{raggedleft}%
652 \ifx\@tempa\@tempb
653 \let\vwcol@justify\RaggedLeft
654 \else
655 \def\@tempb{center}%
656 \ifx\@tempa\@tempb
657 \let\vwcol@justify\Centering
658 \else
659 \vwcol@PackageWarning{%
660 '#1' not a valid option for option 'justify';
661 one of 'flush'/'ragged'/'raggedleft'/'center' only.}%
662 \fi
663 \fi
664 \fi
665 \fi}
666 % \end{macrocode}
667 % Default:
668 % \begin{macrocode}
669 \vwcolsetup{justify=ragged}
670 % \end{macrocode}
671 %
672 % \paragraph{indent}
673 % The paragraph indent to use with |flush| or |ragged| justification.
674 % \begin{macrocode}
675 \define@key{vwcol}{indent}{\setlength\vwcol@parindent{#1}}
676 % \end{macrocode}
677 % Default:
678 % \begin{macrocode}
679 \vwcolsetup{indent=1.5em}
680 % \end{macrocode}
681 %
682 % \paragraph{rulecolor} The colour of each rule.
683 % \begin{macrocode}
684 \define@key{vwcol}{rulecolor}{\def\vwcol@rulecol{#1}}
685 \vwcolsetup{rulecolor=black}
686 % \end{macrocode}
687 % No defaults.
688 %
689 % \section{\texttt{vwcol} environment definition}
690 %
691 % \begin{environment}{vwcol}
692 % Always start a new par.
693 % \begin{macrocode}
694 \NewEnviron{vwcol}[1][]{%
695 \par\noindent
696 % \end{macrocode}
697 % Initialisation:
698 % \begin{macrocode}
699 \@vwcol@boxreadyfalse
700 \vwcolsetup{#1}%
701 % \end{macrocode}
702 % Ensure the space at the top of each column is uniform:
703 % \begin{macrocode}
704 \splittopskip=\ht\strutbox
705 % \end{macrocode}
706 % Setup widths (this counts the columns and calculates the average and total widths of the columns):
707 % \begin{macrocode}
708 \expandafter\vwcol@process@widths\expandafter{\vwcol@widths}%
709 % \end{macrocode}
710 % Set up the paragraph parameters:
711 % \begin{macrocode}
712 \vwcol@para@setup
713 % \end{macrocode}
714 % From the width of the columns, the total width of the environment can be calculated. First, if |sep=fill| then the whole linewidth will be used:
715 % \begin{macrocode}
716 \ifdim\vwcol@sep=1sp
717 \vwcol@totalwidth=\linewidth
718 % \end{macrocode}
719 % Otherwise calculate the total from the number of separation gaps:\\ (\cmd\vwcol@totalwidth\ is currently the total of the columns widths, which was calculated above in \cmd\vwcol@process@widths)
720 % \begin{macrocode}
721 \else
722 \vwcol@totalwidth=\numexpr
723 \vwcol@totalwidth+(\vwcol@Ncols-1)*\vwcol@sep
724 \relax sp
725 % \end{macrocode}
726 % Add on extra space due to the optional pre- and post-separation gaps and rules. Note that while rules between columns do not contribute to the total width of the columns (they subtract from the empty space in the gaps between the columns, which explains why the correction is needed in the |presep|/|postsep| length processing), pre- or post-rules \emph{do}.
727 % \begin{macrocode}
728 \if@vwcol@presep
729 \advance\vwcol@totalwidth\dimexpr(\vwcol@sep-\vwcol@rule)/2\relax
730 \fi
731 \if@vwcol@postsep
732 \advance\vwcol@totalwidth\dimexpr(\vwcol@sep-\vwcol@rule)/2\relax
733 \fi
734 \if@vwcol@prerule \advance\vwcol@totalwidth \vwcol@rule\fi
735 \if@vwcol@postrule\advance\vwcol@totalwidth \vwcol@rule\fi
736 \fi
737 % \end{macrocode}
738 % Finally, warn the author if their columns are going to be too large:
739 % \begin{macrocode}
740 \ifdim\vwcol@totalwidth > \linewidth
741 \vwcol@PackageWarning{%
742 Total width of columns plus their separations
743 is greater than the linewidth^^J\space\space
744 (by \the\vwcol@totalwidth\space - \the\linewidth\space =
745 \the\dimexpr \vwcol@totalwidth-\linewidth\relax)}%
746 \fi
747 \ifnum\vwcol@Nlines=0%
748 % \end{macrocode}
749 % If the |lines| are not explicitly selected then they must be estimated.
750 % Typeset the text into a single box of the average column width (while ignoring overfull/underfull boxes):
751 % \begin{macrocode}
752 \@tempcnta=\hbadness
753 \hbadness=\maxdimen
754 \setbox\vwcol@plainbox\hbox{%
755 \parbox{\vwcol@averagewidth}{\vwcol@justify\BODY}}%
756 \hbadness=\@tempcnta
757 % \end{macrocode}
758 % Now the estimate of the number of lines per column, $L$, can be calculated.
759 % Start by assuming that the `area' of the material in the single block will be about the same when split into columns of un-equal width, $w_i$.
760 % (By `area' we \emph{actually} mean the number of lines in a block multiplied by the number of lines $N$.)
761 % If $T$ is the total number of lines of the single block typeset above (which is calculated by dividing the height of the block by the baselineskip), this gives
762 % \[ T\times w_a \approx L\times w_1+L\times w_2+\cdots = L\times\sum_{i=1}^N w_i .\]
763 % The width of the single block is defined above to be the average of the column widths:
764 % \[ w_a = \mathrm{ave}(w_i) = \sum_{i=1}^N w_i/N\]
765 % These two expressions are easily combined to give
766 % \[ L = \frac{T\times \mathrm{ave}(w_i)}{\sum_{i=1}^N w_i} = \frac{T}{N} . \]
767 % In words, the number of lines per column is simply to simply the number of lines in the single block divided by the number of columns.
768 % \begin{macrocode}
769 \vwcol@Nlines=\numexpr
770 (\ht\vwcol@plainbox+\dp\vwcol@plainbox)/
771 (\baselineskip*\vwcol@Ncols)
772 \relax
773 % \end{macrocode}
774 % However, differences may arise due to rounding (due to \TeX's integer arithmetic, the floor of the resultant value is always calculated\footnote{I think.}) and hyphenation/justification variations between the two cases.
775 %
776 % Due to these differences, we start with the calculated number of lines and increment in a loop if necessary to ensure all of the material does actually fit. It's unlikely that the number of lines estimated will be \emph{greater} than the number of lines required due to the effect of the `flooring' of the calculations.
777 % \begin{macrocode}
778 \@tempcnta=1%
779 \loop\unless\if@vwcol@boxready
780 \savebox\vwcol@outputbox{%
781 \hbox to \vwcol@totalwidth{\vwcol@{\BODY}}}%
782 \unless\if@vwcol@boxready
783 \advance\@tempcnta 1%
784 \advance\vwcol@Nlines 1%
785 % \end{macrocode}
786 % Here we could keep looping for as long as necessary, but in case of weird input we put a hard limit on the number of iterations. Stop after the line number has been incremented five times (by default) because surely the calculation couldn't have been that far wrong.
787 % \begin{macrocode}
788 \ifnum\@tempcnta>\vwcol@maxrecursion
789 \@vwcol@boxreadytrue
790 \vwcol@PackageError{%
791 The estimated number of lines is greater than
792 \the\vwcol@maxrecursion\space lines too small,%
793 ^^J\space\space
794 so I gave up (last tried maximum value of
795 [lines=\the\vwcol@Nlines])%
796 }{%
797 Text will be truncated in the multicolumns;
798 please select the%
799 ^^J\space\space
800 number of lines explicitly or increase
801 [maxrecursion=\the\vwcol@maxrecursion].%
802 }%
803 \fi
804 \fi
805 \repeat
806 \usebox\vwcol@outputbox
807 % \end{macrocode}
808 % If the |lines| was chosen explicitly then just run with it, giving an error if the lines were too small. I can imagine an |approxlines| option that varies the number of lines over a range of say, 5 lines up and down then chooses the best one, but I can't be bothered implementing that right now.
809 % \begin{macrocode}
810 \else
811 \hbox to \vwcol@totalwidth{\vwcol@{\BODY}}%
812 \unless\if@vwcol@boxready
813 \vwcol@PackageError{%
814 Not enough lines to fit the entire text;
815 some text has been truncated.^^J\space\space
816 Increase [lines=\the\vwcol@Nlines] to fit more%
817 }{%
818 Or remove [lines=\the\vwcol@Nlines] altogether
819 to have 'vwcol' estimate the value.}%
820 \fi
821 \fi\par}
822 % \end{macrocode}
823 % That's it!
824 % \end{environment}
825 %
826 % \begin{macro}{\vwcol@para@setup}
827 % Set up the paragraph options.
828 % \begin{macrocode}
829 \def\vwcol@para@setup{%
830 % \end{macrocode}
831 % Justification:
832 % \begin{macrocode}
833 \vwcol@justify
834 % \end{macrocode}
835 % \cmd\parindent\ override if |justify| is |ragged| or |flush|:
836 % \begin{macrocode}
837 \@tempswafalse
838 \ifx\vwcol@justify\RaggedRight
839 \@tempswatrue
840 \else\ifx\vwcol@justify\justifying
841 \@tempswatrue
842 \fi\fi
843 \if@tempswa
844 \parindent=\vwcol@parindent
845 \else
846 \vwcol@PackageInfo{%
847 'indent' ignored for [justify=raggedleft]
848 or [justify=center]}
849 \fi
850 % \end{macrocode}
851 % The algorithm, unfortunately, doesn't work with non-zero \cmd\parskip:
852 % \begin{macrocode}
853 \parskip=0pt}
854 % \end{macrocode}
855 % \end{macro}
856 %
857 % \begin{macro}{\vwcol@process@widths}
858 % This macros takes the |widths| input and calculates the number of columns and the total and average widths of the columns.
859 % \begin{macrocode}
860 \def\vwcol@process@widths#1{%
861 % \end{macrocode}
862 % Count the number of columns: (this must be done in a loop before the main one so that \cmd\vwcol@Ncols\ is known first)
863 % \begin{macrocode}
864 \@for\@ii:=#1\do{\advance\vwcol@Ncols 1}%
865 % \end{macrocode}
866 % Based on the colsep and rule width, calculate allowable space. For stretchable column gaps, the separation gap counts as zero but the rules still take up some space:
867 % \begin{macrocode}
868 \ifdim\vwcol@sep=1sp
869 \@tempdimb=\numexpr
870 \linewidth-(\vwcol@Ncols-1)*\vwcol@rule
871 \relax sp
872 % \end{macrocode}
873 % And for fixed-width column gaps: (chuck in the warning here about |sep|$\ge$|rule| coz it's convenient)
874 % \begin{macrocode}
875 \else
876 \ifdim\vwcol@rule > \vwcol@sep
877 \vwcol@sep=\vwcol@rule
878 \vwcol@PackageWarning{%
879 'sep' must be greater than or equal to 'rule'}%
880 \fi
881 \@tempdimb=\numexpr
882 \linewidth-(\vwcol@Ncols-1)*\vwcol@sep
883 \relax sp
884 % \end{macrocode}
885 % Remember that the rules do not take up any space of their own between the columns, so they subtract from the white space of the separation gap; this must be mirrored when additional space is included before or after the columns:
886 % \begin{macrocode}
887 \if@vwcol@presep
888 \advance\@tempdimb\dimexpr(-\vwcol@sep+\vwcol@rule)/2\relax
889 \fi
890 \if@vwcol@postsep
891 \advance\@tempdimb\dimexpr(-\vwcol@sep+\vwcol@rule)/2\relax
892 \fi
893 \fi
894 % \end{macrocode}
895 % The prerule and postrule both contribute to the total width, unlike the rules between the columns:
896 % \begin{macrocode}
897 \if@vwcol@prerule\advance\@tempdimb-\vwcol@rule\fi
898 \if@vwcol@postrule\advance\@tempdimb-\vwcol@rule\fi
899 % \end{macrocode}
900 % \cmd\@tempdimb\ now contains the maximum width that the columns can span before the environment is wider the \cmd\linewidth, after the rules and gaps are added in too. Use this as the reference length to calculate the lengths of the columns that have widths specified as ratios.
901 %
902 % Now iterate to do stuff:
903 % \begin{macrocode}
904 \@for\@ii:=#1\do{%
905 % \end{macrocode}
906 % If the column width is a plain rational number (like |0.4|) then set the columnwidth to be that fraction of the allowable width.
907 % \begin{macrocode}
908 \vwcol@test@length\@ii\@tempdimb
909 % \end{macrocode}
910 % Keep a running total of the total width being used:
911 % \begin{macrocode}
912 \advance\vwcol@totalwidth\@tempdima
913 % \end{macrocode}
914 % Save the column widths for later in the \cmd\parshape\ processing:
915 % \begin{macrocode}
916 \expandafter\expandafter\expandafter\def
917 \expandafter\expandafter\expandafter\vwcol@setup@parlines
918 \expandafter\expandafter\expandafter{%
919 \expandafter\vwcol@setup@parlines
920 \expandafter\vwcol@addlines
921 \expandafter{\the\@tempdima}}}%
922 % \end{macrocode}
923 % End the loop. Finally, calculate the average width of the columns:
924 % \begin{macrocode}
925 \vwcol@averagewidth=\dimexpr \vwcol@totalwidth/\vwcol@Ncols \relax}
926 % \end{macrocode}
927 % \end{macro}
928 %
929 % \begin{macro}{\vwcol@setup@parlines}
930 % This is the macro used to locally store the setup for the \cmd\parshape\ line specification: (see a few lines back for the \cmd\expandafter\ fun of getting stuff into it)
931 % \begin{macrocode}
932 \def\vwcol@setup@parlines{\let\vwcol@parlines\@empty}
933 % \end{macrocode}
934 % \end{macro}
935 %
936 % \begin{macro}{\vwcol@addlines}
937 % Adds paragraph specifications to \cmd\vwcol@parlines for a single column in the \cmd\parshape\. For $N$ columns there will be $N$ calls to this macro inside \cmd\vwcol@setup@parlines, which gets expanded at the beginning of every paragraph to create the required \cmd\parshape\ specification.
938 %
939 % \cmd\@tempcntb\ starts at |0| at the beginning of each paragraph and counts the number of lines over all the columns.
940 % \cmd\vwcol@last\ is the total number of lines that have so far been
941 % put into the columns. \cmd\vwcol@parlines\ is initialised at the beginning of each paragraph.
942 %
943 % Each time \cmd\vwcol@addlines\ is executed, \cmd\@tempcnta\ iterates through each line in that column. Once the total line count reaches the number of lines that have been typeset, \cmd\vwcol@parlines\ starts filling up with \cmd\parshape\ lines for the next paragraph.
944 % \begin{macrocode}
945 \def\vwcol@addlines#1{%
946 \@tempcnta=0
947 \loop\ifnum\@tempcnta<\vwcol@Nlines
948 \advance\@tempcntb 1
949 \ifnum\@tempcntb>\vwcol@last
950 \xdef\vwcol@parlines{\vwcol@parlines 0cm #1 }%
951 \fi
952 \advance\@tempcnta 1
953 \repeat}
954 % \end{macrocode}
955 % \end{macro}
956 %
957 %
958 % \begin{macro}{\vwcol@}
959 % This is the macro for splitting the text into variable-width columns.
960 % \begin{macrocode}
961 \newcommand\vwcol@[1]{%
962 % \end{macrocode}
963 % \paragraph{Setting the paragraphs}
964 % First set the text into a special box that varies width at the appropriate places so when it is split into equal segments they can be arranged into variable-width columns.
965 % \begin{macrocode}
966 \setbox\vwcol@box\vbox{%
967 % \end{macrocode}
968 % The trick is to keep a running counter of lines that we've gone through by inspecting every paragraph after it is typeset:
969 % \begin{macrocode}
970 \def\par{\endgraf\advance\vwcol@last\the\prevgraf}%
971 % \end{macrocode}
972 % (see \cmd\vwcol@addlines\ for a more detailed explanation):
973 % \begin{macrocode}
974 \everypar{%
975 \@tempcntb=0
976 \vwcol@setup@parlines
977 \parshape=\numexpr \vwcol@Nlines*\vwcol@Ncols-\vwcol@last \relax
978 \vwcol@parlines}%
979 % \end{macrocode}
980 % Insert a \cmd\strut\ at the top to ensure we chop off the first column at the same height as all the others:
981 % \begin{macrocode}
982 \noindent\strut#1}%
983 % \end{macrocode}
984 % \paragraph{Splitting the columns}
985 % First insert a pre-sep and -rule, if appropriate:
986 % \begin{macrocode}
987 \if@vwcol@presep
988 \if@vwcol@prerule
989 \begingroup
990 \color{\vwcol@rulecol}
991 \vrule width \vwcol@rule
992 \endgroup
993 \fi
994 \hskip\dimexpr (\vwcol@sep-\vwcol@rule)/2 \relax
995 \fi
996 % \end{macrocode}
997 % Iterate over the total number of columns:
998 % \begin{macrocode}
999 \@tempcnta=0
1000 \loop\ifnum\@tempcnta < \vwcol@Ncols
1001 \advance\@tempcnta 1
1002 % \end{macrocode}
1003 % Skip the separations and rules in the first case:
1004 % \begin{macrocode}
1005 \unless\ifnum\@tempcnta=1
1006 % \end{macrocode}
1007 % Sep and rule between the columns if |[sep=fill]|:
1008 % \begin{macrocode}
1009 \ifdim\vwcol@sep=1sp
1010 \hfill
1011 \begingroup
1012 \color{\vwcol@rulecol}
1013 \vrule width \vwcol@rule
1014 \endgroup
1015 \hfill
1016 \else
1017 % \end{macrocode}
1018 % Sep and rule between the columns if |sep| is a length:
1019 % \begin{macrocode}
1020 \@tempdima=\dimexpr (\vwcol@sep-\vwcol@rule)/2 \relax
1021 \hskip\@tempdima
1022 \begingroup
1023 \color{\vwcol@rulecol}
1024 \vrule width \vwcol@rule
1025 \endgroup
1026 \hskip\@tempdima
1027 \fi
1028 \fi
1029 % \end{macrocode}
1030 % Split off and place the text column, then loop:
1031 % \begin{macrocode}
1032 \vsplit\vwcol@box to \numexpr
1033 (\vwcol@Nlines-1)*\baselineskip+\ht\strutbox \relax sp
1034 \repeat
1035 % \end{macrocode}
1036 % Finally place the post-sep and -rule, if appropriate:
1037 % \begin{macrocode}
1038 \if@vwcol@postsep
1039 \hskip\dimexpr (\vwcol@sep-\vwcol@rule)/2 \relax
1040 \if@vwcol@postrule
1041 \begingroup
1042 \color{\vwcol@rulecol}
1043 \vrule width \vwcol@rule
1044 \endgroup
1045 \fi
1046 \fi
1047 % \end{macrocode}
1048 % If \cs{vwcol@box} is void then we've used up all the material. This fact is passed on so we can re-run the algorithm with a different number of lines (or give a warning) if the material was truncated.
1049 % \begin{macrocode}
1050 \ifvoid\vwcol@box
1051 \global\@vwcol@boxreadytrue
1052 \fi}
1053 % \end{macrocode}
1054 % \end{macro}
1055 %
1056 % \newpage
1057 % \section{Problem with \cmd\raggedright\ and \cmd\parshape}
1058 %
1059 % Check it out; when you make a \cmd\parshape\ with more lines specified than necessary, the linebreak of the first line is totally wrong:
1060 %
1061 % \begin{example}{}
1062 % \raggedright
1063 % \newlength\tmp\tmp=241.84842pt
1064 %
1065 % \def\oneline{ 2.5em \tmp}
1066 % \def\fivelines{\oneline\oneline\oneline\oneline\oneline}
1067 %
1068 % \textbf{Wrong}:\\
1069 % \parshape 10 \fivelines\fivelines
1070 % \lipsum[66]
1071 %
1072 % \textbf{Right}:\\
1073 % \parshape 7 \fivelines\oneline\oneline
1074 % \lipsum[66]
1075 % \end{example}
1076 % This is why this package uses \pkg{ragged2e}'s \cmd\RaggedRight\ instead of \LaTeX's \cmd\raggedright.
1077 %
1078 % In actual fact, when isolated into plain \TeX\ code this reveals a legitimate bug in \TeX's line-breaking algorithm. Unfortunately discovered too late in \TeX's life to be awarded a cheque.
1079 %
1080 %\iffalse
1081 %</package>
1082 %\fi
1083 %
1084 % \Finale
1085 %
1086 %
1087 %\iffalse
1088 %<*dtx-style>
1089 % \begin{macrocode}
1090 \ProvidesPackage{dtx-style}
1091
1092 \errorcontextlines=999
1093
1094 \def\@dotsep{1000}
1095 \setcounter{tocdepth}{2}
1096 \setlength\columnseprule{0.1pt}
1097 \renewcommand\tableofcontents{\relax
1098 \begin{multicols}{2}[\section*{\contentsname}]\small
1099 \@starttoc{toc}\relax
1100 \end{multicols}}
1101
1102 \setcounter{IndexColumns}{2}
1103 \renewenvironment{theglossary}
1104 {\small\list{}{}
1105 \item\relax
1106 \glossary@prologue\GlossaryParms
1107 \let\item\@idxitem \ignorespaces
1108 \def\pfill{\hspace*{\fill}}}
1109 {\endlist}
1110
1111 \usepackage[svgnames]{xcolor}
1112 \usepackage{amsmath,array,bm,booktabs,calc,enumitem,fancyvrb,graphicx,ifthen,lipsum,longtable,microtype,refstyle,subfig,varioref,url}
1113
1114 \usepackage[center,it]{titlesec}
1115 \usepackage[quiet]{vwcol}
1116
1117 \usepackage[T1]{fontenc}
1118 \usepackage{textcomp}
1119 \usepackage[sc,osf]{mathpazo}
1120
1121 \linespread{1.1} % A bit more space between lines
1122 \frenchspacing % Remove ugly extra space after punctuation
1123 \setlength\parindent{2em}
1124
1125 \definecolor{niceblue}{rgb}{0.2,0.4,0.8}
1126 \newenvironment{example}[1]
1127 {\VerbatimEnvironment
1128 \def\Options{#1}%
1129 \begin{VerbatimOut}[gobble=2]{\examplefilename}}
1130 {\end{VerbatimOut}\relax
1131 \typesetexample}
1132
1133 \fvset{formatcom=\color{niceblue}}
1134 \DefineShortVerb{\|}
1135
1136 \def\theCodelineNo{\textcolor{niceblue}{\sffamily\tiny\arabic{CodelineNo}}}
1137
1138 \let\examplesize\normalsize
1139 \let\auxwidth\relax
1140
1141 \newsavebox\verbatimbox
1142 \edef\examplefilename{\jobname.example}
1143
1144 \newcommand\typesetexample{\relax
1145 \par\noindent
1146 \begin{trivlist}\item[]
1147 \begin{minipage}[t]{\linewidth}
1148 \begin{quote}
1149 \edef\@tempa{[gobble=2,fontsize=\noexpand\small,\Options]}%
1150 \begin{lrbox}{\verbatimbox}\relax
1151 \expandafter\BVerbatimInput\@tempa{\examplefilename}%
1152 \end{lrbox}
1153 \noindent\usebox\verbatimbox\par
1154 \vspace{-0.7\baselineskip}%
1155 {\color{gray}\hrulefill}\par
1156 \catcode`\%=14
1157 \input\examplefilename
1158 \end{quote}
1159 \end{minipage}
1160 \end{trivlist}}
1161
1162 \newcommand*\name[1]{{#1}}
1163 \newcommand*\pkg[1]{\textsf{#1}}
1164 \newcommand*\feat[1]{\texttt{#1}}
1165 \newcommand*\opt[1]{\texttt{#1}}
1166
1167 \newcommand*\note[1]{\unskip\footnote{#1}}
1168
1169 \let\latin\textit
1170 \def\eg{\latin{e.g.}}
1171 \def\Eg{\latin{E.g.}}
1172 \def\ie{\latin{i.e.}}
1173 \def\cf{\latin{cf.}}
1174 \def\etc{\@ifnextchar.{\latin{etc}}{\latin{etc.}\@}}
1175
1176 \def\STIX{\textsc{stix}}
1177 \def\MacOSX{Mac~OS~X}
1178 \def\ascii{\textsc{ascii}}
1179 \def\OMEGA{Omega}
1180 \def\CTAN{\textsc{ctan}}
1181
1182 \newcounter{argument}
1183 \g@addto@macro\endmacro{\setcounter{argument}{0}}
1184 \newcommand*\darg[1]{%
1185 \stepcounter{argument}%
1186 {\ttfamily\char`\{\char`\#\theargument\char`\}:~}#1\par\noindent\ignorespaces}
1187 \newcommand*\doarg[1]{%
1188 \stepcounter{argument}%
1189 {\ttfamily[\char`\#\theargument]:~}#1\par\noindent\ignorespaces}
1190
1191 \def\codeline{\par\hspace{\parindent}}% two \indents in total
1192
1193 % \end{macrocode}
1194 %</dtx-style>
1195 %\fi
1196 %
1197 % \typeout{*************************************************************}
1198 % \typeout{*}
1199 % \typeout{* To finish the installation you have to move the following}
1200 % \typeout{* file into a directory searched by TeX:}
1201 % \typeout{*}
1202 % \typeout{* \space\space\space vwcol.sty}
1203 % \typeout{*}
1204 % \typeout{*************************************************************}
1205 %
1206 \endinput