I think this solution will work best for my purposes. My first thought about making the procedure only calculate the indent was "Why didn't I think of that?" Thanks for working through this with me.
Jean, I like your solution, the only problem is that the right-margin applies to the markup as well, and I want the markup to extend all the way across the page. Thanks to everyone for their ideas. 𐑪𐑯 2023-04-11 𐑨𐑑 14:40, [email protected] 𐑮𐑴𐑑: > Ok. Wasn't aware of that. Still learning too... > I changed the procedure so it is just calculating the indent and not > creating a layout block... (more code in the layout block necessary) > > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > \version "2.24.0" > > > #(define (get-indent lw) > (let* ( > (pw (ly:output-def-lookup $defaultpaper 'paper-width)) > (lmd (ly:output-def-lookup $defaultpaper 'left-margin-default)) > (rmd (ly:output-def-lookup $defaultpaper 'right-margin-default))) > ; calculate indent for use in layout blocks > (/ (- pw lmd rmd lw) 2))) > > > \score { > \layout { > lineWidth = 120 > ind = #(get-indent lineWidth) > line-width = #(+ lineWidth ind) > indent = \ind > short-indent = \ind > > > % some other stuff... > } > \repeat unfold 20 \relative c { c' d e f g a b } > } > > > \markup \wordwrap-string "Bacon ipsum dolor amet hamburger aliqua > incididunt sunt in. Excepteur consequat ad laboris anim flank jowl. > Irure drumstick shoulder dolor. Cupim tri-tip meatloaf prosciutto > leberkas." > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > > Not sure what is best practice here > > > > Juergen. > > > > >> -----ursprüngliche Nachricht----- >> Von: [email protected] >> Gesendet: 11.04.2023 16:59 Uhr >> An: [email protected], [email protected] >> Betreff: Re: How to fix markup horizontal position relative to edge of page > > > > >> I did try that, but in the output the the score appears twice since there >> are two layout blocks. Is there no way to merge them? >> >> 𐑪𐑯 2023-04-11 𐑨𐑑 08:36, [email protected] 𐑮𐑴𐑑: >> > This >> >> #{ >> >> line-width = #(+ lw ind) >> >> indent = #ind >> >> short-indent = #ind >> >> #} >> > is part of the scheme procedure. You can use lilypond syntax - put into >> > #{ ...#} - in scheme procedures. I create a new layout-block in the >> > procedure. You can not nest layout blocks but you can have parallel >> > layout-blocks. So copy the procedure-call into your score but not into >> > your own layout block: >> > >> > >> > \version "2.24.0" >> > >> > #(define (set-score-width lw) >> > (let* ( >> > (pw (ly:output-def-lookup $defaultpaper 'paper-width)) >> > (lmd (ly:output-def-lookup $defaultpaper 'left-margin-default)) >> > (rmd (ly:output-def-lookup $defaultpaper 'right-margin-default)) >> > (ind (/ (- pw lmd rmd lw) 2))) >> > >> > #{ \layout { >> > line-width = #(+ lw ind) >> > indent = #ind >> > short-indent = #ind >> > } #} )) % end of scheme code >> > >> > \score { >> > %%%% procedure call >> > #(set-score-width 120) >> > >> > %%%% your own layout block >> > \layout { >> > % do something >> > } >> > \repeat unfold 20 \relative c { c' d e f g a b } >> > } >> > \markup \wordwrap-string "Bacon ipsum dolor amet hamburger aliqua >> > incididunt sunt in. Excepteur consequat ad laboris anim flank jowl. >> > Irure drumstick shoulder dolor. Cupim tri-tip meatloaf prosciutto >> > leberkas." >> > >> > >> > >> > >> > >> > HTH, Juergen. >> > >> > >> > >> > >> > >> > >> > >> > >> >> -----ursprüngliche Nachricht----- >> >> Von: [email protected] >> >> Gesendet: 11.04.2023 16:14 Uhr >> >> An: [email protected], [email protected] >> >> Betreff: Re: How to fix markup horizontal position relative to edge of >> >> page >> > >> > >> >> Quick question, in the scores I am working on I already have a \layout >> >> block with several other settings within it. How can I insert just the >> >> line-width, indent, and short-indent settings into the already-existent >> >> \layout block without creating another one? If I try just >> >> >> >> #{ >> >> line-width = #(+ lw ind) >> >> indent = #ind >> >> short-indent = #ind >> >> #} >> >> >> >> for my LilyPond code block, it gives me the error "not a note name: >> >> line-width". >> >> Thanks for your Scheme expertise :) >> >> >> >> 𐑪𐑯 2023-04-11 𐑨𐑑 07:38, Benjamin Bruce 𐑮𐑴𐑑: >> >> > This is exactly what I needed. I figured it could be done with some >> >> > Scheme code, but that's beyond my knowledge. Thanks so much for your >> >> > help! >> >> > >> >> > 𐑪𐑯 2023-04-11 𐑨𐑑 03:55, [email protected] 𐑮𐑴𐑑: >> >> >> OK, this was not correct. There is a left-margin-default set and the >> >> >> indent does not shift the line but makes it shorter(?) Here is another >> >> >> approach: >> >> >> >> >> >> %%%%%%%%%%%%%%%%%%%%%%%% >> >> >> >> >> >> \version "2.24.0" >> >> >> >> >> >> #(define (set-score-width lw) >> >> >> (let* ( >> >> >> (pw (ly:output-def-lookup $defaultpaper 'paper-width)) >> >> >> (lmd (ly:output-def-lookup $defaultpaper 'left-margin-default)) >> >> >> (rmd (ly:output-def-lookup $defaultpaper 'right-margin-default)) >> >> >> (ind (/ (- pw lmd rmd lw) 2))) >> >> >> >> >> >> #{ \layout { >> >> >> line-width = #(+ lw ind) >> >> >> indent = #ind >> >> >> short-indent = #ind >> >> >> } #} )) >> >> >> >> >> >> \score { >> >> >> #(set-score-width 120) >> >> >> \repeat unfold 20 \relative c { c' d e f g a b } >> >> >> } >> >> >> >> >> >> \markup \wordwrap-string "Bacon ipsum dolor amet hamburger aliqua >> >> >> incididunt sunt in. Excepteur consequat ad laboris anim flank jowl. >> >> >> Irure drumstick shoulder dolor. Cupim tri-tip meatloaf prosciutto >> >> >> leberkas." >> >> >> >> >> >> %%%%%%%%%%%%%%%%%%%%%%%% >> >> >> >> >> >> Juergen. >> >> >> > >> > >> >> -----ursprüngliche Nachricht Ende----- >> > > > > >> -----ursprüngliche Nachricht Ende-----
