Search code examples
graphvizdot2tex

multiline graphviz node with math mode


I have a node which represents a multiline label in math mode. However, I failed to include the newline symbol \n into the node label. Here is my try

\begin{dot2tex}[neato,scale=.5,options=-t math]
digraph G
{
c[shape=none,label="x_1",pos="1,.25!"];
d[label="D",pos=".5,-1.6!"];


}
\end{dot2tex}

How can I add newline for the node c?


Solution

  • I found the solution here by using matrix package from tikz

    \begin{dot2tex}[neato,scale=.8,options=-t math]
    digraph G
    {
    c[shape=none,texlbl="$
    \begin{matrix}
    x_1
    \\ x_2
    \end{matrix}$"
    ,pos="1,-1.2!"];
    
    }
    \end{dot2tex}
    

    will add node with two lines $x_1$ and $x_2$.