0
\begin{tikzpicture}
[acteur/.style={circle, fill=black,thick, inner sep=4pt, minimum size=0.2cm}]
\node (A) at (5,12) [acteur][label=right:0]{};
\node (B) at (8,11) [acteur][label=right:1]{};
\node (C) at (9,9) [acteur][label=left:2]{};
\node (D) at (8,7) [acteur][label=right:3]{};
\node (E) at (5,6) [acteur][label=below:4]{};
\node (F) at (2,7) [acteur][label=right:5]{};
\node (G) at (1,9) [acteur][label=left:6]{};
\node (H) at (2,11) [acteur][label=right:7]{};
\path (A) edge [loop above, thick] node {} (0);
\path (B) edge [loop above, thick] node {} (1);
\path (C) edge [loop above, thick] node {} (2);
\path (D) edge [loop above, thick] node {} (3);
\path (E) edge [loop above, thick] node {} (4);
\path (F) edge [loop above, thick] node {} (5);
\path (G) edge [loop above, thick] node {} (6);
\path (H) edge [loop above, thick] node {} (7);
\end{tikzpicture}

It occur an error when I change

label 0 to label (0,0,0), label 1 to label<br/> (0,0,1) ... and so on

like this

\node (A) at (5,12) [acteur][label=right:(0,0,0)]{};
\node (B) at (8,11) [acteur][label=right:(0,0,1)]{};
... and so on
  • Are the <br/> in the code or an effect from a copy paste? – albert Sep 12 '18 at 16:52
  • 1
    Welcome to TeX.SX! Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass and ending with \end{document}. - Why (0,0,0)...? – Bobyandbob Sep 12 '18 at 16:57
  • I guess you only need to put braces around the coordinates (or whatever the 3-tupels are) \node (A) at (5,12) [acteur][label=right:{(0,0,0)}]{};. – user121799 Sep 12 '18 at 17:07
  • You are right need only to put braces thanks – Marvin Sep 14 '18 at 2:35
  • @Marvin is your question solved? If yes please accept the given answer. – Bobyandbob Sep 20 '18 at 20:29
2

Welcome to TeX.SE! If you place some sensitive character like (, it might be misinterpreted by the parser. In almost all situations putting things in groups, i.e. putting { and } around them, fixes the issue. And you can make your code much shorter using \foreach. (In principle, one \foreach loop is sufficient, but for the sake of the argument I am using two here.)

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[acteur/.style={circle, fill=black,thick, inner sep=4pt, minimum size=0.2cm}] 
\foreach \X [count=\Y starting from 0,evaluate=\Y as \Z using {90-\Y*45}] in {A,...,H}
{\node (\X) at (\Z:3) [acteur][label=right:{(0,0,\Y)}]{};}
\foreach \X [count=\Y starting from 0] in {A,...,H}
{\path (\X) edge [loop above, thick] (\Y);}
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.