Bhavneet
Bhavneet

Reputation: 317

Using loops in latex

I'm trying to create 5*2 matrix using \psframe. I want to repeat the following code using loops and changing the coordinates. Means just adding into X and Y coordinates and getting the results.

\documentclass[a4paper]{article}
\usepackage{pstricks}
\begin{document}
\psframe(-3,-1)(5.5,3) %frame1
\end{document}

Upvotes: 2

Views: 1098

Answers (2)

Joel Berger
Joel Berger

Reputation: 20280

PGF has the pgffor package. It can be used independent of PGF so in principal you could use it for PSTricks. In the future, you might look into using PGF/TikZ unless you are bound to PSTricks, it's being actively developed and can do some really amazing things.

Upvotes: 0

harper
harper

Reputation: 13690

It's not a loop in LaTeX but in PSTricks:

\documentclass[a4paper]{article}
\usepackage{pstricks}
\begin{document}
\psframe(-3,-1)(5.5,3) %frame1

\begin{pspicture}(4,4)
\multirput(0,0)(1,0){4}{
    \multirput(0,0)(0,1){3}{
        \psframe(0,-1)(1,1)}
}
\end{pspicture}
\end{document}

Upvotes: 2

Related Questions