4

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

enter image description here

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}
0

1 Answer 1

3

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

Nicetabular

\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}
1
  • What a misuse of "node" names on my part.... Thank you.
    – projetmbc
    Nov 25, 2022 at 10:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .