Skip to content

Incorrect eolshift for mid-syllable line break #1738

Open

Description

@davidweichiang

If a forced line break occurs in the middle of a syllable, then the full syllable's enddifference is used to compute the eolshift. This can cause the text to be shifted into the margin.

\gresetinitiallines{0}
\begin{minipage}{3in}
  \gabcsnippet{a(g) abbbbbbbbbb(gzggggg)}
\end{minipage}
Image

Activity

  1. davidweichiang commented on May 3, 2026

    @davidweichiang
    ContributorAuthor

    I’m kind of hoping that the answer to this one is that no one ever uses a line break in the middle of a syllable.

  2. rpspringuel commented on May 3, 2026

    @rpspringuel
    Contributor

    Line breaks can occur in the middle of a syllable, usually because there's a significant melisma on the syllable. Take https://gregobase.selapa.net/chant.php?id=1365 as an example. Three syllables are long enough that automatic line breaks are introduced into them. I can fully imagine someone deciding they don't like where Gregorio has placed the line breaks and introducing their own forced breaks instead. The spot where "tur" is broken, for instance. Someone might prefer to break it at the divisio minima rathe than where it's broken automatically.

  3. davidweichiang commented on May 4, 2026

    @davidweichiang
    ContributorAuthor

    That makes sense.

    Additionally, a natural line break can occur at \GreEndOfElement, and a similar problem can occur:

    \gresetinitiallines{0}
    \begin{minipage}{3in}
    \gabcsnippet{(gggggggggggggggggggggggggg) abbbbbbbbbb(ggggg//ggggg)}
    \end{minipage}
    
    Image
  4. davidweichiang commented on May 5, 2026

    @davidweichiang
    ContributorAuthor

    So my new understanding of this is:

    Line breaks can occur in three places:

    • at the end of a syllable: the break is preceded by eolshift (to keep text from overflowing into margin) and is followed by bolshift (to align first note of each line).
    • forced line breaks: preceded by eolshift but not followed by bolshift. If the break occurs mid-syllable, the eolshift is based on the wrong enddifference.
    • at the end of an element: the break is not preceded by eolshift and not followed by bolshift.

    All three kinds of line breaks should call a common macro, say \gre@maybenewline{#1} where #1 is a penalty, which inserts the eolshift, penalty, and bolshift. The sizes of both shifts can be calculated in Lua in the pre-linebreak filter.

  5. rpspringuel commented on May 5, 2026

    @rpspringuel
    Contributor

    Mostly. There are some elements which are allowed to protrude into the margin and the eolshift has to take that into account. Look for "protrusion" in the code base.

  6. davidweichiang commented on May 5, 2026

    @davidweichiang
    ContributorAuthor

    I should have clarified, the last paragraph is what I think the right behavior is and will try to implement at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions