# nicematrix & TikZ positionning

In the following output, I would like to change the start and the end of the red path: see the green arrows.

Here is my code.

\documentclass[12pt]{article}

\usepackage{tikz}
\usepackage{nicematrix}

\newcommand\explainit[3]{& $\leftarrow \,\, #1 = 2\cdot#2 + #3$}

\begin{document}

\begin{NiceTabular}{r|ll}
& 77
\\
1 & 38 \explainit{77}{38}{1}
\\
0 & 19 \explainit{38}{19}{0}
\\
1 & 9
\\
1 & 4
\\
0 & 2
\\
0 & 1
\CodeAfter
\begin{tikzpicture}
\draw[red, rounded corners, ->, transform canvas={yshift=-2.5pt}](8-|3) -- (8-|1) -- (2-|1);
\end{tikzpicture}
\end{NiceTabular}

\medskip

Donc $(77)_{10} = (1001101)_2$ .

\end{document}


Use cell names instead of table lines names, and shift them a bit:

\documentclass[12pt]{article}

\usepackage{tikz}
\usepackage{nicematrix}

\newcommand\explainit[3]{& $\leftarrow \,\, #1 = 2\cdot#2 + #3$}

\begin{document}

\begin{NiceTabular}{r|ll}
& 77
\\
1 & 38 \explainit{77}{38}{1}
\\
0 & 19 \explainit{38}{19}{0}
\\
1 & 9
\\
1 & 4
\\
0 & 2
\\
0 & 1
\CodeAfter %\ShowCellNames
\begin{tikzpicture}
\draw[red, rounded corners, ->]([yshift=-7pt]7-2.south) -| ([xshift=-7pt]2-1.west);
\end{tikzpicture}
\end{NiceTabular}

\medskip

Donc $(77)_{10} = (1001101)_2$ .

\end{document}

• What a misuse of "node" names on my part.... Thank you. Commented Nov 25, 2022 at 10:29