Re: Get the margin values
Simon, Jean, thank you both ! Le lun. 5 juin 2023 à 15:45, Jean Abou Samra a écrit : > Le lundi 05 juin 2023 à 15:34 +0200, Simon Albrecht a écrit : > > However, I can’t say why the right margin isn’t yet known by the time it > is queried. > > > > > Well, don't use “$defaultpaper”, that's the toplevel \paper block, which > is almost always not what you want. If your markup command is used on score > level like with { c'^\markup \margin ... }, it should be affected \paper > settings on \score level. Use “layout” instead (or another name like > “output-def” if you have defined your markup command as “(margin output-def > props ...) (...)”, though the name “layout” is conventional). > > I seem to recall “$defaultpaper” is not normalized which could be why > you're seeing undefined margins, but I didn't check. “layout” is definitely > what you want in this case. > > Jean > >
Re: Get the margin values
Le lundi 05 juin 2023 à 15:34 +0200, Simon Albrecht a écrit : > However, I can’t say why the right margin isn’t yet known by the time it > is queried. Well, don't use “$defaultpaper”, that's the toplevel \paper block, which is almost always not what you want. If your markup command is used on score level like with { c'^\markup \margin ... }, it should be affected \paper settings on \score level. Use “layout” instead (or another name like “output-def” if you have defined your markup command as “(margin output-def props ...) (...)”, though the name “layout” is conventional). I seem to recall “$defaultpaper” is not normalized which could be why you're seeing undefined margins, but I didn't check. “layout” is definitely what you want in this case. Jean signature.asc Description: This is a digitally signed message part
Re: Get the margin values
Hi Pierre, On 05.06.23 15:07, Pierre Perol-Schneider wrote: So how can I get the paper values as a markp? the call to ly:output-def-lookup returns a number or an empty list. So this returns valid markup regardless: \version "2.24.1" \paper { top-margin = 30 %bottom-margin = 30 left-margin = 30 %right-margin = 30 } #(define-markup-command (margin layout props)() (let* ((prnt (lambda (i) (let ((mrgn (ly:output-def-lookup $defaultpaper i))) (if (number? mrgn) (number->string mrgn) "not yet known" (top-margin (prnt 'top-margin)) (bottom-margin (prnt 'bottom-margin)) (left-margin (prnt 'left-margin)) (right-margin (prnt 'right-margin))) (interpret-markup layout props #{ \markup\column { \line { top-margin = #top-margin } \line { bottom-margin = #bottom-margin } \line { left-margin = #left-margin } \line { right-margin = #right-margin } } #}))) % Test: \markup\margin % However, I can’t say why the right margin isn’t yet known by the time it is queried. Best, Simon
Re: Get the margin values
So far: \version "2.24.1" \paper { top-margin = 30 left-margin = 30 } #(define-markup-command (margin layout props)() (let* ((top-margin (ly:output-def-lookup $defaultpaper 'top-margin)) (bottom-margin (ly:output-def-lookup $defaultpaper 'bottom-margin)) (left-margin (ly:output-def-lookup $defaultpaper 'left-margin)) (right-margin (ly:output-def-lookup $defaultpaper 'right-margin))) (interpret-markup layout props #{ \markup\column { \line { top-margin = #top-margin } \line { bottom-margin = #bottom-margin } \line { left-margin = #left-margin } \line { right-margin = #right-margin } } #}))) % Test: \markup\margin Error: not a markup So how can I get the paper values as a markp? Tia, cheers, Pierre Le lun. 5 juin 2023 à 09:54, Pierre Perol-Schneider < pierre.schneider.pa...@gmail.com> a écrit : > Dear List, > How could I automagically get the margin values, including the default > values ? > > Ex. > > \version "2.24.1" > > \paper { > top-margin = 30 > left-margin = 30 > } > > \markuplist { > "top-margin = ?" > "bottom-margin = ?" > "left-margin = ?" > "right-margin = ?" > } > > TIA, cheers, > Pierre >
Get the margin values
Dear List, How could I automagically get the margin values, including the default values ? Ex. \version "2.24.1" \paper { top-margin = 30 left-margin = 30 } \markuplist { "top-margin = ?" "bottom-margin = ?" "left-margin = ?" "right-margin = ?" } TIA, cheers, Pierre