Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve automatic widow/club control #1752

Closed
tkoeppe opened this issue Sep 23, 2017 · 7 comments
Closed

Improve automatic widow/club control #1752

tkoeppe opened this issue Sep 23, 2017 · 7 comments

Comments

@tkoeppe
Copy link
Contributor

tkoeppe commented Sep 23, 2017

Specifically, we seem to have orphaned headings (\rSecs) and orphaned \itemdecls that we should prevent automatically. I think we should generally never have a page break between an \itemdecl and its associated \itemdescr (though I could be persuaded to tolerate a page break within a long \itemdecl containing multiple declarations).

The headings are even more confusing; currently it seems that LaTeX sometimes really wants to keep a few lines of the preceding parapgraph together with a heading, and only a manual \newpage achieves the appropriate break.

We should revise or add appropriate penalties to make this work.

@jensmaurer
Copy link
Member

I've tried \nopagebreak in the definitions of \itemdecl and \itemdescr, but to no avail (i.e. no effect shows up). It appears I can relax the page break penalty before \itemdecl, but that just causes lone headings. And the end of the \lstnewenvironment seems particularly hostile to adding a \nopagebreak.

Ah, suggesting a \pagebreak at the end of an \itemdescr seems to do some good.

@jensmaurer
Copy link
Member

Re: suggesting a \pagebreak at the end of an \itemdescr seems to do some good

Not so, it just makes index entries have off-by-one errors in the page number, apparently when the \itemdecl is preceded by \index stuff.

@jensmaurer
Copy link
Member

After some further experimentation, it seems we should enable \raggedbottom. For example, \itemdescr uses the indenthelper environment, which seems to have nearly zero stretchable vertical space. (I'm actually wondering why we're using that particular path to indent an area of text.)

My theory is that with zero vertical stretchable space, we often run into the situation that there are several page break scenarios that are all infinitely bad, so TeX picks a random scenario (which could mean a lone section heading at the bottom of a page).

@tkoeppe: Any opinions on \raggedbottom?

@jensmaurer
Copy link
Member

https://tex.stackexchange.com/questions/35933/indenting-a-whole-paragraph
has ideas on indenting text, the simplest of which changes \leftskip (idea: put that into the "indented" environment).

@tkoeppe
Copy link
Contributor Author

tkoeppe commented Oct 7, 2017

@jensmaurer: I thought raggedbottom is the default. What are we currently using?

@jensmaurer
Copy link
Member

@tkoeppe: There is no explicit \raggedbottom or \flushbottom in the source.
Maybe the key is this trick: \addtolength{\topskip}{0pt plus 20pt} which tells the middle-layer page layout algorithm that not entirely filling the page is ok. Claims are \raggedbottom alone doesn't help here, because it is consider too late in the process.

jensmaurer added a commit to jensmaurer/draft that referenced this issue Oct 9, 2017
Strongly discourage breaking between itemdecl and itemdescr.
Mildly discourage breaking before an itemized list.
Add stretchable vertical space between paragraphs and before listings.
Allow substantial whitespace at the end of a page.

Fixes cplusplus#1752.
@jensmaurer
Copy link
Member

It appears we need to allow a bit of vertical stretching between paragraphs: \setlength{\parskip}{1ex plus 1pt} (the Latex default is "0pt plus 1pt", it seems).
It seems the only stretchable space we have is around headings, which is not enough to make Latex happy. Also, we need to nudge Latex into allowing more empty space at the bottom for \raggedbottom.

jensmaurer added a commit to jensmaurer/draft that referenced this issue Oct 9, 2017
Strongly discourage breaking between itemdecl and itemdescr.
Mildly discourage breaking before an itemized list.
Add stretchable vertical space between paragraphs and before listings.
Allow substantial whitespace at the end of a page.

Fixes cplusplus#1752.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants