# parallel tables and in-between lines

How can I create the following table? Actually, it includes 2 tables and some lines connecting to cells each time.

\documentclass{standalone}
\usepackage[english,greek]{babel}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{tkz-tab}
\usepackage{cancel}
\usepackage{forest}
\usepackage{caption}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{pst-node}
\def\obj#1{\makebox[1cm]{\strut#1}}
\usepackage{pdflscape}
\usepackage{paralist}
\usepackage{pst-tree,array}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{rotating}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{chngcntr}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{wrapfig}
\usepackage{color}
\usepackage[explicit]{titlesec}
\usepackage{appendix}
\usepackage{etoolbox}
\usepackage{type1cm}
\usepackage{lettrine}
\usepackage[stable]{footmisc}
\usepackage{multicol}
\usepackage{chngcntr}
\usepackage{url}
\usepackage{marvosym}
\usepackage{tcolorbox}
\usepackage{hyperref}
\tcbuselibrary{theorems}
\usepackage{tkz-euclide}
\usetikzlibrary{shapes.geometric}
\usepackage{tkz-fct} \usetkzobj{all}
\usetikzlibrary{calc,decorations.pathreplacing}
\usetikzlibrary{decorations.markings}
\usepackage{pgfplots}
\usepackage{verbatim}
\usepackage{smartdiagram}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{intersections}

\begin{document}

\begin{multicols}{2}
\begin{tabular}{r}
\toprule
$L$ \\
\midrule
5 \\
10 \\
20 \\
21 \\
\bottomrule
\end{tabular}%

\begin{tabular}{r}
\toprule
$MP$ \\
\midrule
50=$\frac{\Delta Q_1}{5}$ \\
70=$\frac{\Delta Q_2}{10}$ \\
120=$\frac{\Delta Q_3}{1}$ \\
\bottomrule
\end{tabular}%

\end{multicols}
\end{document}

• Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. You can improve your question by adding a minimal working example (MWE) that more users can copy/paste onto their systems to work on. If no hero takes the challenge we might have to close your question. – Seamus Jul 20 '16 at 9:11
• sorry. I had forgotten the very basics! :) – Y_gr Jul 20 '16 at 9:36
• Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – user36296 Nov 9 '17 at 1:00

You can try to learn a little bit of TikZ

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{positioning, matrix, backgrounds}
\usepackage{amsmath}

\begin{document}
\begin{tikzpicture}

\matrix (L) [matrix of nodes, nodes={minimum size=8mm, fill=gray!80}, every odd row/.style={nodes={fill=gray!50}}, row sep=.5mm]
{|[minimum height=5mm, font=\sffamily\bfseries]| L\\5\\10\\20\\21\\};

\matrix (MP) at ([xshift=5mm]L-3-1.south east) [matrix anchor=west, matrix of math nodes, row sep=2mm]
{
50 = \frac{\Delta Q_1}{5}\\
70 = \frac{\Delta Q_2}{10}\\
120 = \frac{\Delta Q_3}{1}\\
};

\node[font=\sffamily\bfseries] at (L-1-1-|MP-1-1) (MPtitle) {MP};

\begin{scope}[on background layer]
\fill[gray!50] (MP-3-1.west|-L-2-1.north) rectangle (MP-3-1.east|-L-5-1.south);

\fill[gray!50] (MP-3-1.west|-L-1-1.north) rectangle (MP-3-1.east|-L-1-1.south);
\end{scope}

\draw[ultra thick, line join=bevel] (L.east|-L-2-1)--(MP.west|-MP-1-1)--(L.east|-L-3-1);

\draw[ultra thick, line join=bevel] (L.east|-L-3-1)--(MP.west|-MP-2-1)--(L.east|-L-4-1);

\draw[ultra thick, line join=bevel] (L.east|-L-4-1)--(MP.west|-MP-3-1)--(L.east|-L-5-1);
\end{tikzpicture}
\end{document}


• Very nice solution (+1)! However, drawing lines between nodes with \begin{scope}[every path/.style={shorten <=0.5mm, shorten >=0.5mm, ultra thick, line join=bevel}] \draw (L.east|-L-2-1)--(MP.west|-MP-1-1)--(L.east|-L-3-1); \draw (L.east|-L-3-1)--(MP.west|-MP-2-1)--(L.east|-L-4-1); \draw (L.east|-L-4-1)--(MP.west|-MP-3-1)--(L.east|-L-5-1); \end{scope} to my opinion gives nicer result :-) – Zarko Jul 20 '16 at 11:02

It wasn't clear whether the color was part of the requirement or not, so here it is without, using stacks.

\documentclass{article}
\usepackage{amsmath}
\usepackage{stackengine,graphicx}
\stackMath
\newcommand\connect{\scalebox{2}[4]{\raisebox{-1pt}{$>$}}}
\begin{document}
\setstackgap{L}{2.5\normalbaselineskip}
\def\stacktype{L}
\stackon[2\dimexpr\Lstackgap]{\Centerstack{5 10 20 21}}{\textbf{L}}
~
\Centerstack{{\connect} {\connect} {\connect}}
~
\stackon[2\dimexpr\Lstackgap]{%
\Centerstack{50=\dfrac{\Delta Q_1}{5} 70=\dfrac{\Delta Q_2}{10} 120=\dfrac{\Delta Q_3}{1}}%
}{\textbf{MP}}
\end{document}