lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble defining markup functiion


From: Aaron Hill
Subject: Re: Trouble defining markup functiion
Date: Thu, 17 Jan 2019 07:05:25 -0800
User-agent: Roundcube Webmail/1.3.8

On 2019-01-17 6:27 am, Carl Sorensen wrote:
I'm trying to define a markup function for establishing a common set
of formatting for a number of text markups.

%%% beginning of sample code

\version "2.19.82"

\displayScheme
\markup{\sans{\fontsize #10 "C"}}  % Just used to show the scheme
markup command -- this is what I'm trying

#(define-markup-command (chord-name-markup layout props chord-name) (markup?)
   "Display a chord name in the desired formatting"
   (interpret-markup layout props
     (make-line-markup (#:sans (#:fontsize 10 chord-name)))))


\markup \chord-name-markup "E"

%%% end of code

I've used displayScheme to get the representation of the markup
function.  I've found that is uses #:line so that I have to use
make-line-markup.

When I run this code, I get

Processing
`/var/folders/q5/88k2s1717qv1v7rq4tqz53k80000gn/T/frescobaldi-fmnvoopw/tmpc0ltmn4y/document.ly'
Parsing.../var/folders/q5/88k2s1717qv1v7rq4tqz53k80000gn/T/frescobaldi-fmnvoopw/tmpc0ltmn4y/document.ly:9:32:
In expression (#:fontsize 10 chord-name):
/var/folders/q5/88k2s1717qv1v7rq4tqz53k80000gn/T/frescobaldi-fmnvoopw/tmpc0ltmn4y/document.ly:9:32:
Wrong type to apply: #:fontsize

Apparently, in the context of make-line-markup I can't use #:fontsize
as the first element in a list, because it's not applyable.

How can I do this properly?

I would sidestep trying to do the markup in pure Scheme and use #{ #} instead:

%%%%
#(define-markup-command (chord-name-markup layout props chord-name) (markup?)
   "Display a chord name in the desired formatting"
   (interpret-markup layout props
     #{ \markup \sans \fontsize #10 $chord-name #}))
%%%%

NOTE: I omitted some of the curly braces, since they were not needed.


-- Aaron Hill



reply via email to

[Prev in Thread] Current Thread [Next in Thread]