Math & ScienceEquation flips between centred and left justified

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
bazman
Posts: 78
Joined: Mon Jan 26, 2009 3:24 am

Equation flips between centred and left justified

Post by bazman »

Hi there,

When I complie the following code using TeXnicCenter. The first equation is centred on the page while the group of 5 equations in the next "equation section" are all left justified.

Why is this?

I would like all my equations to be left justified. Can soeone please expalin how I can achive this.

Code: Select all

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\parskip = 1pc %change spacing between paragraphs
\parindent = 0pc %change paragraph indentation
\section{Stochastic Calculus Exam}

\subsection{Question 1a}

\begin{equation*}
dX_t = kX_t dt + \sigma dW_t \qquad x_0=x \in \Re
\end{equation*}

Take the homogeneous part:

\begin{equation*}

\ dX_t &= kX_t dt \\ \\
\frac{dX_t}{X_t}&= kdt\\ \\
\int_0^t \frac{dX_s}{X_s} &= k \int_0^t ds \\ \\   
\ln{X_t}-\ln{X_0} &= kt + C \\ \\
X_t &= C \exp^{kt} 

\end{equation*}

C is found to be $x$ from the intial conditions.

\begin{equation*}
\tilde{X_t} = x \exp^{kt} 
\end{equation*}

Integrating factor $q_t = ( \frac{ \tilde{X_t} }{X_0})^{-1} = \exp^{-kt} $

Auxilliary Function $ F_t = q_tX_t = X_t \exp^{-kt} $

Applying Ito to $F_t$

Recommended reading 2024:

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

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

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Equation flips between centred and left justified

Post by phi »

Your code doesn't even compile, it produces dozens of errors. You cannot use paragraphs (empty lines) inside math environments, and you cannot use alignment marks (&) inside equation* environments. Here is a corrected version, in which all equations are centered:

Code: Select all

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\parskip = 1pc %change spacing between paragraphs
\parindent = 0pc %change paragraph indentation
\section{Stochastic Calculus Exam}

\subsection{Question 1a}

\begin{equation*}
dX_t = kX_t dt + \sigma dW_t \qquad x_0=x \in \Re
\end{equation*}

Take the homogeneous part:

\begin{align*}
dX_t &= kX_t dt \\
\frac{dX_t}{X_t}&= kdt\\
\int_0^t \frac{dX_s}{X_s} &= k \int_0^t ds \\
\ln{X_t}-\ln{X_0} &= kt + C \\
X_t &= C \exp^{kt}
\end{align*}

C is found to be $x$ from the intial conditions.

\begin{equation*}
\tilde{X_t} = x \exp^{kt}
\end{equation*}

Integrating factor $q_t = ( \frac{ \tilde{X_t} }{X_0})^{-1} = \exp^{-kt} $

Auxilliary Function $ F_t = q_tX_t = X_t \exp^{-kt} $

Applying Ito to $F_t$

\end{document}
To align all of them to the left, use the fleqn class option:

Code: Select all

\documentclass[fleqn]{article}
Post Reply