3

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.

3

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.)

enter image description here

\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

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.