행렬의 회전된 선에 대한 Tikz 계산 거리 수정자 오류

행렬의 회전된 선에 대한 Tikz 계산 거리 수정자 오류

나는 무한한 표에서 특정 용어를 그룹화하는 방법을 설명하고 싶습니다. 지금까지 나는 이것을 만들었습니다:

여기에 이미지 설명을 입력하세요

또한 a₃b₃와 a₃b₃를 그룹화하고 a₃b₃에 대한 다른 그룹을 만들고 싶습니다. 지금까지 나는 다른 Tex 스택 교환 답변을 기반으로 점선 끝으로 선을 만들었습니다.여기그리고여기. 위의 예제는 다음 코드를 사용하여 작성되었습니다.

\documentclass{article}

\usepackage{etoolbox}
\usepackage{tikz} 
\usetikzlibrary{positioning, fit, matrix, decorations.pathreplacing, calc}

\tikzset{%
  rect/.style n args={4}{
        draw=none,
        rectangle,
        append after command={
            \pgfextra{%
                \pgfkeysgetvalue{/pgf/outer xsep}{\oxsep}
                \pgfkeysgetvalue{/pgf/outer ysep}{\oysep}
                \def\arg@one{#1}
                \def\arg@two{#2}
                \def\arg@three{#3}
                \def\arg@four{#4}
                \begin{pgfinterruptpath}
                    \ifx\\#1\\\else
                        \draw[draw,#1] ([xshift=-\oxsep,yshift=+\pgflinewidth]\tikzlastnode.south east) edge[decorate] ([xshift=-\oxsep,yshift=0\ifx\arg@two\@empty-\pgflinewidth\fi]\tikzlastnode.north east);
                    \fi\ifx\\#2\\\else
                        \draw[draw,#2] ([xshift=-\pgflinewidth,yshift=-\oysep]\tikzlastnode.north east) edge[decorate] ([xshift=0\ifx\arg@three\@empty+\pgflinewidth\fi,yshift=-\oysep]\tikzlastnode.north west);
                    \fi\ifx\\#3\\\else
                        \draw[draw,#3] ([xshift=\oxsep,yshift=0-\pgflinewidth]\tikzlastnode.north west) edge[decorate] ([xshift=\oxsep,yshift=0\ifx\arg@four\@empty+\pgflinewidth\fi]\tikzlastnode.south west);
                    \fi\ifx\\#4\\\else
                        \draw[draw,#4] ([xshift=0+\pgflinewidth,yshift=\oysep]\tikzlastnode.south west) edge[decorate] ([xshift=0\ifx\arg@one\@empty-\pgflinewidth\fi,yshift=\oysep]\tikzlastnode.south east);
                    \fi
                \end{pgfinterruptpath}
            }
        }
    },
    dotted ends/.style={
        decoration={
            show path construction,
            lineto code={
                \draw[dashed,#1] (\tikzinputsegmentfirst) --($(\tikzinputsegmentfirst)!-.2!(\tikzinputsegmentlast)$);,
                \draw (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);,
                \draw[dashed,#1] (\tikzinputsegmentlast) -- ($(\tikzinputsegmentlast)!-.2!(\tikzinputsegmentfirst)$);,
            }
        },
        decorate
    },
}



\begin{document}

\begin{center}    
    \begin{tikzpicture}
        \matrix[
            matrix of nodes,
            inner sep=20pt,
            row sep=2mm,
            column sep=2mm,
            every node/.style={
                circle,
                inner sep=0pt,
                align=center,
                text width=3em,
                text height=0.8em,
                text depth=0.2em,
            }] (m) {
                $a_0b_0$ & $a_0b_1$ & $a_0b_2$ & $a_0b_3$ & $\cdots$ \\
                $a_1b_0$ & $a_1b_1$ & $a_1b_2$ & $a_1b_3$ & $\cdots$ \\
                $a_2b_0$ & $a_2b_1$ & $a_2b_2$ & $a_2b_3$ & $\cdots$ \\
                $a_3b_0$ & $a_3b_1$ & $a_3b_2$ & $a_3b_3$ & $\cdots$ \\
                $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ & $\ddots$ \\
            };
            \node[
                inner sep=0pt,
                draw=blue,
                thick,
                rounded corners=1.2em,
                rotate fit=-45,
                fit={(m-1-1) (m-1-1)}
            ] {};
            \node[
                inner sep=0pt,
                draw=blue,
                thick,
                rounded corners=1.2em,
                rotate fit=-45,
                fit={(m-1-2) (m-2-1)}
            ] {};
            \node[
                inner sep=0pt,
                draw=blue,
                thick,
                rounded corners=1.2em,
                rotate fit=-45,
                fit={(m-1-3) (m-3-1)}
            ] {};
            \node[
                inner sep=0pt,
                draw=blue,
                thick,
                rounded corners=1.2em,
                rotate fit=-45,
                fit={(m-1-4) (m-4-1)}
            ] {};
            \node[
                inner sep=0pt,
                rotate fit=-45,
                fit={(m-2-4) (m-4-2)},
                rect={thick, blue, dotted ends={thick}}{}{thick, blue, dotted ends={thick}}{}
            ] {};
    \end{tikzpicture}
\end{center}

\end{document}

그러나 dotted-ends마지막 2개 그룹에 스타일을 적용하면 끝에 더 짧은 점선이 표시됩니다.

여기에 이미지 설명을 입력하세요

($(\tikzinputsegmentfirst)!-.2!(\tikzinputsegmentlast)$)으로 교체하여 이 문제를 해결하려고 했습니다 ($(\tikzinputsegmentfirst)!-1cm!(\tikzinputsegmentlast)$). 그러나 이로 인해 일부 오류가 발생했으며 이제 줄은 다음과 같습니다.

여기에 이미지 설명을 입력하세요

이 문제를 어떻게 해결합니까?

관련 정보