tikz 中的多个箭头

tikz 中的多个箭头

我想将下面代码中的单箭头替换为双箭头(往返于每个节点)。我需要为其添加动画效果,因此我想调整第一张幻灯片中的代码来实现该效果。

\documentclass{beamer}
\mode<presentation>{\usetheme{Madrid}}

\usepackage{tikz}
\usetikzlibrary{backgrounds,fit,matrix}


\tikzstyle{bigbox} = [minimum size=3cm,draw=blue!50, thick, fill=blue!10, rounded corners, rectangle]
\tikzstyle{box} = [minimum size=1.5cm, rounded corners,rectangle, fill=blue!50]
\tikzstyle{arrow} = [thick,->,>=stealth]

\begin{document}


\begin{frame}[fragile]
    

\begin{tikzpicture}

\node (box11) [box] {11};

\node (box12) [box, right of=box11,xshift=2cm] {12};

\node (box13) [box, right of=box12,xshift=2cm] {13};

\node (box21) [box, below of=box11,yshift=4cm] {21};

\node (box22) [box, right of=box21,xshift=2cm] {22};

\node (box23) [box, right of=box22,xshift=2cm] {23};

\draw<.(1)-> [arrow] (box11) -- (box12);
\draw<.(1)-> [arrow] (box12) -- (box13);
\draw<.(1)-> [arrow] (box21) -- (box22);
\draw<.(1)-> [arrow] (box22) -- (box23);
\draw<.(1)-> [arrow] (box12) -- (box22);
\draw<.(1)-> [arrow] (box13) -- (box23);


\end{tikzpicture}
\end{frame}

   
\end{document}

答案1

像这样?

在此处输入图片描述

\documentclass{beamer}
\mode<presentation>{\usetheme{Madrid}}

\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                backgrounds,
                fit,
                matrix}

\begin{document}
\begin{frame}[fragile]
    \begin{tikzpicture}[
every edge/.style = {draw, thick, -Stealth}
                        ]
\matrix (m) [matrix of nodes,
             nodes={rounded corners, fill =blue!50, minimum size=15mm},
             column sep=20mm,
             row sep=20mm
             ]
{ 
21  &   22  &   23  \\
11  &   12  &   13  \\
};
\path[transform canvas={yshift=+2mm}]
    (m-1-1) edge (m-1-2) 
    (m-1-2) edge (m-1-3)
    (m-2-1) edge (m-2-2)
    (m-2-2) edge (m-2-3);
\path[transform canvas={yshift=-2mm}]
    (m-1-2) edge (m-1-1)
    (m-1-3) edge (m-1-2)
    (m-2-2) edge (m-2-1)
    (m-2-3) edge (m-2-2);
\path[transform canvas={xshift=+2mm}]
    (m-1-2) edge (m-2-2)
    (m-1-3) edge (m-2-3);
\path[transform canvas={xshift=-2mm}]
    (m-2-2) edge (m-1-2)
    (m-2-3) edge (m-1-3);
   \end{tikzpicture}
\end{frame}
\end{document}

答案2

使用

\tikzstyle{arrow} = [thick,<->,>=stealth]

在此处输入图片描述

相关内容