diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-13 00:01:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-13 00:01:49 +0000 |
commit | 73a9ae5b19318589e2604cc2ef1687dcbac3c61e (patch) | |
tree | 0558cb6b3104e8b4b0f10bc6ab49b038d9cdbaab /Master | |
parent | e6d80de7402f094f5a5172b96a620733136a4084 (diff) |
parrun
git-svn-id: svn://tug.org/texlive/trunk@1172 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/tex/latex/parrun/parrun.sty | 209 |
1 files changed, 209 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/parrun/parrun.sty b/Master/texmf-dist/tex/latex/parrun/parrun.sty new file mode 100644 index 00000000000..5eecb5c075e --- /dev/null +++ b/Master/texmf-dist/tex/latex/parrun/parrun.sty @@ -0,0 +1,209 @@ +%% +%% This is file `parrun.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% parrun.dtx (with options: `parrun') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from parrun.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file parrun.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% parrun.dtx +%% Copyright (C) 2003 Massimiliano Dominici +%% \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 \~} +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% % +%% ******************** % +%% * PARALLEL RUNNING * % +%% ******************** % +%% This is package ``parrun.sty'', providing % +%% a set of macro for typesetting two streams % +%% of text running parallel on the same phy- % +%% sical page, in a vertical layout. % +%% % +%% Author: Massimiliano Dominici % +%% Date: 18/11/2003 % +%% Version: 1.1 % +%% % +%% Released under the GNU General Public License. % +%% Please report any bugs to mlgdominici@interfree.it % +%% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\NeedsTeXFormat{LaTeX2e}[2001/06/01] +\ProvidesPackage{parrun}[2004/02/06 v1.1a Package for parallel text] +\RequirePackage{ifthen} \RequirePackage{calc} +\newif\ifmultic@l +\DeclareOption{multicol}{\multic@ltrue} +\ProcessOptions +\newbox\ffram +\newbox\sfram +\newcount\k +\newcount\cnum +\cnum=2 +\newlength\flength +\newlength\slength +\newlength\ffrac +\newlength\sfrac +\newlength\nop +\newlength\total +\newlength\actualheight +\newlength\initskip +\setlength{\initskip}{0pt} +\newdimen\colframsep +\newdimen\h +\newdimen\test +\newdimen\temp +\colframsep=8pt +\newenvironment{fframe}{\global\setbox\ffram=\vbox\bgroup}{\vfill\egroup} +\newenvironment{sframe}{% + \ifmultic@l \k=\cnum \advance\k by -1 + \dimen0=\textwidth \divide\dimen0 by + \cnum \advance\dimen0 by -\k\colframsep + \hsize=\dimen0 + \fi + \global\setbox\sfram=\vbox\bgroup} +{\vfill\egroup} +\newcommand{\b@xbalance}{% + \vbox to\initskip{} + \vsplit\ffram to \flength + \smallskip \hrule \smallskip + \rigidbalance} +\newcommand{\v@idb@xbalance}{% + \vbox to\initskip{} + \vbox to \flength{} + \smallskip \hrule \smallskip + \rigidbalance} +\newcommand{\v@idb@xone}{% + \vbox to\initskip{} + \vbox to \flength{} + \smallskip \hrule \smallskip + \vsplit\sfram to \slength} +\newcommand{\v@idb@xtwo}{% + \vbox to\initskip{} + \vsplit\ffram to \flength + \smallskip \hrule \smallskip + \vbox to \slength{}} +\newcommand{\splitb@x}{% + \vbox to\initskip{} + \vsplit\ffram to \flength + \smallskip \hrule \smallskip + \vsplit\sfram to \slength} +\newcommand{\rigidbalance}{\hsize=\textwidth \k=\cnum + \ifdim\ht\sfram>\cnum\slength + \myline{\splittopskip=\h \vbadness=10000 \hfilneg + \valign{##\vfil\cr\dosplits}} + \else + \myline{\temp=\ht\sfram \advance\temp by \baselineskip + \divide\temp by \cnum \splittopskip=\h \vbadness=10000 + \hfilneg \valign{##\vfil\cr\dobalance}} + \fi} +\newcommand{\dosplits}{\ifnum\k>0 \noalign{\hfil} + \splitoff\global\advance\k-1\cr\dosplits\fi} +\newcommand{\splitoff}{ + \vsplit\sfram to \slength} +\newcommand{\dobalance}{\ifnum\k>0 \noalign{\hfil} + \finalbalance\global\advance\k-1\cr\dobalance\fi} +\newcommand{\finalbalance}{ + \vsplit\sfram to \temp} +\newcommand{\myline}{\hbox to\hsize} +\newcommand{\m@kelayout}{% +\ifmultic@l + \whiledo{\ht\ffram>0 \AND \ht\sfram>0}{\b@xbalance} + \ifthenelse{\ht\ffram>0 \AND \ht\sfram=0}{\whiledo{\ht\ffram>0 + \AND \ht\sfram=0}{\v@idb@xtwo} + \sec@nderror} + \ifthenelse{\ht\ffram=0 \AND \ht\sfram>0}{\whiledo{\ht\ffram=0 + \AND \ht\sfram>0}{\v@idb@xbalance} + \sec@nderror} +\else + \whiledo{\ht\ffram>0 \AND \ht\sfram>0}{\splitb@x} + \ifthenelse{\ht\ffram>0 \AND \ht\sfram=0}{\whiledo{\ht\ffram>0 + \AND \ht\sfram=0}{\v@idb@xtwo} + \sec@nderror} + \ifthenelse{\ht\ffram=0 \AND \ht\sfram>0}{\whiledo{\ht\ffram=0 + \AND \ht\sfram>0}{\v@idb@xone} + \sec@nderror} +\fi +\UsefulLengthsTable} +\newcommand{\UserDefWidths}[2]{ + \setlength{\actualheight}{% + \textheight-2\smallskipamount-\topskip-\baselineskip} + \flength=.#1\actualheight \slength=.#2\actualheight + \test=\flength \advance\test by \slength + \ifdim\test>\actualheight + \firsterror + \fi + \m@kelayout +} +\newcommand{\AutoCompute}{% + \setlength{\actualheight}{% + \textheight-2\smallskipamount-\topskip-\baselineskip-\initskip} + \ifmultic@l + \setlength{\total}{\cnum\ht\ffram+\ht\sfram} + \divide\total by 10 \divide\actualheight by 10% + \setlength{\nop}{1pt*\ratio{\total}{\cnum\actualheight}} + \setlength{\flength}{1pt*\ratio{\ht\ffram}{\nop}} + \setlength{\slength}{1pt*\ratio{\ht\sfram}{\cnum\nop}} + \else + \setlength{\total}{\ht\ffram+\ht\sfram} + \divide\total by 10 \divide\actualheight by 10% + \setlength{\nop}{1pt*\ratio{\total}{\actualheight}} + \setlength{\flength}{1pt*\ratio{\ht\ffram}{\nop}} + \setlength{\slength}{1pt*\ratio{\ht\sfram}{\nop}} + \fi + \setlength{\ffrac}{1pt*\ratio{\flength}{10\actualheight}} + \setlength{\sfrac}{1pt*\ratio{\slength}{10\actualheight}} + \m@kelayout +} +\newcommand{\Place}{% + \@ifstar{\AutoCompute}{\UserDefWidths}} +\newcommand{\UsefulLengthsTable}{% +\AtEndDocument{\immediate\write\m@ne{******************************************^^J% + ffrac=\the\ffrac, sfrac=\the\sfrac^^J% + flength=\the\flength, slength=\the\slength^^J% + ******************************************}} +} +\newcommand{\firsterror}{\PackageError{parrun}{% + Warning: Text fractions exceeding \string\textheight} + {The total dimension of + the single fractions of text exceeds \string\textheight.^^J% + You probably should reconsider the parameters in \string\Place.^^J% + However, if you are sure of what you have done, you can go on.^^J% + Luck!}} +\newcommand{\sec@nderror}{\PackageError{parrun}{% + Warning: the box still contains some text} + {Your text is not well balanced. Probably you'll get a bad ^^J% + output. You should reconsider your document's layout.^^J% + You will find at the end of the log file some useful^^J% + length for dealing with.} +} + +\endinput +%% +%% End of file `parrun.sty'. |