15

how to make maths equations start at the left?

$$ \lim_{ x \to 0} \frac{\log {10 + \log(x+ \frac{1}{10})}}{x} = 10 $$

this display on center we want to start it left

AJITH
  • 151

4 Answers4

18

Another method that works with all display math environments, if you don't want all equation to be aligned on the left margin, is the following.

We define a new command

\newcommand{\mathleft}{\@fleqntrue\@mathmargin0pt}

that simulates the option fleqn with \mathindent=0pt, and a new command to restore the normal behavior

\newcommand{\mathcenter}{\@fleqnfalse}

In the following MWE you can see how to use those commands:

\documentclass{article}
\usepackage{showframe} % just for the example
\usepackage{amsmath}

\makeatletter
\newcommand{\mathleft}{\@fleqntrue\@mathmargin0pt}
\newcommand{\mathcenter}{\@fleqnfalse}
\makeatother

\begin{document}

\mathleft
\begin{equation}
\lim_{ x \to 0} \frac{\log {10 + \log(x+ \frac{1}{10})}}{x} = 10
\end{equation}
\mathcenter

\begin{equation}
\lim_{ x \to 0} \frac{\log {10 + \log(x+ \frac{1}{10})}}{x} = 10
\end{equation}

\end{document} 

Output

enter image description here

karlkoeller
  • 124,410
16
\documentclass{article}
\usepackage{amsmath}
\usepackage{showframe}   %% just for demo
\begin{document}
  \begin{flalign}
     \lim_{ x \to 0} \frac{\log {10 + \log(x+ \frac{1}{10})}}{x} = 10 && 
  \end{flalign}
\end{document}

enter image description here

If you want all your equations to start from left, add [fleqn] option to the \documentclass. Further, you may want to set \mathindent to zero.

\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage{showframe}   %% just for demo
\setlength\mathindent{0pt}
\begin{document}
  \[
    \lim_{ x \to 0} \frac{\log {10 + \log(x+ \frac{1}{10})}}{x} = 10 
  \]
\end{document}

enter image description here

1

Simplest way one can do for the fewer lines of equation is to put "&" which ever location you want to align from.

For Example,

\begin{aligned}
1. &\: E(a) = a \\
2. &\: E(aX) = aE(X) = a \mu \\
3. &\: E(aX + b) = aE(X) + b \\
4. &\: E(X \pm Y) = E(X) \pm E(Y) \\
5. &\: E(aX \pm bY) = aE(X) \pm bE(Y) \\
6. &\: E(X^2) = \sum x_i^2 P(x_i^2) = \sum x_i^2 P(x_i) \\
7. &\: E(h(x)) = \sum h(x_i) P(x_i) \\
&\: \ where \ h(x) \ is \ a  \ function \\
8. &\: E(X^3) = \sum x_i^3 P(x_i^3) = \sum x_i^3 P(x_i)
\end{aligned}

Thanks.

Roland
  • 6,655
1

There's also the nccmath package, which defines the fleqn environment for that. %oreover, this environment can take a optional argument to set the value of \displayindent (0pt by default). Demo:

\documentclass{article}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{nccmath}
\usepackage{showframe} %% just for demo
\renewcommand{\ShowFrameColor}{\color{red}}
\renewcommand{\ShowFrameLinethickness}{0.3pt}

\begin{document}

Some text. Some more text. Some more text. Some more text. Still some more text. \begin{fleqn} [ \lim_{ x \to 0} \frac{\log {10 + \log(x+ \frac{1}{10})}}{x} = 10 ] \end{fleqn}

\begin{fleqn}[\parindent] \begin{equation} \lim_{ x \to 0} \frac{\log {10 + \log(x+ \frac{1}{10})}}{x} = 10 \end{equation} \end{fleqn}

\end{document}

enter image description here

Bernard
  • 271,350