blob: 5356183d4ea053e704c639831713d22e63d2271a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
\documentclass[tikz]{standalone}
\usepackage{ifthen}
\usepackage{intcalc}
\begin{document}
\begin{tikzpicture}
\pgfkeys{/pgf/number format/.cd,fixed,precision=0}
\draw[gray,step=2cm] (0,0) grid (20cm, 20cm) rectangle (0, 0);
\foreach \y in {1,...,10}
\foreach \x in {1,...,10}
\pgfmathsetmacro{\p}{ifthenelse(\intcalcMod{\y}{2}==1, \x + (\y - 1) * 10, 10 * \y - \x + 1)}
\node at (\x * 2cm - 1cm, \y * 2cm - 1cm) { \pgfmathprintnumber{\p} };
\end{tikzpicture}
\end{document}
|