Math & ScienceHow to Split an Equation

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
alony
Posts: 3
Joined: Sun Jul 05, 2009 10:15 am

How to Split an Equation

Post by alony »

Hi,
I started to use just lately in TeXnicCenter.
I'm writing a 'book' in 'twocolumns' and I tried to insert an equation which is too long thus part of the equation disappear, How can I force the equation to split/wrap? (I prefer not to write twice an equation even though it should work)
Thanks

Recommended reading 2024:

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

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

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

How to Split an Equation

Post by frabjous »

With \usepackage{amsmath} you can use:

Code: Select all

\begin{equation}
   \begin{split}
       (first part) \\
       (second part)
   \end{split}
\end{equation}
there are other options too, like gather, multline and align environments. See the AMS math documentation.
bazman
Posts: 78
Joined: Mon Jan 26, 2009 3:24 am

How to Split an Equation

Post by bazman »

Hi there,

I have think I have followed the example given below correctly but my equation is still not working?

Please advise.

Code: Select all

\documentclass{article} % Your input file must contain these two lines
\usepackage{natbib}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{bm}
\usepackage{grffile}
\usepackage{graphicx}
\usepackage[%
  font=small,
  labelfont=bf,
  figurewithin=section,
  tablewithin=section,
  tableposition=top
]{caption}
\numberwithin{equation}{section}
\begin{document} % plus the \end{document} command at the end
\parskip = 1pc %change spacing between paragraphs
\parindent = 0pc %change paragraph indentation

\begin{equation}
 \begin{split}
\textbf{Cpl}(0,T_{j-1},T_j,\tau_j,K)=\tau_j P(0,T-j)[\frac{F_j(0)}{2\sinh(-L_i)}(exp^{-L_i}   \Phi(\overline{y}_i(T_{j-1}) + \\ A_i(T_{j-1))-\exp^{L_i}\Phi(\overline(y)_i(T_{j-1}-A_i(T{j-1})))-K\phi(\overline(y)_i(T_{j-1}))]
 \end{split}
\end{equation}
\end{document}
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

How to Split an Equation

Post by frabjous »

The reason your code isn't compiling isn't because of the split environment, but because of other errors in the equation. Here's what I noticed:
  • Right after the \\-split you have A_i(T_{j-1)) whereas you probably mean A_i(T_{j-1}) -- hence that subscript never closes (hence the split never closes).
  • Twice you have \overline(y) rather than \overline{y}
  • There may be others, but it's not clear without knowing precisely what you were after.
melekzedek
Posts: 34
Joined: Sat Aug 08, 2009 1:05 pm

How to Split an Equation

Post by melekzedek »

You should also take a look at the following option
Screenshot.png
Screenshot.png (14.31 KiB) Viewed 5538 times
The difference is that your equation is aligned in a slight different way, left aligned in the first line, and then right aligned the last line. If you have, for example, three lines, the middle is aligned in the center, giving a nice formula breaking.

Check User's Guide for the amsmath Package (Version 2.0) for further details on various types for display equation environments (see especially Table 3.1 on page 4)
Using Ubuntu 13.10 under the hood and LaTeXing via Vim-LaTeX
ウンベルト
Post Reply