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