Debian Codegraph @

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

raw
1 %
2 % Copyright (c) 1994-2003 Matthias Eckermann
3 %
4 % This program may be distributed and/or modified under the
5 % conditions of the LaTeX Project Public License, either version 1.2
6 % of this license or (at your option) any later version.
7 % The latest version of this license is in
8 % http://www.latex-project.org/lppl.txt
9 % and version 1.2 or later is part of all distributions of LaTeX
10 % version 1999/12/01 or later.
11 %
12 % This program consists of the files parallel.dtx, parallel.ins, readme
13 %
14 %
15 % \iffalse meta-comment
16 %<*!example1>
17 %<*!example2>
18 %<*!driver>
19 %
20 % \begin{macrocode}
21 %%
22 %% $Id: parallel.dtx,v 1.11 2003/04/13 16:54:40 mge Exp $
23 %%
24 %% $Log: parallel.dtx,v $
25 %% Revision 1.11 2003/04/13 16:54:40 mge
26 %% cleanups
27 %%
28 %% Revision 1.10 2003/04/13 16:52:04 mge
29 %% Beta 4 fixed (not tagging:-)
30 %%
31 %% Revision 1.9 2003/04/13 16:47:07 mge
32 %% correct checksum
33 %%
34 %% Revision 1.8 2003/04/13 16:46:14 mge
35 %% cvs cleanups
36 %%
37 %% Revision 1.7 2003/04/13 16:36:22 mge
38 %% changed \fileversion
39 %%
40 %% Revision 1.6 2003/04/13 16:27:30 mge
41 %% added readme
42 %%
43 %% Revision 1.5 2003/04/13 16:17:18 mge
44 %% added minor changes (fmi)
45 %% License->LPPL (mge)
46 %%
47 %% Revision 1.4 2003/04/13 15:51:44 mge
48 %% minor changes (cosmetic)
49 %%
50 %% Revision 1.3 2000/04/01 08:44:40 mge
51 %% updated \fileversion \filedate
52 %%
53 %% Revision 1.2 2000/04/01 08:42:39 mge
54 %% initial checkin
55 %%
56 %% author(s) : Matthias Eckermann (mge), Berlin, Germany
57 %% - debugging : Bernd Raichle (br), Stuttgart, Germany
58 %% - contributions : Wonkoo Kim (wk), Pittsburgh, PA, USA
59 %% Frank Mittelbach (fmi) , Mainz, Germany
60 %% history : 2003-04-13 Minor corrections (fmi)
61 %% License->LPPL (mge)
62 %% 10.11.1997 (2.0 interim-public-beta) (mge)
63 %% 28.02.1997 (option 'verbose')
64 %% 01.10.1996 (better spacing) (br)
65 %% 29.09.1996 (smarter column support) (wk)
66 %% Sep.1996 (on pages, VLine, '.dtx') (mge)
67 %% 26.03.1995 (works within {list}s) (mge)
68 %% 15.02.1995 (first public release) (mge)
69 %% 19.10.1994 (initial tests) (mge)
70 %% email : [email protected] (private), [email protected] (job)
71 %% description : provides a small tool to typeset in two columns
72 %% or on two pages parallel, e.g. if you want to set
73 %% two languages besides.
74 %% thanks : R.Braun, H.Kopka, J.Schrod
75 %%
76 % \end{macrocode}
77 % \fi
78 %
79 % \CheckSum{808}
80 % \CharacterTable
81 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
82 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
83 % Digits \0\1\2\3\4\5\6\7\8\9
84 % Exclamation \! Double quote \" Hash (number) \#
85 % Dollar \$ Percent \% Ampersand \&
86 % Acute accent \' Left paren \( Right paren \)
87 % Asterisk \* Plus \+ Comma \,
88 % Minus \- Point \. Solidus \/
89 % Colon \: Semicolon \; Less than \<
90 % Equals \= Greater than \> Question mark \?
91 % Commercial at \@ Left bracket \[ Backslash \\
92 % Right bracket \] Circumflex \^ Underscore \_
93 % Grave accent \` Left brace \{ Vertical bar \|
94 % Right brace \} Tilde \~}
95 %
96 % \iffalse meta-comment
97 %</!driver>
98 % \fi
99 \def\fileversion{beta 4}
100 \def\filedate{2003/04/13}
101 %
102 % \MakeShortVerb{\|}
103 %
104 % \title{The \texttt{Parallel}-Package\thanks{%
105 % I want to mention and thank
106 % Bernd Raichle (Stuttgart) and Wonkoo Kim (Pittsburgh, PA),
107 % who helped developing this packages with
108 % their ideas, debugging and pieces of code.}\\
109 % release \fileversion{}
110 % }
111 %
112 % \author{Matthias Eckermann, Berlin\\
113 % [email protected], [email protected]}
114 %
115 % \date{\filedate}
116 % \maketitle
117 %
118 % \begin{abstract}
119 % This package provides a small tool to typeset in two columns or on
120 % two pages parallel; this might be helpful,
121 % e.g. if you want to set two languages besides in translations or
122 % if you want to compare two texts. There are some caveats and some
123 % limitations which are described in this documentation.\par
124 % The gentle reader might excuse wrong words or bad constructions,
125 % but I'm not a ``native speaker''.\par
126 % Please remember: this is only an ``interim-public-beta''
127 % until I'll have finished the complete documentation,
128 % the code should be fine.
129 % \end{abstract}
130 %
131 % {\parskip 0pt\tableofcontents}
132 %
133 % \StopEventually{}
134 %
135 % \section{Usage}
136 % \subsection{Simple Usage -- for the Impatient}
137 % It is recommended, that you first read the complete section \emph{Usage}\
138 % to understand \texttt{Parallel}'s behavior and limitations, but if one
139 % wants to begin immediately and there is only one paragraph in two columns
140 % parallel, one may try this code:
141 % \begin{verbatim}
142 % \usepackage{parallel}
143 % ...
144 % \begin{Parallel}{<left-width>}{<right-width>}
145 % \ParallelLText{<left-text>}
146 % \ParallelRText{<right-text>}
147 % \end{Parallel}
148 % \end{verbatim}
149 % It generates the two texts typesetted parallel in two columns, footnotes
150 % at the end of the \texttt{Parallel}-Environment.
151 %
152 % \subsection{Advanced Usage}
153 % But, I think, most people want a more flexible handling of their parallel
154 % texts. So they will have to use a more difficult structure of environment
155 % \texttt{parallel}:
156 % \begin{verbatim}
157 % \usepackage[<package_options>]{parallel}
158 % ...
159 % \begin{Parallel}[<environment_options>]{<left-width>}{<right-width>}
160 % \ParallelLText{<left-text>}
161 % \ParallelRText{<right-text>}
162 % \ParallelPar
163 % \ParallelLText{<left-text>}
164 % ...
165 % \renewcommand{\ParallelAtEnd}{<text>}
166 % \end{Parallel}
167 % \end{verbatim}
168 %
169 % \DescribeMacro{\ParallelPar}
170 % |\ParallelPar| is the most important Macro of this package;
171 % it tells the environment to begin a new \emph{parallel paragraph},
172 % i.e.: left and right texts are printed out to their lengths
173 % and then we begin new on the same vertical position, as if you close the
174 % environment |Parallel| and begin a new one. Therefore |\ParallelPar| must
175 % not be left out after a pair of |\ParallelLText| -- |\ParallelRText|
176 % (only at the total end of the environment).
177 %
178 % \DescribeMacro{\ParallelAtEnd}
179 % With the help of |\ParallelAtEnd|\par
180 % \hspace*{3em}(|\renewcommand{\ParallelAtEnd}{<Your text here>}|)\par
181 % you can set some text between the parallel columns and the footnotes.
182 %
183 % \DescribeEnv{Parallel}
184 % Now we'll have a look at the options of |Parallel|.
185 %
186 % \begin{description}
187 % \item[Package options] (the options, which can be chosen when loading
188 % |parallel| in the document-preamble). The following options are
189 % possible, but only |Verbose| and |SeparatedFootnotes| can be combined
190 % with one of the others, while out of the |*Nums|-options only one can
191 % be set at one time. This behaviour may change in a later release.
192 % \begin{description}
193 % \item[OldStyleNums] set the footnote-numbers with \LaTeX's
194 % |\oldstylnums|-command
195 % \item[RaiseNums] like |\footnote|
196 % \item[ItalicNums] the footnote-numbers are set in Italics
197 % \item[RomanNums] using |\romannnumeral|
198 % \item[SeparatedFootnotes] The footnotes of the left and right columns
199 % are separately numbered and printed. The right footnotes are signed
200 % with the content of |\ParallelDot| (usual |$\cdot$|).
201 % \item[Verbose] tell the author used environment and its options\dots
202 % \end{description}
203 % \item[Environment options] Due to the work of W.Kim (see below)
204 % the |<left-width>| and/or |<right-width>| may be left empty;
205 % the package will set the two widths to about 50\%\ of |\textwidth|.
206 % But it is also possible to set both widths with absolute (e.g. |3cm|)
207 % or relative (e.g. |0.37\textwidth|) values.\par
208 % One may use only one of the \emph{real} options; if none is used,
209 % ``c'' is assumed, if a bad character is chosen, an error-message
210 % will appear, but the user may go on by pressing |<return>|.
211 % \begin{description}
212 % \item[``c''] (\emph{Columns}) print in columns
213 % \item[``v''] (\emph{Vertical line between columns}) print in columns,
214 % but with intermediate |\vline|
215 % \item[``p''] (\emph{Pages}) print on two pages;
216 % if one box is empty, the corresponding page is left blank
217 % (not a bug, but feature!)
218 % \task{me}{%
219 % \item[``a''] (\emph{Autocomputed pages}) print on two pages,
220 % autocompute the width of the text that holds less characters.
221 % \item[``s''] (\emph{Save/Store once autocalculated widths})
222 % Using this option, the widths autocalculated in the first
223 % |\ParallelPar| will be used for the other paragraphs of this
224 % \emph{environment}. This option is introduced, to enable
225 % autocalculation \emph{and}\ the same look-alike of every paragraph
226 % of an environment |Parallel|.
227 % \item[``r''] (\emph{Resume/Reload once autocalculated widths})
228 % This option allows to transfer the widths-values between
229 % environments.%
230 % }%
231 % \end{description}
232 % \end{description}
233 %
234 % \task{me}{%
235 % \subsubsection{Typesetting in Columns}
236 % \subsubsection{Typesetting on Pages}
237 % }
238 %
239 % \section{Limitations, Warnings}
240 % \begin{itemize}
241 % \item \emph{tabular}s, \emph{minipage}s, ... inside of
242 % |\ParallelLText| or |\ParallelRText| will cause unexpected results.
243 % But you may use these constructions outside |\ParallelLText|
244 % or |\ParallelRText|, but inside the environment,
245 % when typesetting in columns; you \emph{must}\ not use those things
246 % (within the environment), when typesetting on pages parallel.
247 % \item \emph{footnote}s are printed at the end of the environment.
248 % I hope, this is a begin of a solution on further footnote-problems.
249 % \item The max. size of ``left-text'' and ``right-text'' is limited.
250 % \item The lines are typesetted really parallel, i.e. large
251 % size-differences will cause bad or dirty output.
252 % \end{itemize}
253 %
254 % \section{Todo-List}
255 % There are some ideas and todos, that will be fixed in the final release
256 % or in later releases:
257 % \begin{itemize}
258 % \item Most important: complete documentation.
259 % \item Dominik Neidinger, Munich, asked for leaving out |\ParallelPar|
260 % and setting to be done automatically by |\ParallelLText| and/or
261 % |\ParallelRText|.
262 % \item Add more environment-options:
263 % \begin{itemize}
264 % \item[``a''] (\emph{Autocomputed pages}) print on two pages,
265 % autocompute the width of the text that holds less characters.
266 % \item[``s''] (\emph{Save/Store once autocalculated widths})
267 % Using this option, the widths autocalculated in the first
268 % |\ParallelPar| will be used for the other paragraphs of this
269 % \emph{environment}. This option is introduced, to enable
270 % autocalculation \emph{and}\ the same look-alike of every paragraph
271 % of an environment |Parallel|.
272 % \item[``r''] (\emph{Resume/Reload once autocalculated widths})
273 % This option allows to transfer the widths-values between
274 % environments.
275 % \end{itemize}
276 % \item Use ``|\newif|'' instead of many integer variables.
277 % \item different footnote-types for left and right footnotes
278 % \item There might be a bug in the algorithm to typeset on two pages.
279 % I must have a look at this later.
280 % \end{itemize}
281 %
282 % \section{Documentation-Driver}
283 %
284 % \begin{macrocode}
285 %<*driver>
286 \NeedsTeXFormat{LaTeX2e}
287 \documentclass[a4paper]{ltxdoc}
288 \usepackage{parallel}
289 \CodelineNumbered
290 \parskip2ex plus1ex minus1ex
291 \parindent0em
292 \setlength\hfuzz{10pt}
293 \setcounter{tocdepth}{2}
294 \hbadness=5000
295 \addtolength{\textwidth}{0.5in}
296 \pagestyle{myheadings}
297 \markboth{``Parallel''-package (\fileversion, \filedate)}%
298 {``Parallel''-package (\fileversion, \filedate)}
299 \begin{document}
300 \DocInput{parallel.dtx}
301 \begin{Parallel}[v]{0.4\textwidth}{0.51\textwidth}
302 \tolerance=1000
303 %</driver>
304 % \end{macrocode}
305 %
306 % \section{macro package source code}
307 % \subsection{implementation rules}
308 % Even if some people will find this confusing or too much to type: I
309 % decided to use real long names for all dimensions, counters, boxes and
310 % macros. Every name introduced in this package starts with |\Parallel|,
311 % so that it is unary (I hope) in the \LaTeX{}-world.
312 %
313 % \subsection{preamble}
314 % Here is the standard header for a \LaTeX{}-package. This package is
315 % called \texttt{parallel}\ and we just work with release 2.
316 % \begin{macrocode}
317 %<*package>
318 \NeedsTeXFormat{LaTeX2e}
319 \ProvidesPackage{parallel}[\filedate, setting two texts parallel (me)]
320 \message{`parallel': setting two texts parallel, (\fileversion) \filedate.}
321 % \end{macrocode}
322 %
323 % \subsection{lengths}
324 % The two dimensions |\ParallelLWidth| and |\ParallelRWidth| hold the
325 % actual size of the left and right column (or page).
326 % \begin{macrocode}
327 \newdimen\ParallelLWidth
328 \newdimen\ParallelRWidth
329 % \end{macrocode}
330 %
331 % |\ParallelTextWidth| is mainly a copy of |\textwidth|, while
332 % |\ParallelLeftMargin| holds the |\leftmargin|, e.g. if one sets a
333 % Parallel-Environment inside of another construction (e.g. list).
334 % \begin{macrocode}
335 \newdimen\ParallelTextWidth
336 \newdimen\ParallelLeftMargin
337 % \end{macrocode}
338 %
339 % While the user can redefine |\ParallelUserMidSKip| (and this is used for
340 % calculating the sizes and skips), |\ParallelMainMidSkip| holds the skip
341 % which finally is used for typesetting.
342 % \begin{macrocode}
343 \newdimen\ParallelUserMidSkip
344 \newdimen\ParallelMainMidSkip
345 % \end{macrocode}
346 %
347 % \subsection{boxes}
348 % \begin{macrocode}
349 \newbox\ParallelLBox
350 \newbox\ParallelRBox
351 \newbox\ParallelBoxVar
352 % \end{macrocode}
353 %
354 % \subsection{tokens}
355 % \begin{macrocode}
356 \newbox\ParallelLTok
357 \newbox\ParallelRTok
358 % \end{macrocode}
359 %
360 % \subsection{counts}
361 % First we need some ``boolean'' variables. As you see, I'am a
362 % C-programmer using integer-variables for boolean operations.
363 % Perhaps it would be better, to use |\newif| here -- later!?
364 % \task{me}{Use ``|\newif|'' instead of integer variables}
365 % \begin{macrocode}
366 \newcount\ParallelBoolVar
367 \newcount\ParallelBoolMid
368 % \end{macrocode}
369 %
370 % |\ParallelWhichBox| tells the program, if the left ($=$0) or the right
371 % text-box ($=$1) shall be typesetted (when in page-mode).
372 %
373 % In |\ParallelMainMode| the information is stored, if the environment is
374 % ``on pages'', ``in columns'' or ``in columns with vertical line''.
375 % \begin{macrocode}
376 \newcount\ParallelWhichBox
377 \newcount\ParallelMainMode
378 % \end{macrocode}
379 %
380 % These are the variables dealing with the special footnote-implementation
381 % used in environment ``Parallel''. |\ParallelLFNCounter|,
382 % |\ParallelRFNCounter| and |\ParallelMaxFN| are self-explaining.
383 %
384 % |\ParallelFNMode| is again a boolean-like variable.
385 % If |\ParallelFNMode|$=$1, footnotes are countered and set separated
386 % for each columns, if |\ParallelFNMode|$\ne$1, only one
387 % footnote-counter is used: all footnotes are set in one block
388 % (columns mixed!).
389 %
390 % But |\ParallelFNNumMode| needs some description. It holds the style in
391 % which the footnote-numbers (not those in the text, but those before the
392 % footnote-text) are set:
393 % \begin{description}
394 % \item[0] normal numbers
395 % \item[1] old style numbers (|\oldstylenums|)
396 % \item[2] raised numbers
397 % \item[3] italic numbers
398 % \item[4] roman numbers (|\romannumeral|)
399 % \end{description}
400 % \begin{macrocode}
401 \newcount\ParallelFNMode
402 \newcount\ParallelLFNCounter
403 \newcount\ParallelRFNCounter
404 \newcount\ParallelMaxFN
405 \newcount\ParallelFNNumMode
406 % \end{macrocode}
407 %
408 % \subsection{options}
409 % The following options (given to the package in |\usepackage|) set the
410 % footnote-variables in an appropriate way. Obviously only one of
411 % ``OldStyleNums'', ``RaiseNums'', ``ItalicNums'' or ``RomanNums'' is
412 % possible, but one can combine these with ``SeparatedFootnotes'' and
413 % ``Verbose''. Perhaps - one day far away --
414 % \task{me}{different footnote-types for left and right footnotes}
415 % it will be possible, to have arabic-numbered left-footnotes and
416 % roman-numbered right-footnotes; but today the right ones are marked by a
417 % little dot (or something like that, see below, |\ParallelDot|).
418 % \begin{macrocode}
419 \newcommand{\ParallelMessage}[1]{\relax}
420 \DeclareOption{Verbose}{%
421 \renewcommand{\ParallelMessage}[1]{\message{#1}}
422 \message{Verbose}
423 }
424 \DeclareOption{OldStyleNums}{%
425 \ParallelFNNumMode=1\ParallelMessage{OldStyleNums}}
426 \DeclareOption{RaiseNums}{%
427 \ParallelFNNumMode=2\ParallelMessage{RaiseNums}}
428 \DeclareOption{ItalicNums}{%
429 \ParallelFNNumMode=3\ParallelMessage{ItalicNums}}
430 \DeclareOption{RomanNums}{%
431 \ParallelFNNumMode=4\ParallelMessage{RomanNums}}
432 \DeclareOption{SeparatedFootnotes}{%
433 \ParallelFNMode=1\ParallelMessage{SeparatedFootnotes}}
434 % \end{macrocode}
435 %
436 % \subsection{internal commands}
437 % \subsubsection{footnotes}
438 %
439 % The |\footnote|s were the most important problem when first trying to
440 % implement our package. So here is a description of
441 % \begin{itemize}
442 % \item why footnotes are a problem in our task,
443 % \item which problems are solved and in which way,
444 % \item what is not solved and what seems to be \emph{not}\ possible.
445 % \end{itemize}
446 %
447 % \task{me}{%
448 % \paragraph{Problems}
449 % \paragraph{Solutions}
450 % \paragraph{Unsolved Tasks}
451 % }
452 % \DescribeMacro{\ParallelLFootnote}
453 % \begin{macrocode}
454 \newcommand{\ParallelLFootnote}[1]{%
455 \global\advance\ParallelLFNCounter\@ne
456 \footnotemark[\number\ParallelLFNCounter]%
457 \expandafter\gdef%
458 \csname ParallelLFN\romannumeral\ParallelLFNCounter\endcsname{#1}}
459 % \end{macrocode}
460 %
461 % \DescribeMacro{\ParallelRFootnote}
462 % \begin{macrocode}
463 \newcommand{\ParallelRFootnote}[1]{%
464 \global\advance\ParallelRFNCounter\@ne
465 \footnotemark[\number\ParallelRFNCounter]%
466 \expandafter\gdef%
467 \csname ParallelRFN\romannumeral\ParallelRFNCounter\endcsname{#1}}
468 % \end{macrocode}
469 %
470 % \DescribeEnv{ParallelFNEnviron}
471 % \begin{macrocode}
472 \newenvironment{ParallelFNEnviron}{%
473 \footnotesize
474 \begin{list}{}{%
475 \leftmargin=4em \rightmargin=\z@
476 \topsep=\z@skip \itemsep=\z@skip
477 \labelwidth=3em \labelsep=1em%
478 \renewcommand{\makelabel}[1]{{\hfill\footnotesize ##1}}%
479 }%
480 }{%
481 \end{list}%
482 }
483 % \end{macrocode}
484 %
485 % \DescribeMacro{\ParallelShowFNList}
486 % \begin{macrocode}
487 \newcommand{\ParallelShowFNList}{%
488 % footnotes in left or right column, i.e. left+right>0?
489 \ParallelMaxFN=\ParallelLFNCounter
490 \advance\ParallelMaxFN \ParallelRFNCounter
491 \ifnum\ParallelMaxFN>\z@
492 \ParallelMessage{Parallel Footnotes (}%
493 \begin{ParallelFNEnviron}%
494 \ParallelMaxFN=\ParallelLFNCounter
495 \global\ParallelLFNCounter=\z@
496 \loop
497 \ifnum\ParallelLFNCounter<\ParallelMaxFN
498 \global\advance\ParallelLFNCounter \@ne
499 \item[\ifcase\ParallelFNNumMode \number\ParallelLFNCounter%
500 \or \oldstylenums{\the\ParallelLFNCounter}%
501 \or \raisebox{1ex}{\the\ParallelLFNCounter}%
502 \or \textit{\number\ParallelLFNCounter}%
503 \or \romannumeral\ParallelLFNCounter%
504 \else \number\ParallelLFNCounter \fi]%
505 \par
506 {\csname ParallelLFN\romannumeral\ParallelLFNCounter\endcsname}%
507 \par
508 \repeat
509 \end{ParallelFNEnviron}%
510 \ifnum\ParallelFNMode=\@ne
511 \begin{ParallelFNEnviron}%
512 \ParallelMaxFN=\ParallelRFNCounter
513 \global\ParallelRFNCounter=\z@
514 \loop
515 \ifnum\ParallelRFNCounter<\ParallelMaxFN
516 \global\advance\ParallelRFNCounter \@ne
517 \item[\ifcase\ParallelFNNumMode
518 \number\ParallelRFNCounter\ParallelDot
519 \or \oldstylenums{\the\ParallelRFNCounter}\ParallelDot
520 \or \raisebox{1ex}{\the\ParallelRFNCounter\ParallelDot}%
521 \or \textit{\number\ParallelRFNCounter\ParallelDot}%
522 \or \romannumeral\ParallelLFNCounter%
523 \else \number\ParallelRFNCounter\ParallelDot \fi]%
524 \par
525 {\csname ParallelRFN\romannumeral\ParallelRFNCounter\endcsname}%
526 \par
527 \repeat
528 \end{ParallelFNEnviron}%
529 \fi
530 \global\ParallelLFNCounter=\z@
531 \global\ParallelRFNCounter=\z@
532 \ParallelMessage{)}%
533 \else
534 \ParallelMessage{No Parallel Footnotes}%
535 \fi
536 }
537 % \end{macrocode}
538 %
539 % \subsubsection{typesetting on one page}
540 % \DescribeMacro{\ParallelParOnePage}
541 % I'm glad that Bernd Raichle\footnote{Stuttgart;%
542 % [email protected]; 1996/10/01}\
543 % spent his rare time to debug the code of this function and of the
544 % environment |ParallelFNEnviron|. Frank Mittelbach enhanced it in 2002/2003.
545 % \begin{macrocode}
546 \newcommand{\ParallelParOnePage}{%
547 \ifnum\ParallelBoolVar=\@ne
548 \par\begingroup
549 \leftmargin=\z@ \rightmargin=\z@
550 \parskip=\z@skip \parindent=\z@
551 \vbadness=10000
552 \vfuzz=3ex
553 \splittopskip=\z@skip
554 \loop%
555 \ifnum\ParallelBoolVar=\@ne%
556 \noindent
557 \hbox to\textwidth{%
558 \hskip\ParallelLeftMargin
559 \hbox to\ParallelTextWidth{%
560 \ifvoid\ParallelLBox
561 \hskip\ParallelLWidth
562 \else
563 \ParallelWhichBox=\z@
564 \vbox{\setbox\ParallelBoxVar
565 =\vsplit\ParallelLBox to\dp\strutbox%
566 \unvbox\ParallelBoxVar}%
567 \fi
568 \strut
569 \ifnum\ParallelBoolMid=\@ne
570 \hskip\ParallelMainMidSkip
571 \vrule
572 \else
573 \hss
574 \fi
575 \hss
576 \ifvoid\ParallelRBox
577 \hskip\ParallelRWidth
578 \else
579 \ParallelWhichBox=\@ne
580 \vbox{\setbox\ParallelBoxVar
581 =\vsplit\ParallelRBox to\dp\strutbox%
582 \unvbox\ParallelBoxVar}%
583 \fi}}%
584 \ifvoid\ParallelLBox \ifvoid\ParallelRBox
585 \global\ParallelBoolVar=\z@
586 \fi\fi%
587 \fi%
588 \ifnum\ParallelBoolVar=\@ne%
589 \penalty\interlinepenalty
590 \repeat
591 \par
592 \endgroup
593 \fi}
594 % \end{macrocode}
595 %
596 % \subsubsection{typesetting on two page}
597 %
598 % \DescribeMacro{\ParallelParTwoPages}
599 % \begin{macrocode}
600 \newcommand{\ParallelParTwoPages}{%
601 \ifnum\ParallelBoolVar=\@ne
602 \par\begingroup
603 \global\ParallelWhichBox=\@ne
604 \newpage
605 \vbadness=10000
606 \vfuzz=3ex
607 \splittopskip=\z@skip
608 \loop%
609 \ifnum\ParallelBoolVar=\@ne%
610 \ifnum\ParallelWhichBox=\@ne
611 \ifvoid\ParallelLBox \mbox{} \newpage
612 \else\global\ParallelWhichBox=\z@\fi
613 \else
614 \ifvoid\ParallelRBox \mbox{} \newpage
615 \else\global\ParallelWhichBox=\@ne\fi
616 \fi
617 \ifnum\ParallelWhichBox=\z@
618 \ifodd\thepage \mbox{} \newpage \fi
619 \hbox to\textwidth{%
620 \vbox{\vsplit\ParallelLBox to.98\textheight}}%
621 \else
622 \ifodd\thepage\relax\else \mbox{} \newpage \fi
623 \hbox to\textwidth{%
624 \vbox{\vsplit\ParallelRBox to.98\textheight}}%
625 \fi
626 \vspace*{\fill}\newpage
627 \fi
628 \ifvoid\ParallelLBox\ifvoid\ParallelRBox
629 \global\ParallelBoolVar=\z@
630 \fi\fi
631 \ifnum\ParallelBoolVar=\@ne
632 \repeat
633 \par
634 \endgroup
635 \fi}
636 % \end{macrocode}
637 %
638 % \subsection{user commands}
639 %
640 % \task{me}{BR: |\egroup| nicht notwendig, da durch Endeklammer des Arguments gegeben}
641 % \DescribeMacro{\ParallelAfterText}
642 % \begin{macrocode}
643 \newcommand{\ParallelAfterText}{%
644 \global\ParallelBoolVar=\@ne
645 \let\footnote=\ParallelOldFootnote\endgroup}
646 % \end{macrocode}
647 %
648 % \DescribeMacro{\ParallelCheckOpenBrace}
649 % \begin{macrocode}
650 \newcommand{\ParallelCheckOpenBrace}{%
651 \ifx\x\bgroup \else
652 \errmessage{Missing opening brace}%
653 \fi
654 \endgroup}
655 % \end{macrocode}
656 %
657 % \DescribeMacro{\ParallelLText}
658 % \begin{macrocode}
659 \newcommand{\ParallelLText}{%
660 \everypar{}\@restorepar\begingroup
661 \hbadness=3000
662 \let\footnote=\ParallelLFootnote
663 \ParallelWhichBox=0
664 \global\setbox\ParallelLBox=\vbox\bgroup \hsize=\ParallelLWidth
665 \aftergroup\ParallelAfterText
666 \begingroup \afterassignment\ParallelCheckOpenBrace \let\x=}
667 % \end{macrocode}
668 %
669 % \DescribeMacro{\ParallelRText}
670 % \begin{macrocode}
671 \newcommand{\ParallelRText}{%
672 \everypar{}\@restorepar\begingroup
673 \hbadness=3000
674 \ifnum\ParallelFNMode=\@ne
675 \let\footnote=\ParallelRFootnote
676 \else
677 \let\footnote=\ParallelLFootnote
678 \fi
679 \ParallelWhichBox=\@ne
680 \global\setbox\ParallelRBox=\vbox\bgroup \hsize=\ParallelRWidth
681 \aftergroup\ParallelAfterText
682 \begingroup \afterassignment\ParallelCheckOpenBrace \let\x=}
683 % \end{macrocode}
684 %
685 % \DescribeMacro{\ParallelAtEnd}
686 % |\ParallelAtEnd| must be defined: the user just types |\renewcommand|,
687 % and everything is right (I hope); it's a dummy.
688 % \begin{macrocode}
689 \newcommand{\ParallelAtEnd}{}
690 % \end{macrocode}
691 %
692 % \DescribeMacro{\ParallelPar}
693 % Actually, this is a dummy again or a ``Pointer'' to the |\ParallelPar|,
694 % which is choosen.
695 % \task{me/dn}{Dominik Neidinger (dn) requested leaving out |\ParallelPar|
696 % and the setting to be done automatically by |\ParallelLText| or
697 % |\ParallelRText|; mh, let's think about that.}
698 % \begin{macrocode}
699 \newcommand{\ParallelPar}{} % Dummy
700 % \end{macrocode}
701 %
702 % \DescribeMacro{\ParallelDot}
703 % \begin{macrocode}
704 \newcommand{\ParallelDot}{\ensuremath{\cdot}}
705 % \end{macrocode}
706 %
707 % \subsection{Environment ``Parallel''}
708 %
709 % \DescribeEnv{Parallel}
710 % \begin{macrocode}
711 \newenvironment{Parallel}[3][c]{%
712 \begingroup%
713 \ParallelTextWidth=\linewidth
714 \ParallelLeftMargin=\textwidth
715 \advance\ParallelLeftMargin by-\linewidth
716 % \end{macrocode}
717 %
718 % The following code checks for the optional argument: it tells the
719 % environment, if the user wants typesetting on page ('p'), in columns
720 % ('c') or in columns with an intermediate |\vline| ('v').
721 % If none of these options is given, column mode is chosen,
722 % but if there is a wrong char (as an argument),
723 % an error message appears, but the user may go on by pressing |<return>|.
724 %
725 % \begin{macrocode}
726 \if #1p\relax
727 \ParallelMessage{ on Pages (}%
728 \ParallelMainMode=\z@
729 \renewcommand{\ParallelPar}{\ParallelParTwoPages}
730 \else
731 \if #1a\relax
732 \ParallelMessage{ autocomputed Pages (}%
733 \ParallelMainMode=\tw@
734 \renewcommand{\ParallelPar}{\ParallelParTwoPages}
735 \else
736 \tolerance=600 % sorry, but neccessary
737 \emergencystretch=.5em % dto.
738 \ParallelMainMode=\@ne
739 \renewcommand{\ParallelPar}{\ParallelParOnePage}
740 \if #1v\relax
741 \ParallelBoolMid=\@ne
742 \ParallelMessage{ in Columns, with VLine (}%
743 \else
744 \if #1c\relax\else
745 \errhelp{possible options:
746 'p'age, 'c'olumn or columns with 'v'line ---
747 type <return> to proceed in column-mode}
748 \errmessage{bad option '#1' to environment 'Parallel'}
749 \fi
750 \ParallelMessage{ in Columns (}%
751 \fi\fi\fi
752 % \end{macrocode}
753 %
754 % Smart column width support was mainly done by
755 % Wonkoo Kim\footnote{Pittsburgh, PA; [email protected]; 1996/09/29}.
756 % |\ParallelLWidth| or |\ParallelRWidth| fields can be left blank in user
757 % document. Their default width (in column-mode) is
758 % $0.5$|\textwidth| $-$ |\ParallelUserMidSkip| for null widths.
759 % Even the |\ParallelUserMidSkip| can be set by user; its default value
760 % is 0.5em. If only one width is given, the other width will be computed.
761 %
762 % First we must see, if the arguments of the environment are given or
763 % not. If not, the value is set to zero inches, for that we have a value,
764 % that can be calculated.
765 % \begin{macrocode}
766 \def\ParallelArgL{#2} \def\ParallelArgR{#3}
767 \ifx\ParallelArgL\empty\ParallelLWidth=0in\else\ifx\ParallelArgL\space
768 \ParallelLWidth=0in\else\setlength\ParallelLWidth{#2}\fi\fi
769 \ifx\ParallelArgR\empty\ParallelRWidth=0in\else\ifx\ParallelArgR\space
770 \ParallelRWidth=0in\else\setlength\ParallelRWidth{#3}\fi\fi
771 % \end{macrocode}
772 %
773 % If we are in column-mode (|\ParallelMainMode|$=1$):
774 % \begin{macrocode}
775 \ifnum\ParallelMainMode=\@ne
776 \ifdim\ParallelLWidth>1em
777 \ifdim\ParallelRWidth>1em
778 % \end{macrocode}
779 % \begin{itemize}
780 % \item If both dimensions are set, we calculate the left width and set
781 % the vertical line centered (by calculating)
782 % \end{itemize}
783 % \begin{macrocode}
784 \ParallelMainMidSkip=\linewidth
785 \advance\ParallelMainMidSkip by-\ParallelLWidth
786 \advance\ParallelMainMidSkip by-\ParallelRWidth
787 \advance\ParallelMainMidSkip by-.5pt
788 \advance\ParallelMainMidSkip by-\ParallelLeftMargin
789 \divide\ParallelMainMidSkip by 2
790 \else
791 % \end{macrocode}
792 % \begin{itemize}
793 % \item If only the left width is given, the mid-skip (between vertical
794 % line and text) is set to |\ParallelUserMidSkip|), the width of right
795 % text is calculated.
796 % \end{itemize}
797 % \begin{macrocode}
798 \ParallelRWidth=\linewidth
799 \advance\ParallelRWidth by-\ParallelLWidth
800 \advance\ParallelRWidth by-2\ParallelUserMidSkip
801 \advance\ParallelRWidth by-\ParallelLeftMargin
802 \ParallelMainMidSkip=\ParallelUserMidSkip
803 \fi
804 \else
805 \ifdim\ParallelRWidth>1em
806 % \end{macrocode}
807 % \begin{itemize}
808 % \item If only the right width is given, the mid-skip (between vertical
809 % line and text) is set to |\ParallelUserMidSkip|), the width of left
810 % text is calculated.
811 % \end{itemize}
812 % \begin{macrocode}
813 \ParallelLWidth=\linewidth
814 \advance\ParallelLWidth by-\ParallelRWidth
815 \advance\ParallelLWidth by-2\ParallelUserMidSkip
816 \advance\ParallelLWidth by-\ParallelLeftMargin
817 \ParallelMainMidSkip=\ParallelUserMidSkip
818 \else
819 % \end{macrocode}
820 % \begin{itemize}
821 % \item If none of the dimensions is given, the mid-skip (between vertical
822 % line and text) is set to |\ParallelUserMidSkip|, the left and right
823 % dimensions are calculated -- each the same width:
824 % $0.5$|\linewidth| $-$ |\ParallelLeftMargin| $-$ |\ParallelUserMidSkip|.
825 % \end{itemize}
826 % \begin{macrocode}
827 \ParallelLWidth=.5\linewidth
828 \advance\ParallelLWidth by-\ParallelLeftMargin
829 \advance\ParallelLWidth by-\ParallelUserMidSkip
830 \ParallelRWidth=\ParallelLWidth
831 \ParallelMainMidSkip=\ParallelUserMidSkip
832 \fi
833 \fi
834 \else
835 % \end{macrocode}
836 %
837 % If we are in page-mode (|\ParallelMainMode|$\ne$1):
838 % \begin{itemize}
839 % \item If both dimensions are given (standard usage): nothing happens
840 % \item If only left size is given: right is set to
841 % |\linewidth| $-$ |\ParallelLeftMargin|.
842 % \end{itemize}
843 % \begin{macrocode}
844 \ifdim\ParallelLWidth>1em
845 \ifdim\ParallelRWidth>1em
846 \else
847 \ParallelRWidth=\linewidth
848 \advance\ParallelRWidth by-\ParallelLeftMargin
849 \fi
850 \else
851 % \end{macrocode}
852 % \begin{itemize}
853 % \item If only right size is given: left is set to
854 % |\linewidth| $-$ |\ParallelLeftMargin|.
855 % \end{itemize}
856 % \begin{macrocode}
857 \ifdim\ParallelRWidth>1em
858 \ParallelLWidth=\linewidth
859 \advance\ParallelLWidth by-\ParallelLeftMargin
860 \else
861 % \end{macrocode}
862 % \begin{itemize}
863 % \item If none of the sizes is given: each is set to
864 % |\linewidth| $-$ |\ParallelLeftMargin|.
865 % \end{itemize}
866 % \begin{macrocode}
867 \ParallelLWidth=\linewidth
868 \advance\ParallelLWidth by-\ParallelLeftMargin
869 \ParallelRWidth=\linewidth
870 \advance\ParallelRWidth by-\ParallelLeftMargin
871 \fi
872 \fi
873 \fi
874 % \end{macrocode}
875 %
876 % Now we do some standard-settings.
877 % \begin{macrocode}
878 \global\ParallelLFNCounter=\z@
879 \global\ParallelRFNCounter=\z@
880 \let\ParallelOldFootnote=\footnote
881 % \end{macrocode}
882 %
883 % We finished the start-part of this environment with setting the
884 % footnote-counters to zero and saved the old |\footnote|-macro.
885 % \begin{macrocode}
886 }{%
887 % \end{macrocode}
888 %
889 % Before leaving Parallel-environment with |\end{Parallel}|, we enshure,
890 % that all text was typesetted (by invoking |\ParallelPar|), then we call
891 % |\ParallelAtEnd|, to display some (optional) text before the footnotes.
892 % \begin{macrocode}
893 \ParallelPar%
894 \ParallelAtEnd%
895 \endgroup%
896 % \end{macrocode}
897 %
898 % Now, it's time to show the footnotes (by invoking |\ParallelShowFNList|)
899 % and to restore the original |\footnote|-macro. The only thing to do is,
900 % to close the message-braces opened at the beginning of our Environment.
901 % \begin{macrocode}
902 \ParallelShowFNList%
903 \let\footnote=\ParallelOldFootnote
904 \ParallelMessage{)}}
905 % \end{macrocode}
906 %
907 % \subsection{postamble, settings}
908 % When the package is loaded, it's neccessary to reset some of our
909 % Variables to standard-values; the options must be processed.
910 % \begin{macrocode}
911 \ParallelFNNumMode=\z@
912 \ParallelFNMode=\z@
913 \ParallelBoolMid=\z@
914 \ParallelUserMidSkip=.5em
915 \ProcessOptions
916 %</package>
917 % \end{macrocode}
918 %
919 % \iffalse
920 %</!example2>
921 %</!example1>
922 % \fi
923 %
924 % \DeleteShortVerb{\|}
925 %
926 % \newpage \task{me}{necessary for correct setting of last example}
927 %
928 % \section{examples for \texttt{parallel.sty}}
929 % \subsection{typesetting in columns}
930 % \begin{macrocode}
931 %<*example1>
932 \NeedsTeXFormat{LaTeX2e}
933 \documentclass[12pt]{article}
934 \usepackage{parallel}
935 \linespread{1.9}
936 \textwidth10.5cm
937 \textheight15cm
938 \begin{document}
939 This is a sample \LaTeX{}-file for the \texttt{Parallel}-environment.
940 It is typesetted with \verb+\linespread{1.9}+, \verb+\textheight15cm+,
941 \verb+\textwidth10.5cm+, for that we need more space on
942 the pages and some pagebreaks are visible. This really is no masterpiece
943 of typesetting, but the user should see, what the package is able to do
944 and what \texttt{not}.\par
945 The following text is from St.~Augustin, De corr.~et gratia XII,~34%
946 \footnote{De corr. et gratia XII, 34, ALG VII, 214f.},
947 latin and german.\par
948 \begin{Parallel}[v]{0.4\textwidth}{0.51\textwidth}
949 \tolerance=1000
950 %</example1>
951 % \end{macrocode}
952 %
953 % \subsection{typesetting on two pages}
954 % \task{me}{There is a bug in the algorithm to typeset on two pages.
955 % I must have a look at this later.}
956 % \begin{macrocode}
957 %<*example2>
958 \NeedsTeXFormat{LaTeX2e}
959 \documentclass[12pt]{article}
960 \usepackage[Verbose]{parallel}
961 \linespread{1.9}
962 \textwidth10.5cm
963 \textheight14cm
964 \begin{document}
965 \Large\par
966 This is a sample \LaTeX{}-file for the \texttt{Parallel}-environment. It
967 is typesetted with \verb+\linespread{1.9}+, \verb+\textheight14cm+,
968 \verb+\textwidth10.5cm+ and \verb+\Large+ for that we need more space on
969 the pages and some pagebreaks are visible. This really is no masterpiece
970 of typesetting, but the user should see, what the package is able to do
971 and what \texttt{not}.\par
972 The following text is from St.~Augustin, De corr.~et gratia XII,~34%
973 \footnote{De corr. et gratia XII, 34, ALG VII, 214f.},
974 latin and german.\par
975 \begin{Parallel}[p]{}{}
976 %</example2>
977 % \end{macrocode}
978 %
979 % \subsection{Common Text for the two Examples}
980 % Here we see the common text for our examples.
981 % \begin{macrocode}
982 %<*example1|example2|driver>
983 \ParallelLText{Itemque ipsa adiutoria distinguenda sunt. Aliud est
984 adiutorium sine quo aliquid non fit, et aliud est adiutorium quo
985 aliquid fit. \ldots}
986 \ParallelRText{Und ebenso mu\ss\ man die Gnadenhilfen selbst
987 unterscheiden. Etwas anderes ist eine Hilfe, ohne die etwas nicht
988 geschieht, und etwas anderes eine Hilfe, durch die etwas
989 geschieht.\ldots}
990 \ParallelPar
991 \ParallelLText{Primo itaque homini, qui in eo bono quo factus fuerat
992 rectus acceperat posse non peccare, posse non mori, posse ipsum bonum
993 non deserere, datum est adiutorium perseverantiae, non quo fieret ut
994 perseveraret, sed sine quo per liberum arbitrium perseverare non
995 posset. Nunc vero sanctis in regnum Dei per gratiam Dei praedestinatis
996 non tale adiutorium perseverantiae datur, sed tale ut eis perseverantia
997 ipsa donetur; non solum ut sine isto dono perseverantes esse non
998 possint, verum etiam ut per hoc donum non nisi perseverantes sunt.}
999 \ParallelRText{Dem ersten Menschen, der in dem Gute, worin er gerecht
1000 erschaffen war, die F\"ahigkeit empfangen hatte, nicht zu s\"undigen,
1001 nicht zu sterben und vom Guten selbst nicht ab\-zufallen, ist demnach
1002 die Gnade der Beharrlichkeit verliehen worden, nicht jene, wo\-durch
1003 seine Beharrlichkeit bewirkt worden w\"are, sondern jene, ohne die er
1004 nicht imstande gewesen w\"are, mit seinem freien Willen auszuharren.
1005 Jetzt aber wird den Heiligen, die durch die Gnade Gottes f\"ur das Reich
1006 Gottes vorher\-bestimmt sind, nicht eine solche Gnade der Beharrlichkeit
1007 gegeben, sondern eine derartige, da\ss\ ihnen die Beharrlichkeit selbst
1008 geschenkt wird; daher sind sie ohne dieses Gnadengeschenk nicht nur
1009 unf\"ahig zur Beharrlichkeit, sondern sind auch durch dieses Geschenk
1010 Nurbeharrende.}
1011 \end{Parallel}
1012 \end{document}
1013 %</example1|example2|driver>
1014 % \end{macrocode}
1015 %
1016 % \Finale
1017 %
1018 % \subsection{Final commands}
1019 % \begin{macrocode}
1020 %<*package>
1021 \endinput
1022 %
1023 %% End of parallel.sty
1024 %</package>
1025 % \end{macrocode}
1026 %
1027 % \section{Sample-text}
1028 % And finally we see the output of our sample-text typesetted parallel
1029 % on one page with vertical-line. The text is from St.~Augustin,
1030 % De correptione et gratia XII,~34\footnote{De corr. et gratia XII,~34,
1031 % ALG VII, 214f.}, latin and german.\par\vspace*{1ex}\par
1032 %
1033