Table of Contents

Using Macros in gabc

You can use tex macros right in your gabc scores. Here is why you would want to do that:

In your gabc header, you use the macro definition.

def-m1:\yourmacro;

That all sounds like a lot, but it's not so bad. So, to summarize:

  1. Define your macro in the header: ``def-m1:\yourmacro``
  2. Use the prefix to execute the macro: ``em1``
  3. Put the macro in brackets: ``[em1]``
  4. Then put it inside your chant notes: ``my(g) chant(h[em1])``

Example 1: Suppress the Custos

For our example, let's pretend you want to suppress the automatic custos for just a single staff, and then allow it again.

You place this in the gabc header.

name:Suppress the Custos;
def-m1:\greblockcustos;
def-m2:\greblockcusto=0;
%%
(c4)Your(g) chant(g) go(h)eth(h) here.(f) (::)(Z)
<c>1.</c> Some(g) chant(g) on(e) this(e) line(f) (::Z)
<c>2.</c> A(g) line(g) with(e) the(e) cus(f)tos(f) sup(h)pressed.(h) (::Z[em1])
<c>3.</c> Turn(g[em2]) on(g) the(e) cus(f)tos(g) a(g)gain.(g) (::Z) 
<c>4.</c> One(g) more(g) line(e) of(h) chant(h) so(h) the(g) pre(g)vi(g)ous(g) line(h) will(h) get(h) a(h) cus(i)tos(i) (::)

And, once you've suppressed your custos, you can manually add it just after the double bars by putting a ``h+`` or ``g+`` after your double-bars (``::``).


Example 2: Make it Green

In this example, we'll make a section of the chant green! If you just want red, you can surround your gabc notes with ``<c>…</c>``, but if you want green, you'll have to use a macro.

name:Make It Green;
def-m1:\color{green};
def-m2:\color{black};
%%
(c4)Your(g) chant(g) go(h)eth(h) here.(f) (::)
([em1])This(g) section(g) will(e) be(e) green(f) ([em2]::)
Turn(g) on(g) the(e) black(f) col(g)or(g) a(g)gain.(g) (::)

|You can also read the tutorial on the Gregorio website.

Back to Start Page