GeneralProblem of position of equation

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
pallav
Posts: 170
Joined: Wed Nov 12, 2008 5:53 pm

Problem of position of equation

Post by pallav »

I always write equations with eqnarray, for example,

Code: Select all

\begin{eqnarray}
ax^2+by^2+c=0
\end{eqnarray}
It automatically take the equation number but the position of the equation is at the center of a line. But sometimes, I have to write the equation to the left (or right) of a page, obvioutly by using eqnarray (& nothing else). How it is possible?

Recommended reading 2024:

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

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

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Problem of position of equation

Post by frabjous »

The eqnarray environment is obsolete and should no longer be used. See l2tabu for discussion of this. Use align environment or other environment provided by amsmath.

The fleqn option to your document class will left-align all equations by default. If you only want some of them that way, you can use the nccmath package from the ncctools bundle which provides an fleqn environment to left-align some equations rather than others:

Code: Select all


\documentclass{article}
\usepackage{amsmath}
\usepackage{nccmath}
\begin{document}
    \begin{fleqn}
        \begin{align}
            2+2=4 % this will be left aligned
        \end{align}
    \end{fleqn}
    \begin{align}
        3+5=8 % this will be centered
    \end{align}
\end{document}
Post Reply