1

I am planning to draw the following pictures like this:

enter image description here

So far I have tried this:

\documentclass[12pt]{article}
\usepackage{multirow,graphics,graphicx,supertabular}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix,decorations.pathreplacing,calc,positioning,calligraphy}

\begin{document} \begin{tikzpicture} \matrix (m) { \node {\textbf{Name}}; & \node{\textbf{Age}}; & \node {\textbf{Balance}}; \ \hline \node {User 1}; & \node{35}; & \node {7}; \ \node {User 2}; & \node{42}; & \node {7}; \ \node { }; & \node{ }; & \node { }; \ \node {User 3}; & \node{42}; & \node {7}; \ \node {User 4}; & \node{42}; & \node {7}; \ }; \draw[decorate] (m-2-2.north east) -- node[right=2pt] {$m$} (m-2-4.south east); % right \end{tikzpicture} \end{document}

How can I achieve this desired output? Not exactly the arrow should be like. They should be clean and nicer arrows.

Also I need this to draw:

enter image description here

mmr
  • 2,249
  • 5
  • 22

2 Answers2

4

How about this?

\documentclass[crop]{standalone}
\usepackage{multirow,graphics,graphicx,supertabular}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{tikz}

\usetikzlibrary{decorations.pathreplacing} \usetikzlibrary{matrix} \usetikzlibrary{positioning}

\begin{document} \begin{tikzpicture} \matrix (m1) [matrix of nodes] { \textbf{Name} & \textbf{Age} & \textbf{Balance} \ \hline User 1 & 35 & 7 \ User 2 & 42 & 7 \ & & \ User 3 & 42 & 7 \ User 4 & 42 & 7 \ };

\matrix [right=of m1] (m2) [matrix of nodes] { \textbf{Name} & \textbf{Age} \ \hline User 1 & 35 \ User 2 & 42 \ & \ User 3 & 42 \ User 4 & 42 \ };

\draw[decorate, decoration={ brace, mirror, amplitude=5pt, raise = 1pt, }, thick, ] (m1-2-1.west) -- (m1-6-1.west) node [ pos=0.5, left=5pt, ] { text };

\draw[decorate, decoration={ brace, mirror, amplitude=5pt, raise = 1pt, }, thick, ] (m1-6-1.south west) -- (m1-6-3.south east) node [ pos=0.5, below=5pt, ] { text };

\draw[decorate, decoration={ brace, mirror, amplitude=5pt, raise = 1pt, }, thick, ] (m2-6-1.south west) -- (m2-6-2.south east) node [ pos=0.5, below=5pt, ] { text };

\draw[decorate, decoration={ brace, amplitude=5pt, raise = 1pt, }, ultra thick, ] (m1-1-1.north west) -- (m2-1-2.north east) node [ pos=0.5, above=5pt, ] { text };

\end{tikzpicture} \end{document}

sample

4

Also with matrix library, but with calligraphy braces and all picture elements style definition as tikzpicture options:

\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,
                    calligraphy,
                matrix,
                positioning}

\begin{document} \begin{tikzpicture}[ node distance = 7mm, BC/.style args = {#1/#2}{decorate, decoration={calligraphic brace, amplitude=2mm, pre =moveto, pre length=1mm, post=moveto, post length=1mm, raise=#1},% for mirroring of brace very thick, pen colour=#2}, M/.style = {matrix of nodes, nodes={minimum width=4em, minimum height=3ex}, row sep=0ex, row 1/.append style = {nodes={font=\bfseries}}, }, N/.style = {font=\small, sloped} ] \matrix (m1) [M] { Name & Age & Balance \ \hline User 1 & 35 & 7 \ User 2 & 42 & 7 \ User 3 & 42 & 7 \ User 4 & 42 & 7 \ }; \matrix[right=of m1] (m2) [M] { Name & Age \ \hline User 1 & 35 \ User 2 & 42 \ User 3 & 42 \ User 4 & 42 \ };

\draw[BC=1mm/red] (m1.north west) -- node[above=3mm] {text above} (m2.north east); \draw[BC=1mm/red] (m1-5-1.south west) -- node[left =3mm] {text left} (m1-2-1.north west); \draw[BC=1mm/red] (m1.south east) -- node[below=3mm] {text below} (m1.south west); \draw[BC=1mm/red] (m2.south east) -- node[below=3mm] {text below} (m2.south west); % \draw[BC=1mm/red] (m2-2-2.north east) -- node[right=3mm] {text right} (m2-3-2.south east); \draw[BC=1mm/red] (m2-4-2.north east) -- node[right=3mm] {text right} (m2-5-2.south east); \end{tikzpicture} \end{document}

enter image description here

Zarko
  • 296,517