| 1 | \documentclass{article} |
| 2 | \usepackage{tikz} |
| 3 | \usepackage{pdflscape} |
| 4 | \usepackage[top=1.6cm, bottom=1.6cm, left=1.6cm, right=1.6cm]{geometry} |
| 5 | \pagestyle{empty} |
| 6 | \newcommand\genkoyoshi[4]{% maxrow, maxcol, size, sep |
| 7 | \def\maxrow{#1}% |
| 8 | \def\maxcol{#2}% |
| 9 | \def\size{#3}% |
| 10 | \def\sep{#4}% |
| 11 | \begin{tikzpicture} |
| 12 | \pgfmathsetmacro{\inc}{\size+\sep} |
| 13 | \foreach \col in {1,...,\maxcol}{ |
| 14 | \foreach \row in {1,...,\maxrow}{ |
| 15 | \draw ({(\col-1)*\inc pt},{\row*\size}) |
| 16 | rectangle ++ (\size,\size); |
| 17 | } |
| 18 | \draw ({(\col-1)*\inc-\sep},{\size}) |
| 19 | rectangle ++ (\sep,\maxrow*\size); |
| 20 | } |
| 21 | \end{tikzpicture}% |
| 22 | } |
| 23 | \begin{document} |
| 24 | \begin{landscape} |
| 25 | \genkoyoshi{20}{20}{9mm}{3mm} |
| 26 | \end{landscape} |
| 27 | \end{document} |