[pstricks] points as arguments

Kari Eloranta kari.eloranta at gmail.com
Thu Jun 2 20:32:56 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


Thank you very much Michael, that solved my problem. I modified your code a
bit

\def\vektori(#1)(#2)#3{%
 \pcline[linewidth=2pt,
arrowsize=.3,arrows=->,linecolor=blue](#1)(#2)\naput[npos=.55,labelsep=3pt]{$\vv{#3}$}
}

and now I am able to do just what I wanted. I am just curious, is it
possible to do it in a simple way with LaTeX. Not that I would not be happy
with pure TeX code, but I was surprised not to find any information about it
in my LaTeX manuals.

Best regards, Kari

-- 
**************************************************************
Kari Eloranta
Ketunpolku 1
40400 JYVÄSKYLÄ FINLAND
Tel: +358 40 586 7654
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20110602/ef8ca451/attachment.html>


More information about the PSTricks mailing list