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