答案1
\draw
可以使用命令 withgrid
来制作虚线网格line cap=round, dash pattern=on 0pt off 1cm
(假设您想要 1cm 网格间距)。然后可以使用命令制作三角形\draw
,并使用 标记顶点node
。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[line width=2pt, line cap=round, dash pattern=on 0pt off 1cm](0,0) grid (9,6);
\draw (0,0)node[below]{$(0,0)$}--(8.5,0)node[below]{$(\frac{p}{2},0)$}--(8.5,5.5)node[above]{$(\frac{p}{2},\frac{q}{2})$}--cycle;
\end{tikzpicture}
\end{document}
答案2
正如@Miyase所说,你可以在 CTAN 上找到绘制 TiKz 图片所需的一切。这个答案只是为你提供一个起点。
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, calc}
\tikzset{circle node/.style = {circle,inner sep=1pt,draw, fill=white}
}
\begin{document}
\begin{tikzpicture}[scale=0.5]
\foreach \x in {0,...,9}
\foreach \y in {0,...,6}
{
\fill (\x,\y) circle (1pt);
}
\foreach \y in {0,...,6}
{
\fill (10,\y) circle (1pt);
}
\foreach \x in {0,...,8}
{
\fill (\x,7) circle (1pt);
}
\draw (0,0)--(9.5,0)--(9.5,6.5)--cycle;
\node at (0,0)[below]{$(0,0)$};
\node at (9.5,0)[below]{$(\frac{p}{2},0)$};
\node at (9.5,6.5)[above]{$(\frac{p}{2},\frac{q}{2})$};
\end{tikzpicture}
\end{document}