Common rules for typesetting accidentals have been placed in a function. This function is called as follows
#(set-accidental-style 'STYLE #('CONTEXT#))
The function can take two arguments: the name of the accidental style,
and an optional argument that denotes the context that should be
changed. If no context name is supplied, Staff is the default,
but you may wish to apply the accidental style to a single Voice
instead.
The following accidental styles are supported
defaultvoicedefault.
As a result, accidentals from one voice do not get canceled in other voices, which is often an unwanted result
\new Staff <<
#(set-accidental-style 'voice)
<<
{ es g } \\
{ c, e }
>> >>
The voice option should be used if the voices
are to be read solely by individual musicians. If the staff is to be
used by one musician (e.g., a conductor) then
modern or modern-cautionary
should be used instead.
moderndefault, but temporary
accidentals also are canceled in other octaves. Furthermore,
in the same octave, they also get canceled in the following
measure
#(set-accidental-style 'modern)
cis' c'' cis'2 | c'' c'
modern-cautionarymodern, but the “extra” accidentals
(the ones not typeset by default) are typeset as cautionary
accidentals. They are printed in reduced size or with parentheses
#(set-accidental-style 'modern-cautionary)
cis' c'' cis'2 | c'' c'
modern-voicemodern-voice-cautionarymodern-voice, but with the extra
accidentals (the ones not typeset by voice) typeset
as cautionaries. Even though all accidentals typeset by
default are typeset by this variable,
some of them are typeset as cautionaries.
pianomodern but accidentals also get canceled
across the staves in the same GrandStaff or
PianoStaff.
piano-cautionary#(set-accidental-style 'piano) but with the extra
accidentals typeset as cautionaries.
no-resetdefault but with accidentals lasting
“forever” and not only until the next measure
#(set-accidental-style 'no-reset)
c1 cis cis c
forgetno-reset: Accidentals
are not remembered at all – and hence all accidentals are
typeset relative to the key signature, regardless of what was
before in the music
#(set-accidental-style 'forget)
\key d\major c4 c cis cis d d dis dis
Program reference: Accidental_engraver, Accidental, and AccidentalPlacement.
Simultaneous notes are considered to be entered in sequential
mode. This means that in a chord the accidentals are typeset as if the
notes in the chord happen one at a time, in the order in which
they appear in the input file. This is a problem when accidentals
in a chord depend on each other,
which does not happen for the default accidental style. The problem
can be solved by manually inserting ! and ? for the
problematic notes.
This page is for LilyPond-2.10.25 (stable-branch).