我使用tikz排版胶乳文档中的图。

我的“网格图”的网格,与绘制为一个单独的tikz图片,然后排列到电网作为节点每一个网格图。

我想画一个圆圈的节点(这将最终包含一个标签)在每一个网格图的右下手正方形。

我使用完全相同的代码对每个网格图,但圆在不同的地方,每次绘制。

我做得不对,或者这是tikz的错误吗?尤其是我,包括子画面允许/标准/良好实践的方法吗?

请参阅这里的图像。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
\begin{document}
\begin{tikzpicture}[scale=1, node distance = .5cm]
  \node (a) at (0,0) {
    \begin{tikzpicture}
     \draw[step=.5cm,gray,very thin] (-0.1,-1.6) grid (1.6, 0.1);
      \node at (1.25, -1.25) [fill=white, shape=circle, draw=black] {};
   \end{tikzpicture}
    };
    \node[right=of a] (b) {
    \begin{tikzpicture}
     \draw[step=.5cm,gray,very thin] (-0.1,-1.6) grid (1.6, 0.1);
      \node at (1.25, -1.25) [fill=white, shape=circle, draw=black] {};
     \end{tikzpicture}
    };
    \node[below=of a] (c) {
    \begin{tikzpicture}
     \draw[step=.5cm,gray,very thin] (-0.1,-1.6) grid (1.6, 0.1);
      \node at (1.25, -1.25) [fill=white, shape=circle, draw=black] {};
     \end{tikzpicture}
    };
    \node[right=of b] (d){
    \begin{tikzpicture}
     \draw[step=.5cm,gray,very thin] (-0.1,-1.6) grid (1.6, 0.1);
      \node at (1.2, -1.5) [fill=white, shape=circle, draw=black] {};
     \end{tikzpicture}
    };
    \node[below=of b] (e){
    \begin{tikzpicture}
     \draw[step=.5cm,gray,very thin] (-0.1,-1.6) grid (1.6, 0.1);
      \node at (1.25, -1.25) [fill=white, shape=circle, draw=black] {};
     \end{tikzpicture}
    };
    \node[below = of c] (f) {
    \begin{tikzpicture}
     \draw[step=.5cm,gray,very thin] (-0.1,-1.6) grid (1.6, 0.1);
      \node at (1.25, -1.25) [fill=white, shape=circle, draw=black] {};
      \end{tikzpicture}
    };
\end{tikzpicture}
\end{document}
有帮助吗?

解决方案

我不知道为什么圈没有你的榜样一致,但它可能与相对定位使用of做。

我不知道这是不是最好的做法,但你可以使用foreach自动化的电网建设:

\begin{document}
\begin{tikzpicture}[scale=1]
  \foreach \x in {-0.01cm,2.99cm,5.99cm}
    \foreach \y in {-0.01cm,2.99cm,5.99cm} {
      \draw[step=.5cm,gray,thin] (\x,\y) grid +(1.52cm,1.52cm);
      \draw[fill=white, draw=black] (\x,\y) +(1.255cm,0.25cm) circle (0.2cm);
    }
\end{tikzpicture}
\end{document}

“替代文字”

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top