Daniel-Diaz / HaTeX

The Haskell LaTeX library.
BSD 3-Clause "New" or "Revised" License
199 stars 46 forks source link

How to emit \nopagebreak? #128

Closed peti closed 5 years ago

peti commented 5 years ago

HaTeX offers nopagebreak, which requires an optional parameter n that's formatted as:

\nopagebreak[n]

However, I need

\nopagebreak

which requires that the page isn't broken here, whereas the argument-variant of the command encodes a weighed recommendation.

I tried nopagebreak mempty, but the resulting \nopagebreak[] is a syntax error according to LaTeX.

Now, how do I get the parameter-less command (other than comm0 "nopagebreak" that is, which I am using right now as a workaround)?

Daniel-Diaz commented 5 years ago

I think this is a bug in nopagebreak. If the parameter is optional, it should have type Maybe l and not l. Right now it is forcing you to provide it.

Daniel-Diaz commented 5 years ago

I changed the type of nopagebreak to make it actually optional in https://github.com/Daniel-Diaz/HaTeX/commit/fefafd75ee9ae070e3e5cd12b50af5741445a7d3. This is however a breaking change and will require a mejor version bump.

peti commented 5 years ago

@Daniel-Diaz, I would suggest making the exact same change to \pagebreak, too.

Daniel-Diaz commented 5 years ago

@peti Yes, you are right.