20

How do you use Graphviz/DOT's HTML features to add a subscript character to an edge label?

HorseloverFat
  • 3,290
  • 5
  • 22
  • 32

1 Answers1

25

Like this:

digraph g {
  1 -> 2 [label=<Regular<SUB>subscript</SUB>>];
}
marapet
  • 54,856
  • 12
  • 170
  • 184
  • 3
    What if I got char like "<" or ">" in the label? Who to escape them? – enchanter Jun 27 '14 at 00:31
  • 6
    @enchanter According to the [HTML specification](http://www.w3.org/TR/html4/sgml/entities.html), one can [encode](http://www.html-entities.org/) many special characters. "<" becomes `<` and ">" is `>`. UTF-8 HTML encodings `<` and `>` do also work with Graphviz labels. – Serge Stroobandt Dec 20 '14 at 21:02