0

So, thanks to a user on her I managed to make a few graphs but I ran into a problem - why does:

\node at (a.corner 2) {$x_2$};

put the label $x_2$ in the center and not by the node? Many thanks.

Here is the full code:

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}[scale=0.65]
         \path
            (0, 0)
            \foreach \i in {0, ..., 15} {
              +(360/16 * \i:3cm) coordinate (corner \i)
            }
          ;
          \draw[red]
            (corner 2) \foreach \i in {4,6, ..., 14,0} { -- (corner \i) }
            (corner 9) \foreach \i in {11,13,15,1,3,5} { -- (corner \i) }
          ;
          \draw[densely dashed]
            (corner 0) -- (corner 5)
            (corner 2) -- (corner 9)
          ;
          \fill[radius=2pt] \foreach \i in {0, ..., 15} { (corner \i) circle[]       };
          \node at (a.corner 2) {$x_2$};
        \end{tikzpicture}
\end{document}
  • If that is the full code, there is something wrong, because there is no node called a, so you get an error saying No shape named a is known. Edit: In other words, try \node [right] at (corner 2) {$x_2$}; – Torbjørn T. Apr 1 '17 at 16:25
1

Found it, I imported the tikz positioning package and used:

\node [right=1mm of corner 1] {$x_2$};

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.