Embedding GraphViz in LaTeX documents
I have to say I'm loving using LaTeX for my Uni papers. It is so delightfully straightforward and powerful.
I am embedding some GraphViz diagrams in my documents, but I didn't want a round trip to a different editor buffer and the shell to edit/compile/insert the diagram.
Based on graphviz.tex code by Derek Rayside I have created a custom LaTeX function that will automatically compile and embed inline GraphViz code (man those wacky capitilisations are getting boring!)
You embed a graph like so:
\digraph[scale=0.5]{MyGraph}{rankdir=LR; a->b; b->c}
Be careful not to have any double newlines or your dot file will have some bogus \par comments in it (which I should replace with newlines in the function...). Another possible enhancement would be to add a dynamic dot command to set the maximum diagram height & width to the current page/column dimensions.You need my graphviz.sty and you need the following in your document preamble:
\usepackage[pdftex]{graphicx}
\usepackage{graphviz}
Remember to run texhash if you install the style in a system-wide location.
Note this assumes pdflatex. Modifying the command for regular latex is an exercise left for the reader.
10:09 PM, 25 Mar 2007 by Mark Aufflick Permalink
Todo
Change this style to use the excellent dot2tex: http://www.fauskes.net/nb/introducing-dot2tex/
by Mark Aufflick on 05/21/07