Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to create math font inside of my vertex circles, AND draw edges between them. How I typically create network graphs is as follows:

\usepackage{tkz-graph}


\begin{tikzpicture}
\Vertex[x=1,y=6]{A};
\Vertex[x=1,y=5]{B}
\Vertex[x=1,y=4]{C}
\Edge[label= 20](B)(C)
\end{tikzpicture}

However, if I do the following, it doesn't work. How can I get around this so that I can have equations or math font inside my nodes and connect them with an edge?

\begin{tikzpicture}
\Vertex[x=1,y=6]{$\frac{x}{y}$};
\Vertex[x=1,y=5]{$2^n$}
\Vertex[x=1,y=4]{$t$}
\Edge[label= 20]($2^n$)($t$)
\end{tikzpicture}
share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

The letters in the first examples serve as node labels hence referencing them needs text chars/numbers. If you want to put other types of labels you need to use L=<special chars> options. If L= option is empty the node label automatically becomes the visual label.

\documentclass[border=5mm]{standalone}
\usepackage{tkz-graph}

\begin{document}
\begin{tikzpicture}
\show\Vertex
\Vertex[L=$\frac{x}{y}$,x=1,y=6]{A};
\Vertex[L=$2^n$,x=1,y=5]{B}
\Vertex[L=$t$,x=1,y=4]{T}
\Edge[label= 20](B)(T)
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
Also see the manual page 21 for [Math] option and \SetVertexMath switch. –  percusse Jan 29 '13 at 2:35
    
Great! Simple :-) Thanks! –  ruya Jan 29 '13 at 3:35
add comment

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.