On 9-8-2012 20:53, Aditya Mahajan wrote:
On Thu, 9 Aug 2012, Sietse Brouwer wrote:
Steffen Wolfrum wrote:
them to break automatically ... is there a handy solution?
Aditya Mahajan wrote:
Short answer: No easy solution exists.
Is this because allowing automatic line breaks in math mode is itself hard to implement, or is the basic mechanism possible but preventing stupid/ugly breakpoints is hard? Because I can imagine a 70 percent solution being a big help already.
Partly both.
The question is not so much the difficulty in choosing break-points (which is easy: before all \mathbin atoms, after \mathpunct if needed, etc). The hard part is how to align the split up portions, and choosing different alignments changes the line widths, and therefore affect future line-breaks.
The old manual of breqn (the one by Michel Jones) had some discussion on the different alignment of display math. They are also explained nicely in the book on typesetting math by AMS (I forget the author's name).
In principle, one can follow the same approach as Knuth did for line-breaking text (define penalties and then solve a dynamic program to find the layout that gives the lowest score). The breqn package does implement such an algorithm that works well in most cases. I wish that the breqn algorithm were described somethere; then one could play around implementing it in luatex. Trying to read breqn code to understand the algorithm is very difficult.
When I'm done ceaning up the pending tex and lua code, I'll look into these issues. It's probably not that hard to come up with a solution in lua (one of the pet projects on my list). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------