Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've tried 4 different .sty files (most of which didn't work, some of which gave me errors on rendered page).

Now trying with the dot2texi package, which is giving me a blank PDF.

I have tried running initexmf --edit-config-file=pdftex.ini then adding: EnableWrite18=t to opened file, and I've tried adding -shell-escape to the run command:

TeXWorks config

Yet nothing has worked. How can I write and successfully compile inline GraphViz diagrams in LaTeX?

share|improve this question
3  
I noticed in your screenshot that you are using MiKTeX. AFAIK TeX engines provided by MiKTeX don't have the --shell-escape flag, but a similar flag named --enable-write18 (or something along these lines). Could you try replacing the flag and tell us if it works? :) –  Paulo Cereda Jul 8 '12 at 19:48
    
Just tried that, unfortunately it didn't work. –  A T Jul 9 '12 at 4:43
    
--shell-escape works fine with miktex. But the package needs external tools (according the documentation dot2tex and Graphviz). Are you sure that they are installed, that they work and are on your path? –  Ulrike Fischer Jul 9 '12 at 10:02
    
@Ulrike: I thought --shell-escape was an invalid flag with MiKTeX, but it's been a while since I migrated from it to TeX Live. Is --enable-write18 still valid? –  Paulo Cereda Jul 9 '12 at 11:24
    
@Paulo: Both will work. There are "official" (documentated) switches and quite a lot of (undocumented) TeXLive-aliases - most of the switches that work with TeXLive works with miktex too. –  Ulrike Fischer Jul 9 '12 at 12:36
show 1 more comment

1 Answer

up vote 9 down vote accepted
+50

IMHO the problem does not rely on MiKTeX, but in the required programs that dot2texi relies on. The package has the following dependencies:

  • GraphViz - A graph visualization software.
  • dot2tex - A tool for converting graphs generated by GraphViz to formats suitable for use with LaTeX.

The first one is an easy-to-deploy .msi file - just double-click and install it in Windows. If I'm not mistaken, GraphViz even adds itself to the system path. You can check if the GraphViz tools are available by running dot --help in the command prompt:

dot

If you get a similar output, GraphViz is added to the system path.

Now, the second tool - dot2tex - is quite tricky for the average Windows user. This tool is actually a Python script and, well, relies on Python to run. Note that the script runs only in the 2.x series (I have Python 3.x in my development Windows machine and had to downgrade it in order to test the script). If you have Python 2.x installed, I recommend you to use easy_install or pip to install dot2tex. Besides of installing it, make sure to include the PYTHON_INSTALL/Scripts directory to your system path in order to make the script available.

I have another option, in case you are not familiar with Python. I built an wrapper from the dot2tex sources and generated a standalone batteries-included dot2tex.exe file, available here. Unzip it and put dot2tex.exe somewhere in your computer. Make sure that the directory where dot2tex.exe rests is also in the system path. Testing dot2tex --help in the command prompt:

Dot2Tex

With GraphViz and dot2tex available in the system path, let's see this example from the package documentation:

\documentclass{article}
\usepackage{dot2texi}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
\begin{dot2tex}[neato,mathmode]
digraph G {
node [shape="circle"];
a_1 -> a_2 -> a_3 -> a_4 -> a_1;
}
\end{dot2tex}
\end{document}

By running pdflatex --shell-escape myfile.tex, we have the correct output:

Image

The important parts from the .log file:

...
Package dot2texi Info: Automatically converting dot/neato files on input line 1
48.
...
\openout3 = `teste148-dot2tex-fig1.dot'.

 Opening dot2tex stream teste148-dot2tex-fig1.dot
runsystem(dot2tex --figonly -ftikz      --prog=neato -tmath  -o teste148-dot2te
x-fig1.tex  teste148-dot2tex-fig1.dot)...executed.

Package dot2texo Info: teste148-dot2tex-fig1.dot converted on input line 11.
...

Hope it helps. :)

share|improve this answer
    
Thanks, once again it didn't work, but trying it in a different folder with your test-case—then your test-case embedded into my full-text—amounted in a working, compiled PDF with embedded GraphViz. I have no idea what's going on with my computer, and why I need to move folders everytime I require a new sty. :\ –  A T Jul 17 '12 at 3:43
    
I'll give you the bounty and accept as answer anyway –  A T Jul 19 '12 at 3:57
    
@AT: I have no idea why the folder influenced the output. Maybe it was some sort of name clash. I used the dot2texi package that is shipped with TeX Live (I checked that MiKTeX also comes with it), what if you use that version instead of a local .sty in your folder? Thanks for accepting my humble answer. :) –  Paulo Cereda Jul 19 '12 at 10:54
    
Nahh, it wasn't a name-clash, nor was it anything distro specific (I installed TeX Live to confirm). Even now I can't figure it out properly, e.g.: I take my two .tex files and copy them into a new directory; the outputted PDF doesn't include the graphviz diagrams >.< –  A T Jul 19 '12 at 11:07
1  
@AT: Ah cool! I forgot about checking the filename. :) –  Paulo Cereda Aug 7 '12 at 10:53
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.