答案1
\documentclass[border = 5pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\newdimen\radius
\dimen0=0.5pt
\dimen1=1.2pt
\foreach \x in {0 ,..., 11} {
\foreach \y in {0 ,..., 17} {
\pgfmathsetmacro{\xmod}{(mod(\x,2) == 0)}
\pgfmathsetmacro{\ymod}{(mod(\y + \x,3) == 0)}
\ifnum\ymod=1 \ifnum\xmod=1 \radius=\dimen1 \else \radius=\dimen0 \fi
\else \radius=\dimen0
\fi
\draw[fill] (0.5 * \x, 0.4 * \y) circle (\radius);
\ifnum\x=0
\node[yshift = 0.4 * \y cm, xshift = -0.5cm] (0, 0) {\small\y};
\fi
}
\node[xshift = 0.5 * \x cm, yshift = -0.5cm] (0, 0) {\small\x};
}
\end{tikzpicture}
\end{document}
答案2
答案3
picture
这里介绍一种图片环境方法。它展示了如何在 LaTeX2e 图片环境中独立缩放 x 轴和 y 轴的技术(得益于包的使用,但还有一些额外的技巧)。
随附的图片\multiput
大概可以(或应该)替代\xintFor
。
该方法可以轻松扩展到生成器给出的任何子群:您不必计算属于子群的“方程”。
\documentclass[]{article}
%\usepackage{babel}
\usepackage{picture}
\usepackage{caption}
\usepackage{xinttools}
\begin{document}
% \setlength\unitlength{2em}
\edef\xs{\dimexpr\number\dimexpr2em\relax sp\relax}
\edef\ys{\dimexpr\number\dimexpr1em\relax sp\relax}%
\begin{figure}[htbp]
\centering
% use xshift to get "Figure 1" positioned as in OP
\begin{picture}(14\xs,19\ys)(-2\xs,-\ys)
% use \multiput ?
% never read its doc
\xintFor* #1 in {\xintSeq{0}{11}}\do
{
\put(#1\xs, -\ys){\makebox(0,0){#1}}
}
\xintFor* #1 in {\xintSeq{0}{17}}\do
{
\put(-\xs, #1\ys){\makebox(0,0)[r]{#1}}
}
\xintFor* #1 in {\xintSeq{0}{11}}\do
{
\xintFor* #2 in {\xintSeq{0}{17}}\do
{
\put(#1\xs, #2\ys){\makebox(0,0){.}}
}
}
\def\x {0}
\def\y {0}
\xintFor* #1 in {\xintSeq{0}{18}}\do
{
\put(\x\xs, \y\ys){\circle*{.25\xs}}
% weird formulas but that's what we need to do
% with \numexpr to achieve remainder in integer division
% \x <- \x + 2 modulo 12
% \y <- \y + 1 modulo 18
\edef\x {\the\numexpr \x + 2 - 12 * ((\x + 2 + 6)/12 - 1)}
\edef\y {\the\numexpr \y + 1 - 18 * ((\y + 1 + 9)/18 - 1)}
}
\def\x {6}
\def\y {0}
\xintFor* #1 in {\xintSeq{0}{18}}\do
{
\put(\x\xs, \y\ys){\circle*{.25\xs}}
\edef\x {\the\numexpr \x + 2 - 12 * ((\x + 2 + 6)/12 - 1)}
\edef\y {\the\numexpr \y + 1 - 18 * ((\y + 1 + 9)/18 - 1)}
}
\end{picture}
\caption{}
\end{figure}
\end{document}