%% Generated by lilypond-book
%% Options: [exampleindent=10.16\mm,indent=0\mm,line-width=160\mm,paper-height=845.047\pt,paper-width=597.508\pt,papersize='(cons (* 597.508 pt) (* 845.047 pt))]
\include "lilypond-book-preamble.ly"


% ****************************************************************
% Start cut-&-pastable-section
% ****************************************************************

#(ly:set-option 'eps-box-padding 3.000000)



\paper {
  #(set-paper-size '(cons (* 597.508 pt) (* 845.047 pt)))
  indent = 0\mm
  line-width = 160\mm
  % offset the left padding, also add 1mm as lilypond creates cropped
  % images with a little space on the right
  line-width = #(- line-width (* mm  3.000000) (* mm 1))
}

\layout {
  
}




% ****************************************************************
% ly snippet:
% ****************************************************************
\sourcefilename "snippets/creating--real--parenthesized-dynamics.ly"
\sourcefileline 0
%% DO NOT EDIT this file manually; it was automatically
%% generated from the LilyPond Wiki
%% (https://wiki.lilypond.community).
%%
%% Make any changes in the Wiki itself, or in
%% `Documentation/snippets/new/`, then run
%% `scripts/auxiliar/makelsr.pl`.
%%
%% This file is in the public domain.

\version "2.24.0"

\header {
%% Translation of GIT committish: c043783aac6c35926d633aa2daf60ed4f2e7ca7a
  texidocfr = "
Bien que le moyen le plus simple pour ajouter des parenthèses à une
indication de nuance consiste à utiliser un bloc @code{\\markup}, cette
pratique a un inconvénient : les objets ainsi créés sont considérés
comme des annotations textuelles, non comme des nuances.

Il est néanmoins possible de créer des objets particuliers en partant de
code Scheme -- comme expliqué dans le manuel de notation -- avec la
fonction @code{make-dynamic-script}. Les @emph{markups} ainsi créés sont
alors considérés comme étant des indications de nuance, et de ce fait
peuvent se voir appliquer les effets des commandes @code{\\dynamicUp} et
@code{\\dynamicDown}.
"

  doctitlefr = "Indications de nuance vraiment entre parenthèses"

  categories = "Expressive marks, Scheme, Text, Workaround"

  texidoc = "
Although the easiest way to add parentheses to a dynamic mark is to use
a @code{\\markup} block, this method has a downside: the created
objects behave like text markups and not like dynamics.

However, it is possible to create a similar object using the equivalent
Scheme code (as described in the Notation Reference), combined with the
@code{make-dynamic-script} function. This way, the markup is regarded
as a dynamic and therefore remains compatible with commands such as
@code{\\dynamicUp} or @code{\\dynamicDown}.
"

  doctitle = "Creating @qq{real} parenthesized dynamics"
} % begin verbatim


paren =
#(define-event-function (dyn) (ly:event?)
   (make-dynamic-script
    #{ \markup \concat {
         \normal-text \italic \fontsize #2 (
         \pad-x #0.2 #(ly:music-property dyn 'text)
         \normal-text \italic \fontsize #2 )
       }
    #}))

\relative c'' {
  c4\paren\f c c \dynamicUp c\paren\p
}



% ****************************************************************
% end ly snippet
% ****************************************************************
