这里我在文档中的 (0,0) 处绘制圆形节点。我需要在所需的中心处绘制这些节点。示例为 (8,-6.5)。有人能帮我生成代码,在一页中在所需的中心处绘制多个圆形节点吗?
\usepackage{tikz}
\usepackage{amsmath}
\begin{document}
\begin{center}
\vspace*{\fill}
\begin{tikzpicture}
\foreach \x in {0,30,...,360} {
\draw (\x:5cm) circle (1mm);
};
\end{tikzpicture}
\vspace*{\fill}
\end{center}
\end{document}
答案1
这显示了将移位应用于一组点的最简单方法。它还将原点添加到边界框,并绘制边界框。
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\begin{document}
\begin{center}
\vspace*{\fill}
\begin{tikzpicture}
\begin{scope}[shift={(8,-6.5)}]
\foreach \x in {0,30,...,360} {
\draw (\x:5cm) circle (1mm);
};
\end{scope}
\path (0,0) node[circle,draw] {Origin};% add origin to bounding box (and label it)
\draw[red] (current bounding box.south west) rectangle (current bounding box.north east);
\end{tikzpicture}
\vspace*{\fill}
\end{center}
\end{document}
答案2
您可以使用将内容定位在绝对坐标处overlay,remember picture
,例如
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}[overlay,remember picture]
\foreach \x in {0,30,...,330} {
\draw ([xshift=8cm,yshift=-6.5cm]current page.north west)+(\x:5cm) circle (1mm);
};
\end{tikzpicture}
\end{document}
或者
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}[overlay,remember picture]
\foreach \x in {0,30,...,330} {
\draw ($(current page.north west)+(8cm,-6.5cm)+(\x:5cm)$) circle (1mm);
};
\end{tikzpicture}
\end{document}