带有红色花括号的多个表格

带有红色花括号的多个表格

我正在尝试重现下图:

在此处输入图片描述

但到目前为止我唯一能做的是(但我无法改变花括号的颜色,也无法将多个表格放在同一个花括号中):

\documentclass[11pt]{report}
\usepackage{textcomp}
\usepackage{amsmath}
\usepackage{array, multirow, bigdelim, makecell, booktabs} 

\begin{document}

\begin{center}
\renewcommand{\theadfont}{\normalsize\bfseries}
\begin{tabular}{c c c c l}
\cmidrule{2-4}
& $1$ & $2$ & $3$ & \hspace{0.3em}\rdelim\}{11}{*}[Discernable ($A\neq B$)]\\
\cmidrule{2-4}
\ldelim\{{9}{*}[$9$ distinct states] & $AB$ & $\ldots$ & $\ldots$  \\
& $\ldots$ & $AB$ & $\ldots$ \\
& $\ldots$ & $\ldots$ & $AB$ \\
& $A$ & $B$ & $\ldots$ \\
& $B$ & $A$ & $\ldots$ \\
& $A$ & $\ldots$ & $B$ \\
& $B$ & $\ldots$ & $A$ \\
& $\ldots$ & $A$ & $B$ \\
& $\ldots$ & $B$ & $B$ \\
\end{tabular}
\end{center}

\end{document}

感谢您的帮助...

答案1

您可以使用 来执行此操作tikzmark

在此处输入图片描述

将每个表放在tikzmarknode具有不同名称的表中。然后,您可以创建一个tikzpicture带有选项的overlay, remember picture表,并使用 TiZ. 该decorations.pathreplacing库具有内置brace样式,非常有用。垂直线可以用类似的方法绘制。

\documentclass[11pt]{report}
\usepackage{textcomp}
\usepackage{amsmath}
\usepackage{array, multirow, bigdelim, makecell, booktabs} 
\usepackage{tikz}
\usetikzlibrary{tikzmark, decorations.pathreplacing, arrows.meta}

\tikzset{mybrace/.style={decorate, decoration={brace, amplitude=2mm}, red, thick}}

\begin{document}

\begin{center}
\renewcommand{\theadfont}{\normalsize\bfseries}
\tikzmarknode[outer xsep=1mm]{A}{\begin{tabular}{c c c}
\midrule
$1$ & $2$ & $3$\\
\midrule
$\ldots$ & $AB$ & $\ldots$ \\
$\ldots$ & $\ldots$ & $AB$ \\
$A$ & $B$ & $\ldots$ \\
$B$ & $A$ & $\ldots$ \\
$A$ & $\ldots$ & $B$ \\
$B$ & $\ldots$ & $A$ \\
$\ldots$ & $A$ & $B$ \\
$\ldots$ & $B$ & $B$ 
\end{tabular}}

\vspace{5mm}
\tikzmarknode[outer xsep=1mm]{B}{\begin{tabular}{c c c}
\midrule
$1$ & $2$ & $3$\\
\midrule
$AA$ & $\ldots$ & $\ldots$ \\
$\ldots$ & $AA$ & $\ldots$ \\
$\ldots$ & $\ldots$ & $AA$ \\
$A$ & $A$ & $\ldots$ \\
$A$ & $\ldots$ & $A$ \\
$\ldots$ & $A$ & $A$
\end{tabular}}

\vspace{5mm}
\tikzmarknode[outer xsep=1mm]{C}{\begin{tabular}{c c c}
\midrule
$1$ & $2$ & $3$\\
\midrule
$A$ & $A$ & $\ldots$ \\
$A$ & $\ldots$ & $A$ \\
$\ldots$ & $A$ & $A$
\end{tabular}}
\end{center}


\begin{tikzpicture}[overlay, remember picture]
\draw[mybrace](A.south west)--node[left=2mm, text=black]{9 different states}(A.north west);
\draw[mybrace](B.south west)--node[left=2mm, text=black]{6 different states}(B.north west);
\draw[mybrace](C.south west)--node[left=2mm, text=black]{3 different states}(C.north west);
\draw[mybrace](B.north east)--node[right=2mm, text=black]{Indistinguishable}(B.north east|-C.south east);
\draw[thick, red, Latex-]([xshift=-3.5cm]C.south west)--
    node[sloped, above, align=center, text=black]{Some long text\\on two lines}([xshift=-3.5cm]C.south west|-A.north west);
\end{tikzpicture}

\end{document}

答案2

在一张 TikZ 图片中:

  • matrix对于分隔符,
  • fit找到两个节点的边界,
  • positioningbelow=of …node distance)和
  • arrows.meta作为Triangle小费。

代码

\documentclass[tikz]{standalone}
\tikzset{
  @/.style 2 args={
    #1 Delimiter/.style 2 args={append after command={
      \bgroup[every #2 delimiter/.append style={##2}]
        nodealso[#2 delimiter={##1}](\tikzlastnode)\egroup}}},
  @/.list={{Left}{left}, {Right}{right}}}
\usetikzlibrary{arrows.meta, fit, positioning, matrix}
% An alternative to Left Delimiter and Right Delimiter:
%\DeclareDocumentCommand{\tikzbrace}{m O{} m}{
%  \path[every #1 delimiter/.append style={#2}] node also[#1 delimiter={#3}]}
\begin{document}
\begin{tikzpicture}[
  node distance=.5cm,
  every delimiter/.append style=red,
  braced/.style={inner xsep=+0pt}]
\node[
  braced,
  Left Delimiter =\{{label=left:9 different states},
  Right Delimiter=\}{label={[name=Dis]right:Discernables ($A \neq B$)}}
] (mb) {$
\begin{array}{ccc}
  \hline
  1      & 2      & 3      \\ \hline
  AB     & \cdots & \cdots \\
  \cdots & AB     & \cdots \\
  \cdots & \cdots & AB     \\
  A      & B      & \cdots \\
  B      & A      & \cdots \\
  A      & \cdots & B      \\
  B      & \cdots & A      \\
  \cdots & A      & B      \\
  \cdots & B      & A      \\ \hline
\end{array}$};

\node[
  braced, below=of mb,
  Left Delimiter=\{{label=left:6 different states}
] (be) {$
\begin{array}{ccc}
  \hline
  1      & 2      & 3      \\ \hline
  AA     & \cdots & \cdots \\
  \cdots & AA     & \cdots \\
  \cdots & \cdots & AA     \\
  A      & A      & \cdots \\
  A      & \cdots & A      \\
  \cdots & A      & A      \\ \hline
\end{array}$};

\node[
  braced, below=of be,
  Left Delimiter=\{{label=left:3 different states}
] (fd) {$
\begin{array}{ccc}
  \hline
  1      & 2      & 3      \\ \hline
  A      & A      & \cdots \\
  A      & \cdots & A      \\
  \cdots & A      & A      \\ \hline
\end{array}$};

\node[
  fit=(be)(fd),
  inner sep=+0pt,
  Right Delimiter=\}{label=right:{Indistignuishable ($A = B$)}}]{};

\node[align=left, anchor=north west] at (mb.north-|Dis.west) {
  Example:\\
  Two particles: $A$ and $B$\\
  Three states: 1, 2 and 3};
\draw[red, thick, -Triangle] (current bounding box.north west)
 -- node[above, black, rotate=90, align=center] {
   More restrictive: when a particle is in a negative state,\\
   less states are available for the other particles.
 } (current bounding box.south west);

% Here's the alternative to Left Delimiter and Right Delimiter:
%\tikzbrace{left} [label=left:9 different states]         \{ (mb);
%\tikzbrace{right}[label=right:Discernables ($A \neq B$)] \} (mb);
%\tikzbrace{left} [label=left:6 different states]         \{ (be);
% and so one …
\end{tikzpicture}
\end{document}

输出

在此处输入图片描述

相关内容