Kapitel/Chapter 35

"Grafik mit PSTricks"/"Graphics with PSTricks"

Kapitel/Chapter 35

Weitere Beispiele

% !TEX lualatex
\DocumentMetadata{}
\documentclass{article}
\usepackage[landscape,margin = 2cm]{geometry}
\usepackage{pstricks}
\psset{dimen = m}
\usepackage{multido}
\usepackage{expl3}

\def\Arrow{\psline{->}(-0.2,-0.2)(0.2,0.2)}
\def\Frame#1(#2,#3){%
  \psframe#1[linecolor=black!50](#2,#3)%
  \if$#1$\else\rput(! #2 2 div #3 2 div){+}\rput(0,#3){\Arrow}\rput{90}(#2,#3){\Arrow}\fi}
\makeatletter
\def\RPut{\@ifnextchar(\RPut@ii\RPut@i}
\def\RPut@i#1(#2,#3){\rput{#1}(\fpeval{#2},\fpeval{#3})}
\def\RPut@ii(#1,#2){\rput(\fpeval{#1},\fpeval{#2})}

\def\Bricks{\@ifnextchar(\psBricks{\psBricks(2,1)}}%
\def\psBricks(#1,#2)#3{%
  \begin{pspicture}[calcframe]
  \edef\dX{\numexpr2*#1}%
  \edef\dY{\numexpr2*#2}%
  \multido{\iN=0+1}{#3}{%
    \multido{\iA=\iN+\dX}{\numexpr#3-\iN}{\RPut(\iA+\iN*#2,\iN*#2){\Frame(#1,#2)}}
\multido{\iB={\numexpr\iN+#1}+\dX}{\numexpr#3-\iN-1}{\RPut(\iB+\iN*#2,\iN*#2){\Frame*(#1,#2)}}
  }
\end{pspicture}}
\makeatother
\begin{document}
\Bricks(2,1){4}\par
\Bricks(3,2){4}\par
\Bricks{6}
\end{document}

Zurück zur Hauptseite/Back to main page
Copyright $Id: chapter35.html 73 2023-09-07 12:58:10Z voss $