格式化长方程

格式化长方程

我有这个等式:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\title{}
\author{}
\date{}
\begin{document}
\begin{equation}
   \frac{u(x,t)-u(x,t-k)}{k}=c\frac{u(x+h,t)-2u(x,t)+u(x-h,t)}{h^2}+(\frac{u(x+h,t)-u(x-h,t)}{2h})(\frac{c(x+h,t)-c(x-h,t)}{2h}) \\
\end{equation}
\end{document}

问题是它超出了页面范围。所以我尝试了:

\begin{align}
  \frac{u(x,t)-u(x,t-k)}{k} \\
  =& c\frac{u(x+h,t)-2u(x,t)+u(x-h,t)}{h^2}+(\frac{u(x+h,t)-u(x-h,t)}{2h})(\frac{c(x+h,t)-c(x-h,t)}
  {2h})
\end{align}

这似乎也不起作用。有什么建议吗?

答案1

您可以使用multline

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\title{}
\author{}
\date{}
\begin{document}

\begin{multline}
  \frac{u(x,t)-u(x,t-k)}{k} 
  = c\frac{u(x+h,t)-2u(x,t)+u(x-h,t)}{h^2}\\
 +\left(\frac{u(x+h,t)-u(x-h,t)}{2h}\right)
 \left(\frac{c(x+h,t)-c(x-h,t)}{2h}\right) 
\end{multline}

\begin{multline}
  \frac{u(x,t)-u(x,t-k)}{k} 
  = c\frac{u(x+h,t)-2u(x,t)+u(x-h,t)}{h^2}\\
 +\Bigl(\frac{u(x+h,t)-u(x-h,t)}{2h}\Bigr)
 \Bigl(\frac{c(x+h,t)-c(x-h,t)}{2h}\Bigr) 
\end{multline}
\end{document}

在此处输入图片描述

相关内容