6

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
4

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
  • @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
  • @barbarabeeton ^^ Oct 29 '16 at 21:37
3

The equation-number-placement issues can be avoided entirely by using a multline environment instead of nested equation and aligned environments. (Vertical alignment of the two + symbols would not appear to be particularly urgent.)

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}
0
2

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
2

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

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.