# why my formula doesn't align left with "flalign*"?

I want to make my formula align left, so I write like this:

\documentclass[UTF8]{ctexart}
\usepackage[fleqn]{lmodern,amsmath}

\title{标题}
\author{roger}
\begin{document}

\begin{flalign*}
d1 = (x_1, ...x_N) \\
BM25(w_i, d1) = \frac{(k+1)c(w_i, d1)}{c(w_i, d1) + k(1 - b + b\frac{|d|}{avdl})} \\
x_i = \frac{BM25(w_i, d1)}{\Sigma_{j=1}^NBM25(w_j, d1)}
\end{flalign*}
\end{document}


Here is my result:

flalign is a variant of align but uses the full width of the page (length of the line, hence fl). Like the other AMS alignments it is designed to set equations as pairs of columns with a left column right aligned (typically to &=) and a left column left aligned, and then the next two columns again being right-left aligned.

You have specified no alignment points so the entire structure is in the first, right aligned part of the first equation.

You want &= on each row, and perhaps use align rather than flalign.

\documentclass{article}
\usepackage[fleqn]{amsmath}
\usepackage{lmodern}

\author{roger}
\begin{document}
zzz:
\begin{flalign*}
d1 = (x_1, ...x_N) \\
BM25(w_i, d1) = \frac{(k+1)c(w_i, d1)}{c(w_i, d1) + k(1 - b + b\frac{|d|}{avdl})} \\
x_i = \frac{BM25(w_i, d1)}{\Sigma_{j=1}^NBM25(w_j, d1)}
\end{flalign*}

zzz:
\begin{flalign*}
\mathrm{d1} &= (x_1, ...x_N) \\
\mathrm{BM25}(w_i, \mathrm{d1}) &= \frac{(k+1)c(w_i, \mathrm{d1})}{c(w_i, \mathrm{d1}) + k(1 - b + b\frac{|d|}{avdl})} \\
x_i &= \frac{\mathrm{BM25}(w_i, \mathrm{d1})}{\Sigma_{j=1}^N\mathrm{BM25}(w_j, \mathrm{d1})}
\end{flalign*}

zzz:
\begin{align*}
\mathrm{d1} &= (x_1, ...x_N) \\
\mathrm{BM25}(w_i, \mathrm{d1}) &= \frac{(k+1)c(w_i, \mathrm{d1})}{c(w_i, \mathrm{d1}) + k(1 - b + b\frac{|d|}{avdl})} \\
x_i &= \frac{\mathrm{BM25}(w_i, \mathrm{d1})}{\Sigma_{j=1}^N\mathrm{BM25}(w_j, \mathrm{d1})}
\end{align*}
\end{document}

• Blank space after display math is ok with flalign*? Apr 17 '17 at 10:40
• @PeterGrill same as with any other blank line, it is a paragraph break so it is OK or not depending if you want the following zzz to start a paragraph. (It is before a math display that you should never have a blank line) Apr 17 '17 at 10:42