答案1
grid
可以使用绘制网格,无需循环。可以使用循环line width=2pt, line cap=round, dash pattern=on 0pt off 1cm
将各个点标记并编号为s。然后是线条。coordinate
\draw
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[line width=2pt, line cap=round, dash pattern=on 0pt off 1cm](0,0) grid (5,5);
\foreach \n in {1,...,16} {\coordinate[label=135:\n](\n) at({1+mod(\n-1,4)},{4-div(\n-1,4)});}
\draw (1)--(2)--(6)--(5)--(1) (3)--(4)--(8)--(7)--(3) (11)--(10)--(14);
\end{tikzpicture}
\end{document}