当我使用对齐环境时括号消失

当我使用对齐环境时括号消失

我有一个很长的等式,必须拆开。但是,拆开后,一组括号消失了。此外,等式的构成很奇怪。我该怎么办?正如您在图片中看到的,第一个等式似乎没问题,但第二个等式有问题。红色标记表示缺少括号。谢谢。

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\begin{document}

\begin{alignat}{2}
\begin{aligned}
&\frac{d}{dt}\left(\frac{\partial \mathcal{L}}{\partial \Dot{x}}\right)-\frac{\partial \mathcal{L}}{\partial x}=F &&\Rightarrow \left(2m_0+2m_1+2m_2\right)\Ddot{x}+\left(L_1m_1\cos\theta_2+2L_1m_2\cos\theta_1\right)\Ddot{\theta}_1\\
&\:&&+\left(L_1m_1\sin\theta_1+2L_1m_2\sin\theta_1\right)\Dot{\theta}_1^2+\left(L_2m_2\sin\theta_2\right)\Dot{\theta}_2^2=2F\\
%%%%%%%%%%%%SECOND EQUATION%%%%%%%%%%%%
&\frac{d}{dt}\left(\frac{\partial \mathcal{L}}{\partial\Dot{\theta}_1}\right)-\frac{\partial\mathcal{L}}{\partial\theta_1}=0&&\Rightarrow\left(12\,m_{1}\,\cos\theta_1+24\,m_{2}\,\cos\theta_1\right)\Ddot{x}+\left(2\,m_{1}+15\,L_{1}\,m_{1}\\
 &\:&&+24\,L_{1}\,m_{2}-9\,L_{1}\,m_{1}\,\cos\left(2\,\theta_{1}\right)\right)\Ddot{\theta}_1+\left(12\,L_{2}\,m_{2}\,\cos\left(\theta_{1}-\theta_{2}\right)\right)\Ddot{\theta}_2\\
 &\:&&+\left(9\,L_{1}\,m_{1}\,\sin\left(2\,\theta _{1}\right)\right)\Dot{\theta}_1^2+\left(12\,L_{2}\,m_{2}\,\sin\left(\theta _{1}-\theta _{2}\right)\right)\Dot{\theta}_2^2\\
 &\:&&-12\,g\,m_{1}\,\sin\theta _{1}=0
\end{aligned}
\end{alignat}

\end{document} 

在此处输入图片描述

答案1

正如@UlrikeFischer 在评论中已经指出的那样,您的代码包含语法错误,因为\left并且\right不能跨越换行符。

最简单的解决方法是删除几乎所有的\left大小\right修饰符,特别是因为它们实际上什么都不做(除了产生语法错误)。

在此处输入图片描述

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath,amssymb}
\usepackage{geometry}

\begin{document}

\begin{align}
\smash[b]{\frac{d}{dt}
 \left(\frac{\partial \mathcal{L}}{\partial \Dot{x}}\right)
 -\frac{\partial \mathcal{L}}{\partial x}=F }\Rightarrow{}
& (2m_0+2m_1+2m_2)\Ddot{x}
 +(L_1m_1\cos\theta_2+2L_1m_2\cos\theta_1)\Ddot{\theta}_1\notag\\
&\quad+
  (L_1m_1\sin\theta_1+2L_1m_2\sin\theta_1)\Dot{\theta}_1^2
+(L_2m_2\sin\theta_2)\Dot{\theta}_2^2\notag\\
&= 2F\\
%%
\smash[b]{\frac{d}{dt}
 \left(\frac{\partial \mathcal{L}}{\partial\Dot{\theta}_1}\right)
 -\frac{\partial\mathcal{L}}{\partial\theta_1}=0}\Rightarrow{}
&(12m_{1}\cos\theta_1+24m_{2}\cos\theta_1)\Ddot{x}
 +\bigl[2m_{1}+15L_{1}m_{1}+24L_{1}m_{2}\notag\\
&\quad-\phantom{(}9L_{1}m_{1}
 \cos(2\theta_{1})\bigr]\Ddot{\theta}_1
+(12L_{2}m_{2}\cos(\theta_{1}-\theta_{2}))\Ddot{\theta}_2\notag\\
&\quad+(9L_{1}m_{1}\sin(2\theta _{1}))\Dot{\theta}_1^2
      +(12L_{2}m_{2}\sin(\theta _{1}-\theta _{2}))\Dot{\theta}_2^2\notag\\
&\quad-12gm_{1}\sin\theta _{1}\notag\\
&=0
\end{align}

\end{document} 

答案2

我建议使用这种变体布局,以避免盒子过满。它需要nccmath包(在之前加载mathtools)。我删除了不必要的 \left...\right对,并用对替换了其他对bigl ... \bigr。最后,我使用该diffcoeff包简化了莱布尼茨符号中导数的输入:

\documentclass[11pt,a4paper]{article}
\usepackage[english]{babel}
\usepackage{nccmath}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{diffcoeff}

\begin{document}

\begin{fleqn}
\begin{align}
 & \begin{alignedat}{2}%
  & \diff*{\biggl(\diffp{\mathcal{L}}{\Dot{x}}\biggr)}{t} & & -\diffp{\mathcal{L}}{x} = F\Rightarrow \\
 & & & \phantom{{}+{}}(2m_0+2m_1+2m_2)\Ddot{x}+(L_1m_1\cos\theta_2+2L_1m_2\cos\theta_1)\Ddot{\theta}_1\\
 & & & +(L_1m_1\sin\theta_1+2L_1m_2\sin\theta_1)\Dot{\theta}_1^2+(L_2m_2\sin\theta_2)\Dot{\theta}_2^2=2F
\end{alignedat}\\[2ex]
%%%%%%%%%%%%%SECOND EQUATION%%%%%%%%%%%%
 & \begin{alignedat}{2}
 & \diff*{\biggl(\diffp{\mathcal{L}}{\Dot{\theta_1}}\biggr)}{t} & & -\diffp{\mathcal{L}}{\theta_1}=0\Rightarrow \\%
 & & &\phantom{{}+{}}(12\,m_{1}\,\cos\theta_1+ 24\,m_{2}\,\cos\theta_1)\Ddot{x}\\ %
 & & & + \bigl(2\,m_{1}+15\,L_{1}\,m_{1}+24\,L_{1}\,m_{2}-9\,L_{1}\,m_{1}\,\cos 2\,\theta_{1}\bigr)\Ddot{\theta}_1\\
 & & & +\bigl(12\,L_{2}\,m_{2}\,\cos(\theta_{1}-\theta_{2})\bigr)\Ddot{\theta}_2 +(9\,L_{1}\,m_{1}\,\sin 2\,\theta _{1})\Dot{\theta}_1^2\\
 & & & +\bigl(12\,L_{2}\,m_{2}\,\sin(\theta _{1}-\theta _{2})\bigr)\Dot{\theta}_2^2-12\,g\,m_{1}\,\sin\theta _{1}=0
 \end{alignedat}
\end{align}
 \end{fleqn}

\end{document} 

在此处输入图片描述

相关内容