kieranclancy / isv_tex

A project to typeset the ISV translation of the Bible using LaTeX
Other
8 stars 4 forks source link

notex branch: paragraphs are not optimally laid out #59

Open gardners opened 9 years ago

gardners commented 9 years ago

Paragraphs need to have line-breaks determined using a dynamic programming algorithm that also allows the definition of arbitrary penalties for various things.

gardners commented 9 years ago

The first step is to capture each paragraph as a single line. parse_tex converts end of lines to paragraph markers or spaces, so all that is needed is to prevent line-breaking when accumulating lines.

(A complication that is not problematic is when justification changes in a paragraph, which results in a forced line-break, e.g., when switching from prose to poetry. This isn't a problem, because the poetry lines need to be laid out separately. In other words, the non-broken lines in a paragraph represent the correct entity level to work on to optimise layout.)

Once each of these "long lines" are obtained, they can be analysed using a dynamic programming algorithm to find the optimal solution for line-break positions, including arbitrary costs applied to the various putative line breaks.