TransWikia.com

Remarks in equations with arrows

TeX - LaTeX Asked by Mathy on June 23, 2021

In huge calculations it’s often very helpful as reader to have nice remarks about which manipulation was made. Also, other remarks in equations can help alot, e.g., this one

enter image description here

which I like more than the ^-convention.
I am generating the above with the following code

vertarrowbox{e_j}{$i$textsuperscript{th} spot}

where

newcommandvertarrowbox[3][2ex]{%
    begin{array}[t]{@{}c@{}} #2 [-0.7ex]
        leftuparrowvcenter{hrule height #1}right.kern-nulldelimiterspace[-1.2ex]
        makebox[0pt]{scriptsize#3}
    end{array}%
}

My goal now is to achieve something similar. I am looking for something like this

enter image description here

to denote that the exchange of the two variables gives a minus sign.

I wonder how I could implement this. I am not sure if tikz-cd is the way to go (I don’t have experience with tikz-cd in equations like this and don’t know if it is even possible to use it this way).

Thank you for your ideas!

One Answer

After @daleif gave me the tip to use tikz and tikzmark I found how to do it with some trial and error (tikz seems super complex and powerful). Please correct or improve this solution (I am not fully aware of every comment and if this could be done more nicely of if I am doing something very stupid here).

usepackage{tikz}
usetikzlibrary{tikzmark}

begin{equation*}
    f(tikzmarknode{a}a,b,c,d,tikzmarknode{e}e) = -f(e,b,c,d,a)
end{equation*}

begin{tikzpicture}[overlay,remember picture]
    draw [>=latex,<->]
    (a.south) to[out=-90,in=-90,looseness=1] node [below,sloped] (TextNode1) 
    {scriptsize$cdot (-1)$} (e.south);
end{tikzpicture}

yields

enter image description here

However two problems remain:

  1. I want to apply this in an align environment. But then the spacing is messed up:

     begin{align*}
          f(a,b,c,d,e) &= f(tikzmarknode{a}a,b,c,d,tikzmarknode{e}e) 
                       &= -f(e,b,c,d,a)
     end{align*}
    

enter image description here

  1. As I will use this very often in the document, I want to write a command for it. But how could I implement that? The obvious problem is that the begin{tikzpicture}[overlay,remember picture] thing has to come after the whole align environment and I have only ever worked with commands which "replace in place".

Any help is very much appreciated!

EDIT: I added a brace underneath to better symbolize what term exactly is moved. Also read my comment under this answer. enter image description here

Answered by Mathy on June 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP