-
Notifications
You must be signed in to change notification settings - Fork 210
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
LaTeX: make it less likely to page break following solution-like heading #2199
base: master
Are you sure you want to change the base?
Conversation
Like the sentiment here. I'd say 'hint' and 'answer' are equally deserving. Maybe this does that? I do not like anything using 'makeatletter' even in preamble. But certainly not hundreds of times in source. Aren't there macros that have like a 1,2,3,4 argument for aggresiveness? Many things (like comments) contribute to 'position()'. Best avoided. Or build a list of desired elements, and use a 'for-each' to change context. |
Yes, "solution-like" encompasses hint and answer.
I'll look into this.
If the select is on |
Can we bury |
I don't have an opinion on how this is implemented, but I'd like to point out another case that should be included here: If an Exercise group. Compute the derivative of the following functions. And then the exercises follow on the next page. That heading and instruction should move over to the next page with the exercises it refers to. |
@sean-fitzpatrick - can you experiment with manually inserting a |
Things I learned earlier. We have whatever commands we use to print a title, and then whatever environment we open for whatever comes next. And you might think that putting a This is what led me to the basic idea here, to temporarily change the penalty for a page break. And then that applies to all the opportunities for a page break, including the "hidden" ones. |
@Alex-Jordan it sounds like you already know what will be the result of the experiment suggested by @rbeezer ? I'm also wondering how hard it would be to adjust the pagebreak penalty for environments like theorem, definition, etc. Example use case: a Definition takes 12 lines of text, and the pagebreak occurs on line 11, stranding the last line of the definition on the next page. I don't think this should happen. I can fix it using an |
Science experiments should be reproducible! :) I don't mean to discourage you trying, and maybe things are different with an exercisegroup than with a solution like I originally investigated. |
I'll give it a try. Since he recently tackled some other LaTeX subtleties, I wonder if @jjrsylvestre has any insight on this? |
Changing the first line to
did the trick: the exercise group title and introduction move to the next page. |
If we wanted this change universally, I think changing line 5594 of |
I can confirm that although (Of course I can put a pagebreak before the solution title, but that can't be automated.) |
In LaTeX/PDF. This is a proposal for your consideration.
Sometimes the first piece of content following a solution-like heading is something that naturally uses a
\par
before getting started. Examples of this would be like when a solution immediately goes into a list or a tabular. When that happens, the heading (like "Solution") could be at the bottom of a page, and then there is a page break before you get to the first piece of content for that solution. Here is a screenshot where "Solution" has been renamed to "Explanation", and you can see such a header at the bottom.This PR proposes increasing the page break penalty in as minimal a way I could think of, so that it's less likely to have a page break in between the solution-like heading and the first piece of content. After this PR, it looks like:
The verso page now looks like: