[pstricks] points as arguments

Michael Sharpe msharpe at ucsd.edu
Thu Jun 2 17:57:57 CEST 2011


On Jun 2, 2011, at 4:16 AM, Kari Eloranta wrote:

> I am afraid that I do not know how to pass points as arguments. I tried to define a macro
> 
> \newcommand{\vektori[3]}{
>  \psline[arrowsize=.3,arrows=->,linecolor=black](#1)(#2)
>  \uput[-90](B){$\vec{#3}$}
> }
> 
> for drawing force vectors in physics.
> 
> When I try to call the macro with
> 
> \vektori{6,6}{5,5}{F}
> 
> I get the error message "missing number treated as zero". Would anybody be kind enough and teach me what it is I am missing here. I have tried to find information from several books and internet sources without any success.
> 
> Best regards,
>  Kari

The plain TeX macros seem to offer more control than the LaTeX versions.

\def\vektori(#1)(#2)#3{%
 \psline[arrowsize=.3,arrows=->,linecolor=black](#1)(#2)
 \uput[-90](#1){$\vec{#3}$}
}

(I didn't know what B referred to.) You might find it better to use a different method of attaching a label, using a point connection. For example,

\def\vektori(#1)(#2)#3{%
 \pcline[arrowsize=.3,arrows=->,linecolor=black](#1)(#2)\naput[npos=.35]{$\vec{#3}$}
}

which draws the label .35 of the way from #1 to #2, on the left side (looking from #1 to #2).

Michael


More information about the PSTricks mailing list