编辑

编辑

我想在表格行右侧放置一个括号。

我用

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

产生

在此处输入图片描述

我如何修改代码来反转括号的方向,如下面的屏幕截图所示?

在此处输入图片描述

我尝试使用\rdelim但它把括号放在了最后:

在此处输入图片描述

答案1

也许只是:

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

翻转花括号

编辑

您可能还想考虑使表格更加优雅和清晰:

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

美化了?

答案2

您还可以调整解决方案表格环境中的括号它允许您使用标记顶部和底部\tikzmark,然后进行绘图:

在此处输入图片描述

代码:

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

答案3

这是一个不使用的实现bigdelim;而是array在数学轴上垂直对齐:

在此处输入图片描述

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

答案4

使用{NiceTabular}ofnicematrix和它的内置命令\SubMatrix

\documentclass{book}
\usepackage{nicematrix}

\begin{document}
\begin{NiceTabular}{cc}
  \hline 
  Sample values: each line contains one entire beat) \\
  \hline 
  68.1 72.8 78.4 85.6 93.6 98.1 95.3 91.2 91.1 ... \\
  74.4 79.2 85.6 92.8 100.8 108.8 115.2 121.6 ... & \rlap{variable length} \\
  73.6 77.6 84.0 91.2 100.0 108.8 117.6 124.8 ... \\
  \hline 
\CodeAfter
  \SubMatrix{.}{2-1}{4-1}{\}}[extra-height=-1mm]
\end{NiceTabular} 
\end{document}

上述代码的输出

相关内容