两个矩阵中间的箭头

两个矩阵中间的箭头

想要将箭头置于两个矩阵的中间。

\documentclass[journal]{IEEEtran}
\usepackage{tikz,pgfplots}
\usepackage{kbordermatrix}
\usetikzlibrary{fit,matrix,positioning,decorations.pathreplacing,calc}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,arrows,shadows,patterns}
\usepackage{dashbox}
\usepackage{etoolbox}
\begin{document}    
\begin{figure}   
    \[
    \begin{tikzpicture}
    \matrix (m) [matrix of nodes,column sep={1.5em,between origins},row sep = {1.5em,between origins}, left delimiter={[},right delimiter={]}]
    {
        {0} & {1} & {0} & {1}  \\
        {1} & {0} & {1} & {1}  \\
        {1} & {1} & {0} & {0}  \\
        {0} & {0} & {1} & {1}  \\
        {0} & {0} & {0} & {1}  \\
    };  
    \matrix (m2) [matrix of nodes,left=0.4em of m]
    {
        {$ N_1 $} \\
        {$ N_2 $} \\
        {$ N_3 $} \\
        {$ N_4 $} \\
        {$ N_5 $} \\
    };  
    \matrix (m3) [matrix of nodes,above=-0.4em of m]
    {
        {$ t_1 $} & {$ t_2 $} & {$ t_3 $} & {$ t_4 $}  \\
    };
    \end{tikzpicture}
    \longrightarrow 
    \begin{tikzpicture}
    \matrix (m) [matrix of nodes,column sep={1.5em,between origins},row sep = {1.5em,between origins}, left delimiter={[},right delimiter={]}]
    {
        {0} & {1} & {0} & {1}  \\
        {1} & {0} & {1} & {1}  \\
        {1} & {1} & {0} & {0}  \\
        {0} & {0} & {1} & {1}  \\
        {0} & {0} & {0} & {1}  \\
    };
    \matrix (m2) [matrix of nodes,left=0.4em of m]
    {
        {$ N_1 $} \\
        {$ N_2 $} \\
        {$ N_3 $} \\
        {$ N_4 $} \\
        {$ N_5 $} \\
    };
    \matrix (m3) [matrix of nodes,above=-0.4em of m]
    {
        {$ t_1 $} & {$ t_2 $} & {$ t_3 $} & {$ t_4 $}  \\
    };
    \begin{scope}[every node/.style={draw=red,dashed,inner sep = 1pt}]
    \node[fit={(m-1-1) (m-5-2)}]{};
    \node[fit={(m-1-3) (m-5-4)}]{};
    %\node[fit={(m-1-5) (m-5-6)}]{};
    \end{scope}

    \path (m3-1-1.north west) --node[yshift=0.1em,rotate=90]{$ \Bigg\rbrace $} node[yshift=1em]{$ t_1 $} (m3-1-2.north east);
    \path (m3-1-3.north west) --node[yshift=0.1em,rotate=90]{$ \Bigg\rbrace $} node[yshift=1em]{$ t_2 $} (m3-1-4.north east);
    %\path (m3-1-5.north west) --node[yshift=0.1em,rotate=90]{$ \Bigg\rbrace $} node[yshift=1em]{$ t_3 $} (m3-1-6.north east);
    \end{tikzpicture}
    \]
\end{figure}
\end{document}

答案1

只需设定适当的基线。

\documentclass[journal]{IEEEtran}
\usepackage{tikz,pgfplots}
\usepackage{kbordermatrix}
\usetikzlibrary{fit,matrix,positioning,decorations.pathreplacing,calc}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,arrows,shadows,patterns}
\usepackage{dashbox}
\usepackage{etoolbox}
\begin{document}    
\begin{figure}   
    \[
    \begin{tikzpicture}[baseline=(m2-3-1.base)]
    \matrix (m) [matrix of nodes,column sep={1.5em,between origins},row sep = {1.5em,between origins}, left delimiter={[},right delimiter={]}]
    {
        {0} & {1} & {0} & {1}  \\
        {1} & {0} & {1} & {1}  \\
        {1} & {1} & {0} & {0}  \\
        {0} & {0} & {1} & {1}  \\
        {0} & {0} & {0} & {1}  \\
    };  
    \matrix (m2) [matrix of nodes,left=0.4em of m]
    {
        {$ N_1 $} \\
        {$ N_2 $} \\
        {$ N_3 $} \\
        {$ N_4 $} \\
        {$ N_5 $} \\
    };  
    \matrix (m3) [matrix of nodes,above=-0.4em of m]
    {
        {$ t_1 $} & {$ t_2 $} & {$ t_3 $} & {$ t_4 $}  \\
    };
    \end{tikzpicture}
    \longrightarrow 
    \begin{tikzpicture}[baseline=(m2-3-1.base)]
    \matrix (m) [matrix of nodes,column sep={1.5em,between origins},row sep = {1.5em,between origins}, left delimiter={[},right delimiter={]}]
    {
        {0} & {1} & {0} & {1}  \\
        {1} & {0} & {1} & {1}  \\
        {1} & {1} & {0} & {0}  \\
        {0} & {0} & {1} & {1}  \\
        {0} & {0} & {0} & {1}  \\
    };
    \matrix (m2) [matrix of nodes,left=0.4em of m]
    {
        {$ N_1 $} \\
        {$ N_2 $} \\
        {$ N_3 $} \\
        {$ N_4 $} \\
        {$ N_5 $} \\
    };
    \matrix (m3) [matrix of nodes,above=-0.4em of m]
    {
        {$ t_1 $} & {$ t_2 $} & {$ t_3 $} & {$ t_4 $}  \\
    };
    \begin{scope}[every node/.style={draw=red,dashed,inner sep = 1pt}]
    \node[fit={(m-1-1) (m-5-2)}]{};
    \node[fit={(m-1-3) (m-5-4)}]{};
    %\node[fit={(m-1-5) (m-5-6)}]{};
    \end{scope}

    \path (m3-1-1.north west) --node[yshift=0.1em,rotate=90]{$ \Bigg\rbrace $} node[yshift=1em]{$ t_1 $} (m3-1-2.north east);
    \path (m3-1-3.north west) --node[yshift=0.1em,rotate=90]{$ \Bigg\rbrace $} node[yshift=1em]{$ t_2 $} (m3-1-4.north east);
    %\path (m3-1-5.north west) --node[yshift=0.1em,rotate=90]{$ \Bigg\rbrace $} node[yshift=1em]{$ t_3 $} (m3-1-6.north east);
    \end{tikzpicture}
    \]
\end{figure}
\end{document}

在此处输入图片描述

相关内容