I've been asking myself questions about how to do this for a bit... It seems to me most natural the TeX would be having the last word (if you'll look after the lame pun there), and thereby lilypond should indirect somewhat its internal sense of page numbering, so that some negotiation can happen wrt to where things are...
It seems to me this discussion is relevant to what I'm trying to say https://tex.stackexchange.com/questions/15989/toc-entries-and-labels-for-included-pdf-pages I can see the posted code tries to do something like this, but it seems there's more to it than this, per Werner's point, with which I agree. I do wonder why it isn't lilypond to emit a more direct piece of LaTeX directly though: I'm imagining a file usable with \include (or so) that would contain appropriate \includepdf command lines generated by lilypond. I don't understand why it is we're generating them in TeX seems like an unhelpful place to do this... Happy to help if you think there would be use Cheers, Luca On Fri, Mar 11, 2022 at 7:21 AM Werner LEMBERG <w...@gnu.org> wrote: > > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > % \includescore{PossibleExtension} > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > > > [...] > > Ouch, this is ugly LaTeX code. Besides the formatting, it will > exhaust TeX's macro stack, AFAICS, since macro `\readfile@line` is > calling itself recursively, not using the TeX's `\loop` macro (or an > equivalent to it) to ensure proper tail recursion. In other words, > very large TOCs would fail. > > I'll try to cook something up that works decently. > > > Werner > >