I have the following minimal latex code on overleaf in an attempt to create a 12pt, 1in margin, letter-size document in Times New roman:

\documentclass[12pt, letterpaper, fleqn, notitlepage]{article}

$$Entropy(\text{D}) = -\sum\limits_{d \in D} p(d) \log_{2}p(d) $$
$$Entropy(\text{S}) = p(s+)\Bigg [ -\sum\limits_{d \in D} p(d | s+) \log_{2}p(d | s+)\Bigg ] \\
+ p(s-)\Bigg [-\sum\limits_{d \in D} p(d | s-) \log_{2}p(d | s-)\Bigg ]$$

And I'm trying to simply left align all of the equations and hide equation numbers.

Here is what I have tried without success:

  • fleqn in document options
  • \begin{align} and \end{align}
  • \begin{flalign*} and \end{flalign*}
  • \setlength\mathindent{0pt}

Any help would be appreciated. Thank you.


2 Answers 2


Like this?

enter image description here

(red lines indicate text borders)

\documentclass[12pt, fleqn]{article}
\setlength{\mathindent}{0pt}  % <----

\mathrm{Entropy}(D) = -\sum\limits_{d \in D} p(d) \log_{2}p(d) 
some text?
    = p(s+)\Bigg[-\sum\limits_{d \in D} p(d | s+) \log_{2}p(d | s+)\Bigg]    \\
+ p(s-)\Bigg[-\sum\limits_{d \in D} p(d | s-) \log_{2}p(d | s-)\Bigg]

Note, in document code is corrected errors in equation too.


You can accomplish this with the align* environment, the fleqn and alignedleftspaceno options of amsmath, and a \@mathmargin of zero. To break a long equation, insert a split.

If you just want equations flush left without alignment points, you can use the lgather environment from mathtools.

The fleqn option should go to amsmath or whatever package loads it. You should only give it to the document class if you are using an AMS class, such as amsbook.

It sets equations left, with an indentation set by \@mathmargin. Setting it to 0pt gets you flush left.

\documentclass[12pt, letterpaper, notitlepage]{article}
\usepackage[fleqn, alignedleftspaceno]{amsmath}
  \usepackage{newtxtext, newtxmath}
  \defaultfontfeatures{Scale = MatchLowercase}
  \setmainfont[Scale = 1.0]{TeX Gyre Termes}
  \setmathfont{TeX Gyre Termes Math}

% Set the left margin used by fleqn to 0pt.


  \Entropy(\mathrm{D}) &= -\sum\limits_{d \in D} p(d) \log_{2}p(d) \\
  \intertext{Oh, and by the way:}
  \Entropy(\mathrm{S}) &=
     p(s+)\Bigg [ -\sum\limits_{d \in D} p(d | s+) \log_{2}p(d | s+)\Bigg ] \\
     &\hphantom{=} + p(s-)\Bigg [-\sum\limits_{d \in D} p(d | s-) \log_{2}p(d | s-)\Bigg ]

Equation sample

I took a few liberties, such as setting the math font to match Times, defining an operator \Entropy that works like \log or \sin, and changing \text (which matches the current formatting of the surrounding text) to \mathrm (upright letters in math mode).

The alignment of the second line of the split equation is very flexible. You can for example remove the \hphantom to align the + with the=` above, or add more space after it.

You must log in to answer this question.

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