<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I'm still confused about how to introduce computations on inputs into a macro.<div><br></div><div>I am trying to create a macro to then include in a \multido for drawing an arrow</div><div>indicating a vector field. &nbsp;The following two-dimensional version works fine: I can</div><div>insert a postscript formula for the components of the last two inputs and get a reasonable</div><div>picture.</div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>\newcommand{\vectorfieldtwo}[8]{</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>\multido{\rx=#1+#2}{#3}{%</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>\multido{\ry=#4+#5}{#6}{%</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>\psline{-&gt;}(!\rx\space \ry)(!\rx\space #7 add \ry\space #8 add)</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>}}</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>}%2-dim vectorfield: x starts at #1, increments by #2, #3 iterations;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>%y starts at #4, increments by #5, #6 iterations;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>%#7, #8 components of vector (in terms of \rx &amp; \ry, postscript style</div><div><br></div><div>The following also works in 3D, but I am giving both endpoints of the vector explicitly:</div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>\newcommand{\vecThree}[6]{\pstThreeDLine[arrows=-&gt;]%</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(#1\space,#2\space,#3\space)(#4\space,#5\space,#6\space)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>%arrow from (#1,#2,#3) to (#4,#5,#6)</div><div>However, when I try to do the following, which uses as input the components of the vector</div><div>instead of explicit coordinates for its endpoint, I get an error message (the error is the same</div><div>whether I use an exclamation before the coordinates or not):</div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>\newcommand{\vecatThree}[6]{\pstThreeDLine[arrows=-&gt;]%</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(#1\space &nbsp;#2\space &nbsp;#3\space)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(#1\space #4\space add #2\space #5\space add #3\space #6\space add)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>% arrow pinned to (#1,#2,#3) with components (#4,#5,#6)</div><div><br></div><div><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">Runaway argument?</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">\@nil \edef \pst@coors {\pst@coor \pst@coors }\@ifnextchar ({\pst@@getcoors \ET</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">C.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">! Paragraph ended before \cartesianIIID@coor was complete.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">&lt;to be read again&gt;&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \par&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">l.41&nbsp;</div></blockquote></div></div></div><div>
<span class="Apple-style-span" style="font-size: 12px; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I would like, ultimately, to insert such a macro either into a multido as in the 2-dim example,</p><div>or to do something more sophisticated: &nbsp;given a surface plotted via say parametricplotThreeD,</div><div>to insert a formula for the entries #1, #2, and #3 as well (to plot the vectors only along the points</div><div>of the surface). &nbsp;</div><div><br></div><div>I would also prefer to use the algebraic rather than postscript form for formulas, but that is a minor</div><div>and separate matter.</div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; "><br class="Apple-interchange-newline">Zbigniew Nitecki</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Department of Mathematics</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Tufts University</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Medford, MA 02155</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">telephones:</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Office<span class="Apple-converted-space"><span class="Apple-converted-tab">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span></span>(617)627-3843</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Dept.<span class="Apple-converted-space"><span class="Apple-converted-tab">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span></span>(617)627-3234</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Dept. fax<span class="Apple-converted-space"><span class="Apple-converted-tab">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span></span>(617)627-3966</font></p><a href="http://www.tufts.edu/~znitecki/">http://www.tufts.edu/~znitecki/</a></span>
</div>
<br></div></body></html>