我正在尝试使用箭头来标记一组方程式。这是我目前所得到的。
\usepackage{tikz} % needed for arrows explaining equations
\usetikzlibrary{tikzmark,positioning}
\tikzstyle{every picture}+=[remember picture]
\everymath{\displaystyle}
%% the above lines go into the preamble
\tikzstyle{na} = [baseline=-.5ex]
\begin{align*}
\begin{array}{cll}
& \tikz[baseline]{\node[anchor=base](eq1){}} \delta\lambda = -\dot{\varphi}\epsilon & +\epsilon\tfrac{\partial}{\partial p}S = \epsilon(\dot{\varphi}-p)\\
\text{Text1}\tikz[na]\node[coordinate](eom1){}; & &\\
& \tikz[baseline]{\node[anchor=base](eq2){}} \delta p = i\epsilon(x\dot{\lambda} + (1-x)2i\dot{\pi}) & -\epsilon\tfrac{\partial}{\partial\lambda}S = \epsilon\dot{\pi}\\
& & \\
& & +\tfrac{i}{2}\epsilon\tfrac{\partial}{\partial \pi}S = -\tfrac{i}{2}\epsilon\dot{\lambda}\\
\text{Text2}\tikz[na]\node[coordinate](eom2){}; & &\\
&\tikz[baseline]{\node[anchor=base](eq3){}} \delta\pi = -\tfrac{i}{2}(-\dot{\varphi}\epsilon) & -\tfrac{i}{2}\epsilon\tfrac{\partial}{\partial p}S = -\tfrac{i}{2}(\dot{\varphi}-p)\epsilon
\end{array}
\begin{tikzpicture}[overlay]
\path[->]<1-> (eom1) edge [right] (eq1);
\path[->]<1-> (eom1) edge [right] (eq2);
\path[->]<1-> (eom2) edge [right] (eq2);
\path[->]<1-> (eom2) edge [right] (eq3);
\end{tikzpicture}
\end{align*}
我将非常感激任何可以解决此问题的建议。
有没有办法去掉箭头(即只保留线段)?另外,有没有办法确保箭头从文本中心线上的某个点开始?
答案1
我看到 Texnician 和我的想法差不多。我实际上去了 tikzmark 并再次尝试将线条居中。添加\strut
是关键。
\documentclass{article}
\usepackage{mathtools}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\tikzstyle{every picture}+=[remember picture]
\everymath{\displaystyle}
%% the above lines go into the preamble
\begin{document}
\begin{equation*}
\def\arraystretch{2}%
\begin{array}{ll}
\tikz[baseline]{\node[anchor=base](eq1){\strut}} \delta\lambda = -\dot{\varphi}\epsilon & +\epsilon\tfrac{\partial}{\partial p}S = \epsilon(\dot{\varphi}-p)\\
\tikz[baseline]{\node[anchor=base](eq2){\strut}} \delta p = i\epsilon(x\dot{\lambda} + (1-x)2i\dot{\pi}) & -\epsilon\tfrac{\partial}{\partial\lambda}S = \epsilon\dot{\pi}\\
& +\tfrac{i}{2}\epsilon\tfrac{\partial}{\partial \pi}S = -\tfrac{i}{2}\epsilon\dot{\lambda}\\
\tikz[baseline]{\node[anchor=base](eq3){\strut}} \delta\pi = -\tfrac{i}{2}(-\dot{\varphi}\epsilon) & -\tfrac{i}{2}\epsilon\tfrac{\partial}{\partial p}S = -\tfrac{i}{2}(\dot{\varphi}-p)\epsilon
\end{array}
\end{equation*}
\begin{tikzpicture}[overlay]
\path (eq1) -- (eq2) coordinate[midway] (m1);
\node[right] (eom1) at (m1 -| current page text area.west) {Text1};
\path (eq2) -- (eq3) coordinate[midway] (m2);
\node[right] (eom2) at (m2 -| current page text area.west) {Text2};
\draw (eom1.east) -- (eq1);
\draw (eom1.east) -- (eq2);
\draw (eom2.east) -- (eq2);
\draw (eom2.east) -- (eq3);
\end{tikzpicture}