This question already has an answer here:

When using C++, I already became somewhat dependent on clang-format which uses Dijkstra's algorithm (like LaTeX) to tune the whitespace in C++ code. It is amazing, I am not looking back to doing this manually.

LaTeX uses the Dijkstra algorithm every since and the results are gorgeous. The thing that I still have to do is breaking my equations per hand. I do this with align and \\ & \quad usually. Now I was wondering: Could the equations be broken/wrapped automatically with some similar approach?

The obvious problem is that mathematical formulas do not have a rigorous grammar like C++. For instance, there is no clear distinction whether $H(t - t_0)$ is a function $H$ evaluated at the time difference or whether this is just a multiplication. Perhaps one can just break equations at a top-level plus sign or break parentheses over multiple lines.

Is there something out there already that could break equations dynamically depending on \linewidth?

marked as duplicate by Andrew Swann, Bobyandbob, CarLaTeX, Kurt, Zarko Nov 13 '17 at 10:46

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.

  • breqn? or you meant regardless from \linewidth? – SAM Jul 7 '16 at 21:16
  • Looks promising! I will look into that. – Martin Ueding Jul 7 '16 at 21:53

Browse other questions tagged or ask your own question.