4

I am trying to get graphviz up and working and I desperately need subscripts in my node labels. Unfortunately, looking through endless posts with people on similar problems it seems I fit into all the proposed solutions and yet still not working. Heres what I have for the code:

 digraph G{
execute [label=<ex<SUB>2</SUB>>];
main -> parse -> execute;
main -> init;
main -> cleanup;
init -> make_string;
main -> printf;
}

Also run this:

$ dot -Tps:cairo -v test.gv -o out.ps

and as output:

> dot - graphviz version 2.26.3 (20100126.1600)
Activated plugin library: libgvplugin_pango.so.6
Using textlayout: textlayout:cairo
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
Using render: cairo:cairo
Using device: ps:cairo:cairo
The plugin configuration file:
    /usr/lib/graphviz/config6
        was successfully loaded.
    render  :  cairo dot fig gd map ps svg tk vml vrml xdot
    layout  :  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout  :  textlayout
    device  :  canon cmap cmapx cmapx_np dot eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg pdf plain plain-ext png ps ps2 svg svgz tk vml vmlz vrml wbmp x11 xdot xlib
    loadimage   :  (lib) eps gd gd2 gif jpe jpeg jpg png ps svg
Error: Unknown HTML element <SUB> on line 1 
fontname: "Times-Roman" resolved to: (ps:pango  Times Roman,) (PangoCairoFcFont) "DejaVu Sans 14" 
in label of node execute
network simplex:  7 nodes 6 edges maxiter=2147483647 balance=1
network simplex: 7 nodes 6 edges 0 iter 0.00 sec
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross G: 0 crossings, 0.00 secs.
network simplex:  13 nodes 16 edges maxiter=2147483647 balance=2
network simplex: 13 nodes 16 edges 1 iter 0.00 sec
routesplines: 6 edges, 18 boxes 0.00 sec
Using render: cairo:cairo
Using device: ps:cairo:cairo

I m not quite familiar with cairo or svg renders and am quite unsure if this is packaged with graphviz or if it is a separate library all together. I have Ubuntu 12, installed graphviz via apt-get. Any help at all would be appreciated.

Thanks

larsks
  • 277,717
  • 41
  • 399
  • 399
Mgarvey
  • 91
  • 1
  • 4
  • Have you tried using HTML in node labels? – Codie CodeMonkey Jul 23 '13 at 19:51
  • To my understanding that is what I thought I was doing. Sorry, I just edited it, I had italics to test if that was working as well, which they are not. – Mgarvey Jul 23 '13 at 19:52
  • if I cannot use the html subscripts, does anyone else have an alternative solution to get subscripts? – Mgarvey Jul 23 '13 at 20:06
  • That example works just fine for me (using graphviz 2.28.0). – larsks Jul 23 '13 at 20:06
  • i am on 2.26.3. May ubuntu is behind in the repository? I don't see how the difference between the two versions could be my renderer not working properly. Its not my example, so does anyone have an idea where the problem can lie? Thanks for the responses btw – Mgarvey Jul 23 '13 at 20:28
  • Figured it out. It turns out that for some really odd reason, the standard packages for graphviz in apt-get will not render it properly. I removed all the dependencies and did a manual install of version 2.30. It is working now. – Mgarvey Jul 23 '13 at 20:48
  • Try quotes around the labels? Sorry, I'm not in a place where I can try this, so all I can do is suggest. – Codie CodeMonkey Jul 23 '13 at 21:26

2 Answers2

4

Here's why - from the graphviz documentation:

The font markups for bold, italic, underlining, subscript and superscript (<B>, <I>, <U>, <SUB>; and <SUP>) are only available in versions after 14 October 2011, and are currently only available via the cairo and svg renderers

Your version is 2.26.3 which is from January 2010.

I recommend to upgrade.

See also this answer to a similar question

Community
  • 1
  • 1
marapet
  • 54,856
  • 12
  • 170
  • 184
  • even using 20140413 version, this problem still exists. check next answer(north at graphviz's). That's right! – liuyang1 Nov 05 '14 at 02:59
  • @Procras Since the original author of this question was able to resolve the problem by updating graphviz, I'm assuming that this is another problem (graphviz svg output used with applications which do not support the same svg features ?). – marapet Nov 05 '14 at 08:01
2

Another likely problem is that some SVG renderers (inkscape?) don't seem to recognize the baselineskip construct used for subscripts in the graphviz -Tsvg (which is -Tsvg:core:core) output.

Please try -Tsvg:cairo. This may work because the cairo renderer does its own low-level glyph placement and doesn't rely on those pesky high-level features in SVG.

Stephen North