-1

I found the following page, which is almost what I want https://tex.stackexchange.com/questions/344379/side-comment-between-equation/344386#344386

Can someone explain me what change I have to do such that I can put this arrow on the left of my equation? Since this is what I have right now wrong arrow

Thanks in advance

jolien
  • 3
  • 3

1 Answers1

1

You need to:

  • move the tikzmarks to the other side of the equations ;
  • invert the curve: .. controls +(-1,0) and +(-1,0) .. ;
  • readjust the starting positions: \newcommand\sidecomment[5][-0.5,0.1]% ;
  • move and align the text attached to the curve to the opposing side: node[left,align=right]{#5}.

Here's the result:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark,arrows,calc}
\usepackage{amsmath}
\newcommand\sidecomment[5][-0.5,0.1]%
  {\begin{tikzpicture}[remember picture,overlay]
   \draw[-stealth',thick]
     ($({pic cs:#4}|-{pic cs:#2})+(#1)$)
     .. controls +(-1,0) and +(-1,0) ..
     node[left,align=right]{#5}
     ($({pic cs:#4}|-{pic cs:#3})+(#1)$);
   \end{tikzpicture}%
  }
\begin{document}
\begin{align*}
\tikzmark{a}\beta_1^*
&= \frac{\sum_{i=1}^n(x_i^*-\hat x^*)y_i^*}{\sum_{i=1}^n(x_i^*-\hat x^*)^2}\\
\tikzmark{b}&= \frac{\sum_{i=1}^n(w_2x_i-w_2\hat x)w_1y_i}{\sum_{i=1}^n(w_2x_i-w_2\hat x)^2}
\end{align*}
\sidecomment{a}{b}{b}{since $y_i^*=w_1y_i$\\and $x_i*=w_2x_i$}
\end{document}

enter image description here

pchaigno
  • 11,313
  • 2
  • 29
  • 54