平行表和中间行

平行表和中间行

我如何创建下表?实际上,它包含 2 个表格和一些每次连接到单元格的线条。

在此处输入图片描述

\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[colorlinks=true,linkcolor=blue]{hyperref}
\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}
\usesmartdiagramlibrary{additions}
\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}

答案1

你可以尝试学习一点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}

在此处输入图片描述

答案2

目前尚不清楚颜色是否是要求的一部分,因此这里不使用堆栈。

\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}

在此处输入图片描述

相关内容