Crafts

Copyright (c) Matthias Eckermann. This program consists of the files parallel.dtx, parallel.ins, readme

Categories
Published
of 19
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Description
Parallel -package (beta 4, 2003/04/13) 1 Copyright (c) Matthias Eckermann This program may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version
Transcript
Parallel -package (beta 4, 2003/04/13) 1 Copyright (c) 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 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 The Parallel-Package release beta 4 Matthias Eckermann, Berlin 2003/04/13 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. The gentle reader might excuse wrong words or bad constructions, but I m not a native speaker. Please remember: this is only an interim-public-beta until I ll have finished the complete documentation, the code should be fine. Contents 1 Usage SimpleUsage fortheimpatient Advanced Usage Limitations, Warnings 4 3 Todo-List 4 4 Documentation-Driver 5 5 macro package source code implementation rules preamble lengths boxes tokens counts options internal commands 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. 2 Parallel -package (beta 4, 2003/04/13) user commands Environment Parallel postamble, settings examples for parallel.sty typesetting in columns typesetting on two pages Common Text for the two Examples Final commands Sample-text 17 1 Usage 1.1 Simple Usage for the Impatient It is recommended, that you first read the complete section Usage to understand 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: \usepackage{parallel}... \begin{parallel}{ left-width }{ right-width } \ParallelLText{ left-text } \ParallelRText{ right-text } \end{parallel} It generates the two texts typesetted parallel in two columns, footnotes at the end of the Parallel-Environment. 1.2 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 parallel: \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} Parallel -package (beta 4, 2003/04/13) 4 \ParallelPar \ParallelAtEnd Parallel \ParallelPar is the most important Macro of this package; it tells the environment to begin a new 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). With the help of \ParallelAtEnd (\renewcommand{\parallelatend}{ your text here }) you can set some text between the parallel columns and the footnotes. Now we ll have a look at the options of Parallel. 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. OldStyleNums set the footnote-numbers with L A TEX s \oldstylnums-command RaiseNums like \footnote ItalicNums the footnote-numbers are set in Italics RomanNums using \romannnumeral 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$). Verbose tell the author used environment and its options... 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. One may use only one of the 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 . c (Columns) print in columns v (Vertical line between columns) print in columns, but with intermediate \vline p (Pages) print on two pages; if one box is empty, the corresponding page is left blank (not a bug, but feature!) 2 Limitations, Warnings tabulars, minipages,... 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 must not use those things (within the environment), when typesetting on pages parallel. Parallel -package (beta 4, 2003/04/13) 5 footnotes are printed at the end of the environment. I hope, this is a begin of a solution on further footnote-problems. The max. size of left-text and right-text is limited. The lines are typesetted really parallel, i.e. large size-differences will cause bad or dirty output. 3 Todo-List There are some ideas and todos, that will be fixed in the final release or in later releases: Most important: complete documentation. Dominik Neidinger, Munich, asked for leaving out \ParallelPar and setting to be done automatically by \ParallelLText and/or \ParallelRText. Add more environment-options: a (Autocomputed pages) print on two pages, autocompute the width of the text that holds less characters. s (Save/Store once autocalculated widths) Using this option, the widths autocalculatedinthefirst\parallelpar will be used for the other paragraphs of this environment. This option is introduced, to enable autocalculation and the same look-alike of every paragraph of an environment Parallel. r (Resume/Reload once autocalculated widths) This option allows to transfer the widths-values between environments. Use \newif instead of many integer variables. different footnote-types for left and right footnotes There might be a bug in the algorithm to typeset on two pages. I must have a look at this later. 4 Documentation-Driver 1 driver 2 \NeedsTeXFormat{LaTeX2e} 3 \documentclass[a4paper]{ltxdoc} 4 \usepackage{parallel} 5 \CodelineNumbered 6 \parskip2ex plus1ex minus1ex 7 \parindent0em 8 \setlength\hfuzz{10pt} 9 \setcounter{tocdepth}{2} 10 \hbadness= \addtolength{\textwidth}{0.5in} 12 \pagestyle{myheadings} Parallel -package (beta 4, 2003/04/13) 6 13 \markboth{ Parallel -package (\fileversion, \filedate)}% 14 { Parallel -package (\fileversion, \filedate)} 15 \begin{document} 16 \DocInput{parallel.dtx} 17 \begin{parallel}[v]{0.4\textwidth}{0.51\textwidth} 18 \tolerance= /driver 5 macro package source code 5.1 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 L A TEX-world. 5.2 preamble Here is the standard header for a L A TEX-package. This package is called parallel and we just work with release package 21 \NeedsTeXFormat{LaTeX2e} 22 \ProvidesPackage{parallel}[\filedate, setting two texts parallel (me)] 23 \message{ parallel : setting two texts parallel, (\fileversion) \filedate.} 5.3 lengths The two dimensions \ParallelLWidth and \ParallelRWidth hold the actual size of the left and right column (or page). 24 \newdimen\parallellwidth 25 \newdimen\parallelrwidth \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). 26 \newdimen\paralleltextwidth 27 \newdimen\parallelleftmargin 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. 28 \newdimen\parallelusermidskip 29 \newdimen\parallelmainmidskip Parallel -package (beta 4, 2003/04/13) boxes 30 \newbox\parallellbox 31 \newbox\parallelrbox 32 \newbox\parallelboxvar 5.5 tokens 33 \newbox\parallelltok 34 \newbox\parallelrtok 5.6 counts First we need some boolean variables. As you see, I am a C-programmer using integervariables for boolean operations. Perhaps it would be better, to use \newif here later!? 35 \newcount\parallelboolvar 36 \newcount\parallelboolmid \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. 37 \newcount\parallelwhichbox 38 \newcount\parallelmainmode 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 1, only one footnotecounter is used: all footnotes are set in one block (columns mixed!). But \ParallelFNNumMode needs some description. It holds the style in which the footnotenumbers (not those in the text, but those before the footnote-text) are set: 0 normal numbers 1 old style numbers (\oldstylenums) 2 raised numbers 3 italic numbers 4 roman numbers (\romannumeral) 39 \newcount\parallelfnmode 40 \newcount\parallellfncounter 41 \newcount\parallelrfncounter 42 \newcount\parallelmaxfn 43 \newcount\parallelfnnummode Parallel -package (beta 4, 2003/04/13) 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 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). 44 \newcommand{\parallelmessage}[1]{\relax} 45 \DeclareOption{Verbose}{% 46 \renewcommand{\parallelmessage}[1]{\message{#1}} 47 \message{verbose} 48 } 49 \DeclareOption{OldStyleNums}{% 50 \ParallelFNNumMode=1\ParallelMessage{OldStyleNums}} 51 \DeclareOption{RaiseNums}{% 52 \ParallelFNNumMode=2\ParallelMessage{RaiseNums}} 53 \DeclareOption{ItalicNums}{% 54 \ParallelFNNumMode=3\ParallelMessage{ItalicNums}} 55 \DeclareOption{RomanNums}{% 56 \ParallelFNNumMode=4\ParallelMessage{RomanNums}} 57 \DeclareOption{SeparatedFootnotes}{% 58 \ParallelFNMode=1\ParallelMessage{SeparatedFootnotes}} 5.8 internal commands footnotes The \footnotes were the most important problem when first trying to implement our package. So here is a description of why footnotes are a problem in our task, which problems are solved and in which way, what is not solved and what seems to be not possible. \ParallelLFootnote 59 \newcommand{\parallellfootnote}[1]{% \footnotemark[\number\parallellfncounter]% 62 \expandafter\gdef% 63 \csname ParallelLFN\romannumeral\ParallelLFNCounter\endcsname{#1}} \ParallelRFootnote 64 \newcommand{\parallelrfootnote}[1]{% \footnotemark[\number\parallelrfncounter]% 67 \expandafter\gdef% 68 \csname ParallelRFN\romannumeral\ParallelRFNCounter\endcsname{#1}} Parallel -package (beta 4, 2003/04/13) 9 ParallelFNEnviron 69 \newenvironment{parallelfnenviron}{% 70 \footnotesize 71 \begin{list}{}{% 72 \leftmargin=4em \labelwidth=3em \labelsep=1em% 75 \renewcommand{\makelabel}[1]{{\hfill\footnotesize ##1}}% 76 }% 77 }{% 78 \end{list}% 79 } \ParallelShowFNList 80 \newcommand{\parallelshowfnlist}{% 81 % footnotes in left or right column, i.e. left+right 0? 82 \ParallelMaxFN=\ParallelLFNCounter 83 \advance\parallelmaxfn \ParallelRFNCounter \ParallelMessage{Parallel Footnotes (}% 86 \begin{parallelfnenviron}% 87 \ParallelMaxFN=\ParallelLFNCounter \loop 90 \ifnum\parallellfncounter \parallelmaxfn 91 \global\advance\parallellfncounter 92 \item[\ifcase\parallelfnnummode \number\parallellfncounter% 93 \or \oldstylenums{\the\parallellfncounter}% 94 \or \raisebox{1ex}{\the\parallellfncounter}% 95 \or \textit{\number\parallellfncounter}% 96 \or \romannumeral\parallellfncounter% 97 \else \number\parallellfncounter \fi]% 98 \par 99 {\csname ParallelLFN\romannumeral\ParallelLFNCounter\endcsname}% 100 \par 101 \repeat 102 \end{parallelfnenviron}% \begin{parallelfnenviron}% 105 \ParallelMaxFN=\ParallelRFNCounter \loop 108 \ifnum\parallelrfncounter \parallelmaxfn 109 \global\advance\parallelrfncounter 110 \item[\ifcase\parallelfnnummode 111 \number\parallelrfncounter\paralleldot 112 \or \oldstylenums{\the\parallelrfncounter}\paralleldot 113 \or \raisebox{1ex}{\the\parallelrfncounter\paralleldot}% 114 \or \textit{\number\parallelrfncounter\paralleldot}% 115 \or \romannumeral\parallellfncounter% 116 \else \number\parallelrfncounter\paralleldot \fi]% 117 \par Parallel -package (beta 4, 2003/04/13) {\csname ParallelRFN\romannumeral\ParallelRFNCounter\endcsname}% 119 \par 120 \repeat 121 \end{parallelfnenviron}% 122 \fi \ParallelMessage{)}% 126 \else 127 \ParallelMessage{No Parallel Footnotes}% 128 \fi 129 } typesetting on one page \ParallelParOnePage I m glad that Bernd Raichle 1 spent his rare time to debug the code of this function and of the environment ParallelFNEnviron. Frank Mittelbach enhanced it in 2002/ \newcommand{\parallelparonepage}{% \par\begingroup \vbadness= \vfuzz=3ex \loop% \noindent 141 \hbox to\textwidth{% 142 \hskip\parallelleftmargin 143 \hbox to\paralleltextwidth{% 144 \ifvoid\parallellbox 145 \hskip\parallellwidth 146 \else \vbox{\setbox\parallelboxvar 149 =\vsplit\parallellbox to\dp\strutbox% 150 \unvbox\parallelboxvar}% 151 \fi 152 \strut \hskip\parallelmainmidskip 155 \vrule 156 \else 157 \hss 158 \fi 159 \hss 160 \ifvoid\parallelrbox 161 \hskip\parallelrwidth 162 \else 1 Stuttgart; 1996/10/01 Parallel -package (beta 4, 2003/04/13) \vbox{\setbox\parallelboxvar 165 =\vsplit\parallelrbox to\dp\strutbox% 166 \unvbox\parallelboxvar}% 167 \fi}}% 168 \ifvoid\parallellbox \ifvoid\parallelrbox \fi\fi% 171 \fi% \penalty\interlinepenalty 174 \repeat 175 \par 176 \endgroup 177 \fi} typesetting on two page \ParallelParTwoPages 178 \newcommand{\parallelpartwopages}{% \par\begingroup \newpage 183 \vbadness= \vfuzz=3ex \loop% \ifvoid\parallellbox \mbox{} \newpage \else 192 \ifvoid\parallelrbox \mbox{} \newpage \fi \ifodd\thepage \mbox{} \newpage \fi 197 \hbox to\textwidth{% 198 \vbox{\vsplit\parallellbox to.98\textheight}}% 199 \else 200 \ifodd\thepage\relax\else \mbox{} \newpage \fi 201 \hbox to\textwidth{% 202 \vbox{\vsplit\parallelrbox to.98\textheight}}% 203 \fi 204 \vspace*{\fill}\newpage 205 \fi 206 \ifvoid\parallellbox\ifvoid\parallelrbox \fi\fi \repeat Parallel -package (beta 4, 2003/04/13) \par 212 \endgroup 213 \fi} 5.9 user commands \ParallelAfterText 214 \newcommand{\parallelaftertext}{% \let\footnote=\paralleloldfootnote\endgroup} \ParallelCheckOpenBrace 217 \newcommand{\parallelcheckopenbrace}{% 218 \ifx\x\bgroup \else 219 \errmessage{missing opening brace}% 220 \fi 221 \endgroup} \ParallelLText 222 \newcommand{\parallelltext}{% \hbadness= \let\footnote=\parallellfootnote 226 \ParallelWhichBox=0 227 \global\setbox\parallellbox=\vbox\bgroup \hsize=\parallellwidth 228 \aftergroup\parallelaftertext 229 \begingroup \afterassignment\parallelcheckopenbrace \let\x=} \ParallelRText 230 \newcommand{\parallelrtext}{% \hbadness= \let\footnote=\parallelrfootnote 235 \else 236 \let\footnote=\parallellfootnote 237 \fi \global\setbox\parallelrbox=\vbox\bgroup \hsize=\parallelrwidth 240 \aftergroup\parallelaftertext 241 \begingroup \afterassignment\parallelcheckopenbrace \let\x=} \ParallelAtEnd \ParallelPar \ParallelAtEnd must be defined: the user just types \renewcommand, and everything is right (I hope); it s a dummy. 242 \newcommand{\parallelatend}{} Actually, this is a dummy again or a Pointer to the \ParallelPar, which is choosen. 243 \newcommand{\parallelpar}{} % Dummy \ParallelDot 244 \newcommand{\paralleldot}{\ensuremath{\cdot}} Parallel -package (beta 4, 2003/04/13) Environment Parallel Parallel 245 \newenvironment{parallel}[3][c]{% 246 \begingroup% 247 \ParallelTextWidth=\linewidth 248 \ParallelLeftMargin=\textwidth 249 \advance\parallelleftmargin by-\linewidth 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 . 250 \if #1p\relax 251 \ParallelMessage{ on Pages (}% \renewcommand{\parallelpar}{\parallelpartwopages} 254 \else 255 \if #1a\relax 256 \ParallelMessage{ autocomputed Pages (}% \renewcommand{\parallelpar}{\parallelpartwopages} 259 \else 260 \tolerance=600 % sorry, but neccessary 261 \emergencystretch=.5em % dto \renewcommand{\parallelpar}{\parallelparonepage} 264 \if #1v\relax \ParallelMessage{ in Columns, with VLine (}% 267 \else 268 \if #1c\relax\else 269 \errhelp{possible options: 270 p age, c olumn or columns with v line type return to proceed in column-mode} 272 \errmessage{bad option #1 to environment Parallel } 273 \fi 274 \ParallelMessage{ in Columns (}% 275 \fi\fi\fi Smart column width support was mainly done by Wonkoo Kim 2. \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. 2 Pittsburgh, PA; 1996/09/29 Parallel -package (beta 4, 2003/04/13) \def\parallelargl{#2} \def\parallelargr{#3} 277 \ifx\parallelargl\empty\parallellwidth=0in\else\ifx\parallelargl\space 278 \ParallelLWidth=0in\else\setlength\ParallelLWidth{#2}\fi\fi 279 \ifx\parallelargr\empty\parallelrwidth=0in\else\ifx\parallelargr\space 280 \ParallelRWidth=0in\else\setlength\ParallelRWidth{#3}\fi\fi If we are in column-mode (\ParallelMainMode=1): \ifdim\parallellwidth 1em 283 \ifdim\parallelrwidth 1em If both dimensions are set, we calculate the left width and set the vertical line centered (by calculating) 284 \ParallelMainMidSkip=\linewidth 285 \advance\parallelmainmidskip by-\parallellwidth 286 \advance\parallelmainmidskip by-\parallelrwidth 287 \advance\parallelmainmidskip by-.5pt 288 \advance\parallelmainmidskip by-\parallelleftmargin 289 \divide\parallelmainmidskip by \else 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. 291 \ParallelRWidth=\linewidth 292 \advance\parallelrwidth by-\parallellwidth 293 \advance\parallelrwidth by-2\parallelusermidskip 294 \advance\parallelrwidth by-\parallelleftmargin 295 \ParallelMainMidSkip=\ParallelUserMidSkip 296 \fi 297 \else 298 \ifdim\parallelrwidth 1em 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. 299 \ParallelLWidth=\linewidth 300 \advance\parallellwidth by-\parallelrwidth 301 \advance\parallellwidth by-2\parallelusermidskip 302 \advance\parallellwidth by-\parallelleftmarg
Search
Similar documents
View more...
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks