Math & ScienceEquations aligned at equal Sign

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
financialwar
Posts: 29
Joined: Wed Jul 18, 2012 4:55 pm

Equations aligned at equal Sign

Post by financialwar »

I want the equations to be aligned at the equal signs. This is my attempt, I also tried with {eqnarray}, can't get the equal sign to line up.

Code: Select all

\begin{align*}
  interest = PV (r \times t)\\
           = 8000 \left(0.06\times \frac{128}{365}\right)\\
           = \$ 168.32
\end{align*}
MiKTex 2.9, Texmaker 3.5 on Windows 7
Learning LaTeX for Finance and Actuarial Studies.

Recommended reading 2024:

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

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

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Equations aligned at equal Sign

Post by localghost »

Code: Select all

\begin{align*}
  interest &= PV (r \times t)\\
           &= 8000 \left(0.06\times \frac{128}{365}\right)\\
           &= \$ 168.32
\end{align*}
Further reading:
  • The amsmath manual.
  • The »Math Mode« document.
  • »Similar Topics« at the bottom of the page (only when logged in).

Thorsten
financialwar
Posts: 29
Joined: Wed Jul 18, 2012 4:55 pm

Re: Equations aligned at equal Sign

Post by financialwar »

still don't align, just read the guide, don't you have to put & before and after the = sign?
MiKTex 2.9, Texmaker 3.5 on Windows 7
Learning LaTeX for Finance and Actuarial Studies.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Equations aligned at equal Sign

Post by localghost »

financialwar wrote:still don't align, just read the guide, don't you have to put & before and after the = sign?
Could you please be a bit more specific and describe the problem in more than just one line? A code example would be helpful.

The align environment only needs with one single alignment character (»&«) in this case. In most cases it is placed right before the equal sign. The provided code should work. If not, kindly provide a counter example.
financialwar
Posts: 29
Joined: Wed Jul 18, 2012 4:55 pm

Equations aligned at equal Sign

Post by financialwar »

Sorry, my mistake. Got mixed up with {eqnarray}.
MiKTex 2.9, Texmaker 3.5 on Windows 7
Learning LaTeX for Finance and Actuarial Studies.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Equations aligned at equal Sign

Post by localghost »

financialwar wrote:[…] Got mixed up with {eqnarray}.
Avoid eqnarray!
financialwar
Posts: 29
Joined: Wed Jul 18, 2012 4:55 pm

Re: Equations aligned at equal Sign

Post by financialwar »

yea, Sir!
MiKTex 2.9, Texmaker 3.5 on Windows 7
Learning LaTeX for Finance and Actuarial Studies.
Post Reply