2

I need to draw a two tables given below : enter image description here This is what I have tried

\begin{tabular}{|c|@{}c@{}|}\hline
&
\begin{tabular}{cc}
 \\
 \\\hline
 \\
 \\
\end{tabular}
\tabularnewline\hline

&
\begin{tabular}{cc}
\\
 \\\hline
\\
\\

\end{tabular}
\tabularnewline\hline
\end{tabular}
  • i would rather draw it as tikz image. – Zarko Sep 5 '17 at 15:57
  • how with tikz image ? – Isla_Bonita Sep 5 '17 at 16:10
3

for me is simpler to draw those tables as tikz picture:

\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{arrows.meta,
                positioning,
                quotes,
                shapes.multipart}

\begin{document}
    \begin{tikzpicture}[
    node distance = 1mm and 11mm,
tabnod/.style = {rectangle split,
                 rectangle split parts=5, rectangle split empty part height=1em,
                 draw, minimum width=8em}
                        ]
\node (n1) [tabnod, label=below:$A$]{};
\node (n2) [above right=of n1]      {$x$};
\node (n3) [tabnod, label=below:$B$,
            below right=of n2]      {};
\draw[semithick,-Straight Barb]
      (n2) edge [out=265, in=5]     (n1.three east)
      (n2)  to  [out=275, in=175]   (n3.four west);
    \end{tikzpicture}
\end{document}
\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{arrows.meta,
                positioning,
                shapes.multipart}

\begin{document}
    \begin{tikzpicture}[
    node distance = 1mm and 11mm,
tabnod/.style = {rectangle split,
                 rectangle split parts=5, rectangle split empty part height=1em,
                 draw, minimum width=8em}
                        ]
\node (n1) [tabnod, label=below:$A$]{};
\node (n2) [above right=of n1]      {$x$};
\node (n3) [tabnod, label=below:$B$,
            below right=of n2]      {};
\draw[semithick,-Straight Barb]
      (n2) edge [out=265, in=5, "$g$"'] (n1.three east)
      (n2)  to  [out=275, in=175,"$h$"] (n3.four west);
    \end{tikzpicture}
\end{document}

enter image description here

  • (n2) edge [out=265, in=5] (n1.three east) in this edge I want to write g – Isla_Bonita Sep 5 '17 at 16:17
  • ups, a forgot on this two letters, but they are simple to add :) – Zarko Sep 5 '17 at 16:21
1

This could be your starting point. I am afraid that you will have tweak the values based on the actual scenario.

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tabular}{c@{}c@{}c}
    \begin{tabular}{|c|}
      \hline
      \\\hline
      \\\hline
      \\\hline
      \\\hline
    \end{tabular}
&
\begin{tikzpicture}[->, shorten <=-1.75ex, node distance=20.0mm, auto]
  \node (x) {\raisebox{1.50ex}{$X$}};
  \node (x1) [below left of=x] {};
  \node (x2) [below right of=x] {};
  \path (x) edge[bend left] node [above] {$g$} (x1);
  \path (x) edge[bend right] node [above] {$h$} (x2);
\end{tikzpicture}
&
    \begin{tabular}{|c|}
      \hline
      \\\hline
      \\\hline
      \\\hline
      \\\hline
    \end{tabular}
\end{tabular}


\end{document}

enter image description here


PGF Man­ual is the ultimate guide on tikz. It also comes with a min­i­mal in­tro­duc­tion version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.