修复 tabularray 中的双重 \vlines

修复 tabularray 中的双重 \vlines

我正在尝试使用两种不同的双 V 线,tabularray但它们似乎与水平 V 线冲突。

以下是 MWE:

\documentclass[10pt]{report}
\usepackage{tabularray}
\UseTblrLibrary{diagbox}

\newcommand{\rot}[1]{\rotatebox[origin=c]{90}{$#1$}}

\begin{document}
$$\begin{tblr}{
colspec={ccccc},
hline{1,2,3,5,6} = {1-3}{solid},
hline{1,2,3,5,6} = {4-5}{solid},
vline{1,2,3,5,6} = {1-3,4-5}{solid},
hline{4}= {1}{1}{dashed},
hline{4}= {2}{1}{dashed},
vline{4}= {1}{1}{dashed},
vline{4}= {2}{1}{dashed},
hline{4} = {1}{2-3,4-5}{2pt},
hline{4} = {2}{2-3,4-5}{2pt},
hline{2,6} = {2-3,4-5}{2pt},
vline{4} = {1}{2-3,4-5}{2pt},
vline{4} = {2}{2-3,4-5}{2pt},
vline{2,6} = {2-3,4-5}{2pt}
}
\diagbox{pq}{\rot{rs}} &\rot{A_1 a_2} & \rot{A_1 a_1} & \rot{A_{-1} a_{-1}} & \rot{A_{-1} a_{-2}}\\
A_3 a_4 &x_1 &-y_1 & -y_1 &x_1\\
A_2 a_4 &\ast &\ast &\ast &\ast\\
A_{-2} a_{-4} &\ast &\ast &\ast &\ast\\
A_{-3} a_{-4} &x_1 &-y_1 &-y_1 &x_1
\end{tblr}$$
\end{document}

生成下表:

表格示例

我怎样才能阻止hlines跨越vline{4}

将 改为某种锯齿线的替代方法vline{4} = {1}{dashed}也不错。(我想表示我省略了 列\rot{A_1 a_1}和 列之间的一些列\rot{A_{-1}a_{-1}})。

答案1

像这样?

在此处输入图片描述

\documentclass[margin=3mm]{standalone}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{tabularray}
\UseTblrLibrary{diagbox}

\begin{document}
\settowidth\rotheadsize{\small$A_{-1}a_{-1}$}    % from makecell
$   
    \begin{tblr}{colspec={*{6}{c}},
                 hline{1-Z} = {1-3,5-6}{solid},
                 hline{1,4,5,Z} = {4}{dashed},
                 vline{1-4,5-Z} = {1-3,5-6}{solid},
                 vline{1,4,5,Z} = {4}{dashed},
%
                hline{2,4,5,Z} = {2-3,5-6}{1pt},
                vline{2,4,5,Z} = {2-3,5-6}{1pt},
%
                 cell{1}{2-Z}   = {cmd=\rothead},
                 row{1} = {rowsep=0pt}
                }
\diagbox{pq}{rs}    &   $A_1 a_2$   &   $A_1 a_1$   &&  $A_{-1}a_{-1}$  &   $A_{-1}a_{-2}$  \\
A_3 a_4             &   x_1         &   -y_1        &&   -y_1           &   x_1             \\
A_2 a_4             &   \ast        &   \ast        &&  \ast            &   \ast            \\
                    &               &               &&                  &                   \\
A_{-2} a_{-4}       &   \ast        &   \ast        &&  \ast            &   \ast            \\
A_{-3} a_{-4}       &   x_1         &   -y_1        &&  -y_1            &   x_1             \\
    \end{tblr}
$   
\end{document}

答案2

与。{NiceTabular}nicematrix

\documentclass{article}
\usepackage{nicematrix,tikz}

\begin{document}

\renewcommand{\arraystretch}{1.5}
\NiceMatrixOptions{exterior-arraycolsep}

$\begin{NiceArray}{c*{5}{w{c}{6mm}}}
    \Block[hvlines]{3-3}{}
    \diagbox{pr}{rs} & \RowStyle{\rotate} A_1a_2 & A_1a_1 & & \Block[hvlines]{3-2}{}A_{-1}a_{-1} & A_{-1}a_{-2}
    \kern1mm \\
    A_3a_4 & x_1 & -y_1 & & -y_1 & x_1 \\
    A_2a_4 & *   & *    & & *    & *   \\
    \\
    \Block[hvlines]{2-3}{} 
    A_{-2}a_{-4} & * & * & & \Block[hvlines]{2-2}{} * & * \\
    A_{-3}a_{-4} & x_1 & -y_1 & & -y_1 & x_1 
\CodeAfter
   \begin{tikzpicture}
     \draw [very thick] (2-|2) rectangle (4-|4) 
                        (5-|2) rectangle (7-|4) 
                        (2-|5) rectangle (4-|7)  
                        (5-|5) rectangle (7-|7) ; 
     \draw [dashed] (1-|4) -- (1-|5) 
                    (7-|4) -- (7-|5) 
                    (4-|1) -- (5-|1)  
                    (4-|7) -- (5-|7)  
                    (4-|4) rectangle (5-|5) ; 
   \end{tikzpicture}
\end{NiceArray}$

\end{document}

您需要多次编译。

上述代码的输出

相关内容