summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-abspos
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-09-27 23:21:34 +0000
committerKarl Berry <karl@freefriends.org>2009-09-27 23:21:34 +0000
commite7f049fa0c02e2011551de39ad50a836a26ca76c (patch)
treec12254bb5303ca22bcb81d6ae0ebb8faa28aa6f1 /Master/texmf-dist/tex/generic/pst-abspos
parent4de5d522eaad563d787cdfa4ae9a4f44003968d0 (diff)
new pstricks package pst-abspos 0.20 (27sep09)
git-svn-id: svn://tug.org/texlive/trunk@15485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pst-abspos')
-rw-r--r--Master/texmf-dist/tex/generic/pst-abspos/pst-abspos.tex136
1 files changed, 136 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/pst-abspos/pst-abspos.tex b/Master/texmf-dist/tex/generic/pst-abspos/pst-abspos.tex
new file mode 100644
index 00000000000..2f5ac667454
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pst-abspos/pst-abspos.tex
@@ -0,0 +1,136 @@
+%% $Id: pst-abspos.tex 135 2009-09-27 12:33:57Z herbert $
+%%
+%% This is file `pst-abspos.tex',
+%%
+%% IMPORTANT NOTICE:
+%%
+%% Package `pst-abspos.tex'
+%%
+%% Herbert Voss <voss@perce.de>
+%%
+%% This program can be redistributed and/or modified under the terms
+%% of the LaTeX Project Public License Distributed from CTAN archives
+%% in directory macros/latex/base/lppl.txt.
+%%
+%% DESCRIPTION:
+%% `pst-abspos' is a PSTricks package to put objects at absolute coordinates
+%%
+%% For a ChangeLog go the the end
+%%
+\csname PSTabsposLoaded\endcsname
+\let\PSTabsposLoaded\endinput
+% Requires PSTricks, pst-node
+\ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi
+\ifx\PSTnodesLoaded\endinput\else\input pst-node.tex\fi
+\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey \fi
+%
+\def\fileversion{0.2}
+\def\filedate{2009/09/27}
+\message{`PST-abspos' v\fileversion, \filedate\space (Herbert Voss)}
+%
+\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
+\SpecialCoor
+%
+\pst@addfams{pst-abspos}
+%
+\newif\ifpst@lowerleft \pst@lowerleftfalse
+\newif\ifpst@notitlepage \pst@notitlepagefalse
+\newdimen\pst@xOffset
+\newdimen\pst@yOffset
+%
+\define@key[psset]{pst-abspos}{position}{\edef\psk@abspos@position{#1}}
+\psset{position=lb}
+%
+\let\pst@newpage\newpage
+%
+\DeclareOption{notitlepage}{\pst@notitlepagetrue}
+\DeclareOption{absolute}{%
+ \ifpst@notitlepage
+ \def\newpage{\pst@newpage\pstSetAbsoluteOrigin}%
+ \AtBeginDocument{\pstSetAbsoluteOrigin}
+ \fi%
+}
+\DeclareOption{lowerleft}{\pst@lowerlefttrue}
+\DeclareOption{relative}{%
+ \ifpst@notitlepage
+ \def\newpage{\pst@newpage\pstSetRelativeOrigin(0,0)}%
+ \AtBeginDocument{\pstSetRelativeOrigin(0,0)}
+ \fi%
+}
+\DeclareOption{PostScript}{%
+ \ifpst@notitlepage
+ \def\newpage{\pst@newpage\pstSetPostScriptOrigin}%
+ \AtBeginDocument{\pstSetPostScriptOrigin}
+ \fi%
+}
+\ProcessOptions\relax
+%
+\def\pst@paperheight{\ifpst@lowerleft 1 \else 0 \fi }
+%
+% save the origin point of the paper plane. This macro must be
+% initiated before any other output
+%
+\def\pstSetRelativeOrigin(#1){\pnode(#1){pst@Origin}}
+\def\pstSetAbsoluteOrigin{%
+ \pst@xOffset=-\oddsidemargin%
+ \advance\pst@xOffset by -\parindent%
+ \pst@yOffset=\topmargin%
+ \advance\pst@yOffset by \headheight%
+ \advance\pst@yOffset by \headsep%
+ \advance\pst@yOffset by \topskip%
+ \bgroup
+ \psset{unit=1pt}
+% \pnode(\strip@pt\pst@xOffset, \strip@pt\pst@yOffset){pstTextOrigin}%
+ \pnode(0,0){pstTextOrigin}%
+ \advance\pst@xOffset by -1in%
+ \advance\pst@yOffset by 1in%
+ \ifpst@lowerleft
+ \advance\pst@yOffset by -\paperheight
+ \advance\pst@yOffset by 1in%
+ \fi
+ \pnode(\strip@pt\pst@xOffset, \strip@pt\pst@yOffset){pst@Origin}%
+ \egroup%
+}
+\def\pstSetPostScriptOrigin{%
+ \pst@xOffset=-\oddsidemargin%
+ \advance\pst@xOffset by -\parindent%
+ \pst@yOffset=\topmargin%
+ \advance\pst@yOffset by \headheight%
+ \advance\pst@yOffset by \headsep%
+ \advance\pst@yOffset by \topskip%
+ \bgroup
+ \psset{unit=1pt}
+ \pnode(\strip@pt\pst@xOffset, \strip@pt\pst@yOffset){pstTextOrigin}%
+ \ifpst@lowerleft
+ \advance\pst@yOffset by -\paperheight
+ \advance\pst@yOffset by 3in
+ \fi
+ \pnode(\strip@pt\pst@xOffset, \strip@pt\pst@yOffset){pst@Origin}%
+ \egroup}
+%
+\def\pstPutAbs{\@ifnextchar[{\pst@PutAbs@i}{\pst@PutAbs@i[]}}
+\def\pst@PutAbs@i[#1](#2)#3{{%
+% #1: options for \rput[#1]{...}
+% #2: absolute coordinates relative to the paper (0,0)
+% #3: any object to put at (#1)
+ \psset{#1}
+ \pnode(0,0){pst@tempNodeA} % the "cursor" position
+ \pst@getcoor{pst@Origin}\pst@tempa % Origin of the paper
+ \pst@getcoor{#2}\pst@tempb % Absolute coordinates
+ \pst@getcoor{pst@tempNodeA}\pst@tempc % relative coordinates
+ \pnode(! % Special Coor
+ /XA \pst@tempa pop \pst@number\psxunit div def
+ /YA \pst@tempa exch pop \pst@number\psyunit div def
+ /XB \pst@tempb pop \pst@number\psxunit div def
+ /YB \pst@tempb exch pop \pst@number\psyunit div def
+ /XC \pst@tempc pop \pst@number\psxunit div def
+ /YC \pst@tempc exch pop \pst@number\psyunit div def
+ XB XC sub XA add
+ YB YC sub YA add \pst@paperheight\space sub){pst@tempNodeB}
+ \rput[\psk@abspos@position](pst@tempNodeB){#3}%
+}}
+%
+\catcode`\@=\PstAtCode\relax
+%
+%% END: pst-abspos.tex
+\endinput