projectLEMDO / lemdoIssues

Repository for LEMDO issue tracking and related documents.
MIT License
1 stars 0 forks source link

PDF: Scene headers should not be orphaned #260

Open martindholmes opened 2 months ago

martindholmes commented 2 months ago

This is a straightforward bug raised by @JackWilton1594: In AHDM there are examples of scene headers appearing at the bottom of pages. In XSL:FO this is a simple fix, but it seems a little more complicated in LaTeX, so it might take a little while to solve. One option would be to always have page-breaks between scenes, but that might cost too much in wasted paper for plays with lots of short scenes.

martindholmes commented 2 months ago

I've added the following to try to constrain this:

% We attempt to avoid widows and orphans.
\widowpenalty=10000
\clubpenalty=10000

But it's not clear whether this will act effectively on headers or (for instance) trailing SDs. We'll have to look out for individual instances and perhaps devise interventions on a case-by-case basis. Revision of any preceding text or footnote will change the outcome for everything subsequent to it, so it's not worth worrying too much about this till the final stage of proofing.

JanelleJenstad commented 2 months ago

This is probably the same issue. There are <speaker> elements appearing at the bottom of pages with the text of the dialogue beginning on the next page. For example in scene 7 of AHDM:

image

Please work your magic!

B

JanelleJenstad commented 2 months ago

Scene 11 on p. 61 of the PDF is still orphaned.

martindholmes commented 2 months ago

I don't know that this is going to be easy at all in LaTeX. In XSL:FO you have nice keep-together settings that can fix this, but LaTeX seems to do everything in a sort of statistically-based best-effort sort of way, which, combined with the similar necessity to handle footnotes at the same time, is bound to result in this sort of thing. I will do more research on this, and perhaps DA can help, too -- she's familiar with LaTeX.

EDIT: I found something that may help. Just setting up to try it now.

martindholmes commented 2 months ago

Nope, didn't work. The command \nopagebreak should prevent this, but it isn't working; I wonder if it's because of footnotes, since there is in fact no page break right after the scene header, because there are footnotes. Have to do more research here. But I do see a lot of people suggesting that manual intervention may be required when you're at the final proofing stage, just like in the old days with typeset books. :-(

martindholmes commented 2 months ago

I've been working on the combination of \needspace, \nopagebreak\, and \\* (linebreak but not pagebreak), and (possibly just by happy accident) we no longer have any instances of orphan scene headers in AHDM. However, there are still cases of orphaned speech prefixes.

martindholmes commented 2 months ago

I think I've reduced these instances to a minimum, but the penalty is that some pages have more whitespace than you would want to see. Essentially I've had to specify that a speech needs a minimum of five lines worth of vertical space, and if that can't happen, a page break should be inserted before it. There may still be some occasional cases where a page happens to have a very large collection of footnotes. I don't think there's an ideal solution to this.