# [pstricks] global PS procedure for getting the current linewidth in correct units

Christoph Bersch usenet at bersch.net
Thu Apr 17 13:18:16 CEST 2008

Hi,

is there a way to define a global PS procedure for getting the current
linewidth scaled to the correct units?
I tried to do it using the snippet

\pst at Verb{/GetLW {CLW \pst at number\psxunit\space div} bind def}

at the beginning of the document, but this obviously fails when the unit
is changed within the document (shown in the example below). I could not
find any postscript equivalent to '\pst at number\psxunit'. Is there any,
or how can solve the problem?

Thank you,
Christoph

\documentclass{article}
\usepackage{pstricks}
\SpecialCoor
\makeatletter
\pst at Verb{/GetLW {CLW \pst at number\psxunit\space div} bind def}
\makeatother
\begin{document}
\psset{unit=2cm}
\begin{pspicture}[showgrid=true](2,2)
\psset{linewidth=1cm}
\makeatletter
\psdot[dotstyle=x](! CLW \pst at number\psxunit\space div 0)
\psdot[dotstyle=+](! GetLW 0)
\makeatother
\end{pspicture}
\end{document}