等式(左)

时间:2018-02-17 19:42:40

标签: curve tikz

我找到了以下页面,这几乎就是我想要的https://tex.stackexchange.com/questions/344379/side-comment-between-equation/344386#344386

有人可以解释一下我必须做些什么改变,这样我才能把这个箭头放在等式的左边?因为这就是我现在所拥有的wrong arrow

提前致谢

1 个答案:

答案 0 :(得分:1)

你需要:

  • tikzmark移动到等式的另一侧;
  • 反转曲线:.. controls +(-1,0) and +(-1,0) ..;
  • 重新调整起始位置:\newcommand\sidecomment[5][-0.5,0.1]%;
  • 将附加到曲线的文本移动并对齐到对方:node[left,align=right]{#5}

结果如下:

\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