创建一个带有一次和两次阴影区域和花括号的表格

创建一个带有一次和两次阴影区域和花括号的表格

我尝试在 Latex 中用阴影线、单元格虚线和花括号制作下表: 在此处输入图片描述 我在这个网站上看到过很多不同的例子:使用 tikz 设置表格背景阴影和阴影(阴影),带有彩色单元格和虚线的表格(虚线单元格),如何在表格环境中的同一个单元格中混合颜色和阴影?(阴影+着色)。

但是我还没有找到具有两种孵化类型(东北+西北)和整个特征组合的孵化单元,而这在我的示例中是必需的。

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}         
\usepackage[english, russian]{babel}
\usepackage{amssymb,amsmath}
\usepackage{amsthm}
\usepackage{colortbl}
\usepackage{arydshln}
\usepackage{hhline}
\usepackage{multirow,bigdelim}
\usepackage{graphicx}
\usepackage[margin=2cm]{geometry} % just for the example 
\usepackage{fourier} 
\usepackage[table]{xcolor} 
\usepackage{array}
\usepackage{tabularx}
\usepackage{tikz}
\usepackage{lipsum}
\usetikzlibrary{calc,shadings,patterns}

\graphicspath{{pictures/}}

\makeatletter
\tikzset{%
  remember picture with id/.style={%
    remember picture,
    overlay,
    save picture id=#1,
  },
  save picture id/.code={%
    \edef\pgf@temp{#1}%
    \immediate\write\pgfutil@auxout{%
      \noexpand\savepointas{\pgf@temp}{\pgfpictureid}}%
  },
  if picture id/.code args={#1#2#3}{%
    \@ifundefined{save@pt@#1}{%
      \pgfkeysalso{#3}%
    }{
      \pgfkeysalso{#2}%
    }
  }
}

\def\savepointas#1#2{%
  \expandafter\gdef\csname save@pt@#1\endcsname{#2}%
}

\def\tmk@labeldef#1,#2\@nil{%
  \def\tmk@label{#1}%
  \def\tmk@def{#2}%
}

\tikzdeclarecoordinatesystem{pic}{%
  \pgfutil@in@,{#1}%
  \ifpgfutil@in@%
    \tmk@labeldef#1\@nil
  \else
    \tmk@labeldef#1,(0pt,0pt)\@nil
  \fi
  \@ifundefined{save@pt@\tmk@label}{%
    \tikz@scan@one@point\pgfutil@firstofone\tmk@def
  }{%
  \pgfsys@getposition{\csname save@pt@\tmk@label\endcsname}\save@orig@pic%
  \pgfsys@getposition{\pgfpictureid}\save@this@pic%
  \pgf@process{\pgfpointorigin\save@this@pic}%
  \pgf@xa=\pgf@x
  \pgf@ya=\pgf@y
  \pgf@process{\pgfpointorigin\save@orig@pic}%
  \advance\pgf@x by -\pgf@xa
  \advance\pgf@y by -\pgf@ya
  }%
}
\newcommand\tikzmark[2][]{%
\tikz[remember picture with id=#2] {#1;}}
\makeatother
% end of Andrew's code

\newcommand\HatchedCell[4][0pt]{%
  \begin{tikzpicture}[overlay,remember picture]%
    \fill[#4] ( $ (pic cs:#2) + (0,1.9ex) $ ) rectangle ( $ (pic cs:#3) + (0pt,-#1*\baselineskip-.8ex) $ );
  \end{tikzpicture}%
}%

\newcommand\HatchedCellw[4][0pt]{%
  \begin{tikzpicture}[overlay,remember picture]%
    \fill[#4] ( $ (pic cs:#2) + (0,1.9ex) $ ) rectangle ( $ (pic cs:#3) + (0pt,-#1*\baselineskip-.8ex) $ );
  \end{tikzpicture}%

}%

\begin{document}


\HatchedCell{start3}{end3}{%
  pattern color=black!70,pattern=north east lines}

\HatchedCellw{start4}{end4}{%
  pattern color=black!70,pattern=north west lines}

\begin{tabular}[t]{|l|c|c|c|c|c|c|c|c|c|}
\cdashline{5-5} \hhline{----~----}
& $1$ & $2$ & $3$ & \hspace{0.4in} & $a_i$ & $a_i+1$ & $a_i+2$ & \hspace{0.4in} & $B$\\
\cdashline{5-5} \hhline{----~----}
\ldelim\{{5}{1mm}[$k<l_i$]  $1$ & & & & & & & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start4}}c!{\vrule\tikzmark{end4}}}{} &\multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start4}}c!{\vrule\tikzmark{end4}}}{} \rdelim\}{9}{1mm}[$k<j-a_i$]\\
\cdashline{5-5} \hhline{----~----}
$2$ & $\infty$ & & & & & & & & $\infty$ \\
\cdashline{5-5} \hhline{----~----}
$3$ & $\infty$ & $\infty$ & & & & & &\\
\cdashline{5-5} \hhline{----~----}
\multicolumn{1}{:c:}{} & \multicolumn{1}{c:}{$\infty$} & \multicolumn{1}{c:}{$\infty$} & \multicolumn{1}{c:}{$\infty$} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{}\\
\multicolumn{1}{:c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{}\\
\cdashline{5-5} \hhline{----~----}
$l_i-1$ & $\infty$ & $\infty$ & $\infty$ & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start4}}c!{\vrule\tikzmark{end4}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start4}}c!{\vrule\tikzmark{end4}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start4}}c!{\vrule\tikzmark{end4}}}{} & & $\infty$ \\
\cdashline{5-5} \hhline{----~----}
$l_i$ & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start4}}c!{\vrule\tikzmark{end4}}}{}  & & & & $\infty$ \\
\cdashline{5-5} \hhline{----~----}
$l_i+1$ & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & & & & &\\
\cdashline{5-5} \hhline{----~----}
\multicolumn{1}{:c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{}\\
\multicolumn{1}{:c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{}\\
\cdashline{5-5} \hhline{----~----}
$B-a_i-1$ & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & & & & &\\
\cdashline{5-5} \hhline{----~----}
$B-a_i$ & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & & & & &\\
\cdashline{5-5} \hhline{----~----}
$B-a_i+1$ & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & & & & &\\
\cdashline{5-5} \hhline{----~----}
\multicolumn{1}{:c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{}\\
\multicolumn{1}{:c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{} & \multicolumn{1}{c:}{}\\
\cdashline{5-5} \hhline{----~----}
$B$ & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} & \multicolumn{1}{!{\hspace*{-0.4pt}\vrule\tikzmark{start3}}c!{\vrule\tikzmark{end3}}}{} &  & & & &\\
\cdashline{5-5} \hhline{----~----}
\multicolumn{1}{c}{} & \multicolumn{8}{c}{\upbracefill}\\[-1ex]
\multicolumn{1}{c}{} & \multicolumn{8}{c}{$\scriptstyle k>j$}\\
\end{tabular}


\end{document}

在需要两次加热的地方我放了无穷大符号,但最好看上面的图片。

附言:抱歉,我的英语不够好。

答案1

我提出了一个基于tabularx, bigdelim和的解决方案pstricks-add ,总体思路是在相关单元格中定义空节点,将其移到所属单元格的左下角,然后通过封闭的多边形路径链接这些单元格,并用其中一种填充样式进行填充。

\documentclass[t12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[english, russian]{babel}
\usepackage{amssymb,amsmath}
\usepackage{amsthm}
\usepackage{arydshln}
\usepackage{hhline}
\usepackage{multirow, bigdelim}
\usepackage{graphicx}
\usepackage[margin=2cm]{geometry} % just for the example
\usepackage[upright]{fourier}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\newcolumntype{Y}{>{$}X<{$}}
\usepackage{tikz}
\usetikzlibrary{calc,shadings,patterns}
\usepackage{pstricks-add}
\newcommand{\mynode}[1]{\pnode[-6.2pt, -5.6pt]{#1}}
\newcommand{\mycline}{\cline{2-5}\cdashline{6-6}[2.5pt/2pt]\cline{7-9}\cdashline{10-10}[2.5pt/2pt]\cline{11-11}}

\begin{document}

\renewcommand{\arraystretch}{1.5}
\setlength{\dashlinedash}{3pt}
\setlength{\dashlinegap}{2pt}
\noindent \begin{tabularx}{\linewidth}{l|>{$}p{15mm}<{$}|*{9}{Y|}l}
    \mycline
    & &\mynode{H01} 1 & 2 & 3 & \mynode{D0} ... & a_i & a_i + 1 & \mynode{H07} a_i + 2 & \mynode{H08} ... & B & \mynode{B1}\\
    \mycline
     \ldelim\{{5.2} {3.3em}[$ k < l_i $]& 1 &\mynode{H11} & \mynode{H12}& & & & & \mynode{H17} & \mynode{H18} & &\hskip-0.33em\rdelim\}{9.4}{*}[ $ k < j-a_i $]\\
    \mycline
    & 2 & & \mynode{H22}& \mynode{H23} & & & & & \mynode{H28}& \mynode{H29}\\
    \mycline
    & 3 & & & \mynode{H33} & \mynode{D3} & & & & & \\
    \mycline
     & ⋮& & & & & & & & & \\
    \mycline
    & l_{i-1} & \mynode{H51}& & & \mynode{D5} & & & & & \mynode{H59} \\
    \mycline
    & l_i & & & & & & & & &\mynode{H69} & \mynode{B6}\\
    \mycline
    & l_{i + 1} & & & & & & & & & \\
    \mycline
     & ⋮ & \mynode{H81} & & & \mynode{D8} \mynode{H85} &\mynode{H86} & & & & \\
    \mycline
    & B-a_i - 1 & & & & \mynode{H95} & \mynode{H96} & \mynode{H97}& & &\mynode{H9a} & \mynode{B9}\\
    \mycline
    & B-a_i & & & & & \mynode{Ha6} & \mynode{Ha7} & \mynode{Ha8}& & \\
    \mycline
    & B-a_i + 1 & & & & & & \mynode{Hb7} & \mynode{Hb8} & \mynode{Hb9}& \\
    \mycline
   & ⋮ & & & & & & & \mynode{Hc8} & \mynode{Hc9} & \mynode{Hca} \\
    \mycline
   & B &\mynode{B} & & & & & & &\mynode{Hd9} & \mynode{Hda} \\
    \mycline 
        \end{tabularx}
    \psset{linestyle=none, hatchwidth=0.4pt, hatchsep=1.6pt}
    \pspolygon[fillstyle=vlines] (H01)(H11)(H12)(H22)(H23)(H33)(D3)(D5)(H59)(H29)(H28)(H18)(H17)(H07)%(K) %
    \psset{fillstyle=hlines}
    \pspolygon(H51)(D5)(H85)(H86)(H96)(H97)(Ha7)(Ha8)(Hb8)(Hb9)(Hc9)(Hca)(Hda)(B)
    \pspolygon(H69)(B6)(B9)(H9a)
    \psset{fillstyle=crosshatch*,fillcolor=black, hatchcolor=white,hatchwidth=1.6pt,hatchsep=1.6pt, hatchangle=0}
    \pspolygon(H11)(H12)(H22)(H23)(H33)(D3)(D5)(H51)
    \pspolygon(H07)(H17)(H18)(H28)(H29)(H69)(B6)(B1)
    \psbrace[ref=c, nodesepB=0.5em, braceWidthInner=4pt, braceWidthOuter=6pt](B)(Hda){$k > j$}

\end{document} 

在此处输入图片描述

相关内容