summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/rjlparshap
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-07-20 18:08:12 +0000
committerKarl Berry <karl@freefriends.org>2009-07-20 18:08:12 +0000
commit6c74068e8e25a54e976521619559143d6e2245b8 (patch)
tree86bece017d73def2b47406e6813bde153db97f8a /Master/texmf-dist/tex/latex/rjlparshap
parentaba1a497da7708c4f143ed49ed034a4058fc2828 (diff)
new latex package rjlparshap (13jul09)
git-svn-id: svn://tug.org/texlive/trunk@14343 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/rjlparshap')
-rw-r--r--Master/texmf-dist/tex/latex/rjlparshap/rjlpshap.sty212
1 files changed, 212 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/rjlparshap/rjlpshap.sty b/Master/texmf-dist/tex/latex/rjlparshap/rjlpshap.sty
new file mode 100644
index 00000000000..efbf5034e03
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/rjlparshap/rjlpshap.sty
@@ -0,0 +1,212 @@
+%%
+%% This is file `rjlpshap.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% rjlpshap.dtx (with options: `package')
+%%
+%% This is a generated file.
+%%
+%% Copyright (C) 2004 by Robert J Lee <latex@rjlee.homelinux.org>
+%%
+%% This file 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.
+%%
+ \NeedsTeXFormat{LaTeX2e}[1999/12/01]
+ \ProvidesPackage{rjlpshap}
+[2004/11/05 v1.0 .dtx rjlpshap file]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\RequirePackage{arrayjob}
+
+\RequirePackage{forloop}
+\makeatletter
+
+
+\newenvironment{parshapecollect}{%
+ \immediate\openout\rjlpshap@writer=\jobname.parshape%
+ \setcounter{rjlpshap@linecount}{0}%
+ \setboolean{rjlpshap@isodd}{false}%
+ \ignorespaces
+}{%
+ \immediate\closeout\rjlpshap@writer%
+ \rjlpshap@doparshape%
+ \aftergroup\input\aftergroup{\aftergroup\jobname\aftergroup%
+ .\aftergroup%
+ p\aftergroup%
+ a\aftergroup%
+ r\aftergroup%
+ s\aftergroup%
+ h\aftergroup%
+ a\aftergroup%
+ p\aftergroup%
+ e\aftergroup%
+ t\aftergroup%
+ m\aftergroup%
+ p\aftergroup}\ignorespaces
+}
+
+\newcommand{\rjlpshap@doparshape}{%
+ \immediate\openout\rjlpshap@finalwriter=\jobname.parshapetmp%
+ \immediate\write\rjlpshap@finalwriter{\noexpand\parshape \arabic{rjlpshap@linecount}}%
+ \openin\rjlpshap@reader=\jobname.parshape%
+ \setboolean{rjlpshap@loop}{true}%
+ \whiledo{\boolean{rjlpshap@loop}}{%
+ \read\rjlpshap@reader to\rjlpshap@temp%
+ \ifeof\rjlpshap@reader%
+ \setboolean{rjlpshap@loop}{false}%
+ \else
+ \immediate\write\rjlpshap@finalwriter{\rjlpshap@temp }%
+ \fi
+ }%
+ \immediate\closeout\rjlpshap@finalwriter%
+ \immediate\closein\rjlpshap@reader%
+ \let\rjlpshap@temp=\relax%
+}
+
+\newcommand{\parshapelenout}[1]{%
+ \setlength{\rjlpshap@tempwidth}{#1}%
+ \immediate\write\rjlpshap@writer{\the\rjlpshap@tempwidth}%
+ \ifthenelse{\boolean{rjlpshap@isodd}}{%
+ \setboolean{rjlpshap@isodd}{false}%
+ }{%
+ \stepcounter{rjlpshap@linecount}%
+ \setboolean{rjlpshap@isodd}{true}%
+ }%
+ \ignorespaces
+}
+
+\newcommand{\parshapearrlenout}[2]{%
+ \testarray{#1}(\arabic{#2})%
+ \parshapelenout{\temp@macro}%
+ \ignorespaces
+}
+
+
+\newcommand{\parshapeary}[1]{%
+ \testarray{#1}(1)%
+ \edef\rjlpshap@max{\temp@macro}%
+ \begin{parshapecollect}%
+ \forloop{rjlpshap@ctr}{1}{\not \value{rjlpshap@ctr} > \rjlpshap@max }{%
+ \setcounter{rjlpshap@ctr2}{\value{rjlpshap@ctr}}%
+ \addtocounter{rjlpshap@ctr2}{\value{rjlpshap@ctr}}%
+ \parshapearrlenout{#1}{rjlpshap@ctr2}%
+ \stepcounter{rjlpshap@ctr2}%
+ \parshapearrlenout{#1}{rjlpshap@ctr2}%
+ }%
+ \end{parshapecollect}%
+ \typeout{parshapeary end}%
+ \ignorespaces
+}
+
+\newcommand{\parshapearray}[2]{%
+ \begin{parshapecollect}%
+ \testarray{#1}(1)%
+ \edef\rjlpshap@max{\temp@macro}%
+ \forloop{rjlpshap@ctr}{1}{\not \value{rjlpshap@ctr} > \rjlpshap@max }{%
+ \setcounter{rjlpshap@ctr2}{\value{rjlpshap@ctr}}%
+ \addtocounter{rjlpshap@ctr2}{\value{rjlpshap@ctr}}%
+ \edef\rjlpshap@pos{\arabic{rjlpshap@ctr2}}%
+ \testarray{#1}(\rjlpshap@pos)%
+ \setlength{\rjlpshap@tempwidth}{\temp@macro}%
+ \setlength{\rjlpshap@templinewidth}{#2}%
+ \addtolength{\rjlpshap@templinewidth}{-1\rjlpshap@tempwidth}%
+ \parshapelenout{\rjlpshap@tempwidth}%
+ \stepcounter{rjlpshap@ctr2}%
+ \edef\rjlpshap@pos{\arabic{rjlpshap@ctr2}}%
+ \testarray{#1}(\rjlpshap@pos)%
+ \setlength{\rjlpshap@tempwidth}{\temp@macro}%
+ \addtolength{\rjlpshap@templinewidth}{-1\rjlpshap@tempwidth}%
+ \parshapelenout{\rjlpshap@templinewidth}%
+ }%
+ \end{parshapecollect}%
+}
+
+\newcommand{\Parshapearray}[2]{%
+ \testarray{#1}(1)\edef\rjlpshap@maxA{\temp@macro}%
+ \testarray{#2}(1)\edef\rjlpshap@maxB{\temp@macro}%
+ \ifthenelse{\rjlpshap@maxA > \rjlpshap@maxB} {\edef\rjlpshap@max{\rjlpshap@maxA}}{\edef\rjlpshap@max{\rjlpshap@maxB}}%
+ \begin{parshapecollect}%
+ \forloop{rjlpshap@ctr}{1}{\not \value{rjlpshap@ctr} > \rjlpshap@max}{%
+ \ifthenelse{\value{rjlpshap@ctr} > \rjlpshap@maxA}{%
+ \setcounter{rjlpshap@ctr2}{\rjlpshap@maxA}%
+ \addtocounter{rjlpshap@ctr2}{\rjlpshap@maxA}%
+ }{%
+ \setcounter{rjlpshap@ctr2}{\value{rjlpshap@ctr}}%
+ \addtocounter{rjlpshap@ctr2}{\value{rjlpshap@ctr}}%
+ }%
+ \parshapearrlenout{#1}{rjlpshap@ctr2}%
+ \ifthenelse{\value{rjlpshap@ctr} > \rjlpshap@maxB}{%
+ \edef\rjlpshap@pos{\rjlpshap@maxB}%
+ \setcounter{rjlpshap@ctr3}{\rjlpshap@maxB}%
+ \typeout{A pos=\rjlpshap@pos\space of \rjlpshap@maxB}%
+ \testarray{#2}(\arabic{rjlpshap@ctr3})%
+ \typeout{temp=\temp@macro}%
+ \setlength{\rjlpshap@templinewidth}{\temp@macro}%
+ }{%
+ \stepcounter{rjlpshap@ctr}%
+ \edef\rjlpshap@pos{\arabic{rjlpshap@ctr}}%
+ \typeout{B pos=\rjlpshap@pos}%
+ \addtocounter{rjlpshap@ctr}{-1}%
+ \testarray{#2}(\rjlpshap@pos)%
+ \setlength{\rjlpshap@templinewidth}{\temp@macro}%
+ }%
+ \typeout{width=\the\rjlpshap@templinewidth}%
+ \addtolength{\rjlpshap@templinewidth}{-1\rjlpshap@tempwidth}%
+ \stepcounter{rjlpshap@ctr2}%
+ \edef\rjlpshap@pos{\arabic{rjlpshap@ctr2}}%
+ \testarray{#1}(\rjlpshap@pos)%
+ \setlength{\rjlpshap@tempwidth}{\temp@macro}%
+ \addtolength{\rjlpshap@templinewidth}{-1\rjlpshap@tempwidth}%
+ \parshapelenout{\rjlpshap@templinewidth}%
+ }%
+ \end{parshapecollect}%
+}
+
+
+\newcounter{rjlpshap@ctr}
+
+\newcounter{rjlpshap@ctr2}
+
+\newcounter{rjlpshap@ctr3}
+
+\newlength{\rjlpshap@tempwidth}
+
+\newlength{\rjlpshap@templinewidth}
+
+\newboolean{rjlpshap@loop}
+
+\newboolean{rjlpshap@isodd}
+
+\newwrite\rjlpshap@writer % holds \parshape lengths
+\newwrite\rjlpshap@finalwriter % holds entire \parshape command
+\newread\rjlpshap@reader % used to read writer to transfer to finalwriter
+
+\newcounter{rjlpshap@linecount}
+
+\makeatother
+
+\endinput
+%%
+%% End of file `rjlpshap.sty'.