我正在尝试在多列环境中编写一个方程式,尽管最后一行有方程式编号的空间,但 LaTeX 似乎将其放在了新行上。
\documentclass[a4paper, 12pt]{article}
\usepackage{lipsum, amsmath, multicol, geometry}
\geometry{left=20mm, right=20mm, top=20mm, bottom=20mm}
\begin{document}
\begin{multicols}{2}
Using central differences for the first and second order derivative our numerical scheme becomes
\begin{equation}
\begin{aligned}
h_j^{n+1} = h_j^n &+ \dfrac{\Delta t \left(h_j^n\right)^3}{(\Delta x)^2}
\left(h_{j+1}^n - 2 h_j^n + h_{j-1}^n\right)\\
&+ \dfrac{3\Delta t \left(h_j^n\right)^2}{4(\Delta x)^2}
\left(h_{j+1}^n - h_{j-1}^n\right)
\end{aligned}
\label{eqt:numerical_scheme}
\end{equation}
where we notice something\\
\lipsum[2]
\end{multicols}
\end{document}
给出以下内容:
我希望方程式编号在有空间的最后一行更高。我尝试过交换行和各种环境,但没有成功。
任何帮助,将不胜感激。
答案1
\documentclass{article}
\usepackage{multicol,amsmath}
\addtolength\textwidth{2cm}
\begin{document}
\begin{multicols}{2}
Using central differences for the first and second order derivative our numerical scheme becomes
\begin{gather}
\begin{aligned}
h_j^{n+1} = h_j^n &+ \dfrac{\Delta t \left(h_j^n\right)^3}{(\Delta x)^2}
\left(h_{j+1}^n - 2 h_j^n + h_{j-1}^n\right)\\
&+ \dfrac{3\Delta t \left(h_j^n\right)^2}{4(\Delta x)^2}
\left(h_{j+1}^n - h_{j-1}^n\right)
\end{aligned}
\label{eqt:numerical_scheme1}
\raisetag{20pt}
\end{gather}
where we notice something
Using central differences for the first and second order derivative our numerical scheme becomes
\begin{align}
h_j^{n+1} = h_j^n &+ \dfrac{\Delta t \left(h_j^n\right)^3}{(\Delta x)^2}
\left(h_{j+1}^n - 2 h_j^n + h_{j-1}^n\right)\nonumber\\
&+ \dfrac{3\Delta t \left(h_j^n\right)^2}{4(\Delta x)^2}
\left(h_{j+1}^n - h_{j-1}^n\right)
\label{eqt:numerical_scheme2}
\end{align}
where we notice something
\end{multicols}
\end{document}
请始终发布完整的文档,我不得不猜测文本宽度才能获得您显示的效果。您可以使用\raisetag
(但显然不是,equation
所以我使用了一行gather
)或者您可以使用align
并只编号一行。
答案2
另一个选项使用align
:
\documentclass[12pt]{article}
\setlength\textwidth{19.18em}
\usepackage{amsmath,microtype}
\newcommand\ddfrac[2]{\frac{\displaystyle#1}{\displaystyle#2}}
\begin{document}
\noindent differences for the first and second order derivatives
our numerical scheme becomes
\begin{align}
h_j^{n+1} = h_j^n &+ \ddfrac{\Delta t(h_j^n)^3}{(\Delta x)^2}
\bigl(h_{j+1}^n - 2h_j^n + h_{j-1}^n\bigr) \notag \\
& + \ddfrac{3\Delta t(h_j^n)^2}{4(\Delta x)^2}
\bigl(h_{j+1}^n - h_{j-1}^n \bigr) \label{eqt:numerical_scheme2}
\end{align}
where we notice something
\end{document}
答案3
这是另一种方法,使用可选参数aligned
和\mathrlap
:
\documentclass{article}
\usepackage{multicol,mathtools, lipsum}
\addtolength\textwidth{2cm}
\begin{document}
\begin{multicols}{2}
Using central differences for the first and second order derivative our numerical scheme becomes
\begin{equation}
\begin{aligned}[b]
h_j^{n+1} =h_j^n & + \dfrac{Δt \left(h_j^n\right)³}{(Δx)²}
\bigl(h_{j+1}^n - 2 h_j^n +\mathrlap{ h_{j-1}^n\bigr)} \\
& +\dfrac{3Δt \left(h_j^n\right)²}{4(Δx)²}
\left(h_{j+1}^n - h_{j-1}^n\right)
\end{aligned}
\label{eqt:numerical_scheme1}
\end{equation}
where we notice something.
\lipsum[11]
\end{multicols}
\end{document}
答案4
multline
对于手头的材料,可以通过使用环境而不是嵌套equation
和环境来简单地避免方程式编号放置问题aligned
。这两个+
符号的垂直对齐在这里似乎不是一个引人注目的目标。
\documentclass{article}
\setlength\textwidth{2.75in} % an educated guess...
\usepackage{amsmath}
% a version of \frac that uses \displaystyle for numerator and deminator:
\newcommand\ddfrac[2]{\frac{\displaystyle#1}{\displaystyle#2}}
\begin{document}
Using central differences for the first and second
order derivatives our numerical scheme becomes
\begin{multline}
h_j^{n+1} = h_j^n
+ \ddfrac{\Delta t(h_j^n)^3}{(\Delta x)^2}
\bigl(h_{j+1}^n - 2h_j^n + h_{j-1}^n\bigr)\\
+ \ddfrac{3\Delta t(h_j^n)^2}{4(\Delta x)^2}
\bigl(h_{j+1}^n - h_{j-1}^n \bigr)
\label{eqt:numerical_scheme2}
\end{multline}
where we notice something
\end{document}