How to set texts above and below a self adjusting arrow?

I want to show Gauss Elimination process where I need to write R_2-R_1 above an arrow and similar things in below too. I want the arrow to be self adjusted according to the above contents. How can I achieve this?

I think you are looking for the xarrow package. You can use it like this xarrow("above", opposite: "below").

Full example:

Code
#import "@preview/xarrow:0.3.1": xarrow

$ 
mat(
  delim: "[",
  augment: #3,
  1,2,-1,3;
  2,-2,3,2;
  3,-1,2,1;   
) 
xarrow(
  R_2 -> R_2 - 2R_1, 
  opposite: R_3 -> R_3 - 3R_1
)
mat(
  delim: "[",
  augment: #3,
  2,-2,3,2;
  0,-6,5,-4;
  0,-7,5,-8;   
) 
$
1 Like

Thank you very much, this is what I need.

There’s also an active PR for a built-in version of xarrow, but it hasn’t been merged yet.