我想知道如何指向对齐环境中的变量,以便获得如下输出:
这是我目前拥有的代码:
\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows,matrix,positioning,fit,arrows.meta,}
\begin{document}
\begin{align*}
D(\lambda,x) = & ~ f(x) + \lambda'g(x) \quad \lambda\geqslant 0\\
\intertext{the dual is given as:}
\lambda^{*} = & ~ arg\{ \max_{\lambda}D(\lambda,x^{*}) \}\\
= & ~ arg\{ \max_{\lambda}D(\lambda) \}
\end{align*}
%\begin{tikzpicture}[remember picture,overlay]
%\draw[blue,thick,->] (d1) to [in=90,out=245] + (198:2.5cm) node[anchor=north,text = black] {const.};
%\end{tikzpicture}
\end{document}
答案1
使用 很容易做到这一点pstricks
,更具体地说是使用pst-node
:
\documentclass[x11names]{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{pst-node}
\usepackage{pst-pdf}
\begin{document}
\begin{postscript}
\begin{align*}
D(\lambda,x) & = f(x) + \lambda'g(x) \quad \lambda\geqslant 0 \\
\intertext{the dual is given as:}
\lambda^{*} & = \arg\{ \max_{\lambda}D(\lambda,\Rnode{X}{x^{*}}) \} \\
& = \arg\{ \max_{\lambda}D(\lambda) \}
\end{align*}
\nput[labelsep =1cm]{-30}{X}{\Rnode[vref=1.5pt]{C}{\color{red}const}}
\ncdiagg[arrows=->, arrowinset =0.15, linewidth=1.5pt, linecolor=SteelBlue3, angleA=180, nodesepA=3pt, nodesepB=1pt, armA=6mm]{C}{X}
\end{postscript}
\end{document}