Re: function does not replicate \markup?

2012-06-24 Thread and...@andis59.se

On 2012-06-24 05:43, David Kastrup wrote:
Because it is a rehearsal mark rather than a text script? 

This makes sense! I tried to use TextScript but it didn't work.

fN = #(define-music-function (parser location fretp ) (string?)

  #{

\once \override TextScript #'self-alignment-X = #RIGHT

   \once \override TextScript #'direction = #DOWN

\mark \markup  { \box \italic \small  $fretp }

  #}

  )


If you write the contents of the music function in the file rather 
than a text script
I'm sorry but I don't understand what you are saying? Could you possibly 
make a code sample


Try to see whether you can convince your mail client to include code 
without removing its indentation and double-spacing the lines. Makes 
it easier to talk about code. 

Sorry about this. In the mails I get the code looks OK.
I hope that the code above is looking Ok. If not please let me know and 
I try something different.


BTW, is it possible to attach files with the mail. This might be better 
when I'm referencing some code?


Thanks for all you help!

// Anders


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function does not replicate \markup?

2012-06-24 Thread David Kastrup
and...@andis59.se and...@andis59.se writes:

 On 2012-06-24 05:43, David Kastrup wrote:
 Because it is a rehearsal mark rather than a text script? 
 This makes sense! I tried to use TextScript but it didn't work.

 fN = #(define-music-function (parser location fretp ) (string?)

#{

  \once \override TextScript #'self-alignment-X = #RIGHT

 \once \override TextScript #'direction = #DOWN

  \mark \markup  { \box \italic \small  $fretp }

#}

)

You make overrides for a TextScript but still use a mark here.

 If you write the contents of the music function in the file rather 
 than a text script
 I'm sorry but I don't understand what you are saying? Could you possibly 
 make a code sample

contents of the music function is everything between #{ ... #}, and if
you copy this into your file instead of \fn, it will look just like the
result of the function.  That is, the function works fine and quite as
intended for replacing a mark with a mark expressed in a different
manner, namely by routing it through a music function.  However, you are
replacing a textscript with a mark, which is something quite different,
and also looking different in input, and documented differently.

 Try to see whether you can convince your mail client to include code 
 without removing its indentation and double-spacing the lines. Makes 
 it easier to talk about code. 
 Sorry about this. In the mails I get the code looks OK.
 I hope that the code above is looking Ok. If not please let me know and 
 I try something different.

Still double-spaced.

Anyway, you ask why different things look different.  It is because they
are different things.  There is not really more to it than that.  The
real question is why this poses a problem for you, and what it is you
are actually trying to achieve.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function does not replicate \markup?

2012-06-24 Thread and...@andis59.se

On 2012-06-24 11:19, David Kastrup wrote:

You make overrides for a TextScript but still use a mark here.

I see what your are saying, but ...
In my function I need a command?
\mark is the only one I have found that output a text, but obviously 
it's not the correct command!

So what is the command I should use??

Still double-spaced. 

Ok, will try something else...
|fN = #(define-music-function (parser location fretp ) (string?)
#{
\once \override TextScript #'self-alignment-X = #RIGHT
\once \override TextScript #'direction = #DOWN
\mark \markup { \box \italic \small $fretp }
#}
)|

Anyway, you ask why different things look different. It is because 
they are different things. There is not really more to it than that. 
The real question is why this poses a problem for you, and what it is 
you are actually trying to achieve. 
Sorry I thought I had explained this. I want the first result. Where the 
number is located directly under the note or chord.


// Anders
English isn't my first language.
So any error or strangeness is due to the translation.
Please correct my English so that I may become better.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function does not replicate \markup?

2012-06-24 Thread David Kastrup
and...@andis59.se and...@andis59.se writes:

 On 2012-06-24 11:19, David Kastrup wrote:

 You make overrides for a TextScript but still use a mark here.

 I see what your are saying, but ...
 In my function I need a command?
 \mark is the only one I have found that output a text, but obviously
 it's not the correct command!
 So what is the command I should use??

 Still double-spaced. 

 Ok, will try something else...
 fN = #(define-music-function (parser location fretp ) (string?) 
     #{ 
         \once \override TextScript #'self-alignment-X = #RIGHT 
         \once \override TextScript #'direction = #DOWN 
         \mark \markup { \box \italic \small $fretp } 
     #} 
 )

Thunderbird does not really seem to like quoting code...  This now was a
mixed HTML/plain text mail.  The plain text version looked actually
fine, so it is not quite clear why you would need a combined mail just
to get the correct plain text version out.  The HTML rendition here used
non-breakable spaces...

 Anyway, you ask why different things look different. It is because
 they are different things. There is not really more to it than
 that. The real question is why this poses a problem for you, and
 what it is you are actually trying to achieve. 

 Sorry I thought I had explained this. I want the first result. Where
 the number is located directly under the note or chord.

Then you should not be using a mark.  If you want to be using a
textscript, this is actually more fun to do with current versions of
LilyPond (2.15.not-too-old). It would look something like

fN = #(define-event-function (parser location fretp ) (string?) 
#{ 
_\markup { \box \italic \small #fretp } 
#})

The closest you can get with 2.14 is something like

fN = #(define-music-function (parser location fretp ) (string?)
  (make-music 'TextScriptEvent
  'text (markup #:box #:italic #:small $fretp)
  'direction DOWN))

if you are lucky, and even then you will have to use it as

-\fN whatever

rather than just \fN whatever.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function does not replicate \markup?

2012-06-24 Thread Thomas Morley
2012/6/24 and...@andis59.se and...@andis59.se:
 I want the first result. Where the
 number is located directly under the note or chord.

Try:

\version 2.14.2

fN =
#(define-music-function (parser location fretp) (string?)
(make-music
'TextScriptEvent
'direction
-1
'text
(markup #:line (#:box (#:italic fretp)

{
c' e' g' _\markup { \box \italic { 8 } }
c' e' g'-\fN 8
}

HTH,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function does not replicate \markup?

2012-06-24 Thread David Kastrup
David Kastrup d...@gnu.org writes:

 Then you should not be using a mark.  If you want to be using a
 textscript, this is actually more fun to do with current versions of
 LilyPond (2.15.not-too-old). It would look something like

 fN = #(define-event-function (parser location fretp ) (string?) 
 #{ 
 _\markup { \box \italic \small #fretp } 
 #})

Actually, no point to use a string? predicate then: markup? is a
superset and more versatile, and it will accept ordinary strings just
fine as well.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function does not replicate \markup?

2012-06-24 Thread and...@andis59.se

On 2012-06-24 12:36, David Kastrup wrote:
Thunderbird does not really seem to like quoting code... This now was 
a mixed HTML/plain text mail. The plain text version looked actually 
fine, so it is not quite clear why you would need a combined mail just 
to get the correct plain text version out. The HTML rendition here 
used non-breakable spaces... 

I will try to make the mails plain text!



Then you should not be using a mark.  If you want to be using a
textscript, this is actually more fun to do with current versions of
LilyPond (2.15.not-too-old). It would look something like
fN = #(define-event-function (parser location fretp ) (string?)
 #{
 _\markup { \box \italic \small #fretp }
 #})

That was my first attempt! Seems like I'm thinking a bit ahead



The closest you can get with 2.14 is something like

fN = #(define-music-function (parser location fretp ) (string?)
   (make-music 'TextScriptEvent
   'text (markup #:box #:italic #:small $fretp)
   'direction DOWN))

if you are lucky, and even then you will have to use it as

-\fN whatever

Aha! Suddenly a light came on!

A BIG Thank You for persevering while I get my act together!

// Anders

--
English isn't my first language.
So any error or strangeness is due to the translation.
Please correct my English so that I may become better.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function does not replicate \markup?

2012-06-24 Thread and...@andis59.se

On 2012-06-24 12:40, Thomas Morley wrote:

Try:

\version 2.14.2

fN =
#(define-music-function (parser location fretp) (string?)
 (make-music
'TextScriptEvent
'direction
-1
'text
(markup #:line (#:box (#:italic fretp)

{
 c' e' g' _\markup { \box \italic { 8 } }
 c' e' g'-\fN 8
}



This version worked even better!

Thank you very much!
// Anders

--
English isn't my first language.
So any error or strangeness is due to the translation.
Please correct my English so that I may become better.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


function does not replicate \markup?

2012-06-23 Thread and...@andis59.se

I have just made my first Lilypond function!
but somehow it doesn't do what I want it to do...
The box with the number isn't located at the same position and it's a 
bigger size.

WHY?

// Anders

%% Start of file
\version 2.14.2

fN = #(define-music-function (parser location fretp ) (string?)

#{

\once \override Score . RehearsalMark #'direction = #DOWN

\once \override Score . RehearsalMark #'self-alignment-X = #RIGHT

\mark \markup { \box \italic  $fretp }

#}

)

{

c' e' g' _\markup { \box \italic { 8 } }

c' e' g' \fN 8

}

%% End of file

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function does not replicate \markup?

2012-06-23 Thread David Kastrup
and...@andis59.se and...@andis59.se writes:

 I have just made my first Lilypond function!
 but somehow it doesn't do what I want it to do...
 The box with the number isn't located at the same position and it's a
 bigger size.
 WHY?

Because it is a rehearsal mark rather than a text script?  If you write
the contents of the music function in the file rather than a text
script, the results should be pretty much identical.

 %% Start of file
 \version 2.14.2

 fN = #(define-music-function (parser location fretp ) (string?)

 #{
 \once \override Score . RehearsalMark #'direction = #DOWN
 \once \override Score . RehearsalMark #'self-alignment-X = #RIGHT
 \mark \markup { \box \italic  $fretp }
 #}
 )

 {
 c' e' g' _\markup { \box \italic { 8 } }
 c' e' g' \fN 8
 }

Try to see whether you can convince your mail client to include code
without removing its indentation and double-spacing the lines.  Makes it
easier to talk about code.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user