Graphics, Figures & Tablesexecuting command multiple times with different parameters

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Sagil
Posts: 20
Joined: Tue Mar 24, 2009 1:15 am

executing command multiple times with different parameters

Post by Sagil »

The \psdots command from pstricks can take any number of parameters and does something (draws a dot) once for each parameter. I wanted to create a command that does something similar for some other operations (e.g. draw some figure at a given position) once per parameter, i.e. something like

Code: Select all

\myfigs(1,1)(3,7)(4,5)
should draw a predefined figure at positions (1,1), (3,7) and (4,5).

Is there any easy way to do that?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Re: executing command multiple times with different parameters

Post by kaiserkarl13 »

I haven't used it much, but does \multiput solve this problem?
Sagil
Posts: 20
Joined: Tue Mar 24, 2009 1:15 am

Re: executing command multiple times with different parameters

Post by Sagil »

Unfortunately not, since I don't want the objects put in a straight line. Rather I'd need to specify the coordinates explicitely (like for \psdots).
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

executing command multiple times with different parameters

Post by localghost »

Sagil wrote:[...] Rather I'd need to specify the coordinates explicitely (like for \psdots).
This sounds to me like you want to do a scatter plot. The pstricks-add manual shows you how to do that. If I'm wrong, please explain more precisely what you are aiming at.


Best regards
Thorsten
Sagil
Posts: 20
Joined: Tue Mar 24, 2009 1:15 am

Re: executing command multiple times with different parameters

Post by Sagil »

Works, \rmultiput did the trick! :D

Thanks, Henning
Post Reply