TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is my MWE:

\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\begin{document}
\begin{tikzpicture}
   \newdimen\R
\R=2.7cm
   \draw (0:\R)
   \foreach \x in {60,120,...,360} {  -- (\x:\R) }
 -- cycle (360:\R) node[right] {(3,2,1)}
 -- cycle (300:\R) node[below] {(3,1,2)}
      -- cycle (240:\R) node[below] {(1,3,2)}
 -- cycle (180:\R) node[left] {(1,2,3)}
-- cycle  (120:\R) node[above] {(2,1,3)}

           -- cycle  (60:\R) node[above] {(2,3,1)};
\end{tikzpicture}
\end{document}

I have to draw small circles at the corners of this hexagon filled with black color.

share|improve this question

enter image description here

\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
   \newdimen\R
   \R=2.7cm
   \draw (0:\R)
   \foreach \x in {60,120,...,360} {  -- (\x:\R) };
   \foreach \x/\l/\p in
     { 60/{(2,3,1)}/above,
      120/{(2,1,3)}/above,
      180/{(1,2,3)}/left,
      240/{(1,3,2)}/below,
      300/{(3,1,2)}/below,
      360/{(3,2,1)}/right
     }
     \node[inner sep=1pt,circle,draw,fill,label={\p:\l}] at (\x:\R) {};
\end{tikzpicture}
\end{document}
share|improve this answer

Is this helping you:

\documentclass[10pt]{article}
\usepackage{tikz}

\newlength{\R}\setlength{\R}{2.7cm}

\begin{document}
\begin{tikzpicture}
  %% Try to define a style, to prevent typing
  [inner sep=2mm,
  minicirc/.style={circle,draw=black!20,fill=black!20,thick}]

  %% Now do the circle with nodes
  \node (circ1) at ( 60:\R) [minicirc] {(2,3,1)};
  \node (circ2) at (120:\R) [minicirc] {(2,3,1)};
  \node (circ3) at (180:\R) [minicirc] {(2,3,1)};
  \node (circ4) at (240:\R) [minicirc] {(2,3,1)};
  \node (circ5) at (300:\R) [minicirc] {(2,3,1)};
  \node (circ6) at (360:\R) [minicirc] {(2,3,1)};

  %% Connect those circs
  \draw [thick] (circ1) to (circ2) to (circ3) 
  to (circ4) to (circ5) to (circ6) to (circ1);

\end{tikzpicture}
\end{document}

(This was my first attempt on TikZ :-) Thank you)

This is the result:

enter image description here

I've tried this first with your loop. But it seems, as if the names of the elements ("circ1", ...) are local to the loop and hence can't be addressed from outside the loop. So I did it manually without loop.

If the color of the circles doesn't suit you, you can easily change its definition in the style. Maybe you'll have to set the color of the text to be white ...

share|improve this answer
    
I don't know what you did with the loop, but node names are not local to the it. Try for example replacing your six \nodes with \foreach[count=\i] \x in {60,120,...,360} \node (circ\i) at (\x:\R) [minicirc] {(2,3,1)};. – Torbjørn T. 5 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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