# Tikz graphs with typeset nodes

Here is an example of what I want to do:

\documentclass{minimal}
\usepackage{tikz,amssymb}
\usetikzlibrary{graphs}
\begin{document}
\begin{tikzpicture}
\begin{graph}[multi]{
1 -> 2;
% this does not work:
% $\mathbb{Q}$ -> $\mathbb{R}$;
};
\end{graph}
\end{tikzpicture}
\end{document}

With regular tikz nodes it is straightforward, just stick it in the curly braces at the end of the node definition. But I don't understand how to map this to the graphs library. It appears only simple node names can be used.

Add " around the node names, e.g. "$\mathbb{R}$". I don't know where/if this is documented, but it is used in some of the examples in the documentation, for example that on the first page of part IV of pgfmanual.pdf. (Page 364 in the manual dated December 20, 2013.)

\documentclass{standalone}
\usepackage{tikz,amssymb}
\usetikzlibrary{graphs}
\begin{document}
\begin{tikzpicture}
\begin{graph}[multi]{
"$\mathbb{Q}$" -> "$\mathbb{R}$";
};
\end{graph}
\end{tikzpicture}
\end{document}
• Great! This also works for \includegraphics. – timothymctim Dec 24 '16 at 13:53