7

I am trying to write an equation in a multicolumn environment and while there is space on the final line for the equation number, LaTeX is seemingly putting it on a new line.

\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}

gives the following:

misplaced equation number

I would like the equation number to be higher on the final line where there is room. I have tried swapping the lines and various environments, but no luck.

Any help would be appreciated.

1
5

enter image description here

\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}

Please always post full documents, I had to guess a text width to get the effect that you showed. You can use \raisetag (But apparently not in equation so I used a one line gather) or you can use align and just number one line.

5
  • Sorry about the full document, will add it in now (always apprehensive to explode the 'snippit' with what are usually long preambles)! Why did you use \raisetag{20pt}, was 20pt a guess or did you work it out? Thanks!
    – oliversm
    Oct 29 '16 at 21:15
  • @oliversm -- 20pt was obviously a guess. if you look carefully, the parentheses in the right-hand column (using align) are lined up, but the ones in the left-hand column aren't. Oct 29 '16 at 21:23
  • @barbarabeeton -- Thanks for pointing that out. The solution using aligned seems ideal.
    – oliversm
    Oct 29 '16 at 21:32
  • 1
    @oliversm well also it depends on the intention if the equation had been smaller the aligned method puts the number vertically centred between the two lines (so iIused 20pt being a bit more than a baseline) it should be a bit more for that effect, if you want it lined with a baseline using aligned of multline is better as the baseline alignment of the number will be exact then Oct 29 '16 at 21:36
  • 1
    @barbarabeeton ^^ Oct 29 '16 at 21:37
3

Another option using 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}

enter image description here

0
3

Here is another way, with the optional argument of aligned and \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} 

enter image description here

3

For the material at hand, the equation-number-placement issues can be avoided in a simple fashion, by using a multline environment instead of nested equation and aligned environments. Vertical alignment on the two + symbols would not appear to be a compelling objective here.

enter image description here

\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}
2
  • 1
    Are you saying that multline environments should be the environment of choice for multi line equations? Is split just archaic or does it have advantages too?
    – Kvothe
    Dec 13 '21 at 11:31
  • @Kvothe - I did not claim, nor did I intend to claim, that split is archaic or that the multline environment or its close cousin, the multlined environment, should be the "environment of choice" for multi-line displayed equations. My answer was aimed primarily at the material at hand, for which not using split (or aligned, or align, or ...) (a) seems sensible since there is no compelling alignment point and (b) using multline offers a welcome extra degree of freedom. I will amend my answer to draw attention to the fact that it's not meant to be a general statement.
    – Mico
    Dec 13 '21 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.