Math & ScienceProper Alignment for Equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
wicky_83
Posts: 6
Joined: Sat Feb 11, 2012 11:49 am

Proper Alignment for Equations

Post by wicky_83 »

I'm using the amssymb, amsmath packages to do equations. When I compile the following code

Code: Select all

\begin{equation}
  	w_j(k+1) = \biggl\lbrace 
\begin{split}
w_j(k),  j \notin N_{(k+1)} \\
w_j(k) + LR(k)*(x_k-w_j(k)),  j \in N_{(k+1)}
\end{split}
\end{equation}
I get the following output.
Untitled.png
Untitled.png (12.85 KiB) Viewed 1998 times
Hi,

How can I remove the space shown by red lines. I tried the \begin{align} method but it does not work in my distribution.

Please tell me how to remove the unwanted white-space or is there any better way to do the same thing?

Thank you

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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

Proper Alignment for Equations

Post by Stefan Kottwitz »

Hi Wicky,

instead of split, which is for complete formulas, you could use an aligned environment which is for aligned math blocks:

Code: Select all

\begin{equation}
  w_j(k+1) = \biggl\lbrace
    \begin{aligned}
      & w_j(k),  j \notin N_{(k+1)} \\
      & w_j(k) + LR(k)*(x_k-w_j(k)),  j \in N_{(k+1)}
    \end{aligned}
\end{equation}
Or a cases environment:

Code: Select all

\begin{equation}
  w_j(k+1) = 
    \begin{cases}
      w_j(k),  j \notin N_{(k+1)} \\
      w_j(k) + LR(k)*(x_k-w_j(k)),  j \in N_{(k+1)}
    \end{cases}
\end{equation}
Stefan
LaTeX.org admin
wicky_83
Posts: 6
Joined: Sat Feb 11, 2012 11:49 am

Re: Proper Alignment for Equations

Post by wicky_83 »

Thank you. ;)
Post Reply