# Is there a built-in PSTricks macro to get the value of \pslinewidth in the current unit?

I need the value (without trailing unit) of \pslinewidth in \psunit. I have done as follows but I am disappointed with the accuracy.

\documentclass{article}
\parindent=0pt
\usepackage{pstricks}
\pstFPdiv\Temp
{\the\pslinewidth}
{\the\psunit}

\begin{document}
\the\pslinewidth% prints 0.8pt

\Temp% prints 0.028116799998875328

\psset{linewidth=\Temp}
\the\pslinewidth% prints 0.80014pt
\end{document}


Is there a built-in macro to get the value (without trailing unit) of \pslinewidth in any \psunit? The value is very useful to adjust plotting domain such that the cropped curve strokes near the domain edges can be avoided.

The real scenario is as follows. Note: \Temp is the half of \pslinewidth that is not the same as the example above.

\documentclass{article}
\usepackage{pst-func}

\def\Left{-1}
\def\Bottom{-1}
\def\Right{1}
\def\Top{1}

\psset{unit=2cm,linewidth=20pt}

%half of linewidth tickness
\pstFPdiv\Temp{\the\pslinewidth}{\the\dimexpr2\psunit\relax}

\pstFPsub\LEFT\Left\Temp
\pstFPsub\BOTTOM\Bottom\Temp
\pstFPsub\TOP\Top\Temp

\begin{document}
\section*{Without extending the plotting domain}
\begin{pspicture*}[showgrid](\Left,\Bottom)(\Right,\Top)
\psPolynomial[coeff=-1 0 2,linecolor=red]{\Left}{\Right}
\end{pspicture*}

\section*{With extending the plotting domain}
\begin{pspicture*}[showgrid](\LEFT,\BOTTOM)(\RIGHT,\TOP)
\psPolynomial[coeff=-1 0 2,linecolor=red]{\Left}{\Right}
\end{pspicture*}
\end{document}


I accepted Herbert's answer that implies that there is no such a built-in macro.

I also want to emphasize that

• Herbert's method is less accurate than mine.
• The length in Herbert's method cannot be passed to functions that only accept values without unit. But the value in mine can be passed to such functions.
-

\documentclass{article}
\usepackage{pst-func}

\psset{unit=2cm,linewidth=20pt}
\newdimen\Left   \Left=-1\psxunit
\newdimen\Bottom \Bottom=-1\psxunit
\newdimen\Right  \Right=1\psyunit
\newdimen\Top    \Top=1\psyunit

\begin{document}
\section*{With extending the plotting domain}
\begin{pspicture*}[showgrid](\Left,\Bottom)(\Right,\Top)
\psPolynomial[coeff=-1 0 2,linecolor=red]{-1}{1}
\end{pspicture*}

\end{document}


-
The value of \pslinewidth must be in the current unit rather than in pt, so I can use it for adjusting plotting domain. –  xport Jul 25 '11 at 18:29
sure, nobody changed the linewidth, scaling is done on PostScript side –  Herbert Jul 25 '11 at 18:33
The required value (without trailing unit) of \pslinewidth must be in the current unit rather than in pt, so I can use it for adjusting plotting domain. –  xport Jul 25 '11 at 18:34
I will show you the real scenario. Please wait a minute. –  xport Jul 25 '11 at 18:35
see edited answer –  Herbert Jul 25 '11 at 18:38