# TikZ code for drawing an icosahedron and labeling

I found TikZ code for drawing an icosahedron here:

\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\documentclass[a4paper]{amsart}
\usepackage{graphics, tikz, tkz-berge, tkz-graph}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{scope}[rotate=90]
\grIcosahedral[form=1,RA=3,RB=1.5]
\SetUpEdge[color=white,style={double=black,double distance=2pt}]
\EdgeInGraphLoop{a}{6}
\EdgeFromOneToSel{a}{b}{0}{1,5}
\Edges(a2,b1,b3,b5,a4)
\Edge(a3)(b3)
\Edges(a1,b1,b5,a5)
\Edges(a2,b3,a4)
\end{scope}
\end{tikzpicture}
\end{figure}
\end{document}


The output is:

which is very nice, but I want to label the vertices v_1, v_2, ..., v_12 instead of a's and b's. However, I don't know how to change the code so that the labels will be different. I tried to simply replace all the a's in the code by v's but that gives an error.

-
Welcome to TeX.SX. Please complete your example in order to make it compilable. I added the packages tikz, tkz-berge, and tkz-graph but it does not compile. I am happy to help, but can't guess what you are doing. – LaRiFaRi Jun 4 '14 at 8:23
Hi, I'm sorry, I did not realise that. I used graphics, tikz, tkz-berge and tkz-graph. – Jolien Jun 4 '14 at 8:31
Welcome to TeX.SX! As @LaRiFaRi says, please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document} – yo' Jun 4 '14 at 8:32
@Jolien Which documentclass? Which error do you get? I can't compile your code. Do I need other packages than the mentioned? – LaRiFaRi Jun 4 '14 at 8:48
@LaRiFaRi I used \NeedsTeXFormat{LaTeX2e}[1995/06/01] and \documentclass[a4paper]{amsart}. The error is ! Package pgf Error: No shape named v5 is known. – Jolien Jun 4 '14 at 8:57

The macro \grIcosahedral is not documented in tkz-berge manual. However all other graphs in the manual behave in a similar way, so it can be deduced what to do to relabel those nodes.

Internally, all generated graphs define node names based on the a0, a1, ..., b0, b1, etc notation. Changing those internal node names is not easy. However, you can easily change which label is displayed in the printed graph for each of those internal names. So, you can tell for example that node a0 has to be labelled $v_1$, or whatever you like.

This is how:

\documentclass[a4paper]{amsart}
\usepackage{graphics, tikz, tkz-berge, tkz-graph}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{scope}[rotate=90]
\SetVertexNoLabel   % <--- This avoids that default $a_0$, .. $b_0$ labels show up
\grIcosahedral[form=1,RA=3,RB=1.5]

% Following two lines assign labels to a-like and b-like nodes
% change it as you prefer
\AssignVertexLabel{a}{$v_0$, $v_1$, $v_2$, $v_3$, $v_4$, $v_5$};
\AssignVertexLabel{b}{$v_6$, $v_7$, $v_8$, $v_9$, $v_{10}$, $v_{11}$};

% The remaining code is unchanged
\SetUpEdge[color=white,style={double=black,double distance=2pt}]
\EdgeInGraphLoop{a}{6}
\EdgeFromOneToSel{a}{b}{0}{1,5}
\Edges(a2,b1,b3,b5,a4)
\Edge(a3)(b3)
\Edges(a1,b1,b5,a5)
\Edges(a2,b3,a4)
\end{scope}
\end{tikzpicture}
\end{figure}
\end{document}


-