帶有紅色大括號的多個表

帶有紅色大括號的多個表

我正在嘗試重現下圖:

在此輸入影像描述

但到目前為止我唯一能做的是(但我無法更改大括號顏色,也無法將多個表放在同一個大括號中):

\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具有不同名稱的表中。然後你可以建立一個tikzpicturewith 選項overlay, remember picture並使用 Ti 繪製大括號kZ. 該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找出兩個節點的邊界,
  • positioning對於below=of …(參見node distance)和
  • arrows.metaTriangle小費。

程式碼

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

輸出

在此輸入影像描述

相關內容