title: subscripts & greek letters in dot edge labels
body: <p>This is a followup to <a href="https://stackoverflow.com/questions/30040997/using-symbol-font-math-notation-in-graphviz">Using symbol font / math notation in graphviz</a>, and was also posted on the Graphviz discussion forum, <a href="http://www.graphviz.org/content/subscripts-greek-letters-dot-edge-labels" rel="nofollow noreferrer">http://www.graphviz.org/content/subscripts-greek-letters-dot-edge-labels</a>, but there has been no response.</p>
  <p>[Env: graphviz 2.38, Windows 7]</p>
  <p>I'm working on a project to create path diagrams for structural equation models in R with the <a href="https://r-forge.r-project.org/R/?group_id=245" rel="nofollow noreferrer">sem</a> package
  The sem package contains a function, pathDiagram, that does this reasonably well, by constructing the required code for dot.</p>
  <p>We use two back-end renderers: dot itself, with -Tpdf, and the R <a href="https://github.com/rich-iannone/DiagrammeR" rel="nofollow noreferrer">DiagrammeR package</a>, that uses javascript libraries grViz and mermaid.</p>
  <p>We recently added code to allow rendering edge labels using greek letters and subscripts, by
  using the UTF-8 character equivalents, eg</p>
  <pre><code>&quot;beta&quot; &quot;&amp;#946;&quot; &quot;&amp;#x3B2;&quot;
  &quot;gamma&quot; &quot;&amp;#947;&quot; &quot;&amp;#x3B3;&quot;
  </code></pre>
  <p>and</p>
  <pre><code>subscripts &lt;- c(&quot;₀&quot;, &quot;₁&quot;, &quot;₂&quot;, &quot;₃&quot;, &quot;₄&quot;, &quot;₅&quot;, &quot;₆&quot;,
  &quot;₇&quot;, &quot;₈&quot;, &quot;₉&quot;)
  </code></pre>
  <p>We find that this works perfectly with DiagrammeR. With dot, we <em>do</em> get the Greek letters, but
  nothing we have tried allows us to get subscripts from the standard command
  dot -T pdf -o file.pdf file.dot
  All we get are those little boxes with the 4-digit character code.</p>
  <p>Is this a bug or limitation of dot? Is there any work-around?</p>
  <p>Here is an example of a dot file generated by our software that illustrates this behavior.</p>
  <pre><code>digraph &quot;union.sem&quot; {
    rankdir=LR;
    size=&quot;8,8&quot;;
    node [fontname=&quot;Helvetica&quot; fontsize=14 fillcolor=&quot;transparent&quot; shape=box style=filled];
    edge [fontname=&quot;Helvetica&quot; fontsize=10];
    center=1;
    {rank=min &quot;x1&quot;}
     {rank=min &quot;x2&quot;}
    &quot;y1&quot; [fillcolor=&quot;transparent&quot;]
    &quot;y2&quot; [fillcolor=&quot;transparent&quot;]
    &quot;y3&quot; [fillcolor=&quot;transparent&quot;]
    &quot;x2&quot; -&gt; &quot;y1&quot; [label=&quot;&amp;#947;&amp;#770;&amp;2081;&amp;2082;=-0.09&quot; color=red penwidth=1.001];
    &quot;y1&quot; -&gt; &quot;y2&quot; [label=&quot;&amp;#946;&amp;#8322;&amp;#8321;=-0.28&quot; color=red penwidth=1.001];
    &quot;x2&quot; -&gt; &quot;y2&quot; [label=&quot;&amp;#947;&amp;#8322;&amp;#8322;=0.06&quot; color=black penwidth=1.001];
    &quot;y1&quot; -&gt; &quot;y3&quot; [label=&quot;&amp;#946;&amp;#8323;&amp;#8321;=-0.22&quot; color=red penwidth=1.001];
    &quot;y2&quot; -&gt; &quot;y3&quot; [label=&quot;&amp;#946;&amp;#8323;&amp;#8321;=0.85&quot; color=black penwidth=1.001];
    &quot;x1&quot; -&gt; &quot;y3&quot; [label=&quot;&amp;#947;&amp;#8323;&amp;#8321;=0.86&quot; color=black penwidth=1.001];
    &quot;x1&quot; -&gt; &quot;x2&quot; [label=&quot;&amp;#963;&amp;#8321;&amp;#8322;=7.14&quot; dir=both color=black penwidth=1.001];
    // variable labels: 
      &quot;y1&quot; [label=&quot;Deference&quot;];
      &quot;y2&quot; [label=&quot;Activism&quot;];
      &quot;y3&quot; [label=&quot;Sentiment&quot;];
      &quot;x1&quot; [label=&quot;Years&quot;];
      &quot;x2&quot; [label=&quot;Age&quot;];
  }
  </code></pre>
  <p>And the result (using -Tpng)</p>
  <p><img src="https://i.stack.imgur.com/QltK4.png" alt="enter image description here" /></p>
  <p>(In this example, I also tried using Unicode characters for the subscripts in the <code>x2 -&gt; y1</code> path, these taken from <a href="https://stackoverflow.com/questions/17908593/how-to-find-the-unicode-of-the-subscript-alphabet">How to find the unicode of the subscript alphabet?</a>, but these just appear as their <code>&amp;2081;</code> strings.)</p>