amsmath 对齐环境中的可视化方程链接

amsmath 对齐环境中的可视化方程链接

我想“直观地链接”方程式align

因为一张图片胜过千言万语,下面是我在 MS Paint 中制作的一个例子来说明我的意思:

在此处输入图片描述

如何实现这个目标?用于测试目的的 MWE:

\documentclass{article}
\usepackage{amsmath}
\allowdisplaybreaks

\begin{document}
    First, let us solve the following recursion formula:
        $$ F_{n + 1} = \alpha F_{n} + \beta$$
        \begin{align*}
            &\quad F_{n + 1} = \alpha F_{n} + \beta \\
            &\equiv \sum_{n = 0}^{\infty} F_{n + 1} t^{n} = \alpha \sum_{n = 0}^{\infty} F_{n} t^{n} + \beta t^{n} \\
            &\equiv t^{-1} \sum_{n = 0}^{\infty} F_{n + 1} t^{n + 1} = \alpha \sum_{n = 0}^{\infty} F_{n}t^n + \beta t^n \\
            &\equiv \phi(t) - F_{0} = \alpha t\phi(t) + \frac{\alpha t}{1 - \beta t} \\
            &\equiv \phi(t) (1 - \alpha t) =  \frac{\alpha t}{1 - \beta t} + F_0\frac{1 - \beta t}{1 - \beta t} \\
            &\quad \\
            &\quad F_{n + 1} = \alpha F_{n} + \beta \\
            &\equiv \sum_{n = 0}^{\infty} F_{n + 1} t^{n} = \alpha \sum_{n = 0}^{\infty} F_{n} t^{n} + \beta t^{n} \\
            &\equiv t^{-1} \sum_{n = 0}^{\infty} F_{n + 1} t^{n + 1} = \alpha \sum_{n = 0}^{\infty} F_{n}t^n + \beta t^n \\
            &\equiv \phi(t) - F_{0} = \alpha t\phi(t) + \frac{\alpha t}{1 - \beta t} \\
            &\equiv \phi(t) (1 - \alpha t) =  \frac{\alpha t}{1 - \beta t} + F_0\frac{1 - \beta t}{1 - \beta t} \\
            &\quad \\
            &\quad F_{n + 1} = \alpha F_{n} + \beta \\
            &\equiv \sum_{n = 0}^{\infty} F_{n + 1} t^{n} = \alpha \sum_{n = 0}^{\infty} F_{n} t^{n} + \beta t^{n} \\
            &\equiv t^{-1} \sum_{n = 0}^{\infty} F_{n + 1} t^{n + 1} = \alpha \sum_{n = 0}^{\infty} F_{n}t^n + \beta t^n \\
            &\equiv \phi(t) - F_{0} = \alpha t\phi(t) + \frac{\alpha t}{1 - \beta t} \\
            &\equiv \phi(t) (1 - \alpha t) =  \frac{\alpha t}{1 - \beta t} + F_0\frac{1 - \beta t}{1 - \beta t} \\
            &\quad \\
            &\quad F_{n + 1} = \alpha F_{n} + \beta \\
            &\equiv \sum_{n = 0}^{\infty} F_{n + 1} t^{n} = \alpha \sum_{n = 0}^{\infty} F_{n} t^{n} + \beta t^{n} \\
            &\equiv t^{-1} \sum_{n = 0}^{\infty} F_{n + 1} t^{n + 1} = \alpha \sum_{n = 0}^{\infty} F_{n}t^n + \beta t^n \\
            &\equiv \phi(t) - F_{0} = \alpha t\phi(t) + \frac{\alpha t}{1 - \beta t} \\
            &\equiv \phi(t) (1 - \alpha t) =  \frac{\alpha t}{1 - \beta t} + F_0\frac{1 - \beta t}{1 - \beta t} \\
            &\quad \\
            &\quad F_{n + 1} = \alpha F_{n} + \beta \\
            &\equiv \sum_{n = 0}^{\infty} F_{n + 1} t^{n} = \alpha \sum_{n = 0}^{\infty} F_{n} t^{n} + \beta t^{n} \\
            &\equiv t^{-1} \sum_{n = 0}^{\infty} F_{n + 1} t^{n + 1} = \alpha \sum_{n = 0}^{\infty} F_{n}t^n + \beta t^n \\
            &\equiv \phi(t) - F_{0} = \alpha t\phi(t) + \frac{\alpha t}{1 - \beta t} \\
            &\equiv \phi(t) (1 - \alpha t) =  \frac{\alpha t}{1 - \beta t} + F_0\frac{1 - \beta t}{1 - \beta t} \\
            &\quad \\
            &\quad F_{n + 1} = \alpha F_{n} + \beta \\
            &\equiv \sum_{n = 0}^{\infty} F_{n + 1} t^{n} = \alpha \sum_{n = 0}^{\infty} F_{n} t^{n} + \beta t^{n} \\
            &\equiv t^{-1} \sum_{n = 0}^{\infty} F_{n + 1} t^{n + 1} = \alpha \sum_{n = 0}^{\infty} F_{n}t^n + \beta t^n \\
            &\equiv \phi(t) - F_{0} = \alpha t\phi(t) + \frac{\alpha t}{1 - \beta t} \\
            &\equiv \phi(t) (1 - \alpha t) =  \frac{\alpha t}{1 - \beta t} + F_0\frac{1 - \beta t}{1 - \beta t}
        \end{align*}
\end{document}

答案1

根据我的评论的解决方案:

\documentclass{article}
\usepackage{amsmath}
\allowdisplaybreaks
\usepackage{tikz}
\def\tikzmark#1{\begin{tikzpicture}[remember picture]\coordinate(#1);\end{tikzpicture}}
\begin{document}
 $$ F_{n + 1} = \alpha F_{n} + \beta$$
        \begin{align*}
            &\tikzmark{A}\quad F_{n + 1} = \alpha F_{n} + \beta \\
            &\tikzmark{C}\equiv \sum_{n = 0}^{\infty} F_{n + 1} t^{n} = \alpha \sum_{n = 0}^{\infty} F_{n} t^{n} + \beta t^{n} \\
            &\equiv t^{-1} \sum_{n = 0}^{\infty} F_{n + 1} t^{n + 1} = \alpha \sum_{n = 0}^{\infty} F_{n}t^n + \beta t^n \\
            &\equiv \phi(t) - F_{0} = \alpha t\phi(t) + \frac{\alpha t}{1 - \beta t} \\
          &\tikzmark{D}\equiv \phi(t) (1 - \alpha t) =  \frac{\alpha t}{1 - \beta t} + F_0\frac{1 - \beta t}{1 - \beta t} \\
            &\quad \\
            &\quad F_{n + 1} = \alpha F_{n} + \beta \\
      &\tikzmark{B}\equiv \sum_{n = 0}^{\infty} F_{n + 1} t^{n} = \alpha \sum_{n = 0}^{\infty} F_{n} t^{n} + \beta t^{n} \\
            &\equiv t^{-1} \sum_{n = 0}^{\infty} F_{n + 1} t^{n + 1} = \alpha \sum_{n = 0}^{\infty} F_{n}t^n + \beta t^n \\
            &\equiv \phi(t) - F_{0} = \alpha t\phi(t) + \frac{\alpha t}{1 - \beta t} \\
            &\equiv \phi(t) (1 - \alpha t) =  \frac{\alpha t}{1 - \beta t} + F_0\frac{1 - \beta t}{1 - \beta t} \\
            &\quad \\
            &\quad F_{n + 1} = \alpha F_{n} + \beta \\
            &\equiv \sum_{n = 0}^{\infty} F_{n + 1} t^{n} = \alpha \sum_{n = 0}^{\infty} F_{n} t^{n} + \beta t^{n} \\
            &\equiv t^{-1} \sum_{n = 0}^{\infty} F_{n + 1} t^{n + 1} = \alpha \sum_{n = 0}^{\infty} F_{n}t^n + \beta t^n \\
            &\equiv \phi(t) - F_{0} = \alpha t\phi(t) + \frac{\alpha t}{1 - \beta t} \\
            &\equiv \phi(t) (1 - \alpha t) =  \frac{\alpha t}{1 - \beta t} + F_0\frac{1 - \beta t}{1 - \beta t} \\
            &\quad \\
            &\quad F_{n + 1} = \alpha F_{n} + \beta \\
            &\equiv \sum_{n = 0}^{\infty} F_{n + 1} t^{n} = \alpha \sum_{n = 0}^{\infty} F_{n} t^{n} + \beta t^{n} \\
            &\equiv t^{-1} \sum_{n = 0}^{\infty} F_{n + 1} t^{n + 1} = \alpha \sum_{n = 0}^{\infty} F_{n}t^n + \beta t^n \\
            &\equiv \phi(t) - F_{0} = \alpha t\phi(t) + \frac{\alpha t}{1 - \beta t} \\
            &\equiv \phi(t) (1 - \alpha t) =  \frac{\alpha t}{1 - \beta t} + F_0\frac{1 - \beta t}{1 - \beta t} \\
            &\quad \\
            &\quad F_{n + 1} = \alpha F_{n} + \beta \\
            &\equiv \sum_{n = 0}^{\infty} F_{n + 1} t^{n} = \alpha \sum_{n = 0}^{\infty} F_{n} t^{n} + \beta t^{n} \\
            &\equiv t^{-1} \sum_{n = 0}^{\infty} F_{n + 1} t^{n + 1} = \alpha \sum_{n = 0}^{\infty} F_{n}t^n + \beta t^n \\
            &\equiv \phi(t) - F_{0} = \alpha t\phi(t) + \frac{\alpha t}{1 - \beta t} \\
            &\equiv \phi(t) (1 - \alpha t) =  \frac{\alpha t}{1 - \beta t} + F_0\frac{1 - \beta t}{1 - \beta t} \\
            &\quad \\
            &\quad F_{n + 1} = \alpha F_{n} + \beta \\
            &\equiv \sum_{n = 0}^{\infty} F_{n + 1} t^{n} = \alpha \sum_{n = 0}^{\infty} F_{n} t^{n} + \beta t^{n} \\
            &\equiv t^{-1} \sum_{n = 0}^{\infty} F_{n + 1} t^{n + 1} = \alpha \sum_{n = 0}^{\infty} F_{n}t^n + \beta t^n \\
            &\equiv \phi(t) - F_{0} = \alpha t\phi(t) + \frac{\alpha t}{1 - \beta t} \\
            &\equiv \phi(t) (1 - \alpha t) =  \frac{\alpha t}{1 - \beta t} + F_0\frac{1 - \beta t}{1 - \beta t}
        \end{align*}
\begin{tikzpicture}[remember picture,overlay]
  \draw[-,red] (A)--([xshift=-0.6cm]A)|-(B);
   \draw[-,blue] (C)--([xshift=-0.4cm]C)|-(D);
\end{tikzpicture}
\end{document}

输出:

在此处输入图片描述

请注意,线条从每行(每条数学线)的中心开始,可能需要调整以\equiv符号为中心。

如果您有兴趣,我可以稍后自动执行此操作。(yshift=2mm绘制命令中 tikzmark 字母前的选项可以手动修复它)

相关内容