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}
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}
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.
精彩评论