6

I want to put a brace at the right of the rows in a table.

I use

\documentclass{book}
\usepackage{multirow,bigdelim}
\begin{document}
\begin{tabular}{cc}
\hline 
Sample values: each line contains one entire beat)\tabularnewline
\hline 
68.1 72.8 78.4 85.6 93.6 98.1 95.3 91.2 91.1 ... & \rdelim\{{3}{3mm}[variable length] \tabularnewline
74.4 79.2 85.6 92.8 100.8 108.8 115.2 121.6 ...\tabularnewline
73.6 77.6 84.0 91.2 100.0 108.8 117.6 124.8 ...\tabularnewline
\hline 
\end{tabular} 
\end{document}

which produces

enter image description here

How can I modify the code to inverse the direction of the brace, as the following screenshot shows?

enter image description here

I tried using \rdelim but it put the brace at the end:

enter image description here

  • Either you have just answered your question or I cannot see (important) difference betwen case 1 and 2. – Przemysław Scherwentke Nov 23 '14 at 0:52
  • @PrzemysławScherwentke Fixed! – Franck Dernoncourt Nov 23 '14 at 1:03
  • 1
    So it is enough to change \{ into \}. – Przemysław Scherwentke Nov 23 '14 at 1:05
  • @PrzemysławScherwentke Thanks, yes, I had misread the \rdelim\{{3} as \rdelim\{3}. – Franck Dernoncourt Nov 23 '14 at 1:07
9

Maybe just:

\documentclass{book}
\usepackage{multirow,bigdelim}
\begin{document}
  \begin{tabular}{cc}
    \hline
    Sample values: each line contains one entire beat)\tabularnewline
    \hline
    68.1 72.8 78.4 85.6 93.6 98.1 95.3 91.2 91.1 ... & \rdelim\}{3}{3mm}[variable length] \tabularnewline
    74.4 79.2 85.6 92.8 100.8 108.8 115.2 121.6 ...\tabularnewline
    73.6 77.6 84.0 91.2 100.0 108.8 117.6 124.8 ...\tabularnewline
    \hline
  \end{tabular}
\end{document}

flipped curly bracket

EDIT

You might also like to think about making the tabular slightly more elegant and legible:

\documentclass{book}
\usepackage{multirow,bigdelim,dcolumn,booktabs}
\begin{document}
  \begin{tabular}{*{9}{D{.}{.}{1}@{\hskip 7.5pt}}cc}
    \toprule
    \multicolumn{11}{c}{Sample values: each line contains one entire beat)}\tabularnewline
    \midrule
    68.1 &72.8 &78.4 &85.6 &93.6 &98.1 &95.3 &91.2 &91.1 &... & \rdelim\}{3}{17.5mm}[\parbox{12.5mm}{variable\\length}] \tabularnewline
    74.4 &79.2 &85.6 &92.8 &100.8 &108.8 &115.2 &121.6 &&...\tabularnewline
    73.6 &77.6 &84.0 &91.2 &100.0 &108.8 &117.6 &124.8 &&...\tabularnewline
    \bottomrule
  \end{tabular}
\end{document}

prettified?

| improve this answer | |
  • 1
    @FranckDernoncourt Since that seemed too easier I've added a slightly souped up version in an edit ;). (It is always easier to catch other people's typos because you don't know what they meant to write.) – cfr Nov 23 '14 at 1:13
  • It looks awesome, thanks a lot, I'll make sure I understand all the code to improve my future latex tables! – Franck Dernoncourt Nov 23 '14 at 1:30
8

You can also adapt the solution from Braces for cases in tabular environment which allows you to mark the top and bottom using \tikzmark and then do the drawing afterwards:

enter image description here

Code:

\documentclass{book}
\usepackage{multirow,bigdelim,dcolumn,booktabs}

\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathreplacing}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

%% Adapted form https://tex.stackexchange.com/questions/206898/braces-for-cases-in-tabular-environment/207704#207704
\newcommand*{\BraceAmplitude}{0.4em}%
\newcommand*{\VerticalOffset}{0.5ex}%  
\newcommand*{\HorizontalOffset}{0.0em}% 
\NewDocumentCommand{\InsertRightBrace}{%
    O{} % #1 = draw options
    O{\HorizontalOffset,\VerticalOffset} % #2 = optional brace shift options
    m   % #3 = top tikzmark
    m   % #4 = bottom tikzmark
    m   % #5 = node text
}{%
    \begin{tikzpicture}[overlay,remember picture]
        \coordinate (Brace Top)    at ($(#3.north) + (#2)$);
        \coordinate (Brace Bottom) at ($(#4.south) + (#2)$);
    \draw [decoration={brace, amplitude=\BraceAmplitude}, decorate, thick, draw=blue, #1]
            (Brace Top) -- (Brace Bottom) 
            node [pos=0.5, anchor=west, align=left, text width=1.25cm, color=black, xshift=\BraceAmplitude] {#5};
    \end{tikzpicture}%
}%

\begin{document}
  \noindent
  \begin{tabular}{*{9}{D{.}{.}{1}@{\hskip 7.5pt}}cc}
    \toprule
    \multicolumn{11}{c}{Sample values: each line contains one entire beat)}\tabularnewline
    \midrule
    68.1 &72.8 &78.4 &85.6 &93.6  &98.1  &95.3  &91.2  &91.1 &... & \tikzmark{Top Mark}\tabularnewline
    74.4 &79.2 &85.6 &92.8 &100.8 &108.8 &115.2 &121.6 &     &... & \tabularnewline
    73.6 &77.6 &84.0 &91.2 &100.0 &108.8 &117.6 &124.8 &     &... & \tikzmark{Bottom Mark}\tabularnewline
    \bottomrule
  \end{tabular}
  \InsertRightBrace[red, ultra thick]{Top Mark}{Bottom Mark}{Variable Length}
\end{document}
| improve this answer | |
  • (+1) But a lot more work than changing { to }, though ;). Also tikz is a lot to load only for this and it requires multiple passes... – cfr Nov 23 '14 at 1:35
  • 2
    @cfr: Totally agree that it is overkill if you just one specific brace in solid black. But, sure comes in handy when you want to do any customizations. – Peter Grill Nov 23 '14 at 19:15
5

Here is an implementation that doesn't use bigdelim; rather an array that is vertically aligned on the math axis:

enter image description here

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{c c}
  \toprule
  Sample values: each line contains one entire beat \\
  \midrule
  $\left.\kern-\nulldelimiterspace \begin{array}{ *{9}{r} }
    68.1 & 72.8 & 78.4 & 85.6 &  93.6 &  98.1 &  95.3 &  91.2 & \ldots \\
    74.4 & 79.2 & 85.6 & 92.8 & 100.8 & 108.8 & 115.2 & 121.6 & \ldots \\
    73.6 & 77.6 & 84.0 & 91.2 & 100.0 & 108.8 & 117.6 & 124.8 & \ldots
  \end{array} \right\}$ \rlap{variable length} \\
  \bottomrule
\end{tabular} 
\end{document}
| improve this answer | |

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.