[pstricks] Check for file version of pstricks-add.tex
Herbert Voss
LaTeX at zedat.fu-berlin.de
Wed Mar 21 16:00:40 CET 2007
Christoph Bersch schrieb:
>
> I forgot to mention a crucial point, sorry. The \nlput command was
> introduced before 2.81 (October 2005) but was buggy until this version.
>
> A hack could be to check for the existence of another macro that was
> introduced with version 2.81 (which one could this be?) although this
> does not seem such a good idea to me.
>
\documentclass{article}
\usepackage{pstricks}
\input pstricks-add
\typeout{pstricks-add: \fileversion}
\makeatletter
\ifdim\fileversion pt<2.81pt
\typeout{pstricks-add: new definition of \string\nlput}
\def\psLDNode(#1)(#2)#3#4{%
% #1: node A #2: node B #3: dimen measured from A #4: node name
\pst at getcoor{#1}\pst at tempA%
\pst at getcoor{#2}\pst at tempB%
\pssetlength\pst at dimp{#3}%
\pnode(!%
\pst at tempA /YA exch \pst at number\psyunit div def
/XA exch \pst at number\psxunit div def
\pst at tempB /YB exch \pst at number\psyunit div def
/XB exch \pst at number\psxunit div def
/dx XB XA sub def
/dy YB YA sub def
/angle dy dx Atan def
/linelength \pst at number\pst at dimp \pst at number\psunit div def
XA linelength angle cos mul add YA linelength angle sin mul add ){#4}%
}
\def\nlput{\pst at object{nlput}}
\def\nlput at i(#1)(#2)#3#4{%
\begin at SpecialObj
\psLDNode(#1)(#2){#3}{temp at lnput}
\pcline[linestyle=none](#1)(temp at lnput)%
\ncput[npos=1]{#4}%
\end at SpecialObj
}%
\else\typeout{pstricks-add >2.81!}\fi
\makeatother
\begin{document}
foo \nlput(0,0)(3,3){1cm}{A}%
\psdots(0,0)(A)(3,3)
\end{document}
Herbert
More information about the PSTricks
mailing list