GeneralAlignment

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Mini
Posts: 73
Joined: Thu Aug 06, 2009 12:46 pm

Alignment

Post by Mini »

Hi,

In my document, the equations of latex are not aligning to the left, despite using the [fleqn] parameter. Here's the code. I would like the equation to align to the left, ie. in alignment with "Testing 1234" (apart from the equations below the main equation, if you know what I mean).

Here's my code, what am I doing wrong?

Code: Select all

\documentclass[12pt, twocolumn]{article}
\usepackage{polynom}
\usepackage[fleqn]{amsmath}
\usepackage[lmargin=1cm, rmargin=1cm, tmargin=1cm, bmargin=1cm]{geometry}
\setlength{\columnseprule}{1pt}
\begin{document}

\begin{eqnarray*}
\text{(a)} \ \lim_{x\rightarrow0}\frac{sin3x}{2x} &=& \lim_{x \rightarrow 0} \frac{sin3x}{3x}.\frac{3}{2} \\
&=& 1.\frac{3}{2} \\
&=& \frac{3}{2}\ \\
\text{(b)} \ \frac{d}{dx}[ln \sqrt{\frac{1+x}{1-x}}]
&=& \frac{d}{dx}[\frac{1}{2}(ln(1+x)-ln(1-x))] \\
&=&\frac{1}{2}[\frac{1}{1+x} + \frac{1}{1-x}] \\
&=&\frac{1}{2}[\frac{1-x+1+x}{1-x^2}] \\
&=&\frac{1}{1-x^2} \\
\text{(c)} \ I &=& \int_{-3}^3 \frac{dx}{x^2+9} \\
&=& \frac{1}{3}[tan^{-1} \frac{x}{3}]_{-3}^3 \\
&=& \frac{1}{3}tan^{-1}1 - tan^{-1}(-1) \\
&=& \frac{1}{3}[\frac{\pi}{4}+ \frac{\pi}{4}] \\
&=& \frac{\pi}{6}
\end{eqnarray*}

Testing 1234

\end{document}

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

Alignment

Post by phi »

There are a few flaws in your code.
  • Don't use the eqnarray environment.
  • Use the enumerate environment or automatic equation numbering for numbered equations.
  • Use appropriate commands like \sin and \ln for special functions.
  • Use \left…\right for strechable delimiters.
  • Use \times or \cdot for the multiplication sign.
  • fleqn should be included in the class options list.
  • Avoid the control space "\ " in math mode.
Here is a corrected version of your example:

Code: Select all

\documentclass[12pt, twocolumn, fleqn, leqno]{article}

\usepackage{polynom}
\usepackage{amsmath}
\usepackage[lmargin=1cm, rmargin=1cm, tmargin=1cm, bmargin=1cm]{geometry}

\setlength{\columnseprule}{1pt}

\renewcommand*{\theequation}{\alph{equation}}

\begin{document}

\begin{align}
  \lim_{x \to 0}\frac{\sin 3x}{2x}
  &= \lim_{x \to 0} \frac{\sin 3x}{3x} \cdot \frac{3}{2} \\
  &= 1 \cdot \frac{3}{2} \notag \\
  &= \frac{3}{2} \notag
\end{align}

\begin{align}
  \frac{d}{dx} \left[\ln \sqrt{\frac{1+x}{1-x}} \right]
  &= \frac{d}{dx} \left[\frac{1}{2} \left(\ln(1+x)-\ln(1-x) \right) \right] \\
  &=\frac{1}{2} \left[\frac{1}{1+x} + \frac{1}{1-x} \right] \notag \\
  &=\frac{1}{2} \left[\frac{1-x+1+x}{1-x^2} \right] \notag \\
  &=\frac{1}{1-x^2} \notag
\end{align}

\begin{align}
  I
  &= \int_{-3}^3 \frac{dx}{x^2+9} \\
  &= \frac{1}{3} \left[\tan^{-1} \frac{x}{3} \right]_{-3}^3 \notag \\
  &= \frac{1}{3} \left[\tan^{-1}(1) - \tan^{-1}(-1) \right] \notag \\
  &= \frac{1}{3} \left[\frac{\pi}{4}+ \frac{\pi}{4} \right] \notag \\
  &= \frac{\pi}{6} \notag
\end{align}

\noindent Testing 1234

\end{document}
Post Reply