# how to make the in-line math equation as shown in the figure beautifully arranged in text?

When discussing and explaining some math equations, I sometimes prefer to use in-line equations (created by use $...$ in the text) in the text environment, as shown ONLY in the last two lines.

However, you have seen that the long in-line equation

$f(x_i,\eta_i,m)=|x_i|+\log(\frac{2}{\eta_i})(\frac{|x_i|}{3mp_i}+|x_i|\sqrt{(\frac{1}{3mp_i})^2+\frac{2}{\log(2/\eta_i)}(\frac{1}{mp_i}-\frac{1}{m})})$


is ugly arranged in text, with very big space. Do you have any method to let this in-line equation (automatically) have a norm space between each term, and at the same time, the extra part of this long equation can (automatically) start from the next line? Thanks in advance.

• If inline math takes more than one line, use display math. Note \shortintertext from mathtools. Dec 10 '15 at 16:08

Or set the sentence in a \raggedright (or \begin{flushleft}) as that is what you want it to do: allow lines to be short without stretching them to fit.