7

Writing up a piece for guitar I'm not happy with the common strumming tabulature 'stroke up' and 'stroke down' symbols (^\downbow, ^\upbow) and want to replace them with up- and down arrow heads. In itself not a problem,

^\markup { \arrow-head #Y #DOWN ##f } adjacent to the note at hand would do the trick but is a lot of repeated text.

e''8^\markup { \arrow-head #Y #DOWN ##f } fis''8 d'8 d''8 for instance gives:

arrow head down, no macro

So I found a page describing new markup definitions and wrote the following:

#(define-markup-command (arrup layout props text) (markup?)
  "Draw a arrow head down (guitar pick stroke-up)."
  (interpret-markup layout props
    #{\markup { \arrow-head #Y #UP ##f } #}))

Then tried to apply it

e''8^\markup { \arrow-head #Y #DOWN ##f } fis''^\markup \arrup d'8 d''8, which resulted in: arrow head down-up with macro

It's clear that the arrow-up is drawn, but the next following note (d') is gone.

How do I correct this please?

1 Answer 1

5

The problem is very simple: in the first line of the definition, you have

#(define-markup-command (arrup layout props text) (markup?)

The words in the first set of parentheses are the function name and its arguments. Here you declare that it will have three (layout, props and text). The first two are supplied automatically, and the third one is "free". So you declare this to be a markup function with one parameter. The next list (markup?) gives a list of "types" for the free parameters (here for the parameter text); in this case, it says that the function markup?, upon being called with the parameter, needs to return #t.

So after writing \markup \arrup d'8, the d'8 is gobbled up — the function needs a parameter, so it will grab the next token and make it its parameter. Removing the bolded parts will make it work (the (markup?) needs to be reduced to (), since you still need to have the list of parameter "types" in there — even though it's empty).


But this solution is needlessly complicated. Why not just write

arrup = \markup { \arrow-head #Y #UP ##f }

and then use it like this: c^\arrup d e f? The definition is much simpler, and it's easier to use.

7
  • Thanks! I tried to remove 'text', but that resulted in an error, and I don't understand the (markup?) so didn't try to remove that yet. Unfortunately none of your 2 solutions work. The 1st gives error: Guile signaled an error for the expression beginning here {# (define-markup-command (arrup layout props) Syntax error: unknown location: source expression failed to match any pattern in form (list . "Draw a arrow head down (guitar pick stroke-up).")
    – HarryH
    Jun 3, 2023 at 10:51
  • The 2nd: arrup = \markup { \arrow-head #Y #UP ##f } fis''^\arrup results in: error: not a note name: arrup arrup = \markup { \arrow-head #Y #UP ##f } and syntax error, unexpected '=' arrup = \markup { \arrow-head #Y #UP ##f }
    – HarryH
    Jun 3, 2023 at 10:59
  • This however works: arrup = \markup { \arrow-head #Y #UP ##f } \absolute { fis''^\arrup d'8 d''8 }
    – HarryH
    Jun 3, 2023 at 11:07
  • So the declarations of arrup and arrdown should have been done before the 'include' statement loading the guitar notes. I had tried arrup= and arrdown= before, but because of the wrong placement in the file it didn't work. Thanks for your help.
    – HarryH
    Jun 3, 2023 at 11:26
  • 1
    @HarryH: that's weird because I tested them and they both worked. Of course you need to define things before they are used. As for the first solution, I should perhaps have made it more clear that you need to remove only the markup? so that a pair of empty parentheses is left behind.
    – Ramillies
    Jun 3, 2023 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.