![“方程结构嵌套错误”消息 - 我看不出出了什么问题?](https://linux22.com/image/355913/%E2%80%9C%E6%96%B9%E7%A8%8B%E7%BB%93%E6%9E%84%E5%B5%8C%E5%A5%97%E9%94%99%E8%AF%AF%E2%80%9D%E6%B6%88%E6%81%AF%20-%20%E6%88%91%E7%9C%8B%E4%B8%8D%E5%87%BA%E5%87%BA%E4%BA%86%E4%BB%80%E4%B9%88%E9%97%AE%E9%A2%98%EF%BC%9F.png)
我在 Texmaker 中有以下方程组:
\begin{equation}
\begin{align}
\begin{split}
a(t_{n+1}) \cos \varphi_{n+1} = a(t_{n}) \cos \varphi_{n} + \sqrt{2E_{n}}(t_{n+1} - t_{n}) \cos( \alpha_{n}+ \theta{_n}),
\\
b(t_{n+1})\sin \varphi_{n+1} \left(1+ \delta \sin^{2} \varphi_{n+1} \right) = b(t_{n})\sin \varphi_{n} \left(1+ \delta \sin^{2} \varphi_{n} \right) + \sqrt{2E_{n}}(t_{n+1}-t_{n}) \sin (\alpha_{n} + \theta_{n}),
\\
\theta_{n} + \alpha_{n} + \theta^{*}_{n+1} - \alpha_{n+1} = 0,
\\
\sqrt{2E_{n+1}}\cos \theta_{n+1} = \sqrt{2E_{n}}\cos\theta^{*}_{n+1},
\\
\sqrt{2E_{n+1}}\sin\theta_{n+1} = \sqrt{2E_{n}}\sin\theta^{*}_{n+1}-2u(\varphi_{n+1}, t_{n+1}).
\end{split}
\end{align}
\label{system}
\end{equation}
当我编译时,出现以下错误消息:“包 amsmath 错误:方程结构嵌套错误;(amsmath)尝试使用aligned
... 进行恢复。”但是,我仍然可以生成正常的 PDF 文件。
如果有人能指出如何纠正此错误,我将不胜感激。我已经安装了 amsmath 包。
答案1
你不应该嵌套align
。equation
环境align
就足够了:
\documentclass[]{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\begin{split}
a(t_{n+1}) \cos \varphi_{n+1} = a(t_{n}) \cos \varphi_{n} + \sqrt{2E_{n}}(t_{n+1} - t_{n}) \cos( \alpha_{n}+ \theta{_n}),
\\
b(t_{n+1})\sin \varphi_{n+1} \left(1+ \delta \sin^{2} \varphi_{n+1} \right) = b(t_{n})\sin \varphi_{n} \left(1+ \delta \sin^{2} \varphi_{n} \right) + \sqrt{2E_{n}}(t_{n+1}-t_{n}) \sin (\alpha_{n} + \theta_{n}),
\\
\theta_{n} + \alpha_{n} + \theta^{*}_{n+1} - \alpha_{n+1} = 0,
\\
\sqrt{2E_{n+1}}\cos \theta_{n+1} = \sqrt{2E_{n}}\cos\theta^{*}_{n+1},
\\
\sqrt{2E_{n+1}}\sin\theta_{n+1} = \sqrt{2E_{n}}\sin\theta^{*}_{n+1}-2u(\varphi_{n+1}, t_{n+1}).
\end{split}
\label{system}
\end{align}
\end{document}
这可以编译(但在我看来,很糟糕)。
我认为水平对齐看起来更好:
\documentclass[]{article}
\usepackage{amsmath}
\usepackage[margin=1cm]{geometry}
\begin{document}
Without alignment:
\begin{align}
\begin{split}
a(t_{n+1}) \cos \varphi_{n+1} = a(t_{n}) \cos \varphi_{n} + \sqrt{2E_{n}}(t_{n+1} - t_{n}) \cos( \alpha_{n}+ \theta{_n}),
\\
b(t_{n+1})\sin \varphi_{n+1} \left(1+ \delta \sin^{2} \varphi_{n+1} \right) = b(t_{n})\sin \varphi_{n} \left(1+ \delta \sin^{2} \varphi_{n} \right) + \sqrt{2E_{n}}(t_{n+1}-t_{n}) \sin (\alpha_{n} + \theta_{n}),
\\
\theta_{n} + \alpha_{n} + \theta^{*}_{n+1} - \alpha_{n+1} = 0,
\\
\sqrt{2E_{n+1}}\cos \theta_{n+1} = \sqrt{2E_{n}}\cos\theta^{*}_{n+1},
\\
\sqrt{2E_{n+1}}\sin\theta_{n+1} = \sqrt{2E_{n}}\sin\theta^{*}_{n+1}-2u(\varphi_{n+1}, t_{n+1}).
\end{split}
\label{system}
\end{align}
With alignment:
\begin{align}
\begin{split}
a(t_{n+1}) \cos \varphi_{n+1} &= a(t_{n}) \cos \varphi_{n} + \sqrt{2E_{n}}(t_{n+1} - t_{n}) \cos( \alpha_{n}+ \theta{_n}),
\\
b(t_{n+1})\sin \varphi_{n+1} \left(1+ \delta \sin^{2} \varphi_{n+1} \right) &= b(t_{n})\sin \varphi_{n} \left(1+ \delta \sin^{2} \varphi_{n} \right) + \sqrt{2E_{n}}(t_{n+1}-t_{n}) \sin (\alpha_{n} + \theta_{n}),
\\
\theta_{n} + \alpha_{n} + \theta^{*}_{n+1} - \alpha_{n+1} &= 0,
\\
\sqrt{2E_{n+1}}\cos \theta_{n+1} &= \sqrt{2E_{n}}\cos\theta^{*}_{n+1},
\\
\sqrt{2E_{n+1}}\sin\theta_{n+1} &= \sqrt{2E_{n}}\sin\theta^{*}_{n+1}-2u(\varphi_{n+1}, t_{n+1}).
\end{split}
\label{system2}
\end{align}
\end{document}
答案2
align
已经将您置于数学模式,因此请删除冗余equation
环境。我还将 移到了\label
里面align
。
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{amsmath}
\begin{document}
%\begin{equation}
\begin{align}
\begin{split}
a(t_{n+1}) \cos \varphi_{n+1} = a(t_{n}) \cos \varphi_{n} + \sqrt{2E_{n}}(t_{n+1} - t_{n}) \cos( \alpha_{n}+ \theta{_n}),
\\
b(t_{n+1})\sin \varphi_{n+1} \left(1+ \delta \sin^{2} \varphi_{n+1} \right) = b(t_{n})\sin \varphi_{n} \left(1+ \delta \sin^{2} \varphi_{n} \right) + \sqrt{2E_{n}}(t_{n+1}-t_{n}) \sin (\alpha_{n} + \theta_{n}),
\\
\theta_{n} + \alpha_{n} + \theta^{*}_{n+1} - \alpha_{n+1} = 0,
\\
\sqrt{2E_{n+1}}\cos \theta_{n+1} = \sqrt{2E_{n}}\cos\theta^{*}_{n+1},
\\
\sqrt{2E_{n+1}}\sin\theta_{n+1} = \sqrt{2E_{n}}\sin\theta^{*}_{n+1}-2u(\varphi_{n+1}, t_{n+1}).
\end{split}
\label{system}
\end{align}
%\end{equation}
\end{document}
或者,您可以保留equation
环境,并更改align
为aligned
:
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{aligned}
\begin{split}
a(t_{n+1}) \cos \varphi_{n+1} = a(t_{n}) \cos \varphi_{n} + \sqrt{2E_{n}}(t_{n+1} - t_{n}) \cos( \alpha_{n}+ \theta{_n}),
\\
b(t_{n+1})\sin \varphi_{n+1} \left(1+ \delta \sin^{2} \varphi_{n+1} \right) = b(t_{n})\sin \varphi_{n} \left(1+ \delta \sin^{2} \varphi_{n} \right) + \sqrt{2E_{n}}(t_{n+1}-t_{n}) \sin (\alpha_{n} + \theta_{n}),
\\
\theta_{n} + \alpha_{n} + \theta^{*}_{n+1} - \alpha_{n+1} = 0,
\\
\sqrt{2E_{n+1}}\cos \theta_{n+1} = \sqrt{2E_{n}}\cos\theta^{*}_{n+1},
\\
\sqrt{2E_{n+1}}\sin\theta_{n+1} = \sqrt{2E_{n}}\sin\theta^{*}_{n+1}-2u(\varphi_{n+1}, t_{n+1}).
\end{split}
\label{system}
\end{aligned}
\end{equation}
\end{document}
答案3
您不必嵌套align
equation
。如果您想要一个公式编号,请嵌套aligned
或split
,但不能同时嵌套 ,并使用&
作为对齐点。我建议三种可能的布局:要么使用aligned
,第二行很长,用 分割multlined
,mathtools
要么gathered
使用multlined
(无对齐点),或者aligned
使用 但 作为第二行:
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{mathtools, nccmath}
\begin{document}
\begin{equation}
\begin{aligned}
a(t_{n+1}) \cos \varphi_{n+1} & = a(t_{n}) \cos \varphi_{n} + \sqrt{2E_{n}}(t_{n+1} - t_{n}) \cos( \alpha_{n}+ \theta_{n}), \\ b(t_{n+1})\sin \varphi_{n+1} \left(1+ \delta \sin^{2} \varphi_{n+1} \right) & = \begin{multlined}[t] b(t_{n})\sin \varphi_{n} \left(1+ \delta \sin^{2} \varphi_{n} \right) \\+ \sqrt{2E_{n}}(t_{n+1}-t_{n}) \sin (\alpha_{n} + \theta_{n}),\end{multlined} \\%
\theta_{n} + \alpha_{n} + \theta^{}_{n+1} - \alpha_{n+1} & = 0, \\%
\sqrt{2E_{n+1}}\cos \theta_{n+1} & = \sqrt{2E_{n}}\cos\theta^{}_{n+1}, \\%
\sqrt{2E_{n+1}}\sin\theta_{n+1} & = \sqrt{2E_{n}}\sin\theta^{*}_{n+1}-2u(\varphi_{n+1}, t_{n+1}).
\end{aligned}\label{system}
\end{equation}
\bigskip
\begin{equation}
\begin{gathered}
a(t_{n+1}) \cos \varphi_{n+1} = a(t_{n}) \cos \varphi_{n} + \sqrt{2E_{n}}(t_{n+1} - t_{n}) \cos( \alpha_{n}+ \theta_{n}), \\ b(t_{n+1})\sin \varphi_{n+1} \left(1+ \delta \sin^{2} \varphi_{n+1} \right) = \begin{multlined}[t] b(t_{n})\sin \varphi_{n} \left(1+ \delta \sin^{2} \varphi_{n} \right) \\+ \sqrt{2E_{n}}(t_{n+1}-t_{n}) \sin (\alpha_{n} + \theta_{n}),\end{multlined} \\%
\theta_{n} + \alpha_{n} + \theta^{}_{n+1} - \alpha_{n+1} = 0, \\%
\sqrt{2E_{n+1}}\cos \theta_{n+1} = \sqrt{2E_{n}}\cos\theta^{}_{n+1}, \\%
\sqrt{2E_{n+1}}\sin\theta_{n+1}= \sqrt{2E_{n}}\sin\theta^{*}_{n+1}-2u(\varphi_{n+1}, t_{n+1}).
\end{gathered}\label{system}
\end{equation}
\bigskip
\begin{equation}
\begin{aligned}
a(t_{n+1}) \cos \varphi_{n+1} & = a(t_{n}) \cos \varphi_{n} + \sqrt{2E_{n}}(t_{n+1} - t_{n}) \cos( \alpha_{n}+ \theta_{n}), \\ %
\MoveEqLeft[2]\mathclap{b(t_{n+1})\sin \varphi_{n+1} \left(1+ \delta \sin^{2} \varphi_{n+1} \right) = b(t_{n})\sin \varphi_{n} \left(1+ \delta \sin^{2} \varphi_{n} \right) \mathrlap{+ \sqrt{2E_{n}}(t_{n+1}-t_{n}) \sin (\alpha_{n} + \theta_{n}),}} \\%
\theta_{n} + \alpha_{n} + \theta^{}_{n+1} - \alpha_{n+1} & = 0, \\%
\sqrt{2E_{n+1}}\cos \theta_{n+1} & = \sqrt{2E_{n}}\cos\theta^{}_{n+1}, \\%
\sqrt{2E_{n+1}}\sin\theta_{n+1} & = \sqrt{2E_{n}}\sin\theta^{*}_{n+1}-2u(\varphi_{n+1}, t_{n+1}).
\end{aligned}\label{system}
\end{equation}
\end{document}