gregorio-project / gregorio

The Gregorio Project
http://gregorio-project.github.io
Other
164 stars 43 forks source link

Spanning translation over multiple sylables can cause neum to skip to next line. #1570

Open sudobash1 opened 1 year ago

sudobash1 commented 1 year ago

I have been running into issues when spanning a translation over multiple syllables at the end of the line. Here is an example:

\documentclass[12pt]{article}
\usepackage{gregoriotex}

\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Linux Libertine O}

\pagestyle{empty}
\begin{document}

    % This has the issue
    \begin{minipage}{4in}
    \gabcsnippet{
        (c4) A<sc>l</sc>[Loving](c_0!ef/gh)ma[/](g.) *() Red[Redeemer's](g)em(g')ptó(h)ris[/](i') Ma[Mother,](j)ter,[/](g.) (;)
        quæ(e) pér[the open](e')vi(e)a[/](f') cæ[gate of heaven](e)li(d') por(e)ta[/](f')
    }
    \end{minipage}

    \vspace{5ex}

    % This doesn't
    \begin{minipage}{4in}
    \gabcsnippet{
        (c4) A<sc>l</sc>[Loving](c_0!ef/gh)ma[/](g.) *() Red[Redeemer's](g)em(g')ptó(h)ris[/](i') Ma[Mother,](j)ter,[/](g.) (;)
        quæ(e) pér[the open](e')vi[/](e)a(f') cæ[gate of heaven](e)li(d') por(e)ta[/](f')
    }
    \end{minipage}

\end{document}

There are two snippets of gabc (the start of the Alma Redemptoris Mater with translation.) The only difference is the translation for pervia. In the first, it is centered over the whole word and shows the issue. In the second it is only centered over pervi and does not have an issue.

Here is what it looks like when rendered:

image

I see this frequently when I try to span a translation over sylables which (without the translation) would be split across a linebreak. It causes the lyrics to stay on one line, but the neum jumps to the new system. But in this case (as can be seen in the second snippet), without the translation, everything would be on one line anyway.

I did this test on Linux with gregorio 6:

Gregorio 6.0.0 (kpathsea version 6.3.4).
Copyright (C) 2006-2021 Gregorio Project authors (see CONTRIBUTORS.md)
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
sudobash1 commented 1 year ago

Some further notes. I hadn't noticed before, but gregorio seems to be aware of the issue because it outputs a warning when rendering:

Module gregoriotex Warning: End of a translation centering area encountered on 
a
(gregoriotex)               line without translation centering beginning,
(gregoriotex)               skipping translation... on input line 189

Also, I have found two ways to mitigate this. One is to add an explicit line break after the a of pervia:

    \gabcsnippet{
        (c4) A<sc>l</sc>[Loving](c_0!ef/gh)ma[/](g.) *() Red[Redeemer's](g)em(g')ptó(h)ris[/](i') Ma[Mother,](j)ter,[/](g.) (;)
        quæ(e) pér[the open](e')vi(e)a[/](f'z) cæ[gate of heaven](e)li(d') por(e)ta[/](f')
    }

The other is to use <nbla> to prevent the line from breaking in the wrong location:

    \gabcsnippet{
        (c4) A<sc>l</sc>[Loving](c_0!ef/gh)ma[/](g.) *() Red[Redeemer's](g)em(g')ptó(h)ris[/](i') Ma[Mother,](j)ter,[/](g.) (;)
        quæ(e) <nlba>pér[the open](e')vi(e)a</nlba>[/](f') cæ[gate of heaven](e)li(d') por(e)ta[/](f')
    }