This question already has an answer here:

If an equitation like $1 + 2 + 3 + 4 + 5$ doesn't fit to the line it's continued at the next line. But $1, 2, 3, 4, 5$ is extended to page margins and then cropped. What is wrong with it?

marked as duplicate by Werner equations Oct 12 '16 at 20:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • inline math only breaks at binary relations and operators. You can add \linebreak or \linebreak[1] to force or hint breaking places – David Carlisle Oct 12 '16 at 19:42
  • @DavidCarlisle, is it any way to allow breaking on spaces? – Pavel Oct 12 '16 at 19:45
  • 3
    there's always a way but I wouldn't do it, it would be bound to break other things, the convention that white space is almost completely ignored in math mode runs very deep into TeX, you could allow breaking at comma but then (1,2) would break, or if the commas are part of the sentence not the math then $1$, $2$, $3$ allows breaking at the spaces of course. – David Carlisle Oct 12 '16 at 19:54

Browse other questions tagged or ask your own question.