0

The following code:

\documentclass[12pt, a4paper, twoside, titlepage]{article}

\usepackage{amsmath}
\begin{document}

  \begin{flalign}
    J(1)=\\
    \sum\limits_{i=1}^{m} (h_\Theta(x^i)-y^i)^2=&&\\
    \sum\limits_{i=1}^{3} (\Theta_1(x^i)-y^i)^2=&&\\
    \frac{1}{3}((1-1)^2+(2-2)^2+(3-3)^2)=&&\\
    \frac{1}{3}(0+0+0)=0
  \end{flalign}

\end{document}

Gives the following equation alignment:

enter image description here

Aligning by the = is great when developing two sides of an equation. However, when developing an expresion line-by-line, I prefer that the expressions will be aligned to the left:

enter image description here

I assume that after seeing my handwriting skills, my need for Latex is self-explanatory.

What have I tried

My question

How do I align a running numbered list of expressions, similar to the one listed above, in which the expressions are aligned to the left?

1
  • flalign (full length align) has nothing to do with fleqn (fixed length [from the margin] equations). Remember that align and the other environments with align in their name make columns in pair, the first right aligned and the second left aligned. So you just need & in front of each line.
    – egreg
    Commented Mar 20, 2017 at 7:49

1 Answer 1

2

How about this:

\documentclass[12pt, a4paper, twoside, titlepage]{article}

\usepackage{amsmath}
\begin{document}

  \begin{align}
    &J(1)=\\
    &\sum\limits_{i=1}^{m} (h_\Theta(x^i)-y^i)^2=\\
    &\sum\limits_{i=1}^{3} (\Theta_1(x^i)-y^i)^2=\\
    &\frac{1}{3}((1-1)^2+(2-2)^2+(3-3)^2)=\\
    &\frac{1}{3}(0+0+0)=0
  \end{align}

\end{document}

enter image description here

1
  • I changed flalign into align, because the former does nothing different in this case.
    – egreg
    Commented Mar 20, 2017 at 7:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .