Document ClassesProblem with dot2texi.sty

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
werecow
Posts: 5
Joined: Wed Oct 22, 2008 2:58 pm

Problem with dot2texi.sty

Post by werecow »

Hi,

I'm using WinEdt 5.5 with miktex. I have a problem getting dot2texi.sty to work for me. This style calls the external dot2tex script to convert .dot files to .tex using a system() command, but the problem is that it is unable to find the .dot files. When I call texify.exe from the command line, as
texify.exe --pdf --tex-option=--shell-escape "D:/MyFiles/UvA/Scriptie/report/test.tex"
there are no problems and everything works fine. dot2texi then reports this:
Opening dot2tex stream test-dot2tex-fig1.dot
system(dot2tex --figonly -ftikz -o test-dot2tex-fig1.tex test-dot2tex-
fig1.dot)...executed.

Package dot2texo Info: test-dot2tex-fig1.dot converted on input line 21.
(test-dot2tex-fig1.tex)
But when I call it from winedt, the dot2texi script reports:
system(dot2tex --figonly -ftikz -o C:/temp/test-dot2tex-fig1.tex test-
dot2tex-fig1.dot)...executed.


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


Package dot2texi Warning: Please convert test-dot2tex-fig1.dot manually.
I think this happens because the paths passed to the style file when executing pdftexify from winedt are relative paths, but when it calls the external program, this program is started in the directory where the script is located, and not the path where the .dot files are located at. So what I really need is to be able to start the system() command in texify.exe's current working directory.
I'm not at all familiar with .sty type files, but I did some snooping and minor hacking of the code anyway. The relevant lines of code are:

Code: Select all

    % Option for setting an output directory
    \DeclareOptionX{outputdir}[]{\def\dtt@outputdir{#1}}
    \def\dtt@outputdir{}
    \DeclareOptionX{debug}{\dtt@debugtrue}

    (...)

    \ifdtt@ShellEscape
        \IfFileExists{\dtt@outputdir\dtt@figname.dot}{%
            \immediate\write18{dot2tex \dtt@output\space
                \dtt@format\space
                \dtt@tikzedgelabels\space
                \dtt@straightedges\space
                \dtt@styleonly\space
                \dtt@autosizeopt\space
                \dtt@debugstr\space
                \dtt@procprog\space
                \dtt@mathmode\space
                \dtt@graphstyle\space
                -o \dtt@outputdir\dtt@figname.tex \dtt@options\space \dtt@outputdir\dtt@figname.dot}
            \IfFileExists{\dtt@outputdir\dtt@figname.tex}{%
                \PackageInfo{dot2texo}{\dtt@outputdir\dtt@figname.dot converted}
            }
            {\PackageWarningNoLine{dot2texi}
                {Conversion of \dtt@outputdir\dtt@figname.dot failed.}}}
            {
            \PackageInfo{dot2texo}{File \dtt@outputdir\dtt@figname.dot not found}
        }
        \fi
        
I added the \dtt@outputdir's myself, but when looking at the output, they seem to consist of an empty string anyway, which is why I think the problem is the use of relative instead of absolute paths. Does anyone have any idea how to solve this, other than just always calling texify.exe from the command line? My execution mode for pdftexify in winedt has the following parameters:
--pdf --tex-option=--shell-escape
and switches "%P\%N%T".

I'd greatly appreciate any help you might give me. For completeness, this is the original .tex file:

Code: Select all

\documentclass{article}

\usepackage[]{dot2texi}
\usepackage{tikz}
%%%<
%\usepackage[active,tightpage]{preview}
%\setlength\PreviewBorder{0pt}%
%\PreviewEnvironment{tikzpicture}
%%%>
\usetikzlibrary{shapes,arrows}

\begin{document}
\begin{dot2tex}%[pgf]
digraph D
{
rankdir=LR;
ranksep=0.2;
node [shape=circle];
G -> r -> a -> p -> h -> v -> i -> z;
}
\end{dot2tex}

\end{document}
Last edited by werecow on Wed Oct 22, 2008 4:42 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Problem with dot2texi.sty

Post by localghost »

To enable shell escape in MiKTeX, you have to use --enable-write18 instead of --shell-escape in the command line arguments. This should affect texify in the same way.


Best regards and welcome to the board
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
werecow
Posts: 5
Joined: Wed Oct 22, 2008 2:58 pm

Re: Problem with dot2texi.sty

Post by werecow »

Thanks, but unfortunately that doesn't work either. The command was already being executed, it just can't find the .dot file (when I remove the flag entirely, the script outputs a "command(...)... disabled" message, plus, it works fine when I do it from the command line with --shell-escape, using the same version of texify - I'm just in the habit of compiling my reports every five second for previews, so I want it to work from the winedt gui for ease). I'm quite certain it has to do with absolute vs. relative paths. I also tried --include-directory=%P, but that doesn't work either, because it still executes the command() command using the relative path.
propell
Posts: 44
Joined: Fri May 30, 2008 11:16 am

Problem with dot2texi.sty

Post by propell »

Sorry to hear that you have problems with my dot2texi.sty class. I tried your example in winedt and it worked fine. As you suspect, this is probably a configuration issue. Here is how my PDFTexify is configured:
PDFTexify settings
PDFTexify settings
texifysettings.png (37.2 KiB) Viewed 11285 times
Not sure if this helps, but if you load dot2texi.sty with the debug option, a dot2tex.log file will be generated with detailed debug information:

Code: Select all

\usepackage[debug]{dot2texi}
- Kjell Magne Fauske
werecow
Posts: 5
Joined: Wed Oct 22, 2008 2:58 pm

Re: Problem with dot2texi.sty

Post by werecow »

I haven't the faintest idea what changed, but all of a sudden (after two days of trying) and without changing anything (except adding [debug] and then removing it), it's suddenly working (though now winedt locks up whenever acrobat is started, but whatever, I'll fix that tomorrow). Hopefully it will stay that way! Cheers, and thanks for the reply! I think your package will come in very handy for my MSc thesis.
propell
Posts: 44
Joined: Fri May 30, 2008 11:16 am

Problem with dot2texi.sty

Post by propell »

I'm glad that it works now.

Here is a tip that may come in handy. Instead of enabling shell escape in the build profile, you can include the following code at the top of your document:

Code: Select all

%& -shell-escape
\documentclass{article}
\usepackage[]{dot2texi}
...

- Kjell Magne
werecow
Posts: 5
Joined: Wed Oct 22, 2008 2:58 pm

Problem with dot2texi.sty

Post by werecow »

Thanks. Should I remove the % comment marker, or leave it there?

I do have one more question about the package itself: Is there a way to align the nodes in a graph on the same horizontal (or vertical) plane, other than using the hierarchical layout? I've tried rankdir=LR, but it doesn't align the nodes exactly right. What I'm trying to do is draw a hierarchy of state machines, where some nodes are expanded into a new automaton on a lower level in the hierarchy. Right now I'm using a few subgraphs, as shown in the file below. I want each level of the hierarchy to be horizontally oriented (so, for instance: start_o -> Features -> relations -> Finish_o organized from left to right, with the subgraphs expanded from Features and Relations on the next level), whereas now they're organized vertically. The code I used was adapted from your hierarchical graph example in the documentation:

Code: Select all

\begin{tikzpicture}[>=latex',scale=0.8]
    \tikzstyle{n} = [draw,shape=circle,minimum size=2em,
                        inner sep=0pt,fill=red!20]
    \begin{dot2tex}[dot, tikz,codeonly,styleonly,options=-s -tmath]
        digraph G  {
            graph [rankdir=TB]
            node [style="n"];
            subgraph cluster_0 {
                subgraph cluster_1 {
                    Start_O -> Features;
                    Features -> Relations;
                    Start_O -> Relations [topath="bend left"];
                    Features -> Finish_O [topath="bend right"];
                    Relations -> Finish_O;
                    rankdir=LR
                }
                subgraph cluster_4 {
                    subgraph cluster_2 {
                        graph [rankdir=LR]
                        Start_f -> Position;
                        Position -> Size;
                        Size -> Color;
                        Color -> Finish_f;
                        rankdir=LR
                    };
                    subgraph cluster_3 {
                        graph [rankdir=LR]
                        Start_r -> Position_r;
                        Position_r -> Size_r;
                        Size_r -> Color_r;
                        Color_r -> Finish_r;
                        rankdir=LR
                    }
                }
                Features -> Start_f;
                Relations -> Start_r;
            }
            Object -> Start_O;
        }
    \end{dot2tex}
\end{tikzpicture}
I'm a newby when it comes to DOT, graphviz and dot2tex(i), so maybe this can easily be solved, but I couldn't find the answer online.
Attachments
hierarchy.JPG
hierarchy.JPG (31.73 KiB) Viewed 11237 times
propell
Posts: 44
Joined: Fri May 30, 2008 11:16 am

Problem with dot2texi.sty

Post by propell »

werecow wrote:Thanks. Should I remove the % comment marker, or leave it there?
You should leave the %,
I do have one more question about the package itself: Is there a way to align the nodes in a graph on the same horizontal (or vertical) plane, other than using the hierarchical layout?
All the layout is done by Graphviz, so I'm afraid that you have to solve this on the Graphviz level. I have to admit that I have limited experience with Graphviz finetuning. Maybe you can get some help on the Graphviz mailing list. Currently I don't have access to dot2tex, so I'm not able to test your example at the moment. I'll get back to you when I have experimented with it.

It is indeed annoying that Graphviz sometimes don't align the nodes properly. A workaround is to manually edit the generated TikZ source, but this approach should only be used for final finetuning.

- Kjell Magne
werecow
Posts: 5
Joined: Wed Oct 22, 2008 2:58 pm

Re: Problem with dot2texi.sty

Post by werecow »

Ok, I'll just have to work around that then for the time being. Thanks anyway for the reply.
propell
Posts: 44
Joined: Fri May 30, 2008 11:16 am

Re: Problem with dot2texi.sty

Post by propell »

Have you made any progress on the graph layout?

I did a few experiments, but could not get any good results. I think the key is to use the rank parameter in some way. Again I recommend asking for help on the Graphviz mailing list. They are usually very helpful:

https://mailman.research.att.com/mailma ... z-interest

If you post a question there I recommend removing all of the extra dot2tex stuff to avoid confusion.

- Kjell Magne Fauske
Post Reply