4

I'm having some trouble using the dot2texi package. I'm using the Sublime Text 2 editor to compile my LaTeX files, and I have LaTeXTools installed. I'm running this on Mac OSX, Mountain Lion.

The problem is simply that the dot conversion to tex is failing. I have all necessary packages installed, and if I manually run dot2tex from command line, it produces the figure all well and fine. So I'm guessing this is some problem from the Sublime end? I did a debug log output, and here's the relevant snippet from the log:

\openout3 = `test_latex-dot2tex-fig1.dot'.

Opening dot2tex stream test_latex-dot2tex-fig1.dot
runsystem(dot2tex --figonly -ftikz     --debug --prog=neato -tmath  -o test_lat
ex-dot2tex-fig1.tex  test_latex-dot2tex-fig1.dot)...executed.

Package dot2texi Warning: Conversion of test_latex-dot2tex-fig1.dot failed..

Package dot2texi Warning: Please convert test_latex-dot2tex-fig1.dot manually.

The LaTeX code I'm trying to compile is the simple example from the tutorial:

\documentclass{article}
\usepackage[debug]{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}

Earlier, I had enabled -shell-escape in my LaTeXTools build file, and debugged some _nocomma error out from running dot2tex (Python related). After all those issues were resolved, I could compile dot files from command line using dot2tex without any issues. I can't figure out why it fails in Sublime Text 2 and would like to resolve this for ease-of-use purposes. Any help would be greatly appreciated! Thanks!

P.S. I have an inkling it might be something to do with the command being run from the wrong directory, so it can't find the dot file... I have no idea how to confirm that or fix it.

4
  • 1
    Welcome to TeX.SX! The error look as if --shell-escape is not enabled, in particular, if you do the conversion by hand. Can you double check that this works?
    – mafp
    Nov 11, 2013 at 22:28
  • Hi and thanks! Well I initially had problems with enabling shell-escape, and following whatever little I could find through google, it wasn't working until all of a sudden, the warning "Shell-escape is not enabled" disappeared. I'm using the following change in the LaTeX.sublime-build file: "cmd": ["latexmk", "-cd", "-e", "\$pdflatex = 'pdflatex %O -interaction=nonstopmode -synctex=1 %S'", //"-silent", "-shell-escape", "-f", "-pdf"], Is there any other way to double check? As I mentioned, if I do it manually on command line, incl. the command inside runsystem(...) above, everything works.
    – sidmontu
    Nov 11, 2013 at 22:42
  • 2
    Looks good to me. I thought about double checking with other packages that require -shell-escape, like the python package. But of course this can also be a path problem in the environment, maybe a Sublime expert has to have a look.
    – mafp
    Nov 11, 2013 at 23:01
  • Finally found a solution, which I've posted below. You were right about it being a problem with the path in the environment. Thanks!
    – sidmontu
    Nov 12, 2013 at 8:31

1 Answer 1

3

Ah I finally found the answer, thanks to the Readme over at master builder. The problem description and solution can be found under the Troubleshooting > Path Issues section. For convenience, I'll copy-paste the relevant portion here:

On Mac OS X, just having your $PATH set up correctly in a shell (i.e., in Terminal) does not guarantee that things will work when you invoke commands from ST. If something seems to work when you invoke pdflatex or latexmk from the Terminal, but building from within ST fails, you most likely have a path configuration issue. One way to test this is to launch ST from the Terminal, typing

/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl

(and then Return; this is for ST2 of course) at the prompt. If things do work when you run ST this way, but they fail if you launch ST from the Dock or the Finder, then there is a path problem. From the Terminal, type

echo $PATH

and take note of what you get. Then, run ST from the Dock or Finder, open the console (with Ctrl+ `) and type

import os; os.environ['PATH']

and again take note of what you see in the output panel (right above the line where you typed the above command). Finally, look at the path keyword in the osx section of the LaTeX.sublime-build file in the LaTeXTools package directory. For things to work, every directory that you see listed from the Terminal must be either in the list displayed when you type the import os... command in the ST console, or else it must be explicitly specified in LaTeX.sublime-build. If this is not the case, add the relevant paths in LaTeX.sublime-build and please let me know, so I can decide whether to add the path specification to the default build file. Thanks!

This worked like a charm for me, all I had to do was replace whatever was after the "path": declaration with the shell output from echo $PATH. Hope that helps anyone having this problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .