# How to insert a table in TikzEdt? (Create Tikz diagrams with tables using a GUI)

I'm trying to find the easiest way to create Tikz diagrams mixed with tables with GUI.

Such as these:

or

How to add connected graphs to a table?

Writing properly all this code can become quite complex and prone to error.

There are several tools to help you create TikZ diagrams, such as TikzEdt.

One could try to create TikZ diagrams with that tools and import them to your main tex document. But it will be difficult to make a complex diagram properly match the text, tables and other figures.

An alternative would be to create the tables with Lyx, and import it from TikzEdt to start drawing above it.

I've tried inserting the table code in the preample (TikzEdt) or in its main code window but I haven't been able to get it.

In its settings -> compiler options it has this code:

\documentclass{article}
\usepackage{tikz,amsmath, amssymb,bm,color}
\usepackage[active,tightpage]{preview}
\usetikzlibrary{shapes,arrows}
% needed for BB
\usetikzlibrary{calc}


Imagine I want to add this table:

\documentclass{article}
\begin{document}
\begin{tabular}{ccc}
ID & Ord & Event\\
\hline
Ana & 1 & A\\
Tom & 1 & A\\
Tom & 2 & B\\
Tom & 3 & D\\
\end{tabular}
\end{document}


I've tried modyfing the code as:

\documentclass{article}
\usepackage{tikz,amsmath, amssymb,bm,color}
\usepackage[active,tightpage]{preview}
\usetikzlibrary{shapes,arrows}
% needed for BB
\usetikzlibrary{calc}
\begin{document}
\begin{tabular}{ccc}
ID & Ord & Event\\
\hline
Ana & 1 & A\\
Tom & 1 & A\\
Tom & 2 & B\\
Tom & 3 & D\\
\end{tabular}
\end{document}


but it doesn't produce any result. I guess because it tries to add a begin{document} twice.

I've also tried leaving the preamble as is and adding the table on the main window.

\begin{tabular}{ccc}
ID & Ord & Event\\
\hline
Ana & 1 & A\\
Tom & 1 & A\\
Tom & 2 & B\\
Tom & 3 & D\\
\end{tabular}
\begin{tikzpicture}
\end{tikzpicture}


But again it doesn't work.

How can I do it?

Or what other GUI tool can I use able to draw TikZ arrows and simple symbols onto a preexistent document or able to create tables?

• this question seems to be duplicate to your question tex.stackexchange.com/questions/400557/…? – Zarko Nov 14 '17 at 14:10
• It isn't. The old one is about how to code something with Latex. This new one is about how to "hack"the GUI program tikzedt to force it to accept a table as the canvas to paint onto. Or in general how to get that result with a GUI tool. – skan Nov 14 '17 at 15:12

I've never used TikZEdt, but the first thing that strikes me is that you can place the tabulars in nodes. That is, start with

\begin{tikzpicture}
\node (tab1) {%
\begin{tabular}{ccc}
ID & Ord & Event\\
\hline
Ana & 1 & A\\
Tom & 1 & A\\
Tom & 2 & B\\
Tom & 3 & D\\
\end{tabular}};
\end{tikzpicture}


and go from there.

For more tables, I suggest adding \usetikzlibrary{positioning} to the preamble (Code prepended in Settings -> compiler options), and then using something like

\begin{tikzpicture}
\node (tab1) {%
\begin{tabular}{ccc}
ID & Ord & Event\\
\hline
Ana & 1 & A\\
Tom & 1 & A\\
Tom & 2 & B\\
Tom & 3 & D\\
\end{tabular}
};

\node [right=of tab1,yshift=2cm] (tab2) {%
\begin{tabular}{ccc}
ID & Ord & Event\\
\hline
Ana & 1 & A\\
Tom & 1 & A\\
\end{tabular}
};
\end{tikzpicture}

• What if you have two of these tables and want to draw arrows from one to the other one? – skan Nov 14 '17 at 20:50
• @skan I thought that was obvious ... You add a second node, with the second tabular. – Torbjørn T. Nov 14 '17 at 20:51
• Unfortunatelly with several nodes only shows the first one. Anyway I'm getting this error "Couldn't parse code. MismatchedTokenException: Expected token '{'. Instead found ";" in line 12 at position 6. Compilation failed with exit code 1". – skan Nov 14 '17 at 20:59
• @skan You did add the second \node in the same tikzpicture environment I hope? And after the ; that closes the first \node? What exactly did you do to get that error? – Torbjørn T. Nov 14 '17 at 21:06