Closed uliska closed 6 years ago
At least some of this should already be possible using the \betweenLilyPondSystem
mechanism described on the lilypond-book pages.
Indeed. Only now I realize that the system number actually is passed into that function (if it is defined), and one could make that function check against a list somewhere else. The main problem I see is that this is only triggered after each system. So when we ask for anythin not including the first system we can't undo that (AFAICS). In any case it should be easier to completely handle this in teh Lua part.
Well, lilypond-book has \preLilyPondExample
(and \postLilyPondExample
) which one could use to do this like this:
\def\preLilyPondExamples{
\let\oldincludegraphics\includegraphics
\renewcommand{\includegraphics}[2][]{\relax}
}
\def\betweenLilyPondSystem#1{
\ifnum#1<2\else\let\includegraphics\oldincludegraphics\fi
}
\def\postLilyPondExamples{
\let\preLilyPondExamples\relax
\let\betweenLilyPondSystem\undefined
\let\postLilyPondExamples\relax
}
If included just before a particular snippet, this ought to suppress printing of the first system (not tested) and reset things back to normal afterwards.
As best I can tell, the package doesn't currently support those two commands. Would implementing them be sufficient to what you want, or would you want something that would be more user friendly.
Maybe that could be wrapped to make it simpler to use, I think. However, I have the feeling that I would prefer handling it in Lua. But that may solely be based on the fact that I'm still feeling somewhat alien to TeX programming, while Lua (although completely new) is quite familiar based on my knowledge of other languages like Python or JavaScript.
What may be a point for the Lua argument is that it may be easier to make flexible on the long run, and we are dealing with the -systems.tex
page anyway.
But I'm far from having a strong opinion here.
It will be much easier to to now after the refactor
will be merged. Basically it can be done by updating latex.includepdf()
and latex.includesystems()
.
I will add an option print-only
that will take effect depending on the value of insert
. In systems
it affects the systems to be included, in fullpage
it filters pages (in inline
it won't have an effect).
It will accept:
M-N
M, N,O
When having the score encoded in separate files it may be desirable to only print a subset of the score. That way one can have one complete encoding of something and refer to specific points in score examples. Valid requests include (more suggestions welcome):
(“I want to show some amount of music or fill some amount of paper but don't care about the exact amount of music”)
The first two would have to be done in the stage of
write_tex()
while for the third\set score.skipTypesetting
commands would have to be injected in the `ly_code'' somehow. But that might be difficult without adding the edition-engraver as a dependency.