1

I try to convert dot to metapost using the fig output driver of dot, fig2dev to convert the graph to metapost and finally tex to include the result in a document. An example script is

digraph {
    A -> B[label="$\\leftarrow$"]
    A[label="$A \\in M_0$"]
    B[label="$B \\in M_1$"]
}

Everything works fine with these commands from a Makefile:

dot -Tfig test.dot >test.fig
fig2dev -L mp -f tt test.fig >test.mp
F=test-$$; (echo "prologues:=3"; cat test.mp) >$F.mp; mpost -jobname=test.prev -file-line-error $F.mp; rm -f $F.*

I use prologues:=3 here to get a simple preview file in test.prev.0.

enter image description here

As you can see, the labels don't have the right baseline. They are a bit too low. The problem is in the fig driver of graphviz already.

Loading the test.fig into xfig give this sheet:

enter image description here

Does anyone know a quickfix for this?

PS: Here is the direct dot -Tps output (screengrabbed)

enter image description here

where you can see that dot is able to place the text at correct places.

The graphviz fig renderer

The fig renderer seems to refuse to estimate font sizes at all, with the comment, that dot does not know anything about tex fonts. But that's not fully correct. At least some default font size could be proposed and estimated. I assume that even some rough approximations are better than just assuming a height and width of 0pt.

Playing around with some paramters in the graphviz fig driver, I got the best results when I add 1in (72.0pt) to the y coordinate for each text. So besides the approximation there seams to be a systematic error... pushing to github...

1
  • Btw: tikz/pgf can read dot files - you don't have to use MetaPost. Commented Jul 18, 2016 at 21:42

0

You must log in to answer this question.

Browse other questions tagged .