3.2.3 Multiple output files from one input file

If you want multiple output files from the same ‘.ly’ file, then you can add multiple \book blocks, where each such \book block will result in a separate output file. If you do not specify any \book block in the input file, LilyPond will implicitly treat the whole file as a single \book block, see File structure.

When producing multiple files from a single source file, LilyPond ensures that none of the output files from any \book block overwrites the output file produced by a preceding \book from the same input file.

It does this by adding a suffix to the output name for each \book which uses the default output file name derived from the input source file.

The default behavior is to append a version number suffix for each name which may clash, so

\book {
  \score { … }
  \paper { … }
}
\book {
  \score { … }
  \paper { … }
}
\book {
  \score { … }
  \paper { … }
}

in source file ‘eightminiatures.ly’ produces

eightminiatures.pdf
eightminiatures-1.pdf
eightminiatures-2.pdf

as output files.


LilyPond — Notation Reference v2.24.4 (stable-branch).