# Multi-line equations in latex

Is there anyway to write multi-line equations in latex automatically, I mean without using line break or other manually breaking lines. is it possible to tell latex to begin with the next line when the first line reached the edge of the right margin of your page?

You could use the breqn package for that, BUT...

The following example is taken from the breqn manual:

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{breqn}
\begin{document}
Replace $j$ by $h-j$ and by $k-j$ in these sums to get [cf.~(26)]
\begin{dmath}[label={sna74}]
\frac{1}{6} \left(\sigma(k,h,0) +\frac{3(h-1)}{h}\right)
+\frac{1}{6} \left(\sigma(h,k,0) +\frac{3(k-1)}{k}\right)
=\frac{1}{6} \left(\frac{h}{k} +\frac{k}{h} +\frac{1}{hk}\right)
+\frac{1}{2} -\frac{1}{2h} -\frac{1}{2k},
\end{dmath}
which is equivalent to the desired result.
\end{document}