Conditional printing of sections of a gabc file.

20 views
Skip to first unread message

Rob Leduc

unread,
Feb 7, 2022, 11:56:14 AM2/7/22
to Gregorio Users

I'm wondering if there is a way to use macros or some other built-in Gregorio TeX feature to conditionally "turn on" or "turn off" sections of a gabc file so they do or do not appear.

For example, in some documents a particular chant may occur on several occasions (in my own work, one responsory appears 4 times).  Sometimes this is with or without an alleluia for Paschaltide, or with or without a Gloria Patri at ending, or some other seasonal variation.  Or maybe an antiphon is doubled and so printed both before and after a long psalm, but you only want to print the EUOUAE in the copy at the beginning and suppress it at the end.

If such a feature existed, one could keep the chant in a single file and maybe turn portions on or off by setting a TeX \if switch to true or false and testing for that within the tex macro within the gabc file to turn on or off printing of a group of syllables. So set \ifalleluia to true if you want the alleluia portion to print for Paschaltide or set \ifgloria to true to get the Gloria Patri to print.  

This would be desirable in large works to cut down on possible typos and discrepancies by having a single electronic version of something used in multiple locations.

I tried to do this with the "comment" package, but that is trying to use a blunderbuss.  Comment will treat everything between \begin{comment} and \end{comment} as if it were a comment (e.g. line starts with %); but since it is an environment, it quite predictably falls afoul of parenthesis grouping in the Gregorio TeX internals when I try to use it. 

My basic example (without even getting to adding any \if switches yet) is below.  I've ignorantly tried the macros at every level ([em1], [gm1],[nm1]) or with <v> tags and it's a no go.

Test.tex:
---------------
% !TEX TS-program = lualatex
\documentclass[12pt]{book}

\usepackage[autocompile]{gregoriotex}
\usepackage{comment}

\begin{document}

\gregorioscore{test1}

\end{document}

test1.gabc
--------------------
name:test;
def-m1:\begin{comment};
def-m2:\end{comment};
%%
% Hopefully only prints syllables on the note f without any weird extra spaces.
(c4) Test(f) this(f)  now([em1]h) and(h) hope(h) to([em2]f) continue(f) (::)

R. Padraic Springuel

unread,
Feb 8, 2022, 8:13:42 AM2/8/22
to gregori...@googlegroups.com
We don’t currently support this kind of sectioning, but it would make a reasonable feature request. 

✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️✝️
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey 
4501 South Dakota Ave, NE
Washington, DC, 20017

PAX ☧ ΧΡΙΣΤΟΣ

On Feb 7, 2022, at 11:56 AM, Rob Leduc <rled...@gmail.com> wrote:


--
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 on the web visit https://groups.google.com/d/msgid/gregorio-users/4fba1e2b-f5aa-40f2-9a34-2b42e7d33c50n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages