[pstricks] [pst-eucl] The Macro \pstDistVal causes some error when the package pst-fractal was loaded.

廖雄飞 liaofei1128 at 163.com
Sat Sep 28 07:47:08 CEST 2019


Hi, 
    When I use the pst-eucl package to draw a circle with the center O and radius R, I compiled the code with pdflatex,  
and an unexpected string like '28.45274 mul' were draw in the output figure.
    After I remove the unconcerned code, I found that it only happened when I load the pst-fractal package,  
if I comment out the \usepackage{pst-fractal} line, I can get the right figure. 
The minimal test code as following:


\documentclass{article}
\usepackage{pst-eucl}
\usepackage{pst-fractal}
\usepackage{auto-pst-pdf}
\begin{document}
\begin{pspicture}[showgrid=false](-4,-4)(4,4)
\pstGeonode(0,0){O}
\pstCircleOA[Radius=\pstDistVal{3}]{O}{}
\end{pspicture}
\end{document}


After read the source of pst-eucl package, I think the unexpected string in the output figure was brought from 
the macro \pstDistVal, which was set to \psk at Radius and used by \pstCircleOA:


\def\pstDistVal#1{%
 #1 \pst at number\psxunit mul
  \ifx\psk at DistCoef\@none\else
    \psk at DistCoef\space mul
  \fi
}


\def\pstCircleOA{\pst at object{pstCircleOA}}%
\def\pstCircleOA at i#1#2{%
  \bgroup\use at par%
  \rput(#1){%
    \begin at ClosedObj
      \def\pst at linetype{4}%
      \addto at pscode{%
        tx at EcldDict begin
          /N@#1 GetNode
          \ifx\psk at Radius\@none
            \ifx\psk at Diameter\@none
              2 copy /N@#2 GetNode ABDist
            \else\psk at Diameter 2 div
            \fi
          \else\psk at Radius\space
          \fi
        end
        \psk at dimen CLW mul sub 0 360 arc closepath}%
      \showpointsfalse
    \end at ClosedObj
  }%
  \egroup%
}%


The code was very clear and I have no idea why the code string '28.45274 mul' on the postscript stack was draw in the figure.


And I tried to compile this minimal code with engine latex, this time I comment out the \usepackage{auto-pst-pdf} line too. 
If you want to have a try, please save the following code into test.tex and then latex it. 
--------


\documentclass{article}
\usepackage{pst-eucl}
\usepackage{pst-fractal}
\begin{document}
\begin{pspicture}[showgrid=false](-4,-4)(4,4)
\pstGeonode(0,0){O}
\pstCircleOA[Radius=\pstDistVal{3}]{O}{}
\end{pspicture}
\end{document}


--------


But this time the engine latex reported some error, and I can't get the output dvi file.


$latex test.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/W32TeX) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2018-12-01>
(c:/texlive/2019/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(c:/texlive/2019/texmf-dist/tex/latex/base/size10.clo))
(c:/texlive/2019/texmf-dist/tex/latex/pst-eucl/pst-eucl.sty
(c:/texlive/2019/texmf-dist/tex/latex/pstricks/pstricks.sty
(c:/texlive/2019/texmf-dist/tex/generic/iftex/iftex.sty)
(c:/texlive/2019/texmf-dist/tex/latex/tools/shellesc.sty)
(c:/texlive/2019/texmf-dist/tex/latex/xcolor/xcolor.sty
(c:/texlive/2019/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(c:/texlive/2019/texmf-dist/tex/latex/graphics-def/dvips.def))
(c:/texlive/2019/texmf-dist/tex/generic/xkeyval/pst-xkey.tex
(c:/texlive/2019/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(c:/texlive/2019/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(c:/texlive/2019/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(c:/texlive/2019/texmf-dist/tex/generic/xkeyval/keyval.tex)))))
(c:/texlive/2019/texmf-dist/tex/generic/pstricks/pstricks.tex
(c:/texlive/2019/texmf-dist/tex/generic/pstricks/pst-fp.tex
`pst-fp' v0.05, 2010/01/17 (hv))
(c:/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
(c:/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex)
) (c:/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(c:/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex)
) (c:/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
Loading pgffor.code.tex
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex)
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.te
x)
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric
.code.tex)
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.t
ex)
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.co
de.tex)
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex
)
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.te
x)
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex
)
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithm
etics.code.tex)))
(c:/texlive/2019/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)))
`PSTricks' v2.96  <2019/02/23> (tvz,hv)
(c:/texlive/2019/texmf-dist/tex/generic/pstricks/pstricks.con))
(c:/texlive/2019/texmf-dist/tex/generic/pstricks/pst-fp.tex))
(c:/texlive/2019/texmf-dist/tex/latex/pst-node/pst-node.sty
(c:/texlive/2019/texmf-dist/tex/generic/pst-node/pst-node.tex
 v1.42, 2019/03/03))
(c:/texlive/2019/texmf-dist/tex/latex/pst-tools/pst-tools.sty
(c:/texlive/2019/texmf-dist/tex/generic/pst-tools/pst-tools.tex
`PST-tools' v0.09b, 2017/12/03 (hv)))
(c:/texlive/2019/texmf-dist/tex/latex/pst-calculate/pst-calculate.sty
(c:/texlive/2019/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(c:/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3.sty
(c:/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(c:/texlive/2019/texmf-dist/tex/latex/l3kernel/l3dvips.def)))
(c:/texlive/2019/texmf-dist/tex/latex/siunitx/siunitx.sty
(c:/texlive/2019/texmf-dist/tex/latex/amsmath/amstext.sty
(c:/texlive/2019/texmf-dist/tex/latex/amsmath/amsgen.sty))
(c:/texlive/2019/texmf-dist/tex/latex/tools/array.sty)
(c:/texlive/2019/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty)
(c:/texlive/2019/texmf-dist/tex/latex/translator/translator.sty)))
(c:/texlive/2019/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex
(c:/texlive/2019/texmf-dist/tex/generic/pst-arrow/pst-arrow.tex
`pst-arrow' v0.01, 2016/09/01 (dr,hv))
(c:/texlive/2019/texmf-dist/tex/generic/multido/multido.tex
 v1.42, 2010/05/14 <tvz>) `PST-Euclide v1.65, 2019/08/19 (dr,hv)))
No file test.aux.
(c:/texlive/2019/texmf-dist/tex/latex/base/ts1enc.dfu)
(c:/texlive/2019/texmf-dist/tex/latex/translator/translator-basic-dictionary-En
glish.dict)
(c:/texlive/2019/texmf-dist/tex/latex/siunitx/siunitx-abbreviations.cfg)
! Illegal unit of measure (pt inserted).
<to be read again>
                   2
l.19 \pstCircleOA[Radius=\pstDistVal{3}]{O}{}


?
-------------------------------------------------------------------


So I comment out the pst-fractal package, and include some code from this package, 
I found the following three lines (with catcode @ as letter)  will cause the same error.


\documentclass{article}
\usepackage{pst-eucl}
%\usepackage{pst-fractal}
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
\pst at addfams{pst-fractal}
\newdimen\pst at fractal@Radius
\define at key[psset]{pst-fractal}{Radius}[5cm]{\pssetlength\pst at fractal@Radius{#1}}
\catcode`\@=\PstAtCode\relax
\begin{document}
\begin{pspicture}[showgrid=false](-4,-4)(4,4)
\pstGeonode(0,0){O}
\pstCircleOA[Radius=\pstDistVal{3}]{O}{}
\end{pspicture}
\end{document}


May be the problem was the same key name 'Radius'? After I change the key name to RadiusX:
\define at key[psset]{pst-fractal}{RadiusX}[5cm]{\pssetlength\pst at fractal@Radius{#1}}
then I can latex the code successfully.


But this is not the right way to solve this issue, does any one can give a better fix?


Thanks.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/pstricks/attachments/20190928/35c79766/attachment.html>


More information about the PSTricks mailing list