Math & ScienceNumber Positioning for multi-line Equation

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
tabenda
Posts: 13
Joined: Sun Dec 20, 2009 11:42 pm

Number Positioning for multi-line Equation

Post by tabenda »

Hi,

I am an above average user of LaTeX and new to this community. I want to ask a question about multi-line equations. I am writing a multi-line equation using this code

Code: Select all

\begin{equation}
  \begin{split}
%    equation body on two lines goes here.
  \end{split}
\end{equation}
The problem is that the equation number is displayed on the third line(below the equation) in the output. Please let me know how I can get the equation number on the same line in which the equation ends.

Many thanks and best regards in advance.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: Number Positioning for multi-line Equation

Post by Stefan Kottwitz »

Hi Tabenda,

welcome to the board!

If you would post the real equation we could test it and provide a solution. Perhaps you're using a wrong syntax, who knows. The "sample" doesn't show it.

Stefan
LaTeX.org admin
tabenda
Posts: 13
Joined: Sun Dec 20, 2009 11:42 pm

Number Positioning for multi-line Equation

Post by tabenda »

Here is the code for the equation.

Code: Select all

\begin{equation}
  \begin{split}
    \Delta J &=\int_{t_0}^{t_f} \left[ \varphi(x,\dot{x},t)+\left[\delta(x)\frac{\partial\varphi}{\partial x}+\delta(\dot{x})\frac{\partial\varphi}{\partial \dot{x}}\right]+\frac{1}{2!}\left[\delta(x)^2\frac{\partial^2\varphi}{\partial x^2}+\delta(\dot{x})^2\frac{\partial^2\varphi}{\partial \dot{x}^2}+2\frac{\partial^2\varphi}{\partial x\partial\dot{x}}\delta x\delta\dot{x}\right]+\frac{1}{3!} \right. \\
    & \left. \left[\delta(x)^3\frac{\partial^3\varphi}{\partial x^3}+\delta(\dot{x})^3\frac{\partial^3\varphi}{\partial \dot{x}^3}+3\delta(\dot{x})\delta(x)^2\frac{\partial^3\varphi}{\partial x^2\partial \dot{x}}+3\delta(\dot{x})^2\delta(x)\frac{\partial^3\varphi}{\partial x\partial \dot{x}^2}\right]+\cdots-\varphi(x,\dot{x},t)\right]
  \end{split}
\end{equation}
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Number Positioning for multi-line Equation

Post by frabjous »

The problem isn't with the syntax you're using -- it's that this particular equation is, even after being split, too wide for anything to fit next to it.

You can see that the syntax is right just by adding a "\tiny" before it -- that'll make it small enough that the equation number will fit on the side, and it'll be centered next to it, not below it.

Probably, however, you don't want it tiny. Instead, you'll need to find more places to split it, so no one piece is too wide to force the number below.
tabenda
Posts: 13
Joined: Sun Dec 20, 2009 11:42 pm

Re: Number Positioning for multi-line Equation

Post by tabenda »

Its not helping :( "\tiny" makes the text too small and the equation number gets align in the Middle right of the equation. Space is not the problem for equation number to be on the next line cause there is enough space on the second line that equation number could get adjusted there.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Number Positioning for multi-line Equation

Post by localghost »

I have no problem with the code below.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[includeheadfoot,margin=2cm]{geometry}
\usepackage[tbtags]{amsmath}

\begin{document}
  \begin{equation}
    \begin{split}
      \Delta J=\int_{t_0}^{t_f}\left[\varphi(x,\dot{x},t)+\left[\delta(x)\frac{\partial\varphi}{\partial x}+\delta(\dot{x})\frac{\partial\varphi}{\partial \dot{x}}\right]+\frac{1}{2!}\left[\delta(x)^2\frac{\partial^2\varphi}{\partial x^2}+\delta(\dot{x})^2\frac{\partial^2\varphi}{\partial \dot{x}^2}+2\frac{\partial^2\varphi}{\partial x\partial\dot{x}}\delta x\delta\dot{x}\right]+\right. \\
      \left.+\frac{1}{3!}\left[\delta(x)^3\frac{\partial^3\varphi}{\partial x^3}+\delta(\dot{x})^3\frac{\partial^3\varphi}{\partial \dot{x}^3}+3\delta(\dot{x})\delta(x)^2\frac{\partial^3\varphi}{\partial x^2\partial \dot{x}}+3\delta(\dot{x})^2\delta(x)\frac{\partial^3\varphi}{\partial x\partial \dot{x}^2}\right]+\cdots-\varphi(x,\dot{x},t)\right]
    \end{split}
  \end{equation}
\end{document}
Note the option for the amsmath package.


Best regards and welcome to the board
Thorsten
tabenda
Posts: 13
Joined: Sun Dec 20, 2009 11:42 pm

Re: Number Positioning for multi-line Equation

Post by tabenda »

Many thanks :D, it's working.
Post Reply