NABC in LaTeX?

20 views
Skip to first unread message

John Greutman

unread,
Feb 7, 2026, 4:30:56 PMFeb 7
to Gregorio Users
Hello,

Is there any way to include NABC in a document which I am compiling in LaTeX, that is, with the GABC code within the tex document itself, and not in separate GABC files? I would like to use \gabcsnippet, or something similar, if at all possible.

Thank you.

John Greutman

Laércio de Sousa

unread,
Feb 7, 2026, 5:45:10 PMFeb 7
to gregori...@googlegroups.com
I use the following:

\NewDocumentCommand{\sneume}{m}{%
  \begingroup%
  \gresetnabcfont{gregall}{12}%
  \GreNABCChar{#1}%
  \endgroup%
}

\NewDocumentCommand{\lneume}{m}{%
  \begingroup%
  \gresetnabcfont{grelaon}{12}%
  \GreNABCChar{#1}%
  \endgroup%
}

CANTATE DOMINO CANTICUM NOVUM
QUIA MIRABILIA FECIT

Laércio


--
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/fa250816-f55a-4750-88b5-e2e64fd61bban%40googlegroups.com.

Fr. Samuel Springuel

unread,
Feb 8, 2026, 1:46:37 PMFeb 8
to noreply-spamdigest via Gregorio Users
`\gabcsnippet` should work just fine with nabc neumes.

✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
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/CAFRdP%3DDcaEx7qje-g1tu-iVPZ_5bNh64rDPnBZo6-8v2MvFbBg%40mail.gmail.com.

John Greutman

unread,
Feb 8, 2026, 1:46:53 PMFeb 8
to Gregorio Users
Thank you, Laércio, but what I meant was in the context of musical scores (duplex editions of the chant). The above code is for putting the NABC elements in normal text, yes? I like to have all my GABC in the tex document using \gabcsnippet, that way I can make books without having hundreds of separate files for all the chants. I've also found this is a problem if I want my scores to have a different number of staff lines than the standard four. I've found no solution other than calling for the NABC (and differing staff line number) in the heading of a GABC file. But I wanted to check here before assuming it was the only way.

The above code is very handy though for another part of my project, so I will put that in my back pocket. Thank you!

John Greutman

unread,
Feb 10, 2026, 9:50:11 AM (13 days ago) Feb 10
to Gregorio Users
Fr. Samuel,

I am not having any success using \gabcsnippet. Perhaps there is something that I am missing in the code? Here is an MWE of what I am trying:

\documentclass{book}

\usepackage[autocompile]{gregoriotex}

\begin{document}

\gabcsnippet{(c4) test(fef|po)}

\end{document}

Fr. Samuel Springuel

unread,
Feb 10, 2026, 10:01:24 AM (13 days ago) Feb 10
to noreply-spamdigest via Gregorio Users
Oh, right. My mistake. Using nabc requires the `nabc-lines` header and that’s not available in `\gabcsnippet`. Currently the only way to use nabc in a score is with a separate file.

✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
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/d8da81f7-f29a-4100-8e0b-25b6ecf1006bn%40googlegroups.com.


John Greutman

unread,
Feb 10, 2026, 10:17:59 AM (13 days ago) Feb 10
to Gregorio Users
Oh well. Thank you for confirming this. I'm glad that it can at least be done in the gabc files, though it's a tad long-winded.

David Chiang

unread,
Feb 10, 2026, 11:33:43 AM (13 days ago) Feb 10
to Gregorio Users
The manual uses this little hack:

\long\def\nabcsnippet#1#2{%
  \directlua{gregoriotex.direct_gabc("\luaescapestring{\unexpanded\expandafter{#2}}",
                                     "nabc-lines:#1;", false)}%
}%

Then you can write something like:

\nabcsnippet{1}{text(g|pu)}

Or

\nabcsnippet{2}{text(g|pu|pu)}

John Greutman

unread,
Feb 10, 2026, 1:26:46 PM (13 days ago) Feb 10
to Gregorio Users
Thank you, David, that's tremendously helpful! Your last line of code for printing a second line of nabc doesn't seem to be working, but maybe two lines of nabc just isn't supported by gregorio yet? But I don't need to do double neumes for my current endeavor anyway, only St. Gall, so no matter. This will save me a huge amount of trouble!

Matthias Bry

unread,
Feb 10, 2026, 1:37:09 PM (13 days ago) Feb 10
to gregori...@googlegroups.com
\nabcsnippet{2}{text(g|pu|pu)} is not meant to print two lines of NABC, which is a feature that doesn't work yet in the stable version of gregorio.

text(g|pu|pu) encodes two lines of NABC, but only one line will be displayed. The displayed line is selected using \gresetnabc{1}{visible} \gresetnabc{2}{invisible} to display line 1 and not line 2, and vice versa.

John Greutman

unread,
Feb 10, 2026, 2:49:13 PM (13 days ago) Feb 10
to Gregorio Users
Ah, I see. Thanks!
Reply all
Reply to author
Forward
0 new messages