Is it possible to put math with commands that require curly braces inside graph nodes (and edges)? My attempt (see MNWE below, must be compiled with LuaLaTeX) does not seem the way to do it.

\usetikzlibrary{graphs, graphdrawing}
\graph [tree layout] {
    root -> "Child $C_\text{text}$"};

This causes an error:

! Undefined control sequence.
\tikzgraphnodetext ->Child $C_\text 
                                    {text} $
l.14        $"}

1 Answer 1


unrelated to tikz you need


to define \text

Also unrelated to tikz but it is much better to use the standard markup C_{\text{text}} rather rely on the weird artefact of the implementation of \text that allows the braces to be omitted.

  • Thanks a lot! It did not cross my mind to include amsmath in my tikz sandbox...
    – FlorianL
    Feb 26, 2017 at 20:37
  • @FlorianL undefined command \text should have been a clue;-) Feb 26, 2017 at 20:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .