-
Notifications
You must be signed in to change notification settings - Fork 17
/
dot2tex.tex
66 lines (53 loc) · 1.95 KB
/
dot2tex.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dot2tex.tex
% An example demonstrating the use of the dot2texi package for drawing diagrams
% in dot syntax and compiling them to Tikz. This process is slower than drawing
% in Tikz, but may be more convenient for simple diagrams.
% This file must be compiled with the "-shell-escape" flag
% https://github.com/mhyee/latex-examples/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LaTeX Preamble
% Load packages and set options as needed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set the document class to "article"
% Pass it "letterpaper" option
\documentclass[letterpaper]{article}
% We don't need the special font encodings, but still
% good practice to include these. See:
%
% http://tex.stackexchange.com/questions/664/why-should-i-use-usepackaget1fontenc
% http://dsanta.users.ch/resources/type1.html
\usepackage[T1]{fontenc}
\usepackage{ae,aecompl}
% http://tex.stackexchange.com/a/44699
% http://tex.stackexchange.com/a/44701
\usepackage[utf8]{inputenc}
% Use Latin Modern, an improved version of the Computer Modern font
\usepackage{lmodern}
% Draw in dot format
\usepackage{dot2texi}
% NOTE: tikz is not automatically included!
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
% Don't indent paragraphs
\usepackage{parskip}
% Disable page numbering
\pagestyle{empty}
% Begin the actual typesetting, by starting the "document" environment
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
% Example taken from "Drawing graphs with dot" by Gansner, Koutsofios, and North
% http://www.graphviz.org/pdf/dotguide.pdf
\begin{dot2tex}
digraph G {
main -> parse -> execute;
main -> init;
main -> cleanup;
execute -> make_string;
execute -> printf
init -> make_string;
main -> printf;
execute -> compare;
}
\end{dot2tex}
\end{document}