0

I want to draw an ER diagram using these combinations of packages. I have tried to follow and re-create this guide, Figure 6.

The graph has to be drawn in an Overleaf document, which leaves me with some issues. I have so far managed to enable --shell-escape, so that dot2texi can compile, but I still get:

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

I have no idea how to proceed, and actually get this to work within Overleaf and output as a TikZ graphic.

So far the package setup is this:

\usepackage{tikz}
\usetikzlibrary{automata, shapes}
\usepackage{dot2texi}
\usepackage[pdf]{graphviz}

The TikZ sets are set up like this:

\definecolor{coolblack}{rgb}{0.0, 0.18, 0.39}
\tikzset{entity/.style={draw=coolblack, fill=coolblack!20}}
\tikzset{attribute/.style={draw =coolblack, fill=coolblack!20}}
\tikzset{multi attribute/.style={draw =coolblack, fill=coolblack!20}}
\tikzset{derived attribute/.style={draw =coolblack, fill=coolblack!20}}
\tikzset{simple relation/.style={-}}
\tikzset{total relation/.style={-, double, double distance=1.5pt}}
\tikzset{relationship/.style ={diamond, draw=coolblack, fill=coolblack!20}}

The graph I'm trying to draw is:

\begin{tikzpicture}
\begin{dot2tex}[styleonly, mathmode, codeonly, neato, options = - s]
digraph G{
edge [style ="simple relation"];
// nodes
Person [style ="entity"];
pid [ style ="attribute" , label ="\underline{ID}"];
Attribute [ style ="attribute"];
Name [ style ="attribute"];
Phone [ style ="multi attribute"];
Address [ style ="attribute"];
Street [ style ="attribute"];
City [ style ="attribute"];
Age [ style ="derived attribute"];
Uses [ style ="relationship"];
Tool [ style ="entity"];
tid [ style ="attribute" , label ="\underline{ID}"];
tname [ style ="attribute" , label ="Name"];
// edges
Person -> pid;
Person -> Attribute;
Person -> Name;
Person -> Phone;
Person -> Address -> Street;
Person -> City;
Person -> Age;
Person -> Uses;
Tool -> tid;
Tool -> tname;
Tool -> Uses [ style ="total relation"];
}
\end{dot2tex}
\end{tikzpicture}

From the compiler log I can see that --shell-escape is correctly enabled: **main.tex --shell-escape.

This is the error from the compilation log:

Opening dot2tex stream output-dot2tex-fig1.dot
runsystem(dot2tex --codeonly -ftikz   --styleonly   --prog=neato -tmath  -o output-dot2tex-fig1.tex - s output-dot2tex-fig1.dot)...executed.

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

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

The compiler is set to LuaLaTeX. The entire code is:

\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{automata, shapes}
\usepackage{dot2texi}
\usepackage[pdf]{graphviz}
\definecolor{coolblack}{rgb}{0.0, 0.18, 0.39}
\tikzset{entity/.style={draw=coolblack, fill=coolblack!20}}
\tikzset{attribute/.style={draw =coolblack, fill=coolblack!20}}
\tikzset{multi attribute/.style={draw =coolblack, fill=coolblack!20}}
\tikzset{derived attribute/.style={draw =coolblack, fill=coolblack!20}}
\tikzset{simple relation/.style={-}}
\tikzset{total relation/.style={-, double, double distance=1.5pt}}
\tikzset{relationship/.style ={diamond, draw=coolblack, fill=coolblack!20}}

\begin{document}

\begin{tikzpicture} \begin{dot2tex}[styleonly, mathmode, codeonly, neato, options = - s] digraph G{ edge [style ="simple relation"]; // nodes Person [style ="entity"]; pid [ style ="attribute" , label ="\underline{ID}"]; Attribute [ style ="attribute"]; Name [ style ="attribute"]; Phone [ style ="multi attribute"]; Address [ style ="attribute"]; Street [ style ="attribute"]; City [ style ="attribute"]; Age [ style ="derived attribute"]; Uses [ style ="relationship"]; Tool [ style ="entity"]; tid [ style ="attribute" , label ="\underline{ID}"]; tname [ style ="attribute" , label ="Name"]; // edges Person -> pid; Person -> Attribute; Person -> Name; Person -> Phone; Person -> Address -> Street; Person -> City; Person -> Age; Person -> Uses; Tool -> tid; Tool -> tname; Tool -> Uses [ style ="total relation"]; } \end{dot2tex} \end{tikzpicture}

\end{document}

What I would like to have is the graph in the TikZ envoirment, so that it can be included within the PDF produced by Overleaf.

What do I need to do, to compile and include this graph in the Overleaf PDF?

Coby Viner
  • 1,939
heyman
  • 11

1 Answers1

1

As it turned out, this had nothing to do with Overleaf. Fixing my indentation did the trick:

\begin{tikzpicture}
\begin{dot2tex}[styleonly, mathmode, codeonly, neato, options=-s]
digraph G {
    edge[style ="simple relation"];
    // nodes
    Person [style ="entity"];
    pid [style ="attribute", label ="\underline{ID}"];
    Attribute [style ="attribute"];
    Name [style ="attribute"];
    Phone [style ="multi attribute"];
    Address [style ="attribute"];
    Street [style ="attribute"];
    City [style ="attribute"];
    Age [style ="derived attribute"];
    Uses [style ="relationship"];
    Tool [style ="entity"];
    tid [style ="attribute" , label ="\underline{ID}"];
    tname [style ="attribute" , label ="Name"];
    // edges
    Person -> pid;
    Person -> Attribute;
    Person -> Name;
    Person -> Phone;
    Person -> Address -> Street;
    Person -> City;
    Person -> Age;
    Person -> Uses;
    Tool -> tid;
    Tool -> tname;
    Tool -> Uses [ tyle ="total relation"];
    }
\end{dot2tex}
\end{tikzpicture}
Coby Viner
  • 1,939
heyman
  • 11