summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty')
-rw-r--r--Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty171
1 files changed, 171 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty
new file mode 100644
index 00000000000..21e744f36d0
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty
@@ -0,0 +1,171 @@
+% --------------------------------------------------------------------------
+% required packages:
+\RequirePackage{expl3,l3keys2e,xparse,translations}
+
+% --------------------------------------------------------------------------
+% 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}
+
+\ProvidesExplPackage
+ {leadsheets}
+ {\c_leadsheets_date_tl}
+ {\c_leadsheets_version_tl}
+ {\c_leadsheets_info_tl \c_space_tl (CN)}
+
+% --------------------------------------------------------------------------
+% messages:
+\msg_new:nnn {leadsheets} {library-missing}
+ {
+ You've~ requested~ the~ leadsheets~ library~ `#1'~ but~ it~ appears~ to~
+ be~ missing~ on~ your~ system.~ Maybe~ you've~ misspelled~ the~ name?~
+ Loading~ the~ library~ will~ abort~ \msg_line_context:
+ }
+
+\msg_new:nnn {leadsheets} {loading-library}
+ {
+ (leadsheets) \c_space_tl \c_space_tl \c_space_tl \c_space_tl
+ Loading~ library~ `#1'...
+ }
+
+% --------------------------------------------------------------------------
+% variants of kernel functions:
+\cs_generate_variant:Nn \tl_if_eq:nnTF { xx , V }
+\cs_generate_variant:Nn \seq_set_split:Nnn { Nnx }
+\cs_generate_variant:Nn \prop_item:Nn { NV }
+\cs_generate_variant:Nn \seq_item:Nn { cV }
+\cs_generate_variant:Nn \int_to_arabic:n { V }
+\cs_generate_variant:Nn \tl_replace_once:Nnn { NnV }
+\cs_generate_variant:Nn \prop_gput:Nnn { cxx , NVf }
+\cs_generate_variant:Nn \msg_error:nnn { nnV }
+\cs_generate_variant:Nn \msg_warning:nnn { nnV }
+\cs_generate_variant:Nn \vbox_set:Nn { NV }
+
+% --------------------------------------------------------------------------
+% temporary variables:
+\tl_new:N \l__leadsheets_tmpa_tl
+\tl_new:N \l__leadsheets_tmpb_tl
+\tl_new:N \l__leadsheets_tmpc_tl
+\tl_new:N \l__leadsheets_tmpd_tl
+\bool_new:N \l__leadsheets_tmpa_bool
+\dim_new:N \l__leadsheets_tmpa_dim
+\seq_new:N \l__leadsheets_tmpa_seq
+\seq_new:N \l__leadsheets_tmpb_seq
+\int_new:N \l__leadsheets_tmpa_int
+\int_new:N \l__leadsheets_tmpb_int
+\int_new:N \l__leadsheets_tmpc_int
+\box_new:N \l__leadsheets_tmpa_box
+
+% --------------------------------------------------------------------------
+% library mechanism:
+\tl_const:Nn \c__leadsheets_library_extension_tl {code.tex}
+\tl_const:Nn \c__leadsheets_library_prefix_tl {leadsheets.library}
+
+\cs_new_protected:Npn \leadsheets_load_libraries:n #1
+ { \clist_map_inline:nn {#1} { \leadsheets_load_library:n {##1} } }
+
+\cs_new_protected:Npn \leadsheets_load_library:n #1
+ {
+ \tl_set:Nx \l__leadsheets_tmpa_tl { \tl_trim_spaces:n {#1} }
+ \__leadsheets_load_library:V \l__leadsheets_tmpa_tl
+ }
+
+\cs_new_protected:Npn \__leadsheets_load_library:n #1
+ {
+ \cs_if_exist:cF {leadsheets-library-#1-loaded}
+ {
+ \file_if_exist:nTF
+ {\c__leadsheets_library_prefix_tl.#1.\c__leadsheets_library_extension_tl}
+ {
+ \msg_log:nnn {leadsheets} {loading-library} {#1}
+ \@onefilewithoptions
+ {\c__leadsheets_library_prefix_tl.#1}[][]
+ \c__leadsheets_library_extension_tl
+ }
+ { \msg_warning:nnn {leadsheets} {library-missing} {#1} }
+ }
+ }
+\cs_generate_variant:Nn \__leadsheets_load_library:n { V }
+
+\cs_new_protected:Npn \__leadsheets_library:nn #1#2
+ {
+ \cs_new:cpn {leadsheets-library-#1-loaded} {leadsheets:~`#1'~library}
+ \ProvidesFile
+ {\c__leadsheets_library_prefix_tl.#1.\c__leadsheets_library_extension_tl}
+ [
+ \c_leadsheets_date_tl
+ \c_space_tl
+ v \c_leadsheets_version_tl
+ \c_space_tl
+ leadsheets~ library~ `#1'~ #2
+ ]
+ }
+
+% --------------------------------------------------------------------------
+% one of those defines a leadsheets library, either using expl syntax or 2e
+% package syntax:
+\NewDocumentCommand \LeadsheetsExplLibrary {mm}
+ { \__leadsheets_library:nn {#1} {#2} \ExplSyntaxOn }
+
+\NewDocumentCommand \LeadsheetsLibrary {mm}
+ { \__leadsheets_library:nn {#1} {#2} }
+
+% --------------------------------------------------------------------------
+% commands for loading libraries:
+\NewDocumentCommand \useleadsheetslibraries {m}
+ { \leadsheets_load_libraries:n {#1} }
+
+\NewDocumentCommand \useleadsheetslibrary {m}
+ { \leadsheets_load_library:n {#1} }
+
+% --------------------------------------------------------------------------
+% a setup command:
+\NewDocumentCommand \setleadsheets {m}
+ { \keys_set:nn {leadsheets} {#1} }
+
+% --------------------------------------------------------------------------
+% package options:
+\bool_new:N \l__leadsheets_with_options_bool
+
+\keys_define:nn {leadsheets}
+ {
+ musicsymbols .code:n =
+ \bool_set_true:N \l__leadsheets_with_options_bool
+ \leadsheets_load_library:n {musicsymbols} ,
+ chordnames .code:n =
+ \bool_set_true:N \l__leadsheets_with_options_bool
+ \leadsheets_load_library:n {chordnames} ,
+ musejazz .code:n =
+ \bool_set_true:N \l__leadsheets_with_options_bool
+ \leadsheets_load_library:n {musejazz} ,
+ songs .code:n =
+ \bool_set_true:N \l__leadsheets_with_options_bool
+ \leadsheets_load_library:n {songs} ,
+ minimal .code:n =
+ \bool_set_true:N \l__leadsheets_with_options_bool ,
+ full .code:n =
+ \bool_set_true:N \l__leadsheets_with_options_bool
+ \leadsheets_load_libraries:n
+ {
+ musicsymbols ,
+ chordnames ,
+ songs ,
+ chords ,
+ shorthands ,
+ properties ,
+ transposing ,
+ templates ,
+ translations
+ }
+ }
+\ProcessKeysOptions{leadsheets}
+
+\bool_if:NF \l__leadsheets_with_options_bool
+ { \leadsheets_load_library:n {songs} }
+
+
+% --------------------------------------------------------------------------
+\tex_endinput:D
+