Skip to content

Display math mode page break and paragraph indenting issue #2160

@Omikhleia

Description

@Omikhleia

Two related issues with SILE 0.15.5's implementation of display math mode:

  • page breaks may occur before or after a display math formula.
  • if the formula is in a paragraph, the next line is always paragraph indented

Example

We have:
\math[mode=display]{formula1}
hence:
\math[mode=display]{formula2.}

Obtained

(indent)We have:
        (potential page break here)
                     formula1
        (potential page break here)
(indent)hence:
        (potential page break here)
                     formula2
        (potential page break here)

Expected

(indent)We have:
        (no page break unless wanted)
                     formula1
        (potential page break here unless not wanted)
hence: (not indented)
        (no page break unless wanted)
                     formula2
        (potential page break here)

Main references

For reference, (La)TeX has finer control here:

  • predisplaypenalty (default 10000 = keep with previous lines)
  • postdisplaypenalty (default 0 = allow normal break; I remember tweaking it to negative for some personal preferences)
  • displaywidowpenalty (default 50)

It's less obvious than it might seem at a glance

  • In the current implementation, pre/postdisplaypenalty would be easy, but this is likely a wrong approach as....
  • ... displaywindowpenalty would required being at paragraphing (line node boxing),
  • ... and the noindent also need to know whether we are in the same paragraph or not.

Additional notes

SILE has math.displayskip.

TeX has:

  • abovedisplayskip / abovedisplayshortskip
  • belowdisplayskip / belowdisplayshortskip

These allow to have different skips before and after the equation.

More interestingly, the "short" version are used when the display equation would fit on the last paragraph line.

...hence:      formula2

Same challenge as above, this has implications on the line wrapping logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSoftware bug issue

    Type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions