Is there a way to allow long math expressions to break automatically, whenever (and only) in situations where they extend beyond the body text of a document?
For example, I would like something like the following to break over two lines if (and only if) it finds itself in a narrow column of text (say, if <class> is IEEEtran), but otherwise remain on a single line (if, for example <class> is article), as long as it fits within a single (wider) column.
\documentclass{article}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\[
\hat{S}=\sum_{l\in\left\{ 1,\ldots L\right\} }\left[\bigl[1\!-\! f_{p}(l\!+\!1)\bigr]\;\overline{w}(l-1)\;\biggl[\,\prod_{i=0}^{l-1}\; f_{p}(i)\;\,\overline{\! N}(i)\biggr]\;\hat{H}_{S}(l-1)\right]
\]
\lipsum[2]
\end{document}

breqnpackage aims to do this... – cmhughes Mar 17 '12 at 19:14breqnsounds a bit disruptive)? – raxacoricofallapatorius Mar 17 '12 at 19:26\[ to be\begin{dmath}` to usebreqn. Is there a way to do that? – raxacoricofallapatorius Mar 17 '12 at 23:42breqnrather than trying to implement that algorithm on your own. – Aditya Mar 18 '12 at 1:02\let\[\dmath \let\]\enddmath. – Aditya Mar 18 '12 at 3:36