Exchange Arrows in bmatrix

An easy solution with pstricks: the relevant entries in the matrix are \rnodes and linked through a node connection (\ncarc):

\documentclass[10pt,letterpaper, svgnames]{article}
\usepackage[left=8mm,top=6mm,bottom=6mm]{geometry}

\usepackage{nccmath}
\usepackage{soul}

\usepackage[normalem]{ulem}

\usepackage{pst-node}

\begin{document}

\[ \setlength{\arraycolsep}{6pt}\renewcommand{\arraystretch}{1.1}
\mbox{
\Large$
\begin{bmatrix}
1 & \rnode{a}{1} &\rnode{b}{2}\\
\rnode{c}{1}&1&\rnode{d}{3}\\
\rnode{e}{2}&\rnode{f}{1}&4
\end{bmatrix}
$}
\psset{arrows=<->, arrowinset=0.12, nodesepA=1pt, nodesepB=0pt, arcangle=30}
\ncarc[linecolor=Gold]{c}{a}\ncarc[linecolor=Crimson]{e}{b}\ncarc[linecolor=Brown]{f}{d}
\]

\end{document} 

enter image description here


One possibilities is use of the tikzmark library:

\documentclass[10pt,letterpaper]{article}
\usepackage[left=8mm,top=6mm,bottom=6mm]{geometry}

\usepackage{nccmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                tikzmark}       % new

\begin{document}
{\Large
\[
\begin{bmatrix}
1 & \tikzmarknode{a1}{1} & \tikzmarknode{b1}{2}\\
\tikzmarknode{a2}{1}     & 1    &\tikzmarknode{c1}{3}\\
\tikzmarknode{b2}{2}     & \tikzmarknode{c2}{1} &   4
\end{bmatrix}
    \begin{tikzpicture}[overlay,remember picture, 
                        >={Straight Barb[angle=60:2pt 2]}
                        ]
\draw[<->, thick, red, semitransparent]  
        (a1) edge (a2) 
        (b1) edge (b2)
        (c1)  to  (c2);
\draw[<->, thick, blue, semitransparent]
        (a1) edge[bend right] (a2)
        (b1) edge[bend right] (b2)
        (c1)  to[bend right]  (c2);
    \end{tikzpicture}
\]
}
\end{document}

enter image description here

You need to select \draw[...] which you more prefer (for red or for blue) arrows and remove other.


You can use nicematrix which will create a PGF/Tikz node under each cell of the matrix. Then, you have to draw the arrows with Tikz.

\documentclass{article}
\usepackage{nicematrix}
\usepackage{tikz}
\begin{document}

$\begin{bNiceMatrix}[name=A,columns-width=7mm]
1 & 1 & 2 \\[1ex]
1 & 1 & 3 \\[1ex]
2 & 1 & 4 \\
\end{bNiceMatrix}$

\begin{tikzpicture}[remember picture, overlay,
  every path/.style = { <->, thick, blue , bend right = 15, } ]
\draw (A-1-2) to (A-2-1) ;
\draw (A-2-3) to (A-3-2) ;
\draw (A-1-3) to (A-3-1) ;
\end{tikzpicture}

\end{document}

Result of the above

Tags:

Matrices