I have the following code for a border Matrix:

 $\bordermatrix{% & A& B& C& D& E \cr CV_{1} & 0.16 & 0.31 & 0.76 & 0.82 & 0.042 \cr CV_{2} & 0.35 & 0.54 & 0.21 & 0.12 & 0.48 \cr CV_{3} & 0.07& 0.44 & 0.23 & 0.71 & 0.90 6 \cr CV_{4} & 0.37 & 0.31 & 0.91 & 0.75 & 0.22 \cr }}$


I want to add arrows in the following way (the top one above the indices):

Thank you very much for your help.

I guess there are other possibilities to achieve this without tikz. But with the following, you will get what you want. Note that the arrow above overlaps the stuff that is typeset above the matrix, so maybe you add a vspace there. Alike, the arrow on the right overlaps stuff there.

\documentclass{article}
\usepackage{amsmath,tikz}
\usetikzlibrary{tikzmark}

\begin{document}

$\bordermatrix{% \tikzmark{tl} & A & B & C & D & E \tikzmark{tr}\cr \tikzmark{bt} CV_{1} & 0.16 & 0.31 & 0.76 & 0.82 & 0.042 \cr CV_{2} & 0.35 & 0.54 & 0.21 & 0.12 & 0.48 \cr CV_{3} & 0.07 & 0.44 & 0.23 & 0.71 & 0.906 \cr \tikzmark{bb} CV_{4} & 0.37 & 0.31 & 0.91 & 0.75 & 0.22 \cr }$

\begin{tikzpicture}[remember picture,overlay,
every path/.style={->},
every node/.style={draw,circle,inner sep=2pt,fill=white}]
\draw ([xshift=23pt,yshift=18pt]pic cs:tl) -- node {1} ([xshift=12pt,yshift=18pt]pic cs:tr);
\draw ([xshift=-12pt,yshift=8pt]pic cs:bt) -- node {2} ([xshift=-12pt]pic cs:bb);
\end{tikzpicture}

\end{document}


A simple code with pstricks: I make 4 elements in the matrix nodes, connect these nodes with lines (with arrows), using an offset, and add a label on these connections:

\documentclass{article}
\usepackage{amsmath}
\usepackage{pst-node, auto-pst-pdf}

\begin{document}

$\begin{postscript} \bordermatrix{% & \rnode{A}{A} & B & C & D & \rnode{E}{E} \cr \rnode[t]{C1}{CV_{1}} & 0.16 & 0.31 & 0.76 & 0.82 & 0.042 \cr CV_{2} & 0.35 & 0.54 & 0.21 & 0.12 & 0.48\phantom{0} \cr CV_{3} & 0.07 & 0.44 & 0.23 & 0.71 & 0.906 \cr \rnode[b]{C4}{CV_{4}} & 0.37 & 0.31 & 0.91 & 0.75 & 0.22\phantom{0} \cr } \psset{framesep=2pt, arrowinset=0.1, fillstyle=solid} \pcline[offset=3ex]{->}(A)(E)\thput*{\pscirclebox{1}} \pcline[offset=-4.5ex]{->}(C1)(C4)\tvput*{\pscirclebox[fillstyle=solid]{2}} \end{postscript}$

\end{document}


• Hello Bernard, thank you for your solution as well. – IschaIschratioh Sep 8 '18 at 10:35