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

Keep a group of lines together on a page #1024

Closed
ctrlcctrlv opened this issue Aug 12, 2020 · 10 comments
Closed

Keep a group of lines together on a page #1024

ctrlcctrlv opened this issue Aug 12, 2020 · 10 comments
Labels
duplicate Rejected as duplicate enhancement Software improvement or feature request question Ask for advice or investigate solutions

Comments

@ctrlcctrlv
Copy link
Member

Sorry if this is very stupid question, but I can't figure it out.

I have:

\define[command=line]{\novbreak\skip[height=5pt]\noindent\hrule[width=450pt,height=0.3pt]\par\novbreak\skip[height=5pt]}
\define[command=sup]{\raise[height=0.6ex]{\font[size=0.6em]{\process}}}
\hbox{
\line
\pullquote{Thank you so much Fr. Ferdinand Bajao for taking the time to explain so well Postma's greatest contribution in preserving and keeping alive the rich Mangyan cultural heritage---the extensive documentation of the Mangyan script, and not to mention the over 20,000 \em{ambahan} he documented and [which are] now preserved [in] the Library of Congress in D.C. In fact, the vowel killer which is called \em{pamudpod} in the \em{Surat Mangyan}  is not his invention. [It] was introduced in other writing systems as early as the 17\sup{th} or 18\sup{th} century for the Tagalog Baybayin. It was also used in the 900 \font[features=+c2sc]{AD} Laguna Copperplate Inscription, the oldest Philippine document, which was discovered after Postma introduced the \em{pamudpod}. Even in the Tagbanwa script, a vowel killer was also introduced. Postma believed that the use of the \em{pamudpod} is necessary to keep the script alive and the Mangyans approved this for instruction purposes. Postma did not alter the original script.} 
\line
}

The \hbox doesn't do what I expect though, it still ends up broken across two pages:

image

Is my only choice to put an \eject before it? But I want SILE to intelligently place it, not necessarily at top of next page.

What am I missing?

@alerque
Copy link
Member

alerque commented Aug 12, 2020

If \hbox doesn't even inhibit line breaks, why would inhibit page breaks?

There isn't an established mechanism for this yet. Yes there should be. It will probably follow naturally from being able to put stuff in vboxes.

For now you might check out how I worked with this in CaSILE using \requireSpace:

https://github.com/sile-typesetter/casile/blob/461b9f37533128ad0d9b4784d5f9a242e13bca84/casile.lua#L671-L681

Using this you can make sure ahead of time that you have room for the content you're thinking about putting there and break only if it's not going to all fit. If you really needed to you could pretend to typeset the content in a virtual frame, measure it's height, then ditch the typesetter and use the measured height to check for space.

@alerque alerque changed the title How to keep lines together? Keep a group of lines together on a page Aug 12, 2020
@alerque alerque added the enhancement Software improvement or feature request label Aug 12, 2020
@ctrlcctrlv
Copy link
Member Author

If \hbox doesn't even inhibit line breaks

🤔💭💻⌨️🆗⌛😱

"Today I learned", as the kids say.

@ctrlcctrlv
Copy link
Member Author

@alerque Hmm, I tried replacing my \hbox with \requireSpace, then \requireSpace[height=40%ph] and finally \requireSpace[height=80%ph] as a test, and they don't do what I want. The first two have no discernible impact on the document, the last just draws the bottom line only on the next page. 🤔

@alerque
Copy link
Member

alerque commented Aug 12, 2020

You are still thinking in TeX — which depending on circumstances can actually leave horizontal mode, enter vertical mode, and start a new paragraph to insert something that is ostensibly explicitly a "horizontal box". Because that makes sense.

@ctrlcctrlv
Copy link
Member Author

Oh I see, you're trying to tell me to put the \requireSpace before the content, not wrapping it.

@Omikhleia
Copy link
Member

Unless this is heavily clarified, this should be closed/rejected.

two ways of avoiding breaks:

  • penalties
  • wrapping the content is an hbox (via parboxing or any other similar concept)

I don't see how else this issue should be tackled with (maybe it's just unclear) other than using existing solutions.

@alerque
Copy link
Member

alerque commented Dec 16, 2021

@ctrlcctrlv Is part of the problem here that we don't have an easy to use equivalent of LaTeX's \mbox?

@Omikhleia I think we need some sort of "minipage" equivalent that handles what you are calling parboxing more gracefully than having to understand the interaction between vboxes and hboxes.

@ctrlcctrlv
Copy link
Member Author

That's correct, the problem is really lack of a way to inhibit page breaks as an \mbox would do~

@Omikhleia
Copy link
Member

For the record, my own parbox stuff (https://github.com/Omikhleia/omikhleia-sile-packages/blob/main/packages/parbox.lua) does something like that (which I then use in my table package). Still, it's not really related to page breaking, and has other side effects regarding it (which might or might not be acceptable, e.g. vertical stretchability is somewhat cancelled).

LaTeX does distinguish the "minipage" and the "parbox", while quite similar, in subtle ways (e.g. see https://tex.stackexchange.com/questions/6472/parbox-vs-minipage-differences-in-applicability) but I have not dabbled so deep into trying to understand it.

@Omikhleia Omikhleia added the question Ask for advice or investigate solutions label Mar 26, 2023
@Omikhleia
Copy link
Member

I am to closing this "old" issue:

  • Support vbox[width=...] #367 could be the proper way eventually (I'll annotate it later)
  • In the meantime, as stated above, it can be answered via a 3rd-party package from the SILE ecosystem = parbox package from ptable.sile, which is a possible way to wrap vboxes into an hbox

@Omikhleia Omikhleia closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2023
@Omikhleia Omikhleia added the duplicate Rejected as duplicate label Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Rejected as duplicate enhancement Software improvement or feature request question Ask for advice or investigate solutions
Projects
Development

Successfully merging a pull request may close this issue.

3 participants