看看这个:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{align*}
\Leftrightarrow \qquad P'_1(t)+\lambda P_1(t)&=\lambda e^{-\lambda t} && (2.6)\\
\Leftrightarrow \qquad e^{\lambda t}P'_1(t)+\lambda e^{\lambda t}P_1(t)&=\lambda e^{\lambda t} e^{-\lambda t}=\lambda \\
\end{align*}
\end{document}
是否有可能像方程式一样,将等价项放在彼此之下?
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{alignat*}{4}
P'_1(t)&=-\lambda P_1(t)+\lambda P_0(t)\\
\Leftrightarrow &&\qquad P'_1(t)+\lambda P_1(t)&=\lambda e^{-\lambda t} && (2.6)\\
\Leftrightarrow && e^{\lambda t}P'_1(t)+\lambda e^{\lambda t}P_1(t)&=\lambda e^{\lambda t} e^{-\lambda t}=\lambda \\
\end{alignat*}
\end{document}
这几乎可行,但我提到了一个问题,即第一行被拉到最左边。
答案1
像这样吗?
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\Leftrightarrow&& P'_1(t)+\lambda P_1(t)&=\lambda e^{-\lambda t} \tag{2.6} \\
\Leftrightarrow&& e^{\lambda t}P'_1(t)+\lambda e^{\lambda t}P_1(t)&=\lambda e^{\lambda t} e^{-\lambda t}=\lambda \notag
\end{align}
\end{document}
答案2
ArrowBetweenLines
您可能还对以下内容感兴趣mathtools
:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{amssymb}
\numberwithin{equation}{section}
\begin{document}
\setcounter{section}{2}\setcounter{equation}{5}
\begin{equation}\label{equivalenteqs}
\begin{alignedat}{2}
& & abc & =def \\
\ArrowBetweenLines &\qquad& P'_1(t)+\lambda P_1(t)&=\lambda e^{-\lambda t} \\
\ArrowBetweenLines &\qquad& e^{\lambda t}P'_1(t)+\lambda e^{\lambda t}P_1(t)
&=\lambda e^{\lambda t} e^{-\lambda t}=\lambda \\
\end{alignedat}
\end{equation}
As we see in equation~\eqref{equivalenteqs} we can blah blah.
\end{document}
答案3
你不想要手动对方程式进行编号,并不是因为数字彼此不对齐,而是因为维持手动编号基本上是不可能的。
为此使用\label
-机制。\ref
您的问题可以通过以下方式解决alignedat
:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\numberwithin{equation}{section}
\begin{document}
% let's emulate being in section 2 with five
% numbered equations before this one; a real document
% will have nothing like this
\setcounter{section}{2}\setcounter{equation}{5}
\begin{equation}\label{equivalenteqs}
\begin{alignedat}{2}
\Leftrightarrow &\qquad& P'_1(t)+\lambda P_1(t)&=\lambda e^{-\lambda t} \\
\Leftrightarrow &\qquad& e^{\lambda t}P'_1(t)+\lambda e^{\lambda t}P_1(t)
&=\lambda e^{\lambda t} e^{-\lambda t}=\lambda \\
\end{alignedat}
\end{equation}
As we see in equation~\eqref{equivalenteqs} we can blah blah.
\end{document}
如果第一条线恰好没有箭头,只需添加适当数量的对齐点:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\numberwithin{equation}{section}
\begin{document}
% let's emulate being in section 2 with five
% numbered equations before this one
\setcounter{section}{2}\setcounter{equation}{5}
\begin{equation}
\begin{alignedat}{2}
&\qquad& P'_1(t)&=-\lambda P_1(t)+\lambda P_0(t)\\
\Leftrightarrow & & P'_1(t)+\lambda P_1(t)&=\lambda e^{-\lambda t} \\
\Leftrightarrow & & e^{\lambda t}P'_1(t)+\lambda e^{\lambda t}P_1(t)&=\lambda e^{\lambda t} e^{-\lambda t}=\lambda \\
\Leftrightarrow & & \frac{d}{dt}(e^{\lambda t}P_1(t))&=e^{\lambda t}P'_1(t)+\lambda e^{\lambda t}P_1(t)=\lambda\\
\end{alignedat}
\end{equation}
As we see in equation~\eqref{equivalenteqs} we can blah blah.
\end{document}
另一方面,我认为没有理由在等号处对齐。
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\numberwithin{equation}{section}
\begin{document}
% let's emulate being in section 2 with five
% numbered equations before this one
\setcounter{section}{2}\setcounter{equation}{5}
\begin{equation}\label{equivalenteqs}
\begin{aligned}
&& & P'_1(t)=-\lambda P_1(t)+\lambda P_0(t)\\
\Leftrightarrow && & P'_1(t)+\lambda P_1(t)=\lambda e^{-\lambda t} \\
\Leftrightarrow && & e^{\lambda t}P'_1(t)+\lambda e^{\lambda t}P_1(t)=\lambda e^{\lambda t} e^{-\lambda t}=\lambda \\
\Leftrightarrow && & \frac{d}{dt}(e^{\lambda t}P_1(t))=e^{\lambda t}P'_1(t)+\lambda e^{\lambda t}P_1(t)=\lambda\\
\end{aligned}
\end{equation}
As we see in equation~\eqref{equivalenteqs} we can blah blah.
\end{document}
答案4
您还可以使用alignat
:
代码:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{alignat*}{4}
\Leftrightarrow &&\qquad P'_1(t)+\lambda P_1(t) &=\lambda e^{-\lambda t} && (2.6) \\
\Leftrightarrow &&\qquad e^{\lambda t}P'_1(t)+\lambda e^{\lambda t}P_1(t) &=\lambda e^{\lambda t} e^{-\lambda t}=\lambda
\end{alignat*}
\end{document}