Math & ScienceRemoving whitespace in align*

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Removing whitespace in align*

Post by Singularity »

Hi all. I can't get the extra whitespace in an align* to disappear. Any suggestions?

Code: Select all

\documentclass[12pt,fleqn,reqno]{article}
\begin{document}
\begin{align*}
	\ddot{u}_1 &= k(u_{0} &-2u_{1} &+u_{2})  \\
	\ddot{u}_2 &= k(u_{1} & -2u_{2} &+u_{3}) \\
	\vdots & & &\\
	\ddot{u}_{_N} &= k(u_{_{N-1}} &-2u_{_N} &+u_{_{N+1}})
.\end{align*}
\end{document}
For whatever reason, the second ampersand (&) in each line wants to push the whole rest of the line to the center of the page. I tried adding ampersands to the beginning of each line, and tried adding an extra one at the end of each line (as in some examples I've seen), but to no avail.

I also tried removing 'fleqn,reqno' parms at the top.
Attachments
See all that white space?
See all that white space?
Capture1.PNG (8.59 KiB) Viewed 2750 times
Last edited by Singularity on Wed Aug 17, 2011 12:29 am, edited 1 time in total.

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

Removing whitespace in align*

Post by Stefan Kottwitz »

You could use an alignat environment. In this modified example, all required points are aligned without too much space:

Code: Select all

\documentclass[12pt,fleqn,reqno]{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{4}
   \ddot{u}_1 &= k(u_{0} &&-2u_{1} &&+u_{2})  \\
   \ddot{u}_2 &= k(u_{1} && -2u_{2} &&+u_{3}) \\
   \vdots & & &\\
   \ddot{u}_{_N} &= k(u_{_{N-1}} &&-2u_{_N} &&+u_{_{N+1}})
\end{alignat*}
\end{document}
Stefan
LaTeX.org admin
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Re: Removing whitespace in align*

Post by Singularity »

Well, that worked the way I wanted, but now I decide I don't like the way that looks. :oops: I've decided to just remove all the extra ampersands (except before the equal sign), and display it the way everybody else probably does.

Thanks for the alignat tip.
Post Reply