5

I want to reference cumulative rows of an array using large braces, such as appear in cases or with \right\}, combining the table below with the repeated brackets from the lower example made using drcases. How can I reference subsets of the rows of an array with a \left \right effect?

\documentclass{article}

\usepackage{amsmath}
\usepackage{mathtools}

\begin{document}
\begin{displaymath}
\left.
\begin{array}{c|c|c|}
\hline
&\multicolumn{2}{c}{\text{Process}}\vline\\
\hline
0 & \sigma_{0} & a(\phi_{0}')\\
1 & \sigma(\phi_{0}) & a(\phi_{1}')\\
2 & \sigma(\phi_{1}) & a(\phi_{2}')\\
3 & \sigma(\phi_{2}) & a(\phi_{3}')\\
4 & \sigma(\phi_{3}) & a(\phi_{4}')\\
5 & \sigma(\phi_{4}) & a(\phi_{5}')\\
\vdots & \vdots & \vdots
\end{array}
\right\} \rightarrow \phi \rightarrow
\end{displaymath}

\begin{displaymath}
\begin{drcases}
\begin{drcases}
\begin{drcases}
\begin{drcases}
\begin{drcases}
\begin{drcases}
\begin{drcases}
0  \sigma_{0}  a(\phi_{0}')
\end{drcases}\phi_{0}\\
1  \sigma(\phi_{0})  a(\phi_{1}')
\end{drcases}\phi_{1}\\
2  \sigma(\phi_{1})  a(\phi_{2}')
\end{drcases}\phi_{2}\\
3  \sigma(\phi_{2})  a(\phi_{3}')
\end{drcases}\phi_{3}\\
4  \sigma(\phi_{3})  a(\phi_{4}')
\end{drcases}\phi_{4}\\
5  \sigma(\phi_{4})  a(\phi_{5}')
\end{drcases}\phi_{5}\\
\vdots  \vdots  \vdots
\end{drcases}
\phi
\end{displaymath}
\end{document}

enter image description here

edit: As requested, here's a rough idea of what I'm aiming for. Clearly, the scale and indices are off here. phi_{0} should cover only the first row, phi_{1} only the first and second rows, etc.

enter image description here

3
  • 2
    I'm having a hard time envisioning what you want to do. Perhaps a drawing might be a useful addition?
    – Don Hosek
    Jul 28 at 1:20
  • @DonHosek Added!
    – Cary
    Jul 28 at 1:29
  • You can use \left. to match the \right\}. Jul 28 at 13:29
6

Try this (notice that I removed \vline and used a different \multicolumn specifier):

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand*\rightbrace[3][6]{%
  %  Optional argument  : Total number of rows, *excluding* header
  %                       and the last \vdots row. Default 6.
  % Mandatory argument 1: How many rows should the right brace span?
  % Mandatory argument 2: What is the label?
  %
  % We first measure the total height of a \vdots row
  \setbox\z@\vbox{\hbox{$\vdots$\strut}\vss}%
  % Now, \ht0 is the total height of the \vdots row
  \vcenter{%
    \kern\arrayrulewidth % top \hline
    \kern\baselineskip   % header
    \kern\arrayrulewidth % middle \hline
    % Next comes a box spanning #2 rows
    \vbox to#2\baselineskip{%
      \vss
      \hbox{$\left.\vcenter{\hrule height #2\baselineskip}\right\}#3\n@space$}%
      \vss
    }%
    \kern-#2\baselineskip % backup #2 rows
    \kern#1\baselineskip  % move down by #1 (total) rows
    \kern\ht\z@           % move down by total height of \vdots
  }%
}
\makeatother

\begin{document}

\[
\begin{array}{|c|c|c|}
\hline
&\multicolumn{2}{c|}{\text{Process}}\\
\hline
0&\sigma_{0}&a(\phi_{0}')\\
1&\sigma(\phi_{0})&a(\phi_{1}')\\
2&\sigma(\phi_{1})&a(\phi_{2}')\\
3&\sigma(\phi_{2})&a(\phi_{3}')\\
4&\sigma(\phi_{3})&a(\phi_{4}')\\
5&\sigma(\phi_{4})&a(\phi_{5}')\\
\vdots&\vdots&\vdots\\
\end{array}
\rightbrace{1}{\phi_0}
\rightbrace{2}{\phi_1}
\rightbrace{3}{\phi_2}
\rightbrace{4}{\phi_3}
\rightbrace{5}{\phi_4}
\rightbrace{6}{\phi_5}
\rightbrace{7.5}{\phi}
% Yes, the first mandatory argument can be bigger than the optional argument,
% and it also can be a non-integer.
\]

\end{document}

spanning braces

The alignments should be perfect in this specific application.

4

Here's my take:

\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs,array}

\begin{document}

\[
% measure the table header
\sbox0{\begin{tabular}[b]{c}\toprule P \\ \midrule\end{tabular}}
% an outer tabular for alignment
\begin{tabular}{@{}c@{}c@{}}
% the table proper
\begin{tabular}[t]{ c *{2}{>{$}c<{$}}}
\toprule
& \multicolumn{2}{c}{Process} \\
\cmidrule{2-3}
0 & \sigma_0       & a(\phi_0') \\
1 & \sigma(\phi_0) & a(\phi_1') \\
2 & \sigma(\phi_1) & a(\phi_2') \\
3 & \sigma(\phi_2) & a(\phi_3') \\
4 & \sigma(\phi_3) & a(\phi_4') \\
5 & \sigma(\phi_4) & a(\phi_5') \\
$\vdots$ & \vdots & \vdots \\
\addlinespace
\bottomrule
\end{tabular} &
% now the braces
\newcommand{\rb}[2]{%
  \raisebox{-\ht0}{\raisebox{-\height}{%
    $\left.\vphantom{\begin{array}{c}#1\end{array}}\right\rbrace#2$%
  }}%
}
\rb{\phi_0'}{\phi_0}
\rb{\phi_0' \\ \phi_1'}{\phi_1}
\rb{\phi_0' \\ \phi_1' \\ \phi_2'}{\phi_2}
\rb{\phi_0' \\ \phi_1' \\ \phi_2' \\ \phi_3'}{\phi_3}
\rb{\phi_0' \\ \phi_1' \\ \phi_2' \\ \phi_3' \\ \phi_4'}{\phi_4}
\rb{\phi_0' \\ \phi_1' \\ \phi_2' \\ \phi_3' \\ \phi_4' \\ \phi_5' }{\phi_5}
\rb{\phi_0' \\ \phi_1' \\ \phi_2' \\ \phi_3' \\ \\ \phi_4' \\ \phi_5' \\ x}{\phi}
\end{tabular}
\]

\end{document}

enter image description here

1
  • I set the other answer as the solution because its style more closely matched my request, but I've implemented your version because I prefer your style! Thanks!
    – Cary
    Jul 28 at 17:11

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.