diff options
author | Karl Berry <karl@freefriends.org> | 2012-02-22 00:23:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-02-22 00:23:22 +0000 |
commit | a87b2ae3cf7f24521c3a0d4b654e0ac74aa4dee5 (patch) | |
tree | e5ba330c6525bcf22e09969f0929e24c0e643e00 /Master/texmf-dist/tex/latex/pst-layout/pst-layout.sty | |
parent | 74cc739849e30f0b36faebb36046aef5e6202a0e (diff) |
pst-layout should just be a copy, luecking mail 20 Feb 2012 23:31:12
git-svn-id: svn://tug.org/texlive/trunk@25467 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pst-layout/pst-layout.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/pst-layout/pst-layout.sty | 365 |
1 files changed, 365 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/pst-layout/pst-layout.sty b/Master/texmf-dist/tex/latex/pst-layout/pst-layout.sty new file mode 100644 index 00000000000..bdfcb03e783 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pst-layout/pst-layout.sty @@ -0,0 +1,365 @@ +%% BEGIN pst-layout.sty +%% Author: Michael Sharpe (msharpe at ucsd dot edu) +\def\fileversion{.95} +\def\filedate{2011/05/22} +\ProvidesPackage{pst-layout} + ['pst-layout' v.\fileversion, \filedate\space Page layout using pstricks (ms)] +\csname PSTLayoutLoaded\endcsname +\let\PSTLayoutLoaded\endinput +\RequirePackage{graphicx} +\RequirePackage{ifthen} +%\ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi +%\ifx\PSTnodesLoaded\endinput\else\input pst-node.tex \fi\relax +%\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey.tex \fi +\ifx\PSTricksAddLoaded\endinput\else\input pstricks-add.tex \fi +%\RequirePackage{pstricks-add} +%\edef\TheAtCode{\the\catcode`\@}\catcode`\@=11 +\message{`pst-layout' v\fileversion, \filedate\space Page layout using pstricks (ms)} +% +%\edef\TheAtCode{\the\catcode`\@} \catcode`\@=11\relax + +%\@ifundefined{arrayx}{\input{arrayjobx.sty}}{} +\RequirePackage{arrayjobx}%version of arrayjob with \array changed to \Array +% to avoid conflict with LaTeX \array, and its uses in amsmath (cases, align, alignat) +\pst@addfams{pst-layout} +%parameters +\newcount\NumGraphics +\newcount\NumFragments +\newcount\NumLines +\newcount\NumFrames +\newcount\NumPoints +\newcount\NumDots +%arrays to be filled in from main file +\newarray\Graphic +\newarray\GraphicPos +\newarray\GraphicOpts +\newarray\GraphicRefPt +\newarray\Frag +\newarray\FragPos +\newarray\FragRefPt +\newarray\FragRotation +\newarray\FragBlankBG +\newarray\PointName +\newarray\PointPos +\newarray\PointSeries +\newarray\PointInc +\newarray\DotPos +\newarray\DotOpts +\newarray\DotType +\newarray\FrameStart +\newarray\FrameEnd +\newarray\FrameDelta +\newarray\FrameOpts +\newarray\FrameSolid +\newarray\FrameType +\newarray\LOpts +\newarray\LArrow +\newarray\LStart +\newarray\LEnd +\newarray\LDelta +\newarray\LType +% +%some basic default values +%\newcount\PST@args%used in several macros +\def\PST@root{} +%\edef\PST@next{}\let\PST@next\relax +%\edef\plussign{+}\edef\minussign{-} +%\newdimen\absmaxdim \absmaxdim=1073741823sp% 2^30-1 +%my scratch variables +%\newdimen\my@dima +%\newdimen\my@dimb +%\newdimen\my@dimc +\newdimen\my@dimd +\newdimen\my@dimm +\newdimen\my@dimn +\newdimen\my@dimo +%\def\my@tempA{} +%\def\my@tempB{} +%\def\my@tempC{} +%\def\my@tempD{} +\newcount\my@cntA % +\newcount\my@cnta % +\newdimen\my@dimx% +\newdimen\my@dimxx% +\newdimen\my@dimy% +\newdimen\my@dimyy% +% +\edef\arg@A{}\edef\arg@B{}\edef\arg@C{}\edef\arg@D{}\edef\arg@E{}%more scratch +\define@key[psset]{pst-layout}{picwidth}{\def\psk@picwidth{#1}} +%\psset{picwidth=}% +\define@key[psset]{pst-layout}{picheight}{\def\psk@picheight{#1}} +%\psset{picheight=}% +\define@boolkey[psset]{pst-layout}[Pst@]{showfullcanvas}[true]{}%use \ifPst@showfullcanvas +%\psset{showfullcanvas=false} +% +% The pslayout looks for xunit, yunit, picwidth, picheight in constructing the pspicture. +\def\pslayout{\def\pst@par{}\pst@object{pslayout}}% +\def\pslayout@i{% no arguments +\use@keep@par% +\xdef\xmin{0}\xdef\ymin{0}% +\defaultvalue\psk@picwidth{}% +\defaultvalue\psk@picheight{}% +\ifx\psk@picwidth\@empty\@pstrickserr{picwidth not specified}{\@ehpc}\else\pssetxlength\my@dimx\psk@picwidth\fi% +\ifx\psk@picheight\@empty\@pstrickserr{picheight not specified}{\@ehpc}\else\pssetylength\my@dimy\psk@picheight\fi% +\pst@divide\my@dimx\psxunit\xmax% +\pst@divide\my@dimy\psyunit\ymax% +%\processpic%fill in undefined macros +\pst@killglue% +\begingroup% will end in \end{pslayout} +\if@star\pspicture*(\xmax,\ymax)\else% +\pspicture(\xmax,\ymax)\fi% +\psDefPSPNodes% define nine positions on canvas +\pnode(PSPbr){C-1}\pnode(PSPtl){R0}\pnode(PSPbc){C-2}% +%\pnode(\psk@picwidth,0){Ivec}\pnode(0,\psk@picheight){Jvec}% +\bgroup% +\use@par% +\ifdefined\AtLayoutStart \AtLayoutStart \fi %execute startup code +\ifPst@showfullcanvas\psframe[linecolor=black!1,fillstyle=none](PSPbl)(PSPtr)\fi% +\process@picitems% +\egroup %parameters no longer visible +\ignorespaces% +}% +% +\def\endpslayout{% +\pst@killglue% +\endpspicture% +\endgroup% +}% +\@namedef{pslayout*}{\pslayout*}% +\@namedef{endpslayout*}{\endpslayout}% +% +% +\def\parsedelta#1,#2,#3\@nil{% +\def\arg@B{#1}\def\arg@C{#2}% +}% +% +\def\process@picitems{%handle all items specified prior to \begin{layout} + \pst@killglue% +\defaultvalue\MaxR{0}\ifx\MaxR\@empty\def\MaxR{0}\fi % +\defaultvalue\MaxC{0}\ifx\MaxC\@empty\def\MaxC{0}\fi % +% +%Points +\ifdefined\NumPoints% +\ifnum\NumPoints>\z@% +\multido{\i=1+1}{\NumPoints}{% +\checkPointName(\i)% +\ifemptydata%\@pstrickserr{PointName(\i) missing}{\@ehpc}% +\else% +\let\arg@A\cachedata\fi%\arg@A = PointName/ base PointName +\checkPointPos(\i)% +\let\arg@B\cachedata% \arg@B = PointPos +\edef\arg@C{}\edef\arg@E{}% +\checkPointSeries(\i)% +\ifemptydata\else% +\let\arg@C\cachedata % +%\show\arg@C +\expandafter\parseSeries\arg@C;;\@nil %returns \arg@C, \arg@E,my@tempA +\ifx\my@tempA\@empty\@pstrickserr{PointSeries(\i) invalid}{\@ehpc}\fi% +\checkPointInc(\i)% +\ifemptydata\@pstrickserr{PointInc(\i) missing}{\@ehpc}% +\else% +\let\arg@D\cachedata % +\fi %\ifemptydata (PointInc()) +\fi %\ifemptydata (PointSeries()) +\nodex\arg@B%\show\arg@C +\pnode(@TMP){\arg@A}% +\ifx\arg@C\@empty\else% +\pnode(\arg@A){\arg@A\arg@C}% +\my@cntA=\arg@C \relax % +\my@cnta=\arg@E \relax % +\advance\my@cnta -\my@cntA \relax % +\advance\my@cntA -1 \relax % +\mmultido{\iA=\arg@C+1,\iB=\the\my@cntA+1}{\my@cnta}{% +\nodexn{(\arg@A\iB)+(\arg@D)}{\arg@A\iA}}%end mmultido +\fi %\ifemptydata (PointName()) +}%end multido +% now make all combinations like R3C4 +\my@cntA=\MaxR \advance\my@cntA 1 \relax % +\my@cnta=\MaxC \advance\my@cnta 3 \relax % +\multido{\iA=0+1}{\my@cntA}{% +\multido{\iB=-2+1}{\my@cnta}{\pnode(C\iB | R\iA){R\iA C\iB}}}% +\fi \fi %\ifdefined +%Graphics +\ifdefined\NumGraphics% +\ifnum\NumGraphics>\z@% +\multido{\iA=1+1}{\NumGraphics}{% +\checkGraphic(\iA)% +\ifemptydata\else% +\edef\arg@D{\cachedata .eps}% + \IfFileExists{\arg@D}{% + \let\arg@A\cachedata}% +{\@pstrickserr{No file named `\arg@D'}{\@ehpc}}%\fi %\iffileexists +\checkGraphicPos(\iA)% +\ifemptydata\@pstrickserr{GraphicPos(\iA) missing}{\@ehpc}\else% +\let\arg@B\cachedata\fi% +\nodex\arg@B %Pos now in @TMP +\checkGraphicOpts(\iA)% +\ifemptydata\edef\arg@C{}\else\edef\arg@C{[\cachedata]}\fi % +\checkGraphicRefPt(\iA)% +\ifemptydata\edef\arg@D{}\else\edef\arg@D{[\cachedata]}\fi % +\edef\theline{\noexpand\rput\arg@D (@TMP){\noexpand\includegraphics\arg@C{\arg@A}}}% +%\show\theline +\theline % +\fi %\ifemptydata (picture name) +}%end multido +\fi \fi % \ifdefined \ifnum +%Frames +\ifdefined\NumFrames% +\ifnum\NumFrames>\z@% +{\ifdefined\FrameSettings \FrameSettings\fi % +%\whiledo{\NumFrames>\z@}{% +\multido{\iA=1+1}{\NumFrames}{% +\checkFrameStart(\iA)%every frame must have a starting point +\ifemptydata\@pstrickserr{FrameStart(\iA) missing}{\@ehpc}% +\else\nodex\cachedata\pnode(@TMP){@TMPA}% @TMPA=FrameStart +\fi% +\checkFrameOpts(\iA)% +\ifemptydata\edef\arg@B{}\else\edef\arg@B{[\cachedata]}\fi% +\checkFrameSolid(\iA)% +\ifemptydata\edef\arg@D{}\else\edef\arg@D{*}\fi% +\checkFrameType(\iA)% +\ifemptydata\let\arg@E\psframe\else % +\expandafter\let\expandafter\arg@E\csname psframe\cachedata\endcsname\fi % +\checkFrameEnd(\iA)% +\ifemptydata% + \checkFrameDelta(\iA)% + \ifemptydata % + \@pstrickserr{FrameEnd(\iA) and \FrameDelta(\iA) missing}{\@ehpc}% + \else% FrameDelta provided + \nodex\cachedata \pnode(@TMP){@TMPB}% + \nodexn{(\arg@A)+(@TMPB)}{P@opp}% + \edef\theframe{\noexpand\arg@E\arg@D\arg@B(@TMPA)(P@opp)}% + \fi % +\else%FrameEnd provided + \nodex\cachedata % + \edef\theframe{\noexpand\arg@E\arg@D\arg@B(@TMPA)(@TMP)}% +\fi\theframe% +}% end multido loop +}%end group +\fi\fi %\ifdefined\NumFrames +% +%Lines +\ifdefined\NumLines% +\ifnum\NumLines>\z@% +\bgroup% +\ifdefined\LineSettings \LineSettings\fi % +\ifdefined\everyLine\expandafter\psset\expandafter{\everyLine}\fi % +%\whiledo{\NumLines>\z@}{% +\multido{\iA=1+1}{\the\NumLines}{% +\checkLStart(\iA)%every line must have a start +\ifemptydata %do nothing\@pstrickserr{LStart(\iA) missing}{\@ehpc}% +\else\nodex\cachedata \pnode(@TMP){@TMPA} % @@TMP=LStart +%\ifx\iA\iB \psdot(@TMPA)\fi% +\checkLType(\iA)% +\let\arg@D\cachedata % +\checkLOpts(\iA)% +\ifemptydata\edef\arg@B{}\else\edef\arg@B{[\cachedata ]}\fi% \arg@B= LOpts +\checkLArrow(\iA)% +\ifemptydata\let\arg@C\@empty\else% +\edef\arg@C{{\cachedata}}\fi% \arg@C= LArrow +\checkLEnd(\iA)% +\ifemptydata% + \ifx\arg@D\@empty\let\arg@E\psrline\else % + \expandafter\let\expandafter\arg@E\csname psrline\arg@D\endcsname\fi % + \checkLDelta(\iA)% + \ifemptydata % + \@pstrickserr{LEnd(\iA) and \LDelta(\iA) missing}{\@ehpc}% + \else% LDelta provided + \nodex\cachedata % + \edef\theline{\noexpand\arg@E\arg@B\arg@C(@TMPA)(@TMP)}% + \fi +\else%LEnd provided + \ifx\arg@D\@empty\let\arg@E\psline\else % + \expandafter\let\expandafter\arg@E\csname psline\arg@D\endcsname\fi % + \nodex\cachedata % +% \ifx\iA\iB \psdot(@TMP)\fi % + \edef\theline{\noexpand\arg@E\arg@B\arg@C(@TMPA)(@TMP)}% +\fi % +%\show\theline +\theline% +\fi % LStart empty +}% end multido loop +\egroup\fi\fi % +% +%Dots +\ifdefined\NumDots% +\ifnum\NumDots>\z@% +{\ifdefined\DotSettings \DotSettings\fi % +\whiledo{\NumDots>\z@}{% +\checkDotPos(\NumDots)% +\let\arg@B\cachedata% +\ifemptydata\else% +\nodex\arg@B% +\checkDotType(\NumDots)% +\ifemptydata\let\arg@E\psdot\else % +\expandafter\let\expandafter\arg@E\csname psdot\cachedata\endcsname\fi % +\checkDotOpts(\NumDots)% +\ifemptydata % + \edef\arg@A{\noexpand\arg@E(@TMP)}% +\else % + \edef\arg@A{\noexpand\arg@E[\cachedata](@TMP)}% +\fi% +\arg@A% +\fi % +\advance\NumDots by -1\relax % +}% +}%end grouping +\fi \fi% +% +%Fragments% +\ifdefined\NumFragments% +\ifnum\NumFragments>\z@% +\bgroup% +\ifdefined\FragSettings \FragSettings\fi % +\whiledo{\NumFragments>\z@}{% +\checkFrag(\NumFragments)% +\ifemptydata\else%do nothing if fragment blank +\let\arg@E\cachedata% +%\show\arg@E +\checkFragPos(\NumFragments)% +\let\arg@D\cachedata% +\ifx\arg@D\@empty\@pstrickserr{FragPos(\the\NumFragments) missing}{\@ehpc}\fi\nodex\arg@D% +\checkFragRefPt(\NumFragments)% +\let\uflag\@empty% +\expandafter\parseFragRP\cachedata;;\@nil%sets \arg@A, \arg@B and \uflag +\checkFragRotation(\NumFragments)% +\let\arg@C\cachedata% +\checkFragBlankBG(\NumFragments)% +\ifx\uflag\@empty% + \edef\arg@A{\ifx\cachedata\@empty\else*\fi% + \ifx\arg@A\@empty\else[\arg@A]\fi% + \ifx\arg@C\@empty\else{\arg@C}\fi}% + \edef\my@tempA{\noexpand\rput\arg@A(@TMP){\noexpand\arg@E}}\else% + \edef\arg@A{\ifx\cachedata\@empty\else*\fi% + \ifx\arg@A\@empty\else{\arg@A}\fi% + \ifx\arg@B\@empty[0]\else[\arg@B]\fi% + \ifx\arg@C\@empty\else{\arg@C}\fi}%\show\arg@A% +\edef\my@tempA{\noexpand\uput\arg@A(@TMP){\noexpand\arg@E}}% +\fi%uflag +\my@tempA% +\fi%\ifemptydata +\advance\NumFragments by -1 \relax}% end whiledo +\egroup% +\fi \fi %\ifdefined \ifnum +}% end process@picitems +% +\def\parseFragRP#1;#2;#3\@nil{%check whether \cachedata contains ; +\def\arg@A{#1}\def\arg@B{#2}% +\ifx\arg@B\@empty\else\edef\uflag{1}\fi% +}% +\def\parseSeries#1;#2;#3\@nil{%check whether \PointSeries() contains ; +\def\arg@C{#1}\def\arg@E{#2}% +\edef\my@tempA{1}% +\ifx\arg@C\@empty\edef\my@tempA{}\fi% +\ifx\arg@E\@empty\edef\my@tempA{}\fi% +}% +\def\showRC{% +\my@cntA=\MaxR \advance\my@cntA 1 \relax % +\my@cnta=\MaxC \advance\my@cnta 1 \relax % +\multido{\iA=0+1}{\my@cntA}{\psrline[linecolor=green](R\iA)(\xmax,0)\uput[180](R\iA){\scriptsize R\iA}}% +\multido{\iA=0+1}{\my@cnta}{\psrline[linecolor=green](C\iA)(0,\ymax)\uput[-90](C\iA){\scriptsize C\iA}}% +}% +\ProvidesFile{pst-layout.sty} + [\filedate\space \fileversion\space `pst-layout' (ms)] + +\endinput |