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

enter image description here

    \usepackage{tkz-fct} \usetkzobj{all}


    $L$ \\
    5 \\
    10 \\
    20 \\
    21 \\

    $MP$ \\
    50=$\frac{\Delta Q_1}{5}$ \\
    70=$\frac{\Delta Q_2}{10}$ \\
    120=$\frac{\Delta Q_3}{1}$ \\

  • 1
    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

\usetikzlibrary{positioning, matrix, backgrounds}


\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);

\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);

enter image description here

  • 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.

\stackon[2\dimexpr\Lstackgap]{\Centerstack{5 10 20 21}}{\textbf{L}}
\Centerstack{{\connect} {\connect} {\connect}}
\Centerstack{50=\dfrac{\Delta Q_1}{5} 70=\dfrac{\Delta Q_2}{10} 120=\dfrac{\Delta Q_3}{1}}%

enter image description here

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.