2

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?

marapet
  • 54,856
  • 12
  • 170
  • 184
seteropere
  • 479
  • 1
  • 4
  • 17

2 Answers2

1

From the dot2tex documentation page:

The \ character needs to be escaped with \\ if used in the label attribute.

Therefore, label="first line\\\\second line" (four backslashes) should result in a latex newline sequence (can't test it though).

marapet
  • 54,856
  • 12
  • 170
  • 184
1

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

seteropere
  • 479
  • 1
  • 4
  • 17