Score Title

10 views
Skip to first unread message

Justin Davis

unread,
Jul 5, 2025, 1:46:06 PMJul 5
to Gregorio Users
Hello,

Is there a way to anchor a text element, specifically a score title, to the top of a gabc score so that LaTeX does not break the page between that text element and the gregorio score? 

The minimal working example I include below is attempting to always print the Psalm # centered above the psalm pointed in gabc notation, breaking the page before the psalm #, when necessary. The \psalm command here, making use of the needspace package works well in other cases when it does not proceed a score. However, I cannot determine a length or other LaTeX command that will always prevent the psalm title from being orphaned at the bottom of a page and the score beginning at the top of a page. 

Considering Gregorio elements: I do not see a way to automatically center <alt> text above the score or a way to modify the commentary field so that it centers over the score rather than appearing flush right. Is there perhaps a workaround there? 

________________________

\documentclass[11pt]{book}

\usepackage[inner=0.65in, outer=0.35in, top=0.5in, bottom=0.5in, papersize={6in,9in}, head=12pt, headheight=30pt, headsep=5pt]{geometry}

\usepackage{libertine}
\usepackage[autocompile]{gregoriotex}
\usepackage{fontspec}
\usepackage{needspace}
\usepackage[dvipsnames]{xcolor}
\definecolor{red}{RGB}{229,53,44}

\newcommand{\psalm}[1]{%
\Needspace*{3\baselineskip}%
{\centering%
\hyphenpenalty=50\textcolor{red}{\it{#1}}\par%
}%
\nopagebreak%
}%

\begin{document}

\psalm{Psalmus 50.}

\gabcsnippet{
(c3)
MI(i)se(hi)ré(i)re(i) <i>me(h)i,</i>(i) <b>De</b>(j////ir)us,(i.) <c>*</c>(:) se(i)cún(i)dum(i) ma(i)gnam(i) mi(i)se(i)ri(i)<i>cór(h)di(i)am</i>(j) <b>tu</b>(h////fr)am.(f.) (::)
}

\end{document}

_________________________________________

Regards,
-Justin

Matthias Bry

unread,
Jul 5, 2025, 2:02:27 PMJul 5
to gregori...@googlegroups.com
The way I do it is to \needspace the height of two \baselineskip (for the title and a blank line) plus two lines of gregorio score (that can be only one line if your incipits are one line at most).

It is finnicky and frustrating.

--
Gregorio homepage: http://gregorio-project.github.io
Archives for the old mailing list: http://www.mail-archive.com/gregori...@gna.org/
To report a bug, please post to: https://github.com/gregorio-project/gregorio/issues
---
You received this message because you are subscribed to the Google Groups "Gregorio Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gregorio-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/gregorio-users/99579157-c0f3-425f-a2aa-502a844c892en%40googlegroups.com.

Fr. Samuel Springuel

unread,
Jul 5, 2025, 2:57:15 PMJul 5
to noreply-spamdigest via Gregorio Users
Take a look here: https://tex.stackexchange.com/a/86167

That answer provides a good overview of the options for indicating where the preferable break location is. Most of the options insert a penalty (of various strengths), which if suitably high enough, should make the break before the psalm title preferred over the one between it and the score.

The other answer on that question has the more LaTeX solution, but the answer I linked to directly gives you more options because it is TeX.

✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ
> To view this discussion visit https://groups.google.com/d/msgid/gregorio-users/CA%2BKjmK3R1Rzv4PxhjXNQCq-QdPNP-822_OmSpRO%2BE63DQDCbSg%40mail.gmail.com.

Justin Davis

unread,
Jul 10, 2025, 7:54:48 AMJul 10
to Gregorio Users
The problem seems to be resolved by adding a paragraph penalty. It was also necessary to move the \index tags that had been placed on the line below the \psalm command to the line above it.
________________________________________________
\newcommand{\psalm}[1]{%
\par\penalty-500

\Needspace*{3\baselineskip}%
{\centering%
\hyphenpenalty=50\textcolor{red}{\it{#1}}\par%
}%
\nopagebreak%
}%
________________________________________________

Many thanks!
-Justin

Reply all
Reply to author
Forward
0 new messages