Wednesday, October 31, 2012

Deal with repetitive work in pstricks efficiently (1) --- multirput

Computer makes the repetitive work simple. And in pstricks command "\multirput" and "\multido" is designed to deal with the repetitive work.
This time we will talk about command "\multirput", and in the next post "\multido" will also be talked.

"\multirput" as its literal meaning, archive the utility of multi "\rput" commands. The complete form of this command is "\multirput [refpoint] {rotation} (x0,y0) (dx,dy) {nums} {stuff}". The argument "refpoint", "rotation" and "stuff" have the same meaning as the corresponding arguments in command "\rput". (x0,y0) is the starting rput position and (dx,dy) is the increasement, and "nums" is the repetation times. In the following example we use this command to create a simple geometry pattern.

\documentclass{article}
\usepackage{pst-plot}
\usepackage{pstricks}
\begin{document}
  \begin{pspicture}(0,0)(8,5) 
    %horizontal loop
    \multirput[bl](0,0)(1,0){5}
    {
      %vertical loop
      \multirput[bl](0,0)(0.5,0.866){5} 
      {
        \psline(0,0)(1,0)(0.5,0.866)(0,0)
        %Draw a equilateral triangle
      }
    }
    \psline(2.5,4.33)(7.5,4.33) %top line
    \psline(7.5,4.33)(5,0) %right line
  \end{pspicture}
\end{document}

Fig.1 Deal with repetitive work in efficiently (1) --- multirput

Files Download: tex ps pdf
Creative Commons License
Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.