diff options
author | Karl Berry <karl@freefriends.org> | 2015-07-02 22:11:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-07-02 22:11:48 +0000 |
commit | fecdcd43eaa7f73e830159293fe22a202803086b (patch) | |
tree | 8236d44bc6ce2e5899af29d5fba8c5393801a989 /Master/texmf-dist/tex | |
parent | 28c9b4ce4d428d1582c35205f79c62da999cf4d0 (diff) |
leadsheets (2jul15)
git-svn-id: svn://tug.org/texlive/trunk@37735 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
4 files changed, 143 insertions, 86 deletions
diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chordnames.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chordnames.code.tex index 0843dcddfa0..8c875b60906 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chordnames.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chordnames.code.tex @@ -1,12 +1,9 @@ -\LeadsheetsExplLibrary{chordnames} - {2014/08/10 typesetting chord names with easy syntax} +\LeadsheetsExplLibrary{chordnames}{2015/07/02 typesetting chord names with easy syntax} \leadsheets_load_library:n {musicsymbols} -\bool_new:N \l__leadsheets_output_notation_german_bool -\bool_new:N \l__leadsheets_input_notation_german_bool -\bool_new:N \l__leadsheets_notation_literal_bool -\bool_set_true:N \l__leadsheets_notation_literal_bool +% \bool_new:N \l__leadsheets_output_notation_german_bool +% \bool_new:N \l__leadsheets_input_notation_german_bool \tl_new:N \l__leadsheets_chord_tl \tl_new:N \l__leadsheets_tension_tl @@ -17,6 +14,7 @@ \cs_new_protected:Npn \leadsheets_chord_sym:Nnn #1#2#3 { \tl_replace_all:Nnn #1 {#2} {#3} } +\cs_generate_variant:Nn \leadsheets_chord_sym:Nnn {NnV} \tl_new:N \l__leadsheets_sharp_tl \tl_new:N \l__leadsheets_flat_tl @@ -31,6 +29,8 @@ \tl_new:N \l__leadsheets_dim_tl \tl_new:N \l__leadsheets_add_tl \tl_new:N \l__leadsheets_major_seven_tl +\tl_new:N \l__leadsheets_german_B_tl +\tl_new:N \l__leadsheets_german_H_tl \tl_set:Nn \l__leadsheets_sharp_tl {\sharp} \tl_set:Nn \l__leadsheets_flat_tl {\flat} @@ -46,6 +46,8 @@ \tl_set:Nn \l__leadsheets_add_tl {\textsuperscript{add}} \tl_set:Nn \l__leadsheets_major_seven_tl {\textsuperscript{maj7}} \tl_set:Nn \l__leadsheets_major_nine_tl {\textsuperscript{maj9}} +\tl_set:Nn \l__leadsheets_german_B_tl {B} +\tl_set:Nn \l__leadsheets_german_H_tl {H} \group_begin: % for convenient input of sharps: @@ -74,23 +76,10 @@ \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {sus} {\l__leadsheets_sus_tl} \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {^} {\textsuperscript} - \bool_if:NF \l__leadsheets_notation_literal_bool + \bool_if:NT \l__leadsheets_output_notation_german_bool { - % convert to English to German input: - \bool_if:NT \l__leadsheets_input_notation_german_bool - { - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {B} {@@@} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {H} {B} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {@@@} {Bb} - } - % convert to English to German output: - \bool_if:NT \l__leadsheets_output_notation_german_bool - { - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {Bb} {@@@} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {B} {H} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {@@@} {B} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {B#} {H} - } + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {B} \l__leadsheets_german_B_tl + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {H} \l__leadsheets_german_H_tl } \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {#b} {} \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {b#} {} @@ -98,10 +87,10 @@ {\l__leadsheets_doublesharp_tl} \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {bb} {\l__leadsheets_doubleflat_tl} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {#} {\l__leadsheets_sharp_tl} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {b} {\l__leadsheets_flat_tl} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {dim} {\l__leadsheets_dim_tl} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {add} {\l__leadsheets_add_tl} + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {#} \l__leadsheets_sharp_tl + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {b} \l__leadsheets_flat_tl + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {dim} \l__leadsheets_dim_tl + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {add} \l__leadsheets_add_tl \leadsheets_tension_sym:Nn \l__leadsheets_chord_tl {0} \leadsheets_tension_sym:Nn \l__leadsheets_chord_tl {1} \leadsheets_tension_sym:Nn \l__leadsheets_chord_tl {2} @@ -144,7 +133,7 @@ \group_end: } -\keys_define:nn {leadsheets/chordnames} +\keys_define:nn {leadsheets/chords} { format .tl_set:N = \l__leadsheets_format_tl , sharp .tl_set:N = \l__leadsheets_sharp_tl , @@ -161,33 +150,25 @@ dim .tl_set:N = \l__leadsheets_dim_tl , major-seven .tl_set:N = \l__leadsheets_major_seven_tl , major-nine .tl_set:N = \l__leadsheets_major_nine_tl , - output-notation .choice: , - output-notation/literal .code:n = - \bool_set_false:N \l__leadsheets_input_notation_german_bool - \bool_set_false:N \l__leadsheets_output_notation_german_bool - \bool_set_true:N \l__leadsheets_notation_literal_bool , - output-notation/german .code:n = - \bool_set_true:N \l__leadsheets_output_notation_german_bool - \bool_set_false:N \l__leadsheets_notation_literal_bool , - output-notation/english .code:n = - \bool_set_false:N \l__leadsheets_output_notation_german_bool - \bool_set_false:N \l__leadsheets_notation_literal_bool , - input-notation .choice: , - input-notation/literal .code:n = - \bool_set_false:N \l__leadsheets_input_notation_german_bool - \bool_set_false:N \l__leadsheets_output_notation_german_bool - \bool_set_true:N \l__leadsheets_notation_literal_bool , - input-notation/german .code:n = - \bool_set_true:N \l__leadsheets_input_notation_german_bool - \bool_set_false:N \l__leadsheets_notation_literal_bool , - input-notation/english .code:n = - \bool_set_false:N \l__leadsheets_input_notation_german_bool - \bool_set_false:N \l__leadsheets_notation_literal_bool + german-B .tl_set:N = \l__leadsheets_german_B_tl , + german-H .tl_set:N = \l__leadsheets_german_H_tl + % since version 0.2 those are defined in the `chords` library: + % output-notation .choice: , + % input-notation .choice: , } -\NewDocumentCommand \setchordnames {m} - { \keys_set:nn {leadsheets/chordnames} {#1} } +\NewDocumentCommand \setchords {m} + { \keys_set:nn {leadsheets/chords} {#1} } \NewDocumentCommand \chordname {} { \leadsheets_chord: } \endinput + +HISTORY: + +2014/08/10 - first version +2015/05/08 - drop `literal' option for input and output notation + - input/output notation is now handled by the `chords' library + - German output of B and H can be customized +2015/05/22 - improvements to the chord macros +2015/07/02 - this is not a use library any more diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chords.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chords.code.tex index 0dce4372717..3dd24ce0dd4 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chords.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chords.code.tex @@ -1,8 +1,12 @@ -\LeadsheetsExplLibrary{chords}{2014/08/10 printing chords} +\LeadsheetsExplLibrary{chords}{2015/07/02 printing chords} \msg_new:nnn {leadsheets} {no-chords} { No~ more~ chords~ left~ for~ verse~ type~ `#1'~ \msg_line_context: } +\leadsheets_load_library:n {chordnames} +\bool_new:N \l__leadsheets_output_notation_german_bool +\bool_new:N \l__leadsheets_input_notation_german_bool + \tl_new:N \l__leadsheets_current_chord_tl \tl_new:N \l__leadsheets_chord_stack_alignment_tl \tl_set:Nn \l__leadsheets_chord_stack_alignment_tl {c} @@ -16,7 +20,7 @@ \prop_new:N \g__leadsheets_chords_sequences_prop -\seq_new:N \l__leadsheets_chords_sequences_seq +\seq_new:N \g__leadsheets_chords_sequences_seq \dim_new:N \l__leadsheets_empty_chord_dim \dim_set:Nn \l__leadsheets_empty_chord_dim {1em} @@ -24,16 +28,6 @@ \cs_new:Npn \leadsheets_chord_print:n #1 {#1} \cs_generate_variant:Nn \leadsheets_chord_print:n {V} -\cs_new_protected:Npn \leadsheets_chord:nnn #1#2#3 - { - \leadsheets_if_record_chords:T - { \seq_put_right:Nn \l__leadsheets_chords_sequences_seq { {#3} } } - \leadsheets_set_chord:nnn - {#1} - {#2} - { \leadsheets_chord_write:n {#3} } - } - \cs_new_protected:Npn \leadsheets_set_chord:nnn #1#2#3 { \bool_if:NTF #1 @@ -59,11 +53,43 @@ #3 } -\cs_new_protected:Npn \leadsheets_chord_write:n #1 +\cs_new_protected:Npn \leadsheets_chord:nnn #1#2#3 { -% \bool_if:NT \l__leadsheets_chord_print_bool -% { - \tl_set:Nn \l__leadsheets_current_chord_tl {#1} + \leadsheets_if_record_chords:T + { \seq_gput_right:Nn \g__leadsheets_chords_sequences_seq { {#3} } } + \leadsheets_set_chord:nnn + {#1} + {#2} + { \leadsheets_chord_write:n {#3} } + } + +\group_begin: + +\cs_new_protected:Npn \leadsheets_chord_write:n + { + \group_begin: + \char_set_catcode_other:N \# + \char_set_catcode_active:N \^ + \__leadsheets_chord_write:n + } + +% for convenient input of sharps: +\char_set_catcode_other:N \# +% because ^ is active in the song environment: +\char_set_catcode_active:N \^ +% # is other so we need another parameter character: +\char_set_catcode_parameter:N \? + +\cs_new_protected:Npn \__leadsheets_chord_write:n ?1 + { + \tl_set:Nn \l__leadsheets_current_chord_tl {?1} + % => convert to English input + \bool_if:NTF \l__leadsheets_input_notation_german_bool + { + \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {B} {Bb} + \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {H} {B} + } + { \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {H} {B} } \bool_if:nT { \leadsheets_if_property_p:Vn \l_leadsheets_current_song_id_tl {key} @@ -87,9 +113,20 @@ {transpose-key} \l_leadsheets_current_song_id_tl } + % => convert to specified output + \bool_if:NT \l__leadsheets_output_notation_german_bool + { + \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {Bb} {@@@} + \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {B} {H} + \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {@@@} {B} + \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {B#} {H} + } + % => this is \chordname initially: \leadsheets_chord_print:V \l__leadsheets_current_chord_tl -% } + \group_end: } +\group_end: + \cs_generate_variant:Nn \leadsheets_chord_write:n { V } \cs_new_protected:Npn \leadsheets_place_above:nnn #1#2#3 @@ -126,13 +163,22 @@ chord-cs .code:n = \cs_set_protected:Npn \leadsheets_chord_print:n {#1} , chord-cs .initial:n = \chordname , - print-chords .bool_set:N = \l__leadsheets_chord_print_bool + print-chords .bool_set:N = \l__leadsheets_chord_print_bool , + chords/output-notation .choice: , + chords/output-notation/german .code:n = + \bool_set_true:N \l__leadsheets_output_notation_german_bool , + chords/output-notation/english .code:n = + \bool_set_false:N \l__leadsheets_output_notation_german_bool , + chords/input-notation .choice: , + chords/input-notation/german .code:n = + \bool_set_true:N \l__leadsheets_input_notation_german_bool , + chords/input-notation/english .code:n = + \bool_set_false:N \l__leadsheets_input_notation_german_bool } -\NewDocumentCommand \chord {st-m} { \leadsheets_chord:nnn {#1} {#2} {#3} } +\NewDocumentCommand \chord {st-} { \leadsheets_chord:nnn {#1} {#2} } -\NewDocumentCommand \writechord {m} - { \leadsheets_chord_write:n {#1} } +\NewDocumentCommand \writechord {} { \leadsheets_chord_write:n } % -------------------------------------------------------------------------- % record changes for a verse and automatically print them in the next: @@ -174,7 +220,7 @@ \cs_new_protected:Npn \leadsheets_recall_chord:nn #1#2 { - \seq_pop_left:NNF \l__leadsheets_chords_sequences_seq + \seq_pop_left:NNF \g__leadsheets_chords_sequences_seq \l__leadsheets_tmpa_tl { \msg_error:nnV {leadsheets} {no-chords} \l_leadsheets_verse_type_tl } \leadsheets_set_chord:nnn @@ -187,3 +233,14 @@ { \leadsheets_recall_chord:nn {#1} {#2} } \endinput + +HISTORY: + +2014/08/10 - first version +2015/07/02 - input/output notation is done here now instead of in the + `chordnames' library so transposing works with either input + correctly + - options `input-notation' and `output-notation' now directly + belong to the `chords' library. + - this is now a user library + diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.songs.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.songs.code.tex index a669e3cdb8e..3344cdd758b 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.songs.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.songs.code.tex @@ -1,4 +1,4 @@ -\LeadsheetsExplLibrary{songs}{2014/08/10 typesetting songs} +\LeadsheetsExplLibrary{songs}{2015/07/02 typesetting songs} % -------------------------------------------------------------------------- % messages: @@ -47,6 +47,7 @@ \bool_new:N \l__leadsheets_obey_lines_bool \bool_new:N \l__leadsheets_bar_shorthands_bool \bool_new:N \l__leadsheets_measuring_bool +\bool_new:N \l__leadsheets_recall_verse_type_bool \clist_new:N \l__leadsheets_print_tags_clist @@ -447,6 +448,9 @@ % -------------------------------------------------------------------------- % verses and the like: +\tl_new:N \l__leadsheets_verses_default_class_tl +\tl_set:Nn \l__leadsheets_verses_default_class_tl {default} + \cs_new_protected:Npn \leadsheets_verse_label:n #1 { \bool_if:cF {l__leadsheets_#1_empty_bool} @@ -496,6 +500,7 @@ \bool_if:NTF #1 { \bool_set_true:c {l__leadsheets_#2_empty_bool} } { \bool_set_false:c {l__leadsheets_#2_empty_bool} } + \tl_new:c {l__leadsheets_#2_class_tl} \tl_new:c {l__leadsheets_#2_format_tl} \tl_new:c {l__leadsheets_#2_template_tl} \tl_new:c {l__leadsheets_#2_label_format_tl} @@ -507,6 +512,8 @@ { numbered .bool_set:c = {l__leadsheets_#2_numbered_bool} , named .bool_set:c = {l__leadsheets_#2_named_bool} , + class .tl_set:c = {l__leadsheets_#2_class_tl} , + class .initial:V = \l__leadsheets_verses_default_class_tl , format .code:n = \tl_set:cn {l__leadsheets_#2_format_tl} {##1} , format .initial:n = \l__leadsheets_verses_format_tl , @@ -519,7 +526,9 @@ template .code:n = \tl_set:cn {l__leadsheets_#2_template_tl} {##1} , template .initial:n = itemize , - recall-chords .tl_set:N = \l__leadsheets_recall_verse_type_tl , + recall-chords .code:n = + \tl_set:Nn \l__leadsheets_recall_verse_type_tl {##1} + \bool_set_true:N \l__leadsheets_recall_verse_type_bool , name .code:n = \@trnslt@declare@translation {leadsheets/#2} {fallback} {##1} \@trnslt@declare@translation {leadsheets/#2} {English} {##1} @@ -527,20 +536,27 @@ \NewDocumentEnvironment {#2} {O{}} { \par - \tl_set:Nn \l_leadsheets_verse_type_tl {#2} - \tl_set:Nn \l__leadsheets_recall_verse_type_tl {#2} + \bool_set_false:N \l__leadsheets_recall_verse_type_bool \keys_set:nn {leadsheets/#2} {##1} + \tl_set:Nx \l_leadsheets_verse_type_tl + { #2-\tl_use:c {l__leadsheets_#2_class_tl} } + \bool_if:NF \l__leadsheets_recall_verse_type_bool + { + \tl_set_eq:NN + \l__leadsheets_recall_verse_type_tl + \l_leadsheets_verse_type_tl + } \leadsheets_if_record_chords:T - { \seq_clear:N \l__leadsheets_chords_sequences_seq } + { \seq_gclear:N \g__leadsheets_chords_sequences_seq } \leadsheets_if_recall_chords:T { \prop_get:NVN \g__leadsheets_chords_sequences_prop \l__leadsheets_recall_verse_type_tl \l__leadsheets_tmpa_tl - \seq_clear:N \l__leadsheets_chords_sequences_seq + \seq_gclear:N \g__leadsheets_chords_sequences_seq \tl_map_inline:Nn \l__leadsheets_tmpa_tl - { \seq_put_right:Nn \l__leadsheets_chords_sequences_seq {####1} } + { \seq_gput_right:Nn \g__leadsheets_chords_sequences_seq {####1} } } \leadsheets_verse_begin:n {#2} \tl_use:c {l__leadsheets_#2_format_tl} @@ -550,7 +566,7 @@ { \prop_gput:NVf \g__leadsheets_chords_sequences_prop \l_leadsheets_verse_type_tl - { \seq_use:Nn \l__leadsheets_chords_sequences_seq {} } + { \seq_use:Nn \g__leadsheets_chords_sequences_seq {} } } \leadsheets_verse_end:n {#2} \par @@ -616,6 +632,7 @@ verses-format .tl_set:N = \l__leadsheets_verses_format_tl , verses-label-format .tl_set:N = \l__leadsheets_verses_label_format_tl , verses-after-label .tl_set:N = \l__leadsheets_verses_after_label_tl , + verses-default-class .tl_set:N = \l__leadsheets_verses_default_class_tl , obey-lines .bool_set:N = \l__leadsheets_obey_lines_bool , obey-lines-parskip .skip_set:N = \l__leadsheets_obey_parskip_skip , bar-shortcuts .bool_set:N = \l__leadsheets_bar_shorthands_bool , @@ -629,3 +646,5 @@ } \endinput +2015/05/22: \l__leadsheets_chords_sequences_prop changed into global +2015/07/02: added `class' option to verses diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty index 21e744f36d0..430bde992de 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty @@ -5,9 +5,9 @@ % -------------------------------------------------------------------------- % package information: \ExplSyntaxOn -\tl_const:Nx \c_leadsheets_date_tl {2015/01/11} -\tl_const:Nx \c_leadsheets_version_tl {0.1} -\tl_const:Nx \c_leadsheets_info_tl {Typesetting leadsheets and songbooks} +\tl_const:Nn \c_leadsheets_date_tl {2015/07/02} +\tl_const:Nn \c_leadsheets_version_tl {0.2} +\tl_const:Nn \c_leadsheets_info_tl {Typesetting leadsheets and songbooks} \ProvidesExplPackage {leadsheets} @@ -134,9 +134,9 @@ musicsymbols .code:n = \bool_set_true:N \l__leadsheets_with_options_bool \leadsheets_load_library:n {musicsymbols} , - chordnames .code:n = + chords .code:n = \bool_set_true:N \l__leadsheets_with_options_bool - \leadsheets_load_library:n {chordnames} , + \leadsheets_load_library:n {chords} , musejazz .code:n = \bool_set_true:N \l__leadsheets_with_options_bool \leadsheets_load_library:n {musejazz} , |