[pstricks] computed coordinates

Zbigniew Nitecki zbigniew.nitecki at tufts.edu
Sun Apr 25 18:44:47 CEST 2010


I tried that, both with a  space between the "add" and the comma, and without one.  
I don't get the runaway argument, but it also fails to compile.
I can't see what I am doing wrong;  do I have a wrong or outdated file?

Source code (complete .tex file):
> %!TEX TS-program =  latex
> \documentclass[11pt]{article}
> \usepackage{amsmath, amssymb}
> \usepackage{pstricks, pst-plot, pst-math, pst-3dplot}
> \usepackage{pst-grad, pst-func, pst-text}
> \usepackage{pstricks-add}
> 
> \listfiles
> 	\newcommand{\vectorfieldtwo}[8]{
> 			\multido{\rx=#1+#2}{#3}{%
> 				\multido{\ry=#4+#5}{#6}{%
> 					\psline{->}(!\rx\space \ry)(!\rx\space #7 add \ry\space #8 add)
> 						}}
> 				}%2-dim vectorfield: x starts at #1, increments by #2, #3 iterations;
> 				%y starts at #4, increments by #5, #6 iterations;
> 				%#7, #8 components of vector (in terms of \rx & \ry, postscript style
> 
> 
> 
> 	\newcommand{\vecThree}[6]{\pstThreeDLine[arrows=->]%
> 		(#1\space,#2\space,#3\space)(#4\space,#5\space,#6\space)
> 	}
> 		%arrow from (#1,#2,#3) to (#4,#5,#6)
> 	\newcommand{\vecatThree}[6]{\pstThreeDLine[arrows=->]%
> 		(!#1\space,  #2\space,  #3\space)
> 		(!#1\space #4\space add, #2\space #5\space add, #3\space #6\space add)
> 	}
> 		% arrow pinned to (#1,#2,#3) with components (#4,#5,#6)
> 
> \begin{document}
> \begin{pspicture}(-5,-5)(5,5)
> %	\vectorfieldtwo{-1}{0.5}{6}{-1}{0.5}{6}{\rx\space dup mul}{\ry\space \rx\space add}
> %	\vecThree{0.5}{1}{-1}{1}{-1}{2}
> 	\vecatThree{0.5}{1}{-1}{1}{-1}{2}
> \end{pspicture}
> 
> \end{document}

Console output:
### This is /usr/texbin/simpdftex, Version 20070809
### /usr/texbin/latex minpicturetest.tex
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009)
entering extended mode
(./minpicturetest.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, german-x-2009-06-19, ngerman-x-2009-06-19, ancientgreek, ibycus, ar
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutc
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, ku
rmanji, latin, latvian, lithuanian, mongolian, mongolian2a, bokmal, nynorsk, po
lish, portuguese, romanian, russian, sanskrit, serbian, slovak, slovenian, span
ish, swedish, turkish, ukenglish, ukrainian, uppersorbian, welsh, loaded.
(/usr/local/texlive/2009/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2009/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2009/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2009/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2009/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2009/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/local/texlive/2009/texmf-dist/tex/latex/pstricks/pstricks.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/pstricks/pstricks.tex
`PSTricks' v1.29  <2009/05/19> (tvz)
(/usr/local/texlive/2009/texmf-dist/tex/generic/pstricks/pstricks.con))
(/usr/local/texlive/2009/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/latexconfig/color.cfg)
(/usr/local/texlive/2009/texmf-dist/tex/latex/graphics/dvips.def)))
(/usr/local/texlive/2009/texmf-dist/tex/latex/pstricks/pst-plot.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/pstricks/pst-plot.tex
(/usr/local/texlive/2009/texmf-dist/tex/generic/multido/multido.tex
 v1.41, 2004/05/18 <tvz>)  v1.04, 2009/06/08))
(/usr/local/texlive/2009/texmf-dist/tex/latex/pst-math/pst-math.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/pst-math/pst-math.tex
`pst-math' v0.23 , (CJ,hv)))
(/usr/local/texlive/2009/texmf-dist/tex/latex/pst-3dplot/pst-3dplot.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/pst-3dplot/pst-3dplot.tex
(/usr/local/texlive/2009/texmf-dist/tex/generic/pst-3d/pst-3d.tex
(/usr/local/texlive/2009/texmf-dist/tex/generic/xkeyval/pst-xkey.tex
(/usr/local/texlive/2009/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2009/texmf-dist/tex/generic/xkeyval/keyval.tex))))
`PST-3d' v1.00, 2005/09/03 (tvz))
(/usr/local/texlive/2009/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex
(/usr/local/texlive/2009/texmf-dist/tex/generic/pstricks/pst-node.tex
 v1.01, 2008/11/26)
(/usr/local/texlive/2009/texmf-dist/tex/generic/pstricks-add/pst-fp.tex
`pst-fp' v0.02, 2009/04/02 (hv)) `pstricks-add' v3.35, 2009/10/12 (dr,hv))
(/usr/local/texlive/2009/texmf-dist/tex/generic/multido/multido.tex
 v1.41, 2004/05/18 <tvz>) `PST-3dplot' v1.86, 2009/10/06 (HV,DL)))
(/usr/local/texlive/2009/texmf-dist/tex/latex/pst-grad/pst-grad.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/pst-grad/pst-grad.tex
`pst-grad' v1.06, 2006/11/27 (tvz,dg,hv)))
(/usr/local/texlive/2009/texmf-dist/tex/latex/pst-func/pst-func.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/pst-func/pst-func.tex
`PST-func' v0.60, 2009/10/08 (hv)))
(/usr/local/texlive/2009/texmf-dist/tex/latex/pst-text/pst-text.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/pst-text/pst-text.tex
 v1.00, 2006/11/05(tvz,hv)))
(/usr/local/texlive/2009/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex))

No file minpicturetest.aux.
[1] (./minpicturetest.aux)

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size11.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
 amsmath.sty    2000/07/18 v2.13 AMS math features
 amstext.sty    2000/06/29 v2.01
  amsgen.sty    1999/11/30 v2.0
  amsbsy.sty    1999/11/29 v1.2d
  amsopn.sty    1999/12/14 v2.01 operator names
 amssymb.sty    2009/06/22 v3.00
amsfonts.sty    2009/06/22 v3.00 Basic AMSFonts support
pstricks.sty    2008/11/26 v0.40 LaTeX wrapper for `PSTricks' (RN,HV)
pstricks.tex    2009/05/19 v1.29 `PSTricks' (tvz,hv)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
   dvips.def    1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
pst-plot.sty    2004/07/15 package wrapper for pst-plot.tex
pst-plot.tex    2009/06/08 1.04 `pst-plot' (tvz)
pst-math.sty    2009/01/20 package wrapper for PSTricks pst-math.tex
pst-3dplot.sty    2009/07/28 package wrapper for pst-3dplot.tex (hv)
pst-3dplot.tex    2009/10/06 v1.86 `PST-3dplot' (hv)
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
 xkeyval.sty    2008/08/13 v2.6a package option processing (HA)
 xkeyval.tex    2008/08/13 v2.6a key=value parser (HA)
pst-grad.sty    2004/07/15 package wrapper for pst-grad.tex (hv)
pst-grad.tex    2006/11/27 1.06 `pst-grad' (tvz)
pst-func.sty    2008/03/21 package wrapper for pst-func.tex (hv)
pst-func.tex    2009/10/08 v0.60 `PST-func' (hv)
pst-text.sty    2006/01/01 package wrapper for pst-text.tex (hv)
pst-text.tex    2006/11/05 1.00 `pst-text' (tvz)
pstricks-add.sty    2009/03/17 v. 0.13 package wrapper for pstricks-add.tex (hv
)
pstricks-add.tex    2006/11/05 v1.00 `PSTricks-add' (hv)
 ***********

 )
Output written on minpicturetest.dvi (1 page, 3560 bytes).
Transcript written on minpicturetest.log.
### /usr/texbin/dvips -R -Poutline  -o /tmp/altpdflatex.13452-1272213493/minpicturetest.ps minpicturetest.dvi
This is dvips(k) 5.98 Copyright 2009 Radical Eye Software (www.radicaleye.com)
' TeX output 2010.04.25:1238' -> /tmp/altpdflatex.13452-1272213493/minpicturetest.ps
</usr/local/texlive/2009/texmf/dvips/base/tex.pro>
</usr/local/texlive/2009/texmf-dist/dvips/pstricks/pstricks.pro>
</usr/local/texlive/2009/texmf-dist/dvips/pstricks/pst-algparser.pro>
</usr/local/texlive/2009/texmf-dist/dvips/pstricks/pst-dots.pro>
</usr/local/texlive/2009/texmf-dist/dvips/pst-math/pst-math.pro>
</usr/local/texlive/2009/texmf-dist/dvips/pstricks/pst-node.pro>
</usr/local/texlive/2009/texmf-dist/dvips/pstricks-add/pstricks-add.pro>
</usr/local/texlive/2009/texmf-dist/dvips/pst-3dplot/pst-3dplot.pro>
</usr/local/texlive/2009/texmf-dist/dvips/pst-grad/pst-grad.pro>
</usr/local/texlive/2009/texmf-dist/dvips/pst-func/pst-func.pro>
</usr/local/texlive/2009/texmf-dist/dvips/pst-text/pst-text.pro>
</usr/local/texlive/2009/texmf/dvips/base/texps.pro>
</usr/local/texlive/2009/texmf/dvips/base/special.pro>
</usr/local/texlive/2009/texmf/dvips/base/color.pro>. 
</usr/local/texlive/2009/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
[1] 
### ps2pdf13 /tmp/altpdflatex.13452-1272213493/minpicturetest.ps /tmp/altpdflatex.13452-1272213493/minpicturetest.pdf
Error: /undefined in !0.5
Operand stack:
   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1862   1   3   %oparray_pop   1861   1   3   %oparray_pop   1845   1   3   %oparray_pop   1739   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1150/1684(ro)(G)--   --dict:0/20(G)--   --dict:116/200(L)--   --dict:175/300(L)--   --dict:38/200(L)--   --dict:95/200(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 161598
GPL Ghostscript 8.70: Unrecoverable error, exit code 1
### FAILED to generate /tmp/altpdflatex.13452-1272213493/minpicturetest.pdf ()



Zbigniew Nitecki
Department of Mathematics
Tufts University
Medford, MA 02155

telephones:
Office    (617)627-3843
Dept.    (617)627-3234
Dept. fax    (617)627-3966
http://www.tufts.edu/~znitecki/

On Apr 25, 2010, at 12:10, Michael Sharpe wrote:

> 
> On Apr 25, 2010, at 7:00 AM, Zbigniew Nitecki wrote:
> 
>> I'm still confused about how to introduce computations on inputs into a macro.
>> 
>> I am trying to create a macro to then include in a \multido for drawing an arrow
>> indicating a vector field.  The following two-dimensional version works fine: I can
>> insert a postscript formula for the components of the last two inputs and get a reasonable
>> picture.
>> 	\newcommand{\vectorfieldtwo}[8]{
>> 			\multido{\rx=#1+#2}{#3}{%
>> 				\multido{\ry=#4+#5}{#6}{%
>> 					\psline{->}(!\rx\space \ry)(!\rx\space #7 add \ry\space #8 add)
>> 						}}
>> 				}%2-dim vectorfield: x starts at #1, increments by #2, #3 iterations;
>> 				%y starts at #4, increments by #5, #6 iterations;
>> 				%#7, #8 components of vector (in terms of \rx & \ry, postscript style
>> 
>> The following also works in 3D, but I am giving both endpoints of the vector explicitly:
>> 	\newcommand{\vecThree}[6]{\pstThreeDLine[arrows=->]%
>> 		(#1\space,#2\space,#3\space)(#4\space,#5\space,#6\space)
>> 	}
>> 		%arrow from (#1,#2,#3) to (#4,#5,#6)
>> However, when I try to do the following, which uses as input the components of the vector
>> instead of explicit coordinates for its endpoint, I get an error message (the error is the same
>> whether I use an exclamation before the coordinates or not):
>> 
>> 	\newcommand{\vecatThree}[6]{\pstThreeDLine[arrows=->]%
>> 		(#1\space  #2\space  #3\space)
>> 		(#1\space #4\space add #2\space #5\space add #3\space #6\space add)
>> 	}
>> 		% arrow pinned to (#1,#2,#3) with components (#4,#5,#6)
>> 
>>> Runaway argument?
>>> \@nil \edef \pst at coors {\pst at coor \pst at coors }\@ifnextchar ({\pst@@getcoors \ET
>>> C.
>>> ! Paragraph ended before \cartesianIIID at coor was complete.
>>> <to be read again> 
>>>                   \par 
>>> l.41 
>> 
>> I would like, ultimately, to insert such a macro either into a multido as in the 2-dim example,
>> or to do something more sophisticated:  given a surface plotted via say parametricplotThreeD,
>> to insert a formula for the entries #1, #2, and #3 as well (to plot the vectors only along the points
>> of the surface).  
>> 
>> I would also prefer to use the algebraic rather than postscript form for formulas, but that is a minor
>> and separate matter.
>> 
> 
> Just change (#1\space #4\space add #2\space #5\space add #3\space #6\space add) to
>> (#1\space #4\space add, #2\space #5\space add ,#3\space #6\space add)
> 
> The three-d coordinate parser always expects coordinates separated by commas, unlike the two-d coordinate parser.
> 
> Michael
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
> archive: http://www.tug.org/pipermail/pstricks/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20100425/467d3d3c/attachment-0001.html>


More information about the PSTricks mailing list