[pstricks] points as arguments

Manfred Braun manfred.braun at uni-due.de
Thu Jun 2 21:26:53 CEST 2011


Hi Kari,
Coming back to your original macro, there were two errors, namely
1. you have to write  \newcommand{\vektori}[3]{...}  -- note the position of the closing parenthesis -- or  \newcommand\vektori[3]{...}
2. as noted already by Michael, the argument (B) in the \uput makes no sense, supposedly it should be something like (#1).
Correcting these flaws makes your macro work. (Michael's suggestion is still the better choice.) 
Manfred

On 02.06.2011, at 21:32, Kari Eloranta wrote:

> 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
> _______________________________________________
> 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/20110602/0c1f88b1/attachment-0001.html>


More information about the PSTricks mailing list