Math & ScienceEquation Alignment Problems

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Jeremyrolph
Posts: 1
Joined: Fri Mar 30, 2012 12:58 pm

Equation Alignment Problems

Post by Jeremyrolph »

Hi guys,

I've just started using LaTeX and I'm having troubles using align. I am using the following piece of code:

Code: Select all

\begin{align*}
\begin{pmatrix}
\hat{S}^* \\
\hat{I}^*
\end{pmatrix}
=
\begin{pmatrix}
0 \\
0
\end{pmatrix}
\implies 
\lambda_{1}=u, \lambda_{2}=-v
\implies 
\begin{pmatrix}
0 \\
0
\end{pmatrix}
\textrm{is a stable node iff } u<0, v>0\\
\begin{pmatrix}
\hat{S}^* \\
\hat{I}^*
\end{pmatrix}
=
\begin{pmatrix}
1 \\
0
\end{pmatrix}
\implies 
\lambda_{1}=-u, \lambda_{2}=1-v
\implies 
\begin{pmatrix}
1 \\
0
\end{pmatrix}
\textrm{is a stable node iff } u>0, v>1\\
\begin{pmatrix}
\hat{S}^* \\
\hat{I}^*
\end{pmatrix}
=
\begin{pmatrix}
v \\
1-v
\end{pmatrix}
\implies 
P(\lambda)=\lambda^2 + (uv)\lambda + (uv-uv^2) 
\implies 
\begin{pmatrix}
v \\
1-v
\end{pmatrix}
\textrm{is a stable node iff } 0>uv, 0<v<1
\end{align*}
But this aligns totally incorrectly. Ideally I want to align the left hand sides (so the three (S*, I*) vectors are aligned below each other) and also drop the last \implies sign in the third equation to the line below (to make it fit on one page).

Can anyone help?

Thanks
Jezzer

Recommended reading 2024:

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

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

Boersma
Posts: 21
Joined: Mon Nov 22, 2010 9:29 pm

Equation Alignment Problems

Post by Boersma »

Well, this is quite a basic-question. Therefore, I recommend you to read the manual of amsmath. Chapter 3 gives a nice overview of all posibilities about alignments...

and, as Thorsten always says: Best regards, and welcome to the board.
Boersma

P.S. An MWE also contains a complete header, so if you add in your case

Code: Select all

\documentclass{minimal}
\usepackage{amsmath}

\begin{document}
.
.
\end{document} 
to your example, then everybody is happy.
Last edited by Boersma on Fri Mar 30, 2012 5:13 pm, edited 1 time in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Equation Alignment Problems

Post by localghost »

Such alignments can sometimes be quite tricky. If I understand you right, the below example should do what you want.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools}   % loads »amsmath«

\begin{document}
  \begin{alignat*}{3}
    &&
    \begin{pmatrix}
      \hat{S}^* \\
      \hat{I}^*
    \end{pmatrix}
    &=
    \begin{pmatrix}
      0 \\
      0
    \end{pmatrix}\\
    &\implies &
    \lambda_{1}&=u &,\qquad \lambda_{2}&=-v \\
     &\implies&
     \begin{pmatrix}
       0 \\
       0
     \end{pmatrix}
     &\mathrlap{\text{ is a stable node if } u<0, v>0}\\[3\jot]
    &&
    \begin{pmatrix}
      \hat{S}^* \\
      \hat{I}^*
    \end{pmatrix}
    &=
    \begin{pmatrix}
      1 \\
      0
    \end{pmatrix} \\
    &\implies &
    \lambda_{1}&=-u  &,\qquad \lambda_{2}&=1-v \\
    &\implies &
    \begin{pmatrix}
      1 \\
      0
    \end{pmatrix}
    &\mathrlap{\text{ is a stable node if } u>0, v>1}\\[3\jot]
    &&
    \begin{pmatrix}
      \hat{S}^* \\
      \hat{I}^*
    \end{pmatrix}
    &=
    \begin{pmatrix}
    v \\
    1-v
    \end{pmatrix} \\
    &\implies &
    P(\lambda)&=\mathrlap{\lambda^2 + (uv)\lambda + (uv-uv^2)}\\
    &\implies &
    \begin{pmatrix}
    v \\
    1-v
    \end{pmatrix}
    &\mathrlap{\text{ is a stable node iff } 0>uv, 0<v<1}
  \end{alignat*}
\end{document}
I suggest to take a look at the respective manuals of the involved packages. Much useful tips regarding math typesetting can be found in the excellent »Math mode«.

Next time please provide a proper minimal example to give an adequate problem description. It's much better than some loose code snippets to test possible solutions.


Best regards and welcome to the board
Thorsten
Attachments
The resulting output.
The resulting output.
alignment.png (14.52 KiB) Viewed 2981 times
Post Reply