Am 25.05.2018 um 07:44 schrieb Federico
Bruni:
...
How do you use it all the above in combination with lyluatex?
I think this should be transparent. lyluatex will assign an
arbitrary
first page number (i.e. the page it
assumes the score will start),
then the above function will offset the TOC entries to be
based on
"1", and \includepdf will translate them back to whatever
page
they'll *actually* happen to be on in the end.
Thanks for the detailed explanation.
However, I cannot make it work with lyluatex.
You wrote that you wanted to use lyluatex to include the
lilypond file
(not the PDF), in order to use the cache system.
I'm not sure this is what you need, but you should look up
raw-pdf and the section about wrapping commands in the manual.
the
urs
I've read the sections "Providing raw filenames" and "Wrapping Raw
PDF Filenames" of lyluatex manual and I'm still scratching my
head...
Nevermind, I'll use the \includelilypond command of the Usage
manual.
This last comment about using \lilypondfile "instead" makes me
think you got something wrong about the idea of the raw-pdf
option. I don't really see what you want to achieve, and maybe
this isn't even relevant to your use case. However, I'd like to
clarify that.
Generally what happens when you pass LilyPond code to lyluatex is
the following (and it basically doesn't matter if you use \lily,
the environment or \lilypondfile:
- The LilyPond code is passed on to the Lua module
- There it is processed, and a Score is compiled using LilyPond
- In that proces a filename is generated from the hashed
contents of the score
- Finally some sort of a \includegraphics or \includepdf command
is "written" back to LaTeX, using the generated hash name.
When Lua "writes" back to the TeX domain this is what LaTeX
"sees" for its typesetting procedure. That means the LilyPond
code is essentially replaced with the code to include the
resulting score.
However, there are contexts where you need more control over how
the score is integrated into the text document. For example when
you want to provide a custom figure environment and wrap the score
in it. Or when you want to make use of a .toc file you created
here. Or when you don't want to immediately include the score but
just use lyluatex to create and cache the scores, for example in
order to produce a set of parts from one input document.
In that case you can use the option raw-pdf. This does the
following:
- Process the LilyPond code and create the score (as above)
- Generate the hash filename (as above)
- Do *not* write back the code to include the score in the
current document!
- Instead write back code that populates the macro \lyscore{}
with the cached filename (there are further options for multiple
pages/systems, but for now the basic functionality is
sufficient)
Once the lyluatex command has completed you can access the
filename of the current score through \lyscore{}, e.g.
\includepdf[pages=-]{lyscore{}}
and start creating your custom solutions from there.
HTH
Urs