Math & ScienceHow to left align some formulas?

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
ks-zadeh
Posts: 29
Joined: Tue Feb 23, 2010 9:19 am

How to left align some formulas?

Post by ks-zadeh »

How can I "left align" (parindent) one or more, but not all, formulas in a manuscript? That is, by avoiding general commands like "fleqn" and the like.
Last edited by ks-zadeh on Mon Sep 20, 2010 11:52 pm, edited 1 time in total.

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How to left align some formulas?

Post by localghost »

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{mathtools}   % Loads »amsmath«
\usepackage{blindtext}


\begin{document}
  \blindtext
  \begin{align}
    (a+b)^2 &= a^2+2ab+b^2 \\
    (a-b)^2 &= a^2-2ab+b^2 \\
    (a+b)(a-b) &= a^2-b^2
  \end{align}

  \blindtext
  \begin{flalign}
    (a+b)^2 &= a^2+2ab+b^2 & \\
    (a-b)^2 &= a^2-2ab+b^2 & \\
    (a+b)(a-b) &= a^2-b^2 &
  \end{flalign}

  \blindtext
\end{document}
Regarding the indentation of the second equation system I can't advice.


Best regards
Thorsten
ks-zadeh
Posts: 29
Joined: Tue Feb 23, 2010 9:19 am

Re: How to left align some formulas?

Post by ks-zadeh »

Sorry, it seems I have not stated my problem clearly. What I would like to obtain is this: to have, deliberately, one or another of my formulas start at the left hand side of the line where the paragraph indent is. Is there a special, optional command that one can add to equation, eqnarray, gather, etc. to obtain that result?
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

How to left align some formulas?

Post by frabjous »

Perhaps a modification of the above approach would suit your needs, e.g., for a one-liner:

Code: Select all

  \begin{flalign}
      \indent & (a+b)^2 = a^2+2ab+b^2 &
  \end{flalign}
ks-zadeh
Posts: 29
Joined: Tue Feb 23, 2010 9:19 am

Re: How to left align some formulas?

Post by ks-zadeh »

It seems your proposal works for equations only, but not for formulas in general. For example, I want to left align (with indent) an n-tuple like the following one:

\langle \Omega, \mathcal{E}, p, T, A_{t_{1}}, B_{t_{2}}, X \rangle

Using your proposal it is centered.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to left align some formulas?

Post by gmedina »

Hi,

you could try the fleqn environment provided by the nccmath package. A little example:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\usepackage{nccmath}

\begin{document}

text text text text text  text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\begin{fleqn}[\parindent]
  \begin{align}
    a &= b \\
    &= c\\
    &= d.
  \end{align} 
\end{fleqn}
text text text text text  text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\begin{fleqn}[\parindent]
  \begin{equation}
    \langle \Omega, \mathcal{E}, p, T, A_{t_{1}}, B_{t_{2}}, X \rangle
  \end{equation} 
\end{fleqn}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
ks-zadeh
Posts: 29
Joined: Tue Feb 23, 2010 9:19 am

Re: How to left align some formulas?

Post by ks-zadeh »

Using the latter proposal still centers the formulas. But the preceding proposal works. I discovered that initially I had made a mistake. My problem has been resolved. Thank you all!
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to left align some formulas?

Post by gmedina »

ks-zadeh wrote:Using the latter proposal still centers the formulas. But the preceding proposal works. I discovered that initially I had made a mistake. My problem has been resolved. Thank you all!
Eh? The fleqn environment doesn't center formulas. Did you compile my example code?
1,1,2,3,5,8,13,21,34,55,89,144,233,...
ks-zadeh
Posts: 29
Joined: Tue Feb 23, 2010 9:19 am

Re: How to left align some formulas?

Post by ks-zadeh »

My problem found a solution by following proposal:

\begin{flalign}
\indent & (a+b)^2 = a^2+2ab+b^2 &
\end{flalign}

plus gmedina's proposal. The latter one seems to be better.
Last edited by ks-zadeh on Tue Sep 21, 2010 7:57 am, edited 1 time in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How to left align some formulas?

Post by localghost »

Now that the problem is solved, please be so kind and mark the topic accordingly as clearly written in Section 3 of the Board Rules. Please keep that in mind for the future so that further reminders will not be necessary any more.
Post Reply