diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/parallel/parallel.dtx |
Initial commit
Diffstat (limited to 'macros/latex/contrib/parallel/parallel.dtx')
-rw-r--r-- | macros/latex/contrib/parallel/parallel.dtx | 1033 |
1 files changed, 1033 insertions, 0 deletions
diff --git a/macros/latex/contrib/parallel/parallel.dtx b/macros/latex/contrib/parallel/parallel.dtx new file mode 100644 index 0000000000..009ffeadab --- /dev/null +++ b/macros/latex/contrib/parallel/parallel.dtx @@ -0,0 +1,1033 @@ +% +% Copyright (c) 1994-2003 Matthias Eckermann +% +% This program may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.2 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.2 or later is part of all distributions of LaTeX +% version 1999/12/01 or later. +% +% This program consists of the files parallel.dtx, parallel.ins, readme +% +% +% \iffalse meta-comment +%<*!example1> +%<*!example2> +%<*!driver> +% +% \begin{macrocode} + %% + %% $Id: parallel.dtx,v 1.11 2003/04/13 16:54:40 mge Exp $ + %% + %% $Log: parallel.dtx,v $ + %% Revision 1.11 2003/04/13 16:54:40 mge + %% cleanups + %% + %% Revision 1.10 2003/04/13 16:52:04 mge + %% Beta 4 fixed (not tagging:-) + %% + %% Revision 1.9 2003/04/13 16:47:07 mge + %% correct checksum + %% + %% Revision 1.8 2003/04/13 16:46:14 mge + %% cvs cleanups + %% + %% Revision 1.7 2003/04/13 16:36:22 mge + %% changed \fileversion + %% + %% Revision 1.6 2003/04/13 16:27:30 mge + %% added readme + %% + %% Revision 1.5 2003/04/13 16:17:18 mge + %% added minor changes (fmi) + %% License->LPPL (mge) + %% + %% Revision 1.4 2003/04/13 15:51:44 mge + %% minor changes (cosmetic) + %% + %% Revision 1.3 2000/04/01 08:44:40 mge + %% updated \fileversion \filedate + %% + %% Revision 1.2 2000/04/01 08:42:39 mge + %% initial checkin + %% + %% author(s) : Matthias Eckermann (mge), Berlin, Germany + %% - debugging : Bernd Raichle (br), Stuttgart, Germany + %% - contributions : Wonkoo Kim (wk), Pittsburgh, PA, USA + %% Frank Mittelbach (fmi) , Mainz, Germany + %% history : 2003-04-13 Minor corrections (fmi) + %% License->LPPL (mge) + %% 10.11.1997 (2.0 interim-public-beta) (mge) + %% 28.02.1997 (option 'verbose') + %% 01.10.1996 (better spacing) (br) + %% 29.09.1996 (smarter column support) (wk) + %% Sep.1996 (on pages, VLine, '.dtx') (mge) + %% 26.03.1995 (works within {list}s) (mge) + %% 15.02.1995 (first public release) (mge) + %% 19.10.1994 (initial tests) (mge) + %% email : mge@arcor.de (private), mge@suse.de (job) + %% description : provides a small tool to typeset in two columns + %% or on two pages parallel, e.g. if you want to set + %% two languages besides. + %% thanks : R.Braun, H.Kopka, J.Schrod + %% +% \end{macrocode} +% \fi +% +% \CheckSum{808} +% \CharacterTable +% {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 +% 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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \iffalse meta-comment +%</!driver> +% \fi +\def\fileversion{beta 4} +\def\filedate{2003/04/13} +% +% \MakeShortVerb{\|} +% +% \title{The \texttt{Parallel}-Package\thanks{% +% I want to mention and thank +% Bernd Raichle (Stuttgart) and Wonkoo Kim (Pittsburgh, PA), +% who helped developing this packages with +% their ideas, debugging and pieces of code.}\\ +% release \fileversion{} +% } +% +% \author{Matthias Eckermann, Berlin\\ +% mge@arcor.de, mge@suse.de} +% +% \date{\filedate} +% \maketitle +% +% \begin{abstract} +% This package provides a small tool to typeset in two columns or on +% two pages parallel; this might be helpful, +% e.g. if you want to set two languages besides in translations or +% if you want to compare two texts. There are some caveats and some +% limitations which are described in this documentation.\par +% The gentle reader might excuse wrong words or bad constructions, +% but I'm not a ``native speaker''.\par +% Please remember: this is only an ``interim-public-beta'' +% until I'll have finished the complete documentation, +% the code should be fine. +% \end{abstract} +% +% {\parskip 0pt\tableofcontents} +% +% \StopEventually{} +% +% \section{Usage} +% \subsection{Simple Usage -- for the Impatient} +% It is recommended, that you first read the complete section \emph{Usage}\ +% to understand \texttt{Parallel}'s behavior and limitations, but if one +% wants to begin immediately and there is only one paragraph in two columns +% parallel, one may try this code: +% \begin{verbatim} +% \usepackage{parallel} +% ... +% \begin{Parallel}{<left-width>}{<right-width>} +% \ParallelLText{<left-text>} +% \ParallelRText{<right-text>} +% \end{Parallel} +% \end{verbatim} +% It generates the two texts typesetted parallel in two columns, footnotes +% at the end of the \texttt{Parallel}-Environment. +% +% \subsection{Advanced Usage} +% But, I think, most people want a more flexible handling of their parallel +% texts. So they will have to use a more difficult structure of environment +% \texttt{parallel}: +% \begin{verbatim} +% \usepackage[<package_options>]{parallel} +% ... +% \begin{Parallel}[<environment_options>]{<left-width>}{<right-width>} +% \ParallelLText{<left-text>} +% \ParallelRText{<right-text>} +% \ParallelPar +% \ParallelLText{<left-text>} +% ... +% \renewcommand{\ParallelAtEnd}{<text>} +% \end{Parallel} +% \end{verbatim} +% +% \DescribeMacro{\ParallelPar} +% |\ParallelPar| is the most important Macro of this package; +% it tells the environment to begin a new \emph{parallel paragraph}, +% i.e.: left and right texts are printed out to their lengths +% and then we begin new on the same vertical position, as if you close the +% environment |Parallel| and begin a new one. Therefore |\ParallelPar| must +% not be left out after a pair of |\ParallelLText| -- |\ParallelRText| +% (only at the total end of the environment). +% +% \DescribeMacro{\ParallelAtEnd} +% With the help of |\ParallelAtEnd|\par +% \hspace*{3em}(|\renewcommand{\ParallelAtEnd}{<Your text here>}|)\par +% you can set some text between the parallel columns and the footnotes. +% +% \DescribeEnv{Parallel} +% Now we'll have a look at the options of |Parallel|. +% +% \begin{description} +% \item[Package options] (the options, which can be chosen when loading +% |parallel| in the document-preamble). The following options are +% possible, but only |Verbose| and |SeparatedFootnotes| can be combined +% with one of the others, while out of the |*Nums|-options only one can +% be set at one time. This behaviour may change in a later release. +% \begin{description} +% \item[OldStyleNums] set the footnote-numbers with \LaTeX's +% |\oldstylnums|-command +% \item[RaiseNums] like |\footnote| +% \item[ItalicNums] the footnote-numbers are set in Italics +% \item[RomanNums] using |\romannnumeral| +% \item[SeparatedFootnotes] The footnotes of the left and right columns +% are separately numbered and printed. The right footnotes are signed +% with the content of |\ParallelDot| (usual |$\cdot$|). +% \item[Verbose] tell the author used environment and its options\dots +% \end{description} +% \item[Environment options] Due to the work of W.Kim (see below) +% the |<left-width>| and/or |<right-width>| may be left empty; +% the package will set the two widths to about 50\%\ of |\textwidth|. +% But it is also possible to set both widths with absolute (e.g. |3cm|) +% or relative (e.g. |0.37\textwidth|) values.\par +% One may use only one of the \emph{real} options; if none is used, +% ``c'' is assumed, if a bad character is chosen, an error-message +% will appear, but the user may go on by pressing |<return>|. +% \begin{description} +% \item[``c''] (\emph{Columns}) print in columns +% \item[``v''] (\emph{Vertical line between columns}) print in columns, +% but with intermediate |\vline| +% \item[``p''] (\emph{Pages}) print on two pages; +% if one box is empty, the corresponding page is left blank +% (not a bug, but feature!) +% \task{me}{% +% \item[``a''] (\emph{Autocomputed pages}) print on two pages, +% autocompute the width of the text that holds less characters. +% \item[``s''] (\emph{Save/Store once autocalculated widths}) +% Using this option, the widths autocalculated in the first +% |\ParallelPar| will be used for the other paragraphs of this +% \emph{environment}. This option is introduced, to enable +% autocalculation \emph{and}\ the same look-alike of every paragraph +% of an environment |Parallel|. +% \item[``r''] (\emph{Resume/Reload once autocalculated widths}) +% This option allows to transfer the widths-values between +% environments.% +% }% +% \end{description} +% \end{description} +% +% \task{me}{% +% \subsubsection{Typesetting in Columns} +% \subsubsection{Typesetting on Pages} +% } +% +% \section{Limitations, Warnings} +% \begin{itemize} +% \item \emph{tabular}s, \emph{minipage}s, ... inside of +% |\ParallelLText| or |\ParallelRText| will cause unexpected results. +% But you may use these constructions outside |\ParallelLText| +% or |\ParallelRText|, but inside the environment, +% when typesetting in columns; you \emph{must}\ not use those things +% (within the environment), when typesetting on pages parallel. +% \item \emph{footnote}s are printed at the end of the environment. +% I hope, this is a begin of a solution on further footnote-problems. +% \item The max. size of ``left-text'' and ``right-text'' is limited. +% \item The lines are typesetted really parallel, i.e. large +% size-differences will cause bad or dirty output. +% \end{itemize} +% +% \section{Todo-List} +% There are some ideas and todos, that will be fixed in the final release +% or in later releases: +% \begin{itemize} +% \item Most important: complete documentation. +% \item Dominik Neidinger, Munich, asked for leaving out |\ParallelPar| +% and setting to be done automatically by |\ParallelLText| and/or +% |\ParallelRText|. +% \item Add more environment-options: +% \begin{itemize} +% \item[``a''] (\emph{Autocomputed pages}) print on two pages, +% autocompute the width of the text that holds less characters. +% \item[``s''] (\emph{Save/Store once autocalculated widths}) +% Using this option, the widths autocalculated in the first +% |\ParallelPar| will be used for the other paragraphs of this +% \emph{environment}. This option is introduced, to enable +% autocalculation \emph{and}\ the same look-alike of every paragraph +% of an environment |Parallel|. +% \item[``r''] (\emph{Resume/Reload once autocalculated widths}) +% This option allows to transfer the widths-values between +% environments. +% \end{itemize} +% \item Use ``|\newif|'' instead of many integer variables. +% \item different footnote-types for left and right footnotes +% \item There might be a bug in the algorithm to typeset on two pages. +% I must have a look at this later. +% \end{itemize} +% +% \section{Documentation-Driver} +% +% \begin{macrocode} +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\documentclass[a4paper]{ltxdoc} +\usepackage{parallel} +\CodelineNumbered +\parskip2ex plus1ex minus1ex +\parindent0em +\setlength\hfuzz{10pt} +\setcounter{tocdepth}{2} +\hbadness=5000 +\addtolength{\textwidth}{0.5in} +\pagestyle{myheadings} +\markboth{``Parallel''-package (\fileversion, \filedate)}% +{``Parallel''-package (\fileversion, \filedate)} +\begin{document} + \DocInput{parallel.dtx} + \begin{Parallel}[v]{0.4\textwidth}{0.51\textwidth} + \tolerance=1000 +%</driver> +% \end{macrocode} +% +% \section{macro package source code} +% \subsection{implementation rules} +% Even if some people will find this confusing or too much to type: I +% decided to use real long names for all dimensions, counters, boxes and +% macros. Every name introduced in this package starts with |\Parallel|, +% so that it is unary (I hope) in the \LaTeX{}-world. +% +% \subsection{preamble} +% Here is the standard header for a \LaTeX{}-package. This package is +% called \texttt{parallel}\ and we just work with release 2. +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{parallel}[\filedate, setting two texts parallel (me)] +\message{`parallel': setting two texts parallel, (\fileversion) \filedate.} +% \end{macrocode} +% +% \subsection{lengths} +% The two dimensions |\ParallelLWidth| and |\ParallelRWidth| hold the +% actual size of the left and right column (or page). +% \begin{macrocode} +\newdimen\ParallelLWidth +\newdimen\ParallelRWidth +% \end{macrocode} +% +% |\ParallelTextWidth| is mainly a copy of |\textwidth|, while +% |\ParallelLeftMargin| holds the |\leftmargin|, e.g. if one sets a +% Parallel-Environment inside of another construction (e.g. list). +% \begin{macrocode} +\newdimen\ParallelTextWidth +\newdimen\ParallelLeftMargin +% \end{macrocode} +% +% While the user can redefine |\ParallelUserMidSKip| (and this is used for +% calculating the sizes and skips), |\ParallelMainMidSkip| holds the skip +% which finally is used for typesetting. +% \begin{macrocode} +\newdimen\ParallelUserMidSkip +\newdimen\ParallelMainMidSkip +% \end{macrocode} +% +% \subsection{boxes} +% \begin{macrocode} +\newbox\ParallelLBox +\newbox\ParallelRBox +\newbox\ParallelBoxVar +% \end{macrocode} +% +% \subsection{tokens} +% \begin{macrocode} +\newbox\ParallelLTok +\newbox\ParallelRTok +% \end{macrocode} +% +% \subsection{counts} +% First we need some ``boolean'' variables. As you see, I'am a +% C-programmer using integer-variables for boolean operations. +% Perhaps it would be better, to use |\newif| here -- later!? +% \task{me}{Use ``|\newif|'' instead of integer variables} +% \begin{macrocode} +\newcount\ParallelBoolVar +\newcount\ParallelBoolMid +% \end{macrocode} +% +% |\ParallelWhichBox| tells the program, if the left ($=$0) or the right +% text-box ($=$1) shall be typesetted (when in page-mode). +% +% In |\ParallelMainMode| the information is stored, if the environment is +% ``on pages'', ``in columns'' or ``in columns with vertical line''. +% \begin{macrocode} +\newcount\ParallelWhichBox +\newcount\ParallelMainMode +% \end{macrocode} +% +% These are the variables dealing with the special footnote-implementation +% used in environment ``Parallel''. |\ParallelLFNCounter|, +% |\ParallelRFNCounter| and |\ParallelMaxFN| are self-explaining. +% +% |\ParallelFNMode| is again a boolean-like variable. +% If |\ParallelFNMode|$=$1, footnotes are countered and set separated +% for each columns, if |\ParallelFNMode|$\ne$1, only one +% footnote-counter is used: all footnotes are set in one block +% (columns mixed!). +% +% But |\ParallelFNNumMode| needs some description. It holds the style in +% which the footnote-numbers (not those in the text, but those before the +% footnote-text) are set: +% \begin{description} +% \item[0] normal numbers +% \item[1] old style numbers (|\oldstylenums|) +% \item[2] raised numbers +% \item[3] italic numbers +% \item[4] roman numbers (|\romannumeral|) +% \end{description} +% \begin{macrocode} +\newcount\ParallelFNMode +\newcount\ParallelLFNCounter +\newcount\ParallelRFNCounter +\newcount\ParallelMaxFN +\newcount\ParallelFNNumMode +% \end{macrocode} +% +% \subsection{options} +% The following options (given to the package in |\usepackage|) set the +% footnote-variables in an appropriate way. Obviously only one of +% ``OldStyleNums'', ``RaiseNums'', ``ItalicNums'' or ``RomanNums'' is +% possible, but one can combine these with ``SeparatedFootnotes'' and +% ``Verbose''. Perhaps - one day far away -- +% \task{me}{different footnote-types for left and right footnotes} +% it will be possible, to have arabic-numbered left-footnotes and +% roman-numbered right-footnotes; but today the right ones are marked by a +% little dot (or something like that, see below, |\ParallelDot|). +% \begin{macrocode} +\newcommand{\ParallelMessage}[1]{\relax} +\DeclareOption{Verbose}{% + \renewcommand{\ParallelMessage}[1]{\message{#1}} + \message{Verbose} +} +\DeclareOption{OldStyleNums}{% + \ParallelFNNumMode=1\ParallelMessage{OldStyleNums}} +\DeclareOption{RaiseNums}{% + \ParallelFNNumMode=2\ParallelMessage{RaiseNums}} +\DeclareOption{ItalicNums}{% + \ParallelFNNumMode=3\ParallelMessage{ItalicNums}} +\DeclareOption{RomanNums}{% + \ParallelFNNumMode=4\ParallelMessage{RomanNums}} +\DeclareOption{SeparatedFootnotes}{% + \ParallelFNMode=1\ParallelMessage{SeparatedFootnotes}} +% \end{macrocode} +% +% \subsection{internal commands} +% \subsubsection{footnotes} +% +% The |\footnote|s were the most important problem when first trying to +% implement our package. So here is a description of +% \begin{itemize} +% \item why footnotes are a problem in our task, +% \item which problems are solved and in which way, +% \item what is not solved and what seems to be \emph{not}\ possible. +% \end{itemize} +% +% \task{me}{% +% \paragraph{Problems} +% \paragraph{Solutions} +% \paragraph{Unsolved Tasks} +% } +% \DescribeMacro{\ParallelLFootnote} +% \begin{macrocode} +\newcommand{\ParallelLFootnote}[1]{% + \global\advance\ParallelLFNCounter\@ne + \footnotemark[\number\ParallelLFNCounter]% + \expandafter\gdef% + \csname ParallelLFN\romannumeral\ParallelLFNCounter\endcsname{#1}} +% \end{macrocode} +% +% \DescribeMacro{\ParallelRFootnote} +% \begin{macrocode} +\newcommand{\ParallelRFootnote}[1]{% + \global\advance\ParallelRFNCounter\@ne + \footnotemark[\number\ParallelRFNCounter]% + \expandafter\gdef% + \csname ParallelRFN\romannumeral\ParallelRFNCounter\endcsname{#1}} +% \end{macrocode} +% +% \DescribeEnv{ParallelFNEnviron} +% \begin{macrocode} +\newenvironment{ParallelFNEnviron}{% + \footnotesize + \begin{list}{}{% + \leftmargin=4em \rightmargin=\z@ + \topsep=\z@skip \itemsep=\z@skip + \labelwidth=3em \labelsep=1em% + \renewcommand{\makelabel}[1]{{\hfill\footnotesize ##1}}% + }% +}{% + \end{list}% +} +% \end{macrocode} +% +% \DescribeMacro{\ParallelShowFNList} +% \begin{macrocode} +\newcommand{\ParallelShowFNList}{% + % footnotes in left or right column, i.e. left+right>0? + \ParallelMaxFN=\ParallelLFNCounter + \advance\ParallelMaxFN \ParallelRFNCounter + \ifnum\ParallelMaxFN>\z@ + \ParallelMessage{Parallel Footnotes (}% + \begin{ParallelFNEnviron}% + \ParallelMaxFN=\ParallelLFNCounter + \global\ParallelLFNCounter=\z@ + \loop + \ifnum\ParallelLFNCounter<\ParallelMaxFN + \global\advance\ParallelLFNCounter \@ne + \item[\ifcase\ParallelFNNumMode \number\ParallelLFNCounter% + \or \oldstylenums{\the\ParallelLFNCounter}% + \or \raisebox{1ex}{\the\ParallelLFNCounter}% + \or \textit{\number\ParallelLFNCounter}% + \or \romannumeral\ParallelLFNCounter% + \else \number\ParallelLFNCounter \fi]% + \par + {\csname ParallelLFN\romannumeral\ParallelLFNCounter\endcsname}% + \par + \repeat + \end{ParallelFNEnviron}% + \ifnum\ParallelFNMode=\@ne + \begin{ParallelFNEnviron}% + \ParallelMaxFN=\ParallelRFNCounter + \global\ParallelRFNCounter=\z@ + \loop + \ifnum\ParallelRFNCounter<\ParallelMaxFN + \global\advance\ParallelRFNCounter \@ne + \item[\ifcase\ParallelFNNumMode + \number\ParallelRFNCounter\ParallelDot + \or \oldstylenums{\the\ParallelRFNCounter}\ParallelDot + \or \raisebox{1ex}{\the\ParallelRFNCounter\ParallelDot}% + \or \textit{\number\ParallelRFNCounter\ParallelDot}% + \or \romannumeral\ParallelLFNCounter% + \else \number\ParallelRFNCounter\ParallelDot \fi]% + \par + {\csname ParallelRFN\romannumeral\ParallelRFNCounter\endcsname}% + \par + \repeat + \end{ParallelFNEnviron}% + \fi + \global\ParallelLFNCounter=\z@ + \global\ParallelRFNCounter=\z@ + \ParallelMessage{)}% + \else + \ParallelMessage{No Parallel Footnotes}% + \fi +} +% \end{macrocode} +% +% \subsubsection{typesetting on one page} +% \DescribeMacro{\ParallelParOnePage} +% I'm glad that Bernd Raichle\footnote{Stuttgart;% +% raichle@informatik.uni-stuttgart.de; 1996/10/01}\ +% spent his rare time to debug the code of this function and of the +% environment |ParallelFNEnviron|. Frank Mittelbach enhanced it in 2002/2003. +% \begin{macrocode} +\newcommand{\ParallelParOnePage}{% + \ifnum\ParallelBoolVar=\@ne + \par\begingroup + \leftmargin=\z@ \rightmargin=\z@ + \parskip=\z@skip \parindent=\z@ + \vbadness=10000 + \vfuzz=3ex + \splittopskip=\z@skip + \loop% + \ifnum\ParallelBoolVar=\@ne% + \noindent + \hbox to\textwidth{% + \hskip\ParallelLeftMargin + \hbox to\ParallelTextWidth{% + \ifvoid\ParallelLBox + \hskip\ParallelLWidth + \else + \ParallelWhichBox=\z@ + \vbox{\setbox\ParallelBoxVar + =\vsplit\ParallelLBox to\dp\strutbox% + \unvbox\ParallelBoxVar}% + \fi + \strut + \ifnum\ParallelBoolMid=\@ne + \hskip\ParallelMainMidSkip + \vrule + \else + \hss + \fi + \hss + \ifvoid\ParallelRBox + \hskip\ParallelRWidth + \else + \ParallelWhichBox=\@ne + \vbox{\setbox\ParallelBoxVar + =\vsplit\ParallelRBox to\dp\strutbox% + \unvbox\ParallelBoxVar}% + \fi}}% + \ifvoid\ParallelLBox \ifvoid\ParallelRBox + \global\ParallelBoolVar=\z@ + \fi\fi% + \fi% + \ifnum\ParallelBoolVar=\@ne% + \penalty\interlinepenalty + \repeat + \par + \endgroup + \fi} +% \end{macrocode} +% +% \subsubsection{typesetting on two page} +% +% \DescribeMacro{\ParallelParTwoPages} +% \begin{macrocode} +\newcommand{\ParallelParTwoPages}{% + \ifnum\ParallelBoolVar=\@ne + \par\begingroup + \global\ParallelWhichBox=\@ne + \newpage + \vbadness=10000 + \vfuzz=3ex + \splittopskip=\z@skip + \loop% + \ifnum\ParallelBoolVar=\@ne% + \ifnum\ParallelWhichBox=\@ne + \ifvoid\ParallelLBox \mbox{} \newpage + \else\global\ParallelWhichBox=\z@\fi + \else + \ifvoid\ParallelRBox \mbox{} \newpage + \else\global\ParallelWhichBox=\@ne\fi + \fi + \ifnum\ParallelWhichBox=\z@ + \ifodd\thepage \mbox{} \newpage \fi + \hbox to\textwidth{% + \vbox{\vsplit\ParallelLBox to.98\textheight}}% + \else + \ifodd\thepage\relax\else \mbox{} \newpage \fi + \hbox to\textwidth{% + \vbox{\vsplit\ParallelRBox to.98\textheight}}% + \fi + \vspace*{\fill}\newpage + \fi + \ifvoid\ParallelLBox\ifvoid\ParallelRBox + \global\ParallelBoolVar=\z@ + \fi\fi + \ifnum\ParallelBoolVar=\@ne + \repeat + \par + \endgroup + \fi} +% \end{macrocode} +% +% \subsection{user commands} +% +% \task{me}{BR: |\egroup| nicht notwendig, da durch Endeklammer des Arguments gegeben} +% \DescribeMacro{\ParallelAfterText} +% \begin{macrocode} +\newcommand{\ParallelAfterText}{% + \global\ParallelBoolVar=\@ne + \let\footnote=\ParallelOldFootnote\endgroup} +% \end{macrocode} +% +% \DescribeMacro{\ParallelCheckOpenBrace} +% \begin{macrocode} +\newcommand{\ParallelCheckOpenBrace}{% + \ifx\x\bgroup \else + \errmessage{Missing opening brace}% + \fi + \endgroup} +% \end{macrocode} +% +% \DescribeMacro{\ParallelLText} +% \begin{macrocode} +\newcommand{\ParallelLText}{% + \everypar{}\@restorepar\begingroup + \hbadness=3000 + \let\footnote=\ParallelLFootnote + \ParallelWhichBox=0 + \global\setbox\ParallelLBox=\vbox\bgroup \hsize=\ParallelLWidth + \aftergroup\ParallelAfterText + \begingroup \afterassignment\ParallelCheckOpenBrace \let\x=} +% \end{macrocode} +% +% \DescribeMacro{\ParallelRText} +% \begin{macrocode} +\newcommand{\ParallelRText}{% + \everypar{}\@restorepar\begingroup + \hbadness=3000 + \ifnum\ParallelFNMode=\@ne + \let\footnote=\ParallelRFootnote + \else + \let\footnote=\ParallelLFootnote + \fi + \ParallelWhichBox=\@ne + \global\setbox\ParallelRBox=\vbox\bgroup \hsize=\ParallelRWidth + \aftergroup\ParallelAfterText + \begingroup \afterassignment\ParallelCheckOpenBrace \let\x=} +% \end{macrocode} +% +% \DescribeMacro{\ParallelAtEnd} +% |\ParallelAtEnd| must be defined: the user just types |\renewcommand|, +% and everything is right (I hope); it's a dummy. +% \begin{macrocode} +\newcommand{\ParallelAtEnd}{} +% \end{macrocode} +% +% \DescribeMacro{\ParallelPar} +% Actually, this is a dummy again or a ``Pointer'' to the |\ParallelPar|, +% which is choosen. +% \task{me/dn}{Dominik Neidinger (dn) requested leaving out |\ParallelPar| +% and the setting to be done automatically by |\ParallelLText| or +% |\ParallelRText|; mh, let's think about that.} +% \begin{macrocode} +\newcommand{\ParallelPar}{} % Dummy +% \end{macrocode} +% +% \DescribeMacro{\ParallelDot} +% \begin{macrocode} +\newcommand{\ParallelDot}{\ensuremath{\cdot}} +% \end{macrocode} +% +% \subsection{Environment ``Parallel''} +% +% \DescribeEnv{Parallel} +% \begin{macrocode} +\newenvironment{Parallel}[3][c]{% + \begingroup% + \ParallelTextWidth=\linewidth + \ParallelLeftMargin=\textwidth + \advance\ParallelLeftMargin by-\linewidth +% \end{macrocode} +% +% The following code checks for the optional argument: it tells the +% environment, if the user wants typesetting on page ('p'), in columns +% ('c') or in columns with an intermediate |\vline| ('v'). +% If none of these options is given, column mode is chosen, +% but if there is a wrong char (as an argument), +% an error message appears, but the user may go on by pressing |<return>|. +% +% \begin{macrocode} + \if #1p\relax + \ParallelMessage{ on Pages (}% + \ParallelMainMode=\z@ + \renewcommand{\ParallelPar}{\ParallelParTwoPages} + \else + \if #1a\relax + \ParallelMessage{ autocomputed Pages (}% + \ParallelMainMode=\tw@ + \renewcommand{\ParallelPar}{\ParallelParTwoPages} + \else + \tolerance=600 % sorry, but neccessary + \emergencystretch=.5em % dto. + \ParallelMainMode=\@ne + \renewcommand{\ParallelPar}{\ParallelParOnePage} + \if #1v\relax + \ParallelBoolMid=\@ne + \ParallelMessage{ in Columns, with VLine (}% + \else + \if #1c\relax\else + \errhelp{possible options: + 'p'age, 'c'olumn or columns with 'v'line --- + type <return> to proceed in column-mode} + \errmessage{bad option '#1' to environment 'Parallel'} + \fi + \ParallelMessage{ in Columns (}% + \fi\fi\fi +% \end{macrocode} +% +% Smart column width support was mainly done by +% Wonkoo Kim\footnote{Pittsburgh, PA; wkim+@pitt.edu; 1996/09/29}. +% |\ParallelLWidth| or |\ParallelRWidth| fields can be left blank in user +% document. Their default width (in column-mode) is +% $0.5$|\textwidth| $-$ |\ParallelUserMidSkip| for null widths. +% Even the |\ParallelUserMidSkip| can be set by user; its default value +% is 0.5em. If only one width is given, the other width will be computed. +% +% First we must see, if the arguments of the environment are given or +% not. If not, the value is set to zero inches, for that we have a value, +% that can be calculated. +% \begin{macrocode} + \def\ParallelArgL{#2} \def\ParallelArgR{#3} + \ifx\ParallelArgL\empty\ParallelLWidth=0in\else\ifx\ParallelArgL\space + \ParallelLWidth=0in\else\setlength\ParallelLWidth{#2}\fi\fi + \ifx\ParallelArgR\empty\ParallelRWidth=0in\else\ifx\ParallelArgR\space + \ParallelRWidth=0in\else\setlength\ParallelRWidth{#3}\fi\fi +% \end{macrocode} +% +% If we are in column-mode (|\ParallelMainMode|$=1$): +% \begin{macrocode} + \ifnum\ParallelMainMode=\@ne + \ifdim\ParallelLWidth>1em + \ifdim\ParallelRWidth>1em +% \end{macrocode} +% \begin{itemize} +% \item If both dimensions are set, we calculate the left width and set +% the vertical line centered (by calculating) +% \end{itemize} +% \begin{macrocode} + \ParallelMainMidSkip=\linewidth + \advance\ParallelMainMidSkip by-\ParallelLWidth + \advance\ParallelMainMidSkip by-\ParallelRWidth + \advance\ParallelMainMidSkip by-.5pt + \advance\ParallelMainMidSkip by-\ParallelLeftMargin + \divide\ParallelMainMidSkip by 2 + \else +% \end{macrocode} +% \begin{itemize} +% \item If only the left width is given, the mid-skip (between vertical +% line and text) is set to |\ParallelUserMidSkip|), the width of right +% text is calculated. +% \end{itemize} +% \begin{macrocode} + \ParallelRWidth=\linewidth + \advance\ParallelRWidth by-\ParallelLWidth + \advance\ParallelRWidth by-2\ParallelUserMidSkip + \advance\ParallelRWidth by-\ParallelLeftMargin + \ParallelMainMidSkip=\ParallelUserMidSkip + \fi + \else + \ifdim\ParallelRWidth>1em +% \end{macrocode} +% \begin{itemize} +% \item If only the right width is given, the mid-skip (between vertical +% line and text) is set to |\ParallelUserMidSkip|), the width of left +% text is calculated. +% \end{itemize} +% \begin{macrocode} + \ParallelLWidth=\linewidth + \advance\ParallelLWidth by-\ParallelRWidth + \advance\ParallelLWidth by-2\ParallelUserMidSkip + \advance\ParallelLWidth by-\ParallelLeftMargin + \ParallelMainMidSkip=\ParallelUserMidSkip + \else +% \end{macrocode} +% \begin{itemize} +% \item If none of the dimensions is given, the mid-skip (between vertical +% line and text) is set to |\ParallelUserMidSkip|, the left and right +% dimensions are calculated -- each the same width: +% $0.5$|\linewidth| $-$ |\ParallelLeftMargin| $-$ |\ParallelUserMidSkip|. +% \end{itemize} +% \begin{macrocode} + \ParallelLWidth=.5\linewidth + \advance\ParallelLWidth by-\ParallelLeftMargin + \advance\ParallelLWidth by-\ParallelUserMidSkip + \ParallelRWidth=\ParallelLWidth + \ParallelMainMidSkip=\ParallelUserMidSkip + \fi + \fi + \else +% \end{macrocode} +% +% If we are in page-mode (|\ParallelMainMode|$\ne$1): +% \begin{itemize} +% \item If both dimensions are given (standard usage): nothing happens +% \item If only left size is given: right is set to +% |\linewidth| $-$ |\ParallelLeftMargin|. +% \end{itemize} +% \begin{macrocode} + \ifdim\ParallelLWidth>1em + \ifdim\ParallelRWidth>1em + \else + \ParallelRWidth=\linewidth + \advance\ParallelRWidth by-\ParallelLeftMargin + \fi + \else +% \end{macrocode} +% \begin{itemize} +% \item If only right size is given: left is set to +% |\linewidth| $-$ |\ParallelLeftMargin|. +% \end{itemize} +% \begin{macrocode} + \ifdim\ParallelRWidth>1em + \ParallelLWidth=\linewidth + \advance\ParallelLWidth by-\ParallelLeftMargin + \else +% \end{macrocode} +% \begin{itemize} +% \item If none of the sizes is given: each is set to +% |\linewidth| $-$ |\ParallelLeftMargin|. +% \end{itemize} +% \begin{macrocode} + \ParallelLWidth=\linewidth + \advance\ParallelLWidth by-\ParallelLeftMargin + \ParallelRWidth=\linewidth + \advance\ParallelRWidth by-\ParallelLeftMargin + \fi + \fi + \fi +% \end{macrocode} +% +% Now we do some standard-settings. +% \begin{macrocode} + \global\ParallelLFNCounter=\z@ + \global\ParallelRFNCounter=\z@ + \let\ParallelOldFootnote=\footnote +% \end{macrocode} +% +% We finished the start-part of this environment with setting the +% footnote-counters to zero and saved the old |\footnote|-macro. +% \begin{macrocode} +}{% +% \end{macrocode} +% +% Before leaving Parallel-environment with |\end{Parallel}|, we enshure, +% that all text was typesetted (by invoking |\ParallelPar|), then we call +% |\ParallelAtEnd|, to display some (optional) text before the footnotes. +% \begin{macrocode} + \ParallelPar% + \ParallelAtEnd% + \endgroup% +% \end{macrocode} +% +% Now, it's time to show the footnotes (by invoking |\ParallelShowFNList|) +% and to restore the original |\footnote|-macro. The only thing to do is, +% to close the message-braces opened at the beginning of our Environment. +% \begin{macrocode} + \ParallelShowFNList% + \let\footnote=\ParallelOldFootnote + \ParallelMessage{)}} +% \end{macrocode} +% +% \subsection{postamble, settings} +% When the package is loaded, it's neccessary to reset some of our +% Variables to standard-values; the options must be processed. +% \begin{macrocode} +\ParallelFNNumMode=\z@ +\ParallelFNMode=\z@ +\ParallelBoolMid=\z@ +\ParallelUserMidSkip=.5em +\ProcessOptions +%</package> +% \end{macrocode} +% +% \iffalse +%</!example2> +%</!example1> +% \fi +% +% \DeleteShortVerb{\|} +% +% \newpage \task{me}{necessary for correct setting of last example} +% +% \section{examples for \texttt{parallel.sty}} +% \subsection{typesetting in columns} +% \begin{macrocode} +%<*example1> +\NeedsTeXFormat{LaTeX2e} +\documentclass[12pt]{article} +\usepackage{parallel} +\linespread{1.9} +\textwidth10.5cm +\textheight15cm +\begin{document} + This is a sample \LaTeX{}-file for the \texttt{Parallel}-environment. + It is typesetted with \verb+\linespread{1.9}+, \verb+\textheight15cm+, + \verb+\textwidth10.5cm+, for that we need more space on + the pages and some pagebreaks are visible. This really is no masterpiece + of typesetting, but the user should see, what the package is able to do + and what \texttt{not}.\par + The following text is from St.~Augustin, De corr.~et gratia XII,~34% + \footnote{De corr. et gratia XII, 34, ALG VII, 214f.}, + latin and german.\par +\begin{Parallel}[v]{0.4\textwidth}{0.51\textwidth} + \tolerance=1000 +%</example1> +% \end{macrocode} +% +% \subsection{typesetting on two pages} +% \task{me}{There is a bug in the algorithm to typeset on two pages. +% I must have a look at this later.} +% \begin{macrocode} +%<*example2> +\NeedsTeXFormat{LaTeX2e} +\documentclass[12pt]{article} +\usepackage[Verbose]{parallel} +\linespread{1.9} +\textwidth10.5cm +\textheight14cm +\begin{document} +\Large\par + This is a sample \LaTeX{}-file for the \texttt{Parallel}-environment. It + is typesetted with \verb+\linespread{1.9}+, \verb+\textheight14cm+, + \verb+\textwidth10.5cm+ and \verb+\Large+ for that we need more space on + the pages and some pagebreaks are visible. This really is no masterpiece + of typesetting, but the user should see, what the package is able to do + and what \texttt{not}.\par + The following text is from St.~Augustin, De corr.~et gratia XII,~34% + \footnote{De corr. et gratia XII, 34, ALG VII, 214f.}, + latin and german.\par +\begin{Parallel}[p]{}{} +%</example2> +% \end{macrocode} +% +% \subsection{Common Text for the two Examples} +% Here we see the common text for our examples. +% \begin{macrocode} +%<*example1|example2|driver> + \ParallelLText{Itemque ipsa adiutoria distinguenda sunt. Aliud est + adiutorium sine quo aliquid non fit, et aliud est adiutorium quo + aliquid fit. \ldots} + \ParallelRText{Und ebenso mu\ss\ man die Gnadenhilfen selbst + unterscheiden. Etwas anderes ist eine Hilfe, ohne die etwas nicht + geschieht, und etwas anderes eine Hilfe, durch die etwas + geschieht.\ldots} + \ParallelPar + \ParallelLText{Primo itaque homini, qui in eo bono quo factus fuerat + rectus acceperat posse non peccare, posse non mori, posse ipsum bonum + non deserere, datum est adiutorium perseverantiae, non quo fieret ut + perseveraret, sed sine quo per liberum arbitrium perseverare non + posset. Nunc vero sanctis in regnum Dei per gratiam Dei praedestinatis + non tale adiutorium perseverantiae datur, sed tale ut eis perseverantia + ipsa donetur; non solum ut sine isto dono perseverantes esse non + possint, verum etiam ut per hoc donum non nisi perseverantes sunt.} + \ParallelRText{Dem ersten Menschen, der in dem Gute, worin er gerecht + erschaffen war, die F\"ahigkeit empfangen hatte, nicht zu s\"undigen, + nicht zu sterben und vom Guten selbst nicht ab\-zufallen, ist demnach + die Gnade der Beharrlichkeit verliehen worden, nicht jene, wo\-durch + seine Beharrlichkeit bewirkt worden w\"are, sondern jene, ohne die er + nicht imstande gewesen w\"are, mit seinem freien Willen auszuharren. + Jetzt aber wird den Heiligen, die durch die Gnade Gottes f\"ur das Reich + Gottes vorher\-bestimmt sind, nicht eine solche Gnade der Beharrlichkeit + gegeben, sondern eine derartige, da\ss\ ihnen die Beharrlichkeit selbst + geschenkt wird; daher sind sie ohne dieses Gnadengeschenk nicht nur + unf\"ahig zur Beharrlichkeit, sondern sind auch durch dieses Geschenk + Nurbeharrende.} +\end{Parallel} +\end{document} +%</example1|example2|driver> +% \end{macrocode} +% +% \Finale +% +% \subsection{Final commands} +% \begin{macrocode} +%<*package> +\endinput +% +%% End of parallel.sty +%</package> +% \end{macrocode} +% +% \section{Sample-text} +% And finally we see the output of our sample-text typesetted parallel +% on one page with vertical-line. The text is from St.~Augustin, +% De correptione et gratia XII,~34\footnote{De corr. et gratia XII,~34, +% ALG VII, 214f.}, latin and german.\par\vspace*{1ex}\par +% + |