如何在长表中定位括号(装饰)?

如何在长表中定位括号(装饰)?

我正在尝试将括号放入longtable(以将它们跨越到一些行上)。但是,如果奇数页和偶数页上的表格位置不同,则这些括号(装饰)的垂直对齐存在问题: 在此处输入图片描述 在此处输入图片描述

梅威瑟:

\documentclass[12pt,a5paper,twoside]{article}
\usepackage[polish]{babel}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{tikz}
\usepackage[a5paper]{geometry}
\usepackage{array}
\usetikzlibrary{decorations.pathreplacing}

\setlength{\oddsidemargin}{-5mm}
\setlength{\evensidemargin}{-13mm}

\begin{document}
\begin{longtable}{p{3cm}>{\raggedleft\arraybackslash}p{5cm}}
    \toprule
    first column & second column%
    \smash{\tikz [remember picture] \node (rightmark) {};}\\
    \midrule
    \endhead
    A & A \\
    A & A \\
    A & A \\
    A & A \\
    A & A \\
    A & A \\
    A & A \\
    A & A \\
    A & A \\
    B & \smash{\tikz [remember picture] \node (n1) {};} B \\*
    B & B \\*
    B & B \\*
    B & B \\*
    B & B \\*
    B & B \\*
    B & B \\*
    B & B \\*
    B & B \\*
    B & B \\*
    B & B \\*
    B & \tikz [remember picture] \node (n2) {}; B%
    \tikz [overlay,remember picture]
          \draw [decoration={brace,amplitude=2mm},decorate,thick]
          (n1.north -| rightmark.east) -- (n2.south -| rightmark.east)
          node [midway,right=4mm,rotate=90,anchor=north] {brace};\\
    C & C \\
    C & C \\
    C & C \\
    C & C \\
    C & C \\
    C & C \\
    C & C \\
    C & C \\
    C & C \\
    C & C \\
    C & C \\
    C & C \\
    D & \tikz [remember picture] \node (n3) {}; D\\*
    D & D \\
    D & D \\
    D & D \\
    D & D \\
    D & D \\
    D & D \\
    D & D \\
    D & \tikz [remember picture] \node (n4) {}; D%
    \tikz [overlay,remember picture]
          \draw [decoration={brace,amplitude=2mm},decorate,thick]
          (n3.north -| rightmark.east) -- (n4.south -| rightmark.east)
          node [midway,right=4mm,rotate=90,anchor=north] {brace};\\
    \bottomrule
\end{longtable}
\end{document}

我尝试添加一个用于存储水平表位置的代码(紧接着在节点放置命令的下方):

\makeatletter
\ifodd\c@page
    \def\refmargin{\the\oddsidemargin}
\else
    \def\refmargin{\the\evensidemargin}
\fi
\makeatother

\\但在表格中第一个换行命令之后,\refmargin无法读取的值。如何获取rightmark上面 MWE 中节点的正确位置(在偶数页和奇数页上)?

相关内容