# Operations on both sides of equation with annotations

I recently found the package witharrows which allows you to annotate your equations and steps taking during algebraic manipulations and things like this for example.

\WithArrowsOptions{displaystyle,tikz=blue}
$\begin{WithArrows} \sum_{i=1}^n (x_i+1)^2 & = \sum_{i=1}^n (x_i^2+2x_i+1) \Arrow{by linearity}\\ & = \sum_{i=1}^n x_i^2 + 2\sum_{i=1}^nx_i+ n \end{WithArrows}$


Would generate

I also like to use the gather environment to show manipulations to both sides of an equation (using the gather environment)

I was wondering if anyone has any suggestions as to how I can annotate/use arrows to show algebraic manipultations inside the gather environment

• I think you will get much better answers if you provide us with the code that creates the equations. The annotations can be done with tikzmark.
– user121799
Jun 17, 2019 at 5:13
• Thanks for the suggestion, I've added the code that creates the equations Jun 17, 2019 at 18:48
• As of now, there is no direct solution to this question using the extension witharrows. However, I will try to write a new version of the extension witharrows to face this problem (I'm the author of that extension). Jun 18, 2019 at 5:44
• @F.Pantigny Wow, thanks so much for looking into this! Jun 18, 2019 at 14:37

I have written a new version of witharrows to face that situation (version 1.17 2019-07-09). In this version, there is a option format which is similar to the preamble of an environment array of tabular. By putting format = c, we'll have only one centered column.

\documentclass{article}
\usepackage{amsfonts}
\usepackage{witharrows}
\begin{document}
Let $n \in \mathbb N$ and we'll assume that $n \ge n_0$ so we have
\begin{DispWithArrows}[format=c,notag]
25 \le n \Arrow{we multiply by $n$} \\
25 n \le n^2  \Arrow{here, I don't see very well} \\
3n+2 \le 5n \le \frac{n^2}{5}
\end{DispWithArrows}
\end{document}


• Beautiful, thank you! Jul 13, 2019 at 14:13

You can mark points with tikzmark then draw any kind of tikz thing using those point, here a couple of arrows.

\documentclass{article}
\usepackage{amsmath,tikz}
\usetikzlibrary{tikzmark,calc}
\begin{document}
\begin{gather}
\tikzmark{a}12345 = x^3+x^2+x\\
\tikzmark{d}1=0\tikzmark{e}
\end{gather}
\begin{tikzpicture}[remember picture,overlay]
\draw [,->] ($(pic cs:a) - (5pt,0pt)$)  to [bend right=70]
node [left] {interesting step}
($(pic cs:d) - (10pt,0pt)$)
;

\draw [->] ($(pic cs:c) + (5pt,0pt)$)  to [ bend left=70]
node [right] {dull step}
($(pic cs:e) + (10pt,0pt)$)
;

\end{tikzpicture}
\end{document}