5

I would like to enhance the output given by the following code : see the picture below where the end of the arrow is lower and the loop "bigger".

To do this I need a better control of the Bezier curve and also I would like to add a minus sign inside the loop.

\documentclass{article}

\usepackage{tikz}
\usepackage{nicematrix}

\begin{document}

$\begin{vNiceMatrix}[first-row]
    u & v  \\
    x & x'  \\
    y & y'
    \CodeAfter
    \tikz \draw [red,->]
        (1-1.east) .. 
            controls (2-2.south east) 
            and
            (2-1.south west)
        .. (1-2.west) ;
\end{vNiceMatrix}$

\end{document}

enter image description here

5

I would use the in and out keys (and make the matrix a bit bigger so that the annotations do not clash with the matrix entries).

\documentclass{article}

\usepackage{tikz}
\usepackage{nicematrix}

\begin{document}

$\begin{vNiceMatrix}[first-row,columns-width=1.5em]
    u & v  \\
    x & x'  \\
    y & y'
    \CodeAfter
    \begin{tikzpicture}
     \path (1-1.east) -- node[below=0.35em,red,inner sep=0pt] (minus) {$-$} (1-2.west);
     \draw [red,->]
        (1-1.east) to[out=0,in=30]  (minus.south east) 
        to[out=-150,in=-30]  (minus.south west)
        to[out=150,in=180] (1-2.west);
    \end{tikzpicture}           
\end{vNiceMatrix}$

\end{document}

enter image description here

Or maybe also make sure that the arrow attaches at the same vertical position.

\documentclass{article}

\usepackage{tikz}
\usepackage{nicematrix}

\begin{document}

$\begin{vNiceMatrix}[first-row,columns-width=1.5em]
    u & v  \\
    x & x'  \\
    y & y'
    \CodeAfter
    \begin{tikzpicture}
     \path (1-1.east) -- node[below=0.35em,red,inner sep=0pt] (minus) {$-$} (1-2.west);
     \draw [red,->]
        (1-1.east) to[out=0,in=30]  (minus.south east) 
        to[out=-150,in=-30]  (minus.south west)
        to[out=150,in=180] (1-1.east-|1-2.west);
    \end{tikzpicture}           
\end{vNiceMatrix}$

\end{document}

enter image description here

Or even more symmetric.

\documentclass{article}

\usepackage{tikz}
\usepackage{nicematrix}
\usetikzlibrary{calc}
\begin{document}

$\begin{vNiceMatrix}[first-row,columns-width=1.5em]
    u & v  \\
    x & x'  \\
    y & y'
    \CodeAfter
    \begin{tikzpicture}
     \path (1-1.east) -- node[below=0.35em,red,circle,inner sep=1pt] (minus) {$-$} (1-2.west);
     \draw [red,->] let \p1=($(minus.east)-(minus.center)$) in 
        (1-1.east) to[out=0,in=150]  (minus.60) 
        arc[start angle=60,end angle=-240,radius=\x1] 
        to[out=30,in=180] (1-1.east-|1-2.west);
    \end{tikzpicture}           
\end{vNiceMatrix}$
\end{document}

enter image description here

8
  • Thanks a lot. Why does (1-1.east-|1-2.west) do the trick for the vertical position ? – projetmbc Jun 9 '20 at 20:41
  • 2
    @projetmbc The syntax (1-1.east-|1-2.west) means "take the y component of 1-1.east and the x component of 1-2.west). It is very nicely described in tex.stackexchange.com/a/401429 – user194703 Jun 9 '20 at 20:45
  • Thanks for this clarification and the link. – projetmbc Jun 9 '20 at 21:55
  • 2
    @projetmbc Sorry, I do not understand this comment. How are you using ($(1-1.east) + (0.05,0)$) (which can be translated to ([yshift=0.5mm]1-1.east))? (Or are you looking for ...([yshift=-0.5mm]1-1.east) coordinate (aux) ... (aux-|1-2.west)?) – user194703 Jun 12 '20 at 19:41
  • 1
    @projetmbc You can use the keys shorten >=1pt,shorten <=1pt, say. – user194703 Jun 12 '20 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.