Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(850)

Side by Side Diff: Documentation/notation/changing-defaults.itely

Issue 6345086: Doc: Update changing context default settings (2322) (Closed) Base URL: http://git.savannah.gnu.org/gitweb/?p=lilypond.git/trunk/
Patch Set: Changes in response to David's comments, plus mention of leaving out \context. Created 12 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 @c -*- coding: utf-8; mode: texinfo; -*- 1 @c -*- coding: utf-8; mode: texinfo; -*-
2 2
3 @ignore 3 @ignore
4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH 4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5 5
6 When revising a translation, copy the HEAD committish of the 6 When revising a translation, copy the HEAD committish of the
7 version that you are working on. For details, see the Contributors' 7 version that you are working on. For details, see the Contributors'
8 Guide, node Updating translation committishes.. 8 Guide, node Updating translation committishes..
9 @end ignore 9 @end ignore
10 10
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 682
683 The following orderings are important: the 683 The following orderings are important: the
684 @code{Bar_engraver} must normally be first, and 684 @code{Bar_engraver} must normally be first, and
685 the @code{New_fingering_engraver} must come before 685 the @code{New_fingering_engraver} must come before
686 the @code{Script_column_engraver}. There may be others 686 the @code{Script_column_engraver}. There may be others
687 with ordering dependencies. 687 with ordering dependencies.
688 688
689 @node Changing context default settings 689 @node Changing context default settings
690 @subsection Changing context default settings 690 @subsection Changing context default settings
691 691
692 @cindex default context properties, changing
693 @cindex context properties, changing defaults
694
695 Context and grob properties can be changed with @code{\set}
696 and @code{\override} commands, as described in
697 @ref{Modifying properties}. These commands create music events,
698 making the changes take effect at the point in time the music
699 is being processed.
700
701 In contrast, this section explains how to change the @emph{default}
702 values of context and grob properties at the time the context is
703 created. There are two ways of doing this. One modifies the default
704 values in all contexts of a particular type, the other modifies the
705 default values in just one particular instance of a context.
706
707 @menu
708 * Changing all contexts of the same type::
709 * Changing just one specific context::
710 * Order of precedence::
711 @end menu
712
713 @node Changing all contexts of the same type
714 @unnumberedsubsubsec Changing all contexts of the same type
715
716 @cindex \context in \layout block
717 @funindex \context
718 @funindex \layout
719
692 The context settings which are to be used by default in 720 The context settings which are to be used by default in
693 @code{Score}, @code{Staff} and @code{Voice} contexts may be specified 721 @code{Score}, @code{Staff}, @code{Voice} and other contexts may be
694 in a @code{\layout} block, as illustrated in the following example. 722 specified in a @code{\context} block within any @code{\layout} block.
695 The @code{\layout} block should be placed within the @code{\score} 723 The @code{\layout} block should be placed within the @code{\score}
696 block to which it is to apply, but outside any music. 724 block to which it is to apply, after the music.
697 725
698 Note that the @code{\set} command itself and the context must be 726 @example
699 omitted when the context default values are specified in this way: 727 \layout @{
728 \context @{
729 \Voice
730 [context settings for all Voice contexts]
731 @}
732 \context @{
733 \Staff
734 [context settings for all Staff contexts]
735 @}
736 @}
737 @end example
738
739 The following types of settings may be specified:
740
741 @itemize
742 @item
743 An @code{\override} command, but with the context name omitted
700 744
701 @lilypond[quote,verbatim] 745 @lilypond[quote,verbatim]
702 \score { 746 \score {
703 \relative c'' { 747 \relative c'' {
704 a4^"Really small, thicker stems, no time signature" a a a 748 a4^"Thicker stems" a a a
705 a a a a 749 a4 a a\ff a
750 }
751 \layout {
752 \context {
753 \Staff
754 \override Stem #'thickness = #4.0
755 }
756 }
757 }
758 @end lilypond
759
760 @item
761 Directly setting a context property
762
763 @lilypond[quote,verbatim]
764 \score {
765 \relative c'' {
766 a4^"Smaller font" a a a
767 a4 a a\ff a
706 } 768 }
707 \layout { 769 \layout {
708 \context { 770 \context {
709 \Staff 771 \Staff
710 fontSize = #-4 772 fontSize = #-4
773 }
774 }
775 }
776 @end lilypond
777
778 @item
779 A predefined command such as @code{\dynamicUp} or a music
780 expression like @code{\accidentalStyle "dodecaphonic"}
781
782 @lilypond[quote,verbatim]
783 \score {
784 \relative c'' {
785 a4^"Dynamics above" a a a
786 a4 a a\ff a
787 }
788 \layout {
789 \context {
790 \Voice
791 \dynamicUp
792 }
793 \context {
794 \Staff
795 \accidentalStyle "dodecaphonic"
796 }
797 }
798 }
799 @end lilypond
800
801 @item
802 A user-defined variable containing a @code{\with} block; for details
803 of the @code{\with} block see
804 @ref{Changing just one specific context}.
805
806 @lilypond[quote,verbatim]
807 StaffDefaults = \with {
808 fontSize = #-4
809 }
810
811 \score {
812 \new Staff {
813 \relative c'' {
814 a4^"Smaller font" a a a
815 a4 a a a
816 }
817 }
818 \layout {
819 \context {
820 \Staff
821 \StaffDefaults
822 }
823 }
824 }
825 @end lilypond
826
827 @end itemize
828
829 Note that the context block may be omitted if @code{\layout}
830 contains only settings of the first three types, in which case the
831 @code{Score} context is assumed
832
833 @lilypond[quote,verbatim]
834 \score {
835 \new Staff {
836 \relative c'' {
837 a4^"Smaller font" a a a
838 a4 a a a
839 }
840 }
841 \layout {
842 \accidentalStyle "dodecaphonic"
843 fontSize = #-4
Trevor Daniels 2012/07/11 21:32:40 Whoops, should be \set fontsize = #-4
844 \override Stem #'thickness = #4.0
dak 2012/07/11 21:47:58 That overrides Stem thickness in all Bottom contex
Trevor Daniels 2012/07/12 09:31:40 True, but that's not an issue here. An example th
845 }
846 }
847 @end lilypond
848
849
850 @node Changing just one specific context
851 @unnumberedsubsubsec Changing just one specific context
852
853 @cindex \with
854 @funindex \with
855
856 The context properties of just one specific context instance can be
857 changed in a @code{\with} block. All other context instances of the
858 same type retain the default settings built into LilyPond and modified
859 by any @code{\layout} block within scope. The @code{\with} block
860 must be placed immediately after the @code{\new} @var{context-type}
861 command:
862
863 @example
864 \new Staff
865 \with @{
866 [context settings for this context instance only]
867 @} @{
868 ...
869 @}
870 @end example
871
872 The following types of settings may be specified:
873
874 @itemize
875 @item
876 An @code{\override} command, but with the context name omitted
877
878 @lilypond[quote,verbatim]
879 \score {
880 \new Staff {
881 \new Voice
882 \with {
711 \override Stem #'thickness = #4.0 883 \override Stem #'thickness = #4.0
712 \remove "Time_signature_engraver" 884 }
713 } 885 {
714 } 886 \relative c'' {
715 } 887 a4^"Thick stems" a a a
716 @end lilypond 888 a4 a a a
717 889 }
718 In this example, the @code{\Staff} command specifies that the 890 }
719 subsequent specifications are to be applied to all staves within 891 }
720 this score block. 892 }
721 893 @end lilypond
722 Modifications can be made to the @code{Score} context or all 894
723 @code{Voice} contexts in a similar way. 895 @item
724 896 Directly setting a context property
725 Context changes can be placed in a variable and applied to a 897
726 @code{\context} definition by prepending the modification with 898 @lilypond[quote,verbatim]
727 @code{\with}:
728 @lilypond[quote,verbatim]
729 blubb = \with {
730 fontSize = #-4
731 \override Stem #'thickness = #4.0
732 \remove "Time_signature_engraver"
733 }
734
735 bla = \with {
736 fontSize = #3
737 \override Stem #'thickness = #-2.0
738 }
739
740 melody = \relative c'' {
741 a4 a a a |
742 a4 a a a |
743 }
744
745 \score { 899 \score {
746 << 900 <<
747 \new Staff << 901 \new Staff {
748 \melody 902 \relative c'' {
749 s4^"Small, thicker stems, no time signature" 903 a4^"Default font" a a a
750 >> 904 a4 a a a
751 \new Staff \bla << 905 }
752 \melody 906 }
753 s4^"Different" 907 \new Staff
754 >> 908 \with {
909 fontSize = #-4
910 } {
911 \relative c'' {
912 a4^"Smaller font" a a a
913 a4 a a a
914 }
915 }
755 >> 916 >>
756 \layout { 917 }
757 \context { 918 @end lilypond
758 \Staff 919
759 \blubb 920 @item
760 } 921 A predefined command such as @code{\dynamicUp}
761 } 922
762 } 923 @lilypond[quote,verbatim]
763 @end lilypond 924 \score {
764 925 <<
765 @c TODO: add \with in here. 926 \new Staff {
766 927 \new Voice {
928 \relative c'' {
929 a4^"Dynamics below" a a a
930 a4 a a\ff a
931 }
932 }
933 }
934 \new Staff
935 \with { \accidentalStyle "dodecaphonic" }
936 {
937 \new Voice
938 \with { \dynamicUp }
939 {
940 \relative c'' {
941 a4^"Dynamics above" a a a
942 a4 a a\ff a
943 }
944 }
945 }
946 >>
947 }
948 @end lilypond
949
950 @end itemize
951
952 @node Order of precedence
953 @unnumberedsubsubsec Order of precedence
954
955 The value of a property which applies at a particular time is
956 determined as follows:
957
958 @itemize
959 @item
960 if an @code{\override} or @code{\set} command in the input stream is
961 in effect that value is used,
962
963 @item
964 otherwise the default value taken from a @code{\with} statement
965 on the context initiation statement is used,
966
967 @item
968 otherwise the default value taken from the most recent appropriate
969 @code{\context} block in the @code{\layout} blocks is used,
970
971 @item
972 otherwise the LilyPond built-in default is used.
973 @end itemize
974
975 @seealso
976 Learning Manual:
977 @rlearning{Modifying context properties}.
978
979 Notation Reference:
980 @ref{Contexts explained},
981 @ref{The set command},
982 @ref{The override command},
983 @ref{The \layout block}.
767 984
768 985
769 @node Defining new contexts 986 @node Defining new contexts
770 @subsection Defining new contexts 987 @subsection Defining new contexts
771 988
772 @cindex contexts, defining new 989 @cindex contexts, defining new
773 @cindex engravers, including in contexts 990 @cindex engravers, including in contexts
774 991
775 @funindex \alias 992 @funindex \alias
776 @funindex alias 993 @funindex alias
(...skipping 3208 matching lines...) Expand 10 before | Expand all | Expand 10 after
3985 4202
3986 \relative c'' { 4203 \relative c'' {
3987 \tempo \markup { "Low tempo" } 4204 \tempo \markup { "Low tempo" }
3988 c4 d e f g1 4205 c4 d e f g1
3989 \tempoPadded #4.0 "High tempo" 4206 \tempoPadded #4.0 "High tempo"
3990 g4 f e d c1 4207 g4 f e d c1
3991 } 4208 }
3992 @end lilypond 4209 @end lilypond
3993 4210
3994 @c TODO: add appropriate @@ref's here. 4211 @c TODO: add appropriate @@ref's here.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b