aboutsummaryrefslogtreecommitdiffstats
path: root/buch/papers/punktgruppen/tikz/atoms-grid-force.tex
blob: 05742cf81f65e096c5f9dd20474a1b404df14547 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
\documentclass[tikz]{standalone}
\usepackage{amsmath}
\usepackage{times}
\usepackage{txfonts}

\usetikzlibrary{arrows}
\usetikzlibrary{intersections}
\usetikzlibrary{math}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{calc}

\begin{document}
  \begin{tikzpicture}[
      >=latex, 
      node distance = 2mm,
      charge/.style = {
        circle, draw = black, thick,
        minimum size = 5mm
      },
      positive/.style = { fill = red!50 },
      negative/.style = { fill = blue!50 },
    ]

    \matrix[nodes = { charge }, row sep = 5mm, column sep = 1cm] {
      \node[positive] (NW) {}; & \node[negative] (N) {}; & \node [positive] (NE) {}; \\
      \node[negative] (W) {}; & \node[positive] {}; & \node [negative] (E) {}; \\
      \node[positive] (SW) {}; & \node[negative] (S) {}; & \node [positive] (SE) {}; \\
    };

    \foreach \d in {NW, N, NE} {
      \draw[orange, very thick, <-] (\d) to ++(0,.7);
    }

    \foreach \d in {SW, S, SE} {
      \draw[orange, very thick, <-] (\d) to ++(0,-.7);
    }

    \draw[gray, dashed] (W) to (N) to (E) to (S) to (W);
  \end{tikzpicture}
\end{document}