Gregorio/LaTeX - Trim empty staff at end of line?
  • Gregorian
    Posts: 7
    Hello all,

    I am trying to typeset a variety of Gregorian chant texts and want to have the staff lines terminate at the final double bar line of a piece. An example of the current behaviour is attached, with empty staff lines extending all the way to the end of that line on the page. I want to cut that empty section of staff off.

    After searching all over the internet I haven't found a solution.

    Does anyone know how I might control this behaviour so that there are no excess staff lines generated beyond the final double bar line?
    latex query.png
    987 x 580 - 57K
  • MatthewRoth
    Posts: 2,744
    I wish that there was a way to do this easily. If you already know that it won’t break a page, then a minipage is the way to go but that will not flow to the next page like a normal score ought to do. It will be moved without breaking on the mini page.

    But in this case now that I have switched to desktop: I see that it’s the bottom line of a multiple-line score. It’s convention to leave that and the way to get rid of it is editing the PDF afterwards.
  • smvanroodesmvanroode
    Posts: 1,038
    I have no solution to offer; it might be possible and maybe someone else knows how to do this.

    However, in chant editions, this is usually not done. Take a look at the books from Solesmes: empty staff lines always extend to the end.
  • francis
    Posts: 11,013
    If you are including the engraving in a page layout app you can put a white box over the empty staff.
  • Gregorian
    Posts: 7
    That's very frustrating, I would have thought that there were some sort of commands that controlled how the length of the staff is created... perhaps not, or at least not easily accessible to the user.
    Thanks Matthew, the minipage approach may work for me, since in most cases I expect that the chant won't need to cross a page break - will let you know whether it works.

    Having said that, I am setting up this document as a template to typeset a lot of extracts of chant for booklets etc., so if anyone knows a laborious way of doing it that is robust and reproducible, I am still all ears because I will only need to set it up once.

    I am aware that typically the empty staff lines extend to the end (as in the Liber), however I am trying to do this for some specific cases.
    One of those cases is a standalone intonation line as shown in the attached example (I didn't typeset this). There are other cases though, mainly for the sake of formatting booklets and being able to place other elements next to a line of chant that does not take up the whole width. Placing white boxes over these would be quite labour intensive, hence I'm trying to automate this with LaTeX... Thanks for your help though everyone, much appreciated.
    latex query 2.png
    1528 x 347 - 30K
  • MatthewRoth
    Posts: 2,744
    Right. They are trimmed in the Liber in some cases. I think that we could probably get some examples and open an issue in the repo.
  • Gregorian
    Posts: 7
    That sounds like a plan.

    I did try using the minipage option that you recommended (attached). It does work, but is still a manual process as I have to tweak the width of the minipage to get it right (which is different for every chant). So it gives me a baseline approach, for which I am very grateful.

    However, I would be very keen to get an issue opened in the repo in an effort to have a robust solution developed. Ideally there should be a method by which LaTeX/gregorio would be able to detect the location of the double bar line and the fact that there are no neumes after it and trim empty staff lines accordingly.

    How is getting an issue opened like this usually approached/what do I need to do to assist with this?
    latex query 3.png
    1098 x 723 - 69K
  • a_f_hawkins
    Posts: 3,538
    End of line

    The end of line is automatically determined by the GregorioTeX. However, under some circumstances it can be useful for you to specify it because it improves the rendering. To force an end of line at the end of a syllable put z inside parentheses after the notes. If you want your line to end without being justified, use Z instead.

    You can also prevent a line break from occurring within a group of syllables by using the “no line break area” tags (). The opening tag should be placed before the lyrics at the start of the group and the closing tag after the lyrics at the end of the group: these(g) words(g) will(h) not(h) be(g) split(g)
    Thanked by 1CHGiffen
  • Gregorian
    Posts: 7
    Thanks a_f_hawkins, but use of Z or z makes no difference in this case. The issue is not with the ending of the text/neumes, it's a problem with the staff lines continuing too far and the end of line makes no difference to it.
  • joerg
    Posts: 139
    You could add the following lines to your tex file:

    \let\GreFinalDivisioFinalissav=\GreFinalDivisioFinalis%
    \def\GreFinalDivisioFinalis{%
    \GreFinalDivisioFinalissav{}%
    \pdfextension literal direct{q 1 g}%
    \rlap{\vrule width \hsize height 2cm}%
    \pdfextension literal direct{Q}%
    }%


    This prints a white box next to the final double bar hiding the staff lines.
    Thanked by 1CHGiffen
  • francis
    Posts: 11,013
    @joerg

    There you go… a simple left brain solution to the white box.
  • Gregorian
    Posts: 7
    Thanks @joerg, that's a good idea for a hack solution. Do you have any examples that I could look at for how you use this? (Still quite green with Gregorio, so would be handy to see an example).
  • joerg
    Posts: 139
    I would write a file Lectio.tex with the following content:


    \input gregoriotex

    \let\GreFinalDivisioFinalissav=\GreFinalDivisioFinalis%
    \def\GreFinalDivisioFinalis{%
    \GreFinalDivisioFinalissav{}%
    \pdfextension literal direct{q 1 g}%
    \rlap{\vrule width \hsize height 2cm}%
    \pdfextension literal direct{Q}%
    }%

    \gabcsnippet{
    (c3) Lec(h)ti(h)o(h) E(h)pi(h)sto(h)lae(h) be(h)a(h)ti(f) Pau(h)li(g) A(g)po(g)sto(h)li(h.) (,) ad(hi) Ro(g)ma(f.)nos(g.) (::)
    }
    \bye


    Then calling "luatex Lectio" from the command line would give me the required output Lectio.pdf

    I suppose you are using LaTeX; then you would have to add the usual \begin{document} etc.
    (That's almost all I know about LaTeX, so I can't help with this part)
    Thanked by 1CHGiffen