[pstricks] Check for file version of pstricks-add.tex
Herbert Voss
LaTeX at zedat.fu-berlin.de
Tue Mar 20 15:48:11 CET 2007
Christoph Bersch schrieb:
> for my package I need a pstricks-add.tex version >= 2.81. Is there a way
> to check for this (\RequirePackage does not work, as I want to use a
> certain version of the _.tex_ file) and alternatively define the macro
> in my package?
>
> \ifversion>=2.81
> % include pstricks-add.tex
> \else
> % use the corresponding code part
> \fi
>
> Is this possible and is this a good idea? I need the macro \nlput (the
> related code contains only 24 lines).
>
there are different possibilities:
\providecommand\nlput....
...
}
\usepackage{pstricks-add}
or check, if \nlput exists.
Herbert
\documentclass{article}
\usepackage{pstricks-add}
\makeatletter
\@ifundefined{nlput}{%
\typeout{\string\nlput{...} not defined!}
\typeout{pstricks-add: v.\fileversion}
\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
}%
}{}
\makeatother
\begin{document}
foo \nlput(0,0)(3,3){1cm}{A}%
\psdots(0,0)(A)(3,3)
\end{document}
More information about the PSTricks
mailing list