Re: How to get a book twice with different page-footers?

2013-04-11 Thread Ian Hulin
Hi Harm,
Many thanks for the work-round, I'd found this problem too a while ago,
but am only just catching up with this list.

Cheers,  :-) Ian

On 22/03/13 21:27, Thomas Morley wrote:
> Hi Jan-Peter,
> 
> thanks for your reply.
> 
> 2013/3/22 Jan-Peter Voigt :
>> Hello Harm,
>>
>> I don't have a solution, but I found, that not-first-page is not defined in
>> the global space. You can't access it with $(display not-first-page).
> 
> Yep.
> That's the problem.
> 
>> If you (re-)define a procedure #(define (not-first-page layout props arg)
>> (interpret-markup layout props arg)) the example compiles.
>> So propably there is a way to expose the needed functions/vars to another
>> scope?
> 
> I found a very simple solution:
> Instead of redefining all definitions from /ly/titling-init.ly I
> simply include titling-init.ly
> 
> Et voil�:
> 
> \version "2.16.2"
> 
> \include "titling-init.ly"
> 
> myname = #(ly:parser-output-name parser)
> 
> oddFooterMarkupI =
>   \markup \fill-line { "XYZ" }
> 
> oddFooterMarkupII =
>   \markup {
>   \on-the-fly #not-first-page
>   \fill-line { \with-color #red "123" }
>   }
> 
> writeBookTwice =
> #(define-void-function (parser location book)
>(ly:book?)
> 
>; process with oddFooterMarkupI
>(ly:output-def-set-variable!
>   (ly:book-paper book)
>   'oddFooterMarkup
>   oddFooterMarkupI)
>(ly:book-process
>   book
>   $defaultpaper
>   $defaultlayout
>   myname)
> 
>; process with oddFooterMarkupII
>(ly:output-def-set-variable!
>   (ly:book-paper book)
>   'oddFooterMarkup
>   oddFooterMarkupII)
>(ly:book-process
>   book
>   $defaultpaper
>   $defaultlayout
>   (format "~a-other-footer" myname)))
> 
> 
> \writeBookTwice
>   \book {
> \bookpart { \repeat unfold 2 { c''1 \pageBreak } }
> \bookpart { \repeat unfold 2 { cis''1 \pageBreak } }
>   }
> 
> 
> Works.
> Though, I've to test it with some larger real-life-examples.
> 
> 
> Cheers,
>   Harm
> 



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


Re: How to get a book twice with different page-footers?

2013-03-23 Thread David Kastrup
Thomas Morley  writes:

> Hi,
>
> I'm trying to parse a book twice with different footers.
> The function below
> (thanks to Jan-Peter and Urs
> http://lilypond.1069038.n5.nabble.com/Compile-twice-with-different-includes-td140953.html
> )
> below works quite nice so long as very simple footers are used.
> As soon as I try something more elaborated, like \on-the-fly
> #not-first-page , an error occurs.
> Well, that's no surprise.
>
> Though, how to do it?

# gives you lexical closure.  So you might need \on-the-fly
\not-first-page  when the point of entry is not inside of a header
block.

-- 
David Kastrup


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


Re: How to get a book twice with different page-footers?

2013-03-22 Thread Thomas Morley
Hi Jan-Peter,

thanks for your reply.

2013/3/22 Jan-Peter Voigt :
> Hello Harm,
>
> I don't have a solution, but I found, that not-first-page is not defined in
> the global space. You can't access it with $(display not-first-page).

Yep.
That's the problem.

> If you (re-)define a procedure #(define (not-first-page layout props arg)
> (interpret-markup layout props arg)) the example compiles.
> So propably there is a way to expose the needed functions/vars to another
> scope?

I found a very simple solution:
Instead of redefining all definitions from /ly/titling-init.ly I
simply include titling-init.ly

Et voilà:

\version "2.16.2"

\include "titling-init.ly"

myname = #(ly:parser-output-name parser)

oddFooterMarkupI =
  \markup \fill-line { "XYZ" }

oddFooterMarkupII =
  \markup {
  \on-the-fly #not-first-page
  \fill-line { \with-color #red "123" }
  }

writeBookTwice =
#(define-void-function (parser location book)
   (ly:book?)

   ; process with oddFooterMarkupI
   (ly:output-def-set-variable!
  (ly:book-paper book)
  'oddFooterMarkup
  oddFooterMarkupI)
   (ly:book-process
  book
  $defaultpaper
  $defaultlayout
  myname)

   ; process with oddFooterMarkupII
   (ly:output-def-set-variable!
  (ly:book-paper book)
  'oddFooterMarkup
  oddFooterMarkupII)
   (ly:book-process
  book
  $defaultpaper
  $defaultlayout
  (format "~a-other-footer" myname)))


\writeBookTwice
  \book {
\bookpart { \repeat unfold 2 { c''1 \pageBreak } }
\bookpart { \repeat unfold 2 { cis''1 \pageBreak } }
  }


Works.
Though, I've to test it with some larger real-life-examples.


Cheers,
  Harm

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


Re: How to get a book twice with different page-footers?

2013-03-22 Thread Jan-Peter Voigt

Hello Harm,

I don't have a solution, but I found, that not-first-page is not defined 
in the global space. You can't access it with $(display not-first-page).
If you (re-)define a procedure #(define (not-first-page layout props 
arg) (interpret-markup layout props arg)) the example compiles.
So propably there is a way to expose the needed functions/vars to 
another scope?


Cheers,
Jan-Peter

Am 22.03.2013 02:05, schrieb Thomas Morley:

myname = #(ly:parser-output-name parser)

oddFooterMarkupI =
   \markup \fill-line { "XYZ" }

oddFooterMarkupII =
   \markup {
   %\on-the-fly #not-first-page
   \fill-line { "123" }
   }

writeBookTwice =
#(define-void-function (parser location book)
(ly:book?)

; process with oddFooterMarkupI
(ly:output-def-set-variable!
   (ly:book-paper book)
   'oddFooterMarkup
   oddFooterMarkupI)
(ly:book-process
   book
   $defaultpaper
   $defaultlayout
   myname)

; process with oddFooterMarkupII
(ly:output-def-set-variable!
   (ly:book-paper book)
   'oddFooterMarkup
   oddFooterMarkupII)
(ly:book-process
   book
   $defaultpaper
   $defaultlayout
   (format "~a-other-footer" myname)))


\writeBookTwice
   \book {
 \bookpart { \repeat unfold 2 { c''1 \pageBreak } }
 \bookpart { \repeat unfold 2 { cis''1 \pageBreak } }
   }



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


How to get a book twice with different page-footers?

2013-03-21 Thread Thomas Morley
Hi,

I'm trying to parse a book twice with different footers.
The function below
(thanks to Jan-Peter and Urs
http://lilypond.1069038.n5.nabble.com/Compile-twice-with-different-includes-td140953.html
)
below works quite nice so long as very simple footers are used.
As soon as I try something more elaborated, like \on-the-fly
#not-first-page , an error occurs.
Well, that's no surprise.

Though, how to do it?
Any hint would be appreciated.

-Harm



\version "2.16.2"

myname = #(ly:parser-output-name parser)

oddFooterMarkupI =
  \markup \fill-line { "XYZ" }

oddFooterMarkupII =
  \markup {
  %\on-the-fly #not-first-page
  \fill-line { "123" }
  }

writeBookTwice =
#(define-void-function (parser location book)
   (ly:book?)

   ; process with oddFooterMarkupI
   (ly:output-def-set-variable!
  (ly:book-paper book)
  'oddFooterMarkup
  oddFooterMarkupI)
   (ly:book-process
  book
  $defaultpaper
  $defaultlayout
  myname)

   ; process with oddFooterMarkupII
   (ly:output-def-set-variable!
  (ly:book-paper book)
  'oddFooterMarkup
  oddFooterMarkupII)
   (ly:book-process
  book
  $defaultpaper
  $defaultlayout
  (format "~a-other-footer" myname)))


\writeBookTwice
  \book {
\bookpart { \repeat unfold 2 { c''1 \pageBreak } }
\bookpart { \repeat unfold 2 { cis''1 \pageBreak } }
  }

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