diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/acro/acro-examples.sty | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/acro/acro.sty | 463 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/acro/acro2.sty | 60 |
3 files changed, 344 insertions, 183 deletions
diff --git a/Master/texmf-dist/tex/latex/acro/acro-examples.sty b/Master/texmf-dist/tex/latex/acro/acro-examples.sty index 01fca6ada36..2fa89bd3abf 100644 --- a/Master/texmf-dist/tex/latex/acro/acro-examples.sty +++ b/Master/texmf-dist/tex/latex/acro/acro-examples.sty @@ -70,7 +70,7 @@ example definitions with acro (CN)] short = FBI , long = Federal Bureau of Investigation } -\acroifpropertyTF{ +\acroifpropertyTF{short-definite}{ \DeclareAcronym{hadopi}{ short = HADOPI , long = Haute Autorité pour la diffusion des œuvres et la protection des @@ -109,7 +109,7 @@ example definitions with acro (CN)] } \DeclareAcronym{lppl}{ short = LPPL , - long = \unexpanded{\LaTeX} Project Public License + long = \LaTeX\ Project Public License } \DeclareAcronym{ma}{ short = MA , diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty index e53c01b014c..1a40b2b80f6 100644 --- a/Master/texmf-dist/tex/latex/acro/acro.sty +++ b/Master/texmf-dist/tex/latex/acro/acro.sty @@ -22,14 +22,17 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- +\DeclareRelease{v2}{2020-03-07}{acro2.sty} +\DeclareRelease{version2}{2020-03-07}{acro2.sty} + \RequirePackage {l3keys2e} \ExplSyntaxOn % setup package: \tl_const:Nn \c_acro_package_name_tl {acro} -\tl_const:Nn \c_acro_date_tl {2022/01/27} +\tl_const:Nn \c_acro_date_tl {2022/04/01} \tl_const:Nn \c_acro_version_major_number_tl {3} -\tl_const:Nn \c_acro_version_minor_number_tl {7} +\tl_const:Nn \c_acro_version_minor_number_tl {8} \tl_const:Nn \c_acro_version_subrelease_tl {} \tl_const:Nx \c_acro_version_number_tl { @@ -48,6 +51,7 @@ {\c_acro_date_tl} {\c_acro_version_tl} {\c_acro_info_tl \c_space_tl (CN)} +\DeclareCurrentRelease{v3}{\c_acro_date_tl} % -------------------------------------------------------------------------- % document hooks: @@ -79,6 +83,12 @@ typo.~ Check~ the~ manual~ for~ help. } +\msg_new:nnn {acro} {version} + { + Please~ specify~ the~ version~ by~ saying~ \token_to_str:N + \usepackage{acro}[=v#1],~ i.e., using~ LaTeX's~ release~ mechanism. + } + % -------------------------------------------------------------------------- % re-compile mechanism: \bool_new:N \g__acro_rerun_bool @@ -183,8 +193,6 @@ \cs_generate_variant:Nn \msg_error:nnn {nnV} \cs_generate_variant:Nn \msg_warning:nnn {nnV} -\int_new:N \g__acro_version_int - \keys_define:nn {acro/package} { debug .bool_gset:N = \g__acro_debug_bool , @@ -194,20 +202,13 @@ final .bool_gset:N = \g__acro_final_bool , final .initial:n = false , version .choice: , - version / 2 .code:n = \int_gset:Nn \g__acro_version_int {2} , - version / 3 .code:n = \int_gset:Nn \g__acro_version_int {3} , - version .initial:n = 3 , + version / 2 .code:n = \msg_error:nnn {acro} {version} {#1} \file_input_stop: , + version / 3 .code:n = \msg_warning:nnn {acro} {version} {#1} , unknown .code:n = \__acro_loadtime_warning:n {unknown-option} } \ProcessKeysPackageOptions {acro/package} -\int_compare:nNnT \g__acro_version_int = 2 - { - \RequirePackage {acro2} - \file_input_stop: - } - \keys_define:nn {acro/package} { debug .code:n = \__acro_loadtime_error:n {load-time-option} , @@ -1000,51 +1001,41 @@ % -------------------------------------------------------------------------- \AcroModuleEnd -\AcroModule{aux}{usage of auxiliary files} +\AcroModule{aux}{usage of LaTeX's aux files} + + +% this is still true \AtBeginDocument: +\prg_new_conditional:Npnn \acro_if_preamble: {p,T,F,TF} + { + \cs_if_eq:NNTF \@onlypreamble \@notprerr + { \prg_return_false: } + { \prg_return_true: } + } \cs_new_protected:Npn \ACRO #1 { \use:c {__acro_aux_#1:} } \cs_new_protected:Npn \__acro_auxlist_field_new:cpn #1 { \cs_new_protected:cpn {__acro_aux_#1:} } +\cs_new_protected:Npn \acro_auxlist_write_entry:nn #1#2 + { + \acro_if_preamble:F + { + \acro_write_to_aux:x + { \token_to_str:N \ACRO {#1} #2 } + } + } + \cs_new_protected:Npn \acro_auxlist_to_aux:nn #1#2 { \acro_write_to_aux:x { \token_to_str:N \ACRO {#1} #2 } } -\tl_const:Nx \c_acro_auxfile_tl { \c_sys_jobname_str .acr } - -\iow_new:N \l__acro_aux_file_iow \tl_new:N \l__acro_mdfive_hash_tl -\cs_new_protected:Npn \acro_close_aux: - { - \legacy_if:nT {@filesw} - { \iow_now:Nx \@auxout { \token_to_str:N \ACRO {readaux} } } - } - \cs_new_protected:Npn \acro_write_to_aux:n #1 - { - \legacy_if:nT {@filesw} - { \iow_now:Nn \@auxout {#1} } - } + { \legacy_if:nT {@filesw} { \iow_now:Nn \@auxout {#1} } } \cs_generate_variant:Nn \acro_write_to_aux:n {x} -\__acro_auxlist_field_new:cpn {readaux} - { - \file_if_exist:nT { \c_sys_jobname_str .acr } - { \file_input:n { \c_sys_jobname_str .acr } } - } - % ---------------------------------------------------------------------------- -% list for recording values that need to be written to the aux file and -% updated at begin document - -\str_new:N \l__acro_auxlist_split_str -\keys_define:nn {acro} - { - auxlist-split .code:n = \str_set:Nn \l__acro_auxlist_split_str {#1} , - auxlist-split .initial:n = || - } - % define list: % #1: name \cs_new_protected:Npn \__acro_auxlist_new:n #1 @@ -1058,8 +1049,7 @@ { \tl_if_blank:nF {##1} { - \seq_gset_split:cVx {g__acro_auxlist_#1_seq} - \l__acro_auxlist_split_str + \seq_gput_right:cx {g__acro_auxlist_#1_seq} { \tl_to_str:n {##1} } \seq_map_inline:cn {g__acro_auxlist_#1_seq} { \acro_attribute_set:nnn {#1} {####1} {} } @@ -1074,7 +1064,7 @@ \str_set:Nn \l__acro_tmpa_str {##1} \seq_gput_right:cV {g__acro_auxlist_recorded_#1_seq} \l__acro_tmpa_str } - \seq_gremove_duplicates:c {g__acro_auxlist_recorded_#1_seq} + \seq_gremove_duplicates:c {g__acro_auxlist_recorded_#1_seq} } } @@ -1087,7 +1077,9 @@ \acro_attribute_set:nnn {#1} {#2} {} \seq_if_in:cVT {g__acro_auxlist_#1_seq} \l__acro_tmpa_str { \seq_gremove_all:cV {g__acro_auxlist_#1_seq} \l__acro_tmpa_str } + % \acro_auxlist_write_entry:nn {#1} {{#2}} \seq_gput_right:cV {g__acro_auxlist_#1_seq} \l__acro_tmpa_str + \seq_gremove_duplicates:c {g__acro_auxlist_#1_seq} } \cs_generate_variant:Nn \__acro_auxlist_add:nn {nx} @@ -1100,8 +1092,6 @@ { \acro_attribute_unset:nn {#1} {#2} } \seq_if_in:cVT {g__acro_auxlist_#1_seq} \l__acro_tmpa_str { \seq_gremove_all:cV {g__acro_auxlist_#1_seq} \l__acro_tmpa_str } - \seq_if_in:cVT {g__acro_auxlist_recorded#1_seq} \l__acro_tmpa_str - { \seq_gremove_all:cV {g__acro_auxlist_recorded_#1_seq} \l__acro_tmpa_str } } \cs_generate_variant:Nn \__acro_auxlist_remove:nn {nx} @@ -1120,22 +1110,41 @@ \cs_new_protected:Npn \acro_auxlists_clear: { \bool_set_true:N \l__acro_auxlists_clear_bool } + +\cs_new_protected:Npn \__acro_get_string_from_property_seq:NN #1#2 + { + \prop_clear:N \l__acro_tmpa_prop + \seq_clear:N \l__acro_tmpa_seq + \seq_map_inline:Nn #1 + { + \__acro_get_aux_entry:nNN {##1} + \l__acro_tmpa_tl + \l__acro_tmpb_tl + \prop_put:NVV \l__acro_tmpa_prop \l__acro_tmpa_tl \l__acro_tmpb_tl + } + \prop_map_inline:Nn \l__acro_tmpa_prop + { \seq_put_right:Nn \l__acro_tmpa_seq {##1:##2} } + \acro_seq_sort:N \l__acro_tmpa_seq + \str_set:Nx #2 { \seq_use:Nn \l__acro_tmpa_seq {} } + } +\cs_generate_variant:Nn \__acro_get_string_from_property_seq:NN {c} + % update list (should be used inside \acro_at_end_document:n): % #1: name \cs_new_protected:Npn \__acro_auxlist_update:n #1 { - \seq_gremove_duplicates:c {g__acro_auxlist_#1_seq} - \seq_gremove_duplicates:c {g__acro_auxlist_recorded_#1_seq} - \str_set:Nx \l__acro_tmpa_str - { \seq_use:cn {g__acro_auxlist_#1_seq} {} } - \str_set:Nx \l__acro_tmpb_str - { \seq_use:cn {g__acro_auxlist_recorded_#1_seq} {} } + \__acro_get_string_from_property_seq:cN + {g__acro_auxlist_#1_seq} + \l__acro_tmpa_str + \__acro_get_string_from_property_seq:cN + {g__acro_auxlist_recorded_#1_seq} + \l__acro_tmpb_str \str_if_eq:NNF \l__acro_tmpa_str \l__acro_tmpb_str { \acro_rerun:n {property} } \bool_if:NF \l__acro_auxlists_clear_bool { - \acro_auxlist_to_aux:nn {#1} - { { \seq_use:cV {g__acro_auxlist_#1_seq} \l__acro_auxlist_split_str } } + \seq_map_inline:cn {g__acro_auxlist_#1_seq} + { \acro_auxlist_write_entry:nn {#1} {{##1}} } } } @@ -1271,7 +1280,8 @@ } \bool_if:NT \l__acro_property_define_static_bool { - \hook_gput_code:nnn {enddocument} {acro} { \__acro_auxlist_update:n {#2} } + \hook_gput_code:nnn {enddocument/afterlastpage} {acro} + { \__acro_auxlist_update:n {#2} } \acro_at_begin_document:n { \__acro_property_set_from_auxlist:n {#2} } } @@ -1377,6 +1387,13 @@ { \prg_return_false: } } +\prg_new_conditional:Npnn \acro_property_if_static:n #1 {p,T,F,TF} + { + \acro_attribute_if_set:nnTF {dynamic} {#1} + { \prg_return_false: } + { \prg_return_true: } + } + \prg_new_conditional:Npnn \acro_property_if_unique:n #1 {p,T,F,TF} { \acro_attribute_if_set:nnTF {unique} {#1} @@ -1518,7 +1535,7 @@ \__acro_auxlist_add:nn {#2} {#1=={#3}} \acro_attribute_set:nnn {#2} {#1} {#3} } -\cs_generate_variant:Nn \__acro_property_set:nnn {VnV,nne} +\cs_generate_variant:Nn \__acro_property_set:nnn {VnV,nne,V} \tl_set:Nx \l__acro_tmpa_tl { \cs_to_str:N \{ } \tl_set:Nx \l__acro_tmpb_tl { \cs_to_str:N \} } @@ -1534,6 +1551,9 @@ \str_set:Nn #2 {#4} } +\str_new:N \l____acro_tmpa_str +\str_new:N \l____acro_tmpb_str + % #1: id % #2: property \cs_new_protected:Npn \__acro_property_remove_from_auxlist:nn #1#2 @@ -1542,22 +1562,22 @@ \__acro_auxlist_foreach_entry:nn {#2} { \__acro_property_extract_auxlist_entry:NNww - \l__acro_tmpa_str \l__acro_tmpb_str ##1 \q_stop - \str_if_eq:xnT { \l__acro_tmpa_str } {#1} + \l____acro_tmpa_str \l____acro_tmpb_str ##1 \q_stop + \str_if_eq:xnT { \l____acro_tmpa_str } {#1} { \__acro_auxlist_remove:nx {#2} - { #1 == {\l__acro_tmpb_str} } + { #1 == { \l____acro_tmpb_str } } } } % make sure we change the entry if it has been set during the current run: \__acro_auxlist_foreach_new_entry:nn {#2} { \__acro_property_extract_auxlist_entry:NNww - \l__acro_tmpa_str \l__acro_tmpb_str ##1 \q_stop - \str_if_eq:xnT { \l__acro_tmpa_str } {#1} + \l____acro_tmpa_str \l____acro_tmpb_str ##1 \q_stop + \str_if_eq:xnT { \l____acro_tmpa_str } {#1} { \__acro_auxlist_remove:nx {#2} - { #1 == {\l__acro_tmpb_str} } + { #1 == { \l____acro_tmpb_str } } } } } @@ -1566,13 +1586,33 @@ \cs_new_protected:Npn \__acro_property_set_from_auxlist:n #1 { \__acro_auxlist_foreach_entry:nn {#1} - { - \__acro_property_extract_auxlist_entry:NNww - \l__acro_tmpa_str \l__acro_tmpb_str ##1 \q_stop - \tl_set_rescan:Nnx \l__acro_tmpa_tl {} { \l__acro_tmpb_str } - \__acro_property_set:VnV \l__acro_tmpa_str {#1} \l__acro_tmpa_tl - } + { \__acro_property_set_from_aux_entry:nn {#1} {##1} } + } + +% #1: property +% #2: id=={value} +\cs_new_protected:Npn \__acro_property_set_from_aux_entry:nn #1#2 + { + \__acro_property_extract_auxlist_entry:NNww + \l____acro_tmpa_str \l____acro_tmpb_str #2 \q_stop + \tl_set_rescan:NnV \l__acro_tmpa_tl {} \l____acro_tmpb_str + \__acro_property_set:VnV \l____acro_tmpa_str {#1} \l__acro_tmpa_tl + } +\cs_generate_variant:Nn \__acro_property_set_from_aux_entry:nn {ne} +\cs_generate_variant:Nn \tl_set_rescan:Nnn {NnV} + +% #1: id=={value} +% #2: tl var +% #3: tl var +\cs_new_protected:Npn \__acro_get_aux_entry:nNN #1#2#3 + { + \__acro_property_extract_auxlist_entry:NNww + \l____acro_tmpa_str \l____acro_tmpb_str #1 \q_stop + \tl_set_rescan:Nnx \l__acro_tmpa_tl {} { \l____acro_tmpb_str } + \tl_set:NV #3 \l__acro_tmpa_tl + \tl_set:NV #2 \l____acro_tmpa_str } +\cs_generate_variant:Nn \__acro_property_set_from_aux_entry:nn {ne} % set properties: % #1: id @@ -1659,8 +1699,8 @@ % inspect properties: \cs_new_protected:Npn \acro_property_show:nn #1#2 { - \acro_property_if_set:nnT {#1} {#2} - { + % \acro_property_if_set:nnT {#1} {#2} + % { \iow_term:x { \c_space_tl \c_space_tl @@ -1668,7 +1708,7 @@ \c_space_tl \c_space_tl => \c_space_tl \c_space_tl { \acro_property_get:nn {#1} {#2} } } - } + % } } \cs_generate_variant:Nn \acro_property_show:nn {e} @@ -1899,7 +1939,7 @@ % #2: properties \cs_new_protected:Npn \__acro_declare_acronym:nn #1#2 { - \int_new:c {g__acro_#1_int} + \newcounter {g@acro@#1@int} \seq_new:c {g__acro_#1_pages_seq} \seq_new:c {g__acro_#1_barriers_seq} \acro_at_begin_document:n @@ -1933,7 +1973,7 @@ \acro_set_endings:n {#1} \acro_at_end_document:n { - \acro_property_set:nnx {#1} {usage} { \int_use:c {g__acro_#1_int} } + \acro_property_set:nnx {#1} {usage} { \arabic {g@acro@#1@int} } \acro_set_barriers:n {#1} } } @@ -2011,13 +2051,7 @@ { \seq_map_inline:Nn \g_acro_acronyms_seq { \__acro_use:n {##1} } } \cs_new_protected:Npn \__acro_reset:n #1 - { - \acro_property_set:nnn {#1} {used} {false} - % \int_gzero:c {g__acro_ \acro_case_insensitive:n {#1} _int} - % \int_compare:nNnF - % { \acro_property_get:nn {#1} {usage} } > 0 - % { \acro_property_set:nnn {#1} {usage} {0} } - } + { \acro_property_set:nnn {#1} {used} {false} } \cs_new_protected:Npn \acro_reset:n #1 { \clist_map_inline:nn {#1} { \__acro_reset:n {##1} } } @@ -2388,7 +2422,7 @@ % #1: id \cs_new_protected:Npn \acro_step:n #1 - { \int_gincr:c {g__acro_ \acro_case_insensitive:n {#1} _int} } + { \stepcounter {g@acro@ \acro_case_insensitive:n {#1} @int} } \cs_generate_variant:Nn \acro_step:n {e} % #1: id @@ -2867,6 +2901,21 @@ } } +\cs_new_protected:Npn \acro_seq_sort:N #1 + { + \seq_sort:Nn #1 + { + \int_compare:nNnTF + { + \__acro_strcmp:nn + { \str_foldcase:e {##1} } + { \str_foldcase:e {##2} } + } = {-1} + { \sort_return_same: } + { \sort_return_swapped: } + } + } + % -------------------------------------------------------------------------- % barriers: \int_new:N \g_acro_barrier_int @@ -3133,9 +3182,12 @@ % #2: property \cs_new_protected:Npn \__acro_write_acronym:nn #1#2 { - \__acro_upper:n { \__acro_article:nn {#1} {#2} } \bool_if:NT \l__acro_article_bool - { \bool_set_false:N \l__acro_upper_bool } + { + \__acro_upper:n { \__acro_article:nn {#1} {#2} } + \bool_set_false:N \l__acro_article_bool + \bool_set_false:N \l__acro_upper_bool + } \bool_lazy_and:nnTF { \acro_property_if_eq_p:nn {#2} {long} } { \acro_if_first_p:n {#1} } @@ -3255,6 +3307,8 @@ \tl_new:N \l_acro_id_tl \tl_new:N \AcronymID +\int_new:N \l_acro_nest_level_int + % #1: csname % #2: xparse csname % #3: action @@ -3270,6 +3324,7 @@ { base \__acro_remove_bs:N ##1 } {##2} { \acro_begin: + \int_incr:N \l_acro_nest_level_int \l__acro_begin_command_hook_tl \cs_set:Npn \nospace { \exp:w \exp_end_continue_f:w } \acro_check_definition:nT @@ -3283,6 +3338,7 @@ { \l__acro_star_bool } { \acro_case_insensitive:n {####1} } \l__acro_end_command_hook_tl + \int_decr:N \l_acro_nest_level_int } \acro_end: } @@ -3854,34 +3910,36 @@ \msg_new:nnn {acro} {threshold} { The~ sequentes~ threshold~ needs~ to~ be~ at~ least~ 3. } -\group_begin: -\char_set_catcode_other:N \@ - % #1: id \cs_new_protected:Npn \acro_record_page:n #1 { - \seq_if_in:ceF {g__acro_#1_pages_seq} - { - \int_use:N \g_shipout_totalpages_int - @ \int_use:N \g_acro_barrier_int - @ \thepage - } - { - \seq_gput_right:ce {g__acro_#1_pages_seq} - { - \int_use:N \g_shipout_totalpages_int - @ \int_use:N \g_acro_barrier_int - @ \thepage - } - } - \seq_gremove_duplicates:c {g__acro_#1_pages_seq} - \acro_at_end_document:n + \__acro_record_page:n {#1} + \hook_gput_code:nnn {enddocument} {acro} { + \seq_gremove_duplicates:c {g__acro_#1_pages_seq} \acro_property_set:nnx {#1} {pages} { \seq_use:cn {g__acro_#1_pages_seq} {|} } } } +\cs_new_protected:Npn \__acro_record_page:n #1 + { + \iow_shipout_x:Nn \@auxout + { + \token_to_str:N \ACRO {recordpage} + {#1} + { \int_use:N \g_shipout_totalpages_int } + { \int_use:N \g_acro_barrier_int } + { \thepage } + } + } + +\group_begin: +\char_set_catcode_other:N \@ + +\__acro_auxlist_field_new:cpn {recordpage} #1#2#3#4 + { \seq_gput_right:ce {g__acro_#1_pages_seq} {#2@#3@#4} } + \cs_new:Npn \__acro_page_name:w #1@#2@#3 \q_stop { \acro_package_if_loaded:nTF {hyperref} @@ -3924,12 +3982,16 @@ { \seq_set_split:Nnx \l__acro_tmpa_seq {|} { \acro_property_get:nn {#1} {pages} } - \use:e + \seq_remove_all:Nn \l__acro_tmpa_seq {} + \seq_if_empty:NF \l__acro_tmpa_seq { - \exp_last_unbraced:Ne - \__acro_page_name:w - { \seq_item:Nn \l__acro_tmpa_seq {1} } - \q_stop + \use:e + { + \exp_last_unbraced:Ne + \__acro_page_name:w + { \seq_item:Nn \l__acro_tmpa_seq {1} } + \q_stop + } } } @@ -3940,11 +4002,12 @@ { \seq_set_split:Nnx \l__acro_tmpa_seq {|} { \acro_property_get:nn {#1} {pages} } + \seq_remove_all:Nn \l__acro_tmpa_seq {} \intarray_gzero:N \g__acro_pages_intarray \seq_map_inline:Nn \l__acro_tmpa_seq { \intarray_gset:Nnn \g__acro_pages_intarray - { \__acro_absolute_page:w ##1 \q_stop + 1 } + { \__acro_absolute_page:w ##1 \q_stop } { \bool_if:NTF \l__acro_list_local_bool { @@ -3977,7 +4040,7 @@ { % the current page \int_set:Nn \l__acro_tmpa_int - { \__acro_absolute_page:w ##1 \q_stop + 1 } + { \__acro_absolute_page:w ##1 \q_stop } \int_compare:nNnTF \l__acro_tmpa_int = 1 { % first page, start range \seq_put_right:Ne \l__acro_tmpb_seq @@ -4089,7 +4152,11 @@ { \bool_lazy_and_p:nn { \acro_attribute_if_set_p:nn {pages} {#1} } - { !\acro_if_single_p:n {#1} } + { + \bool_lazy_or_p:nn + { \l__acro_list_display_all_bool } + { !\acro_if_single_p:n {#1} } + } } { \prg_return_true: } { \prg_return_false: } @@ -4295,8 +4362,15 @@ { \bool_if:NTF \l__acro_language_auto_bool { - \tl_set:Nx \l_acro_language_tl - { \@trnslt@language{\@trnslt@current@language} } + \tl_if_exist:NTF \c_trnslt_current_language_tl + { + \tl_set_eq:NN \l_acro_language_tl + \c_trnslt_current_language_tl + } + { + \tl_set:Nx \l_acro_language_tl + { \@trnslt@language{\@trnslt@current@language} } + } } { \tl_set_eq:NN @@ -4425,8 +4499,8 @@ { \hyperlink {##1} { \XeTeXLinkBox {##2} } } } { \cs_set_eq:NN \__acro_hyper_link:nn \hyperlink } - \cs_set:Npn \__acro_hyper_target:nn ##1##2 - { \raisebox {3ex} [0pt] { \hypertarget {##1} { } } ##2 } + \cs_set_protected:Npn \__acro_hyper_target:nn ##1##2 + { \Hy@raisedlink { \hypertarget {##1} { } } ##2 } \cs_set_eq:NN \__acro_hyper_back_link:nn \__acro_hyper_link:nn \cs_set_eq:NN \__acro_hyper_back_target:nn \__acro_hyper_target:nn } @@ -4443,7 +4517,11 @@ { { \acro_package_if_loaded_p:n {hyperref} } { \l__acro_hyperref_use_bool } - { !\acro_if_single_p:n {#1} } + { + \bool_lazy_or_p:nn + { \l__acro_list_display_all_bool } + { !\acro_if_single_p:n {#1} } + } { \bool_lazy_or_p:nn { !\l__acro_link_only_first_bool } @@ -4451,7 +4529,9 @@ } } { - \bool_if:NTF \l__acro_list_bool + \bool_lazy_and:nnTF + { \l__acro_list_bool } + { \int_compare_p:nNn { \l_acro_nest_level_int } = 0 } { \__acro_hyper_target:en { @@ -4531,10 +4611,14 @@ { \bool_if:NTF \l__acro_accsupp_bool { - \__acro_do_accsupp:Vnn - \l__acro_acc_supp_options_tl - {#1} + \int_compare:nNnTF { \l_acro_nest_level_int } > 1 {#2} + { + \__acro_do_accsupp:Vnn + \l__acro_acc_supp_options_tl + {#1} + {#2} + } } {#2} } @@ -5019,6 +5103,8 @@ \msg_new:nnn {acro} {patch} { Patching~ `#1'~ failed.~ Please~ contact~ the~ acro~ author. } +\RequirePackage {etoolbox} + \cs_new_protected:Npn \acro_new_patch:n #1 { \bool_new:c {l__acro_patch_#1_bool} @@ -5072,6 +5158,19 @@ {} { \msg_error:nnn {acro} {patch} {floats} } } + % contents lists: + \acro_if_patch:nT {lists} + { + \addtocontents {toc} { \acswitchoff } + \addtocontents {lof} { \acswitchoff } + \addtocontents {lot} { \acswitchoff } + } + % caption package: + \acro_if_patch:nT {caption} + { + \cs_if_exist:NT \caption@prepareslc + { \tl_gput_right:Nn \caption@prepareslc { \acswitchoff } } + } % tables: % * tabularx \acro_if_patch:nT {tabularx} @@ -5103,20 +5202,7 @@ \cs_if_exist:NT \tabuDisableCommands { \tabuDisableCommands { \acswitchoff } } } - % contents lists: - \acro_if_patch:nT {lists} - { - \addtocontents {toc} { \acswitchoff } - \addtocontents {lof} { \acswitchoff } - \addtocontents {lot} { \acswitchoff } - } - % caption package: - \acro_if_patch:nT {caption} - { - \cs_if_exist:NT \caption@prepareslc - { \tl_gput_right:Nn \caption@prepareslc { \acswitchoff } } - } - % longtable pakage: + % * longtable \acro_if_patch:nT {longtable} { \cs_if_exist:NT \endlongtable @@ -5235,8 +5321,8 @@ { \space ( - \acroifT {alt} { \acrotranslate {or} ~ \acrowrite {alt} ~ } - \acroifT {foreign} { \acrowrite {foreign} :~ } + \acroifT {alt} { \acrotranslate {or} ~ \acrowrite {alt} ,~ } + \acroifT {foreign} { \acrowrite {foreign} ,~ } \acrowrite {long} \acrogroupcite ) @@ -5250,7 +5336,7 @@ { \acfootnote { - \acroifT {alt} { \acrotranslate {or} ~ \acrowrite {alt} :~ } + \acroifT {alt} { \acrotranslate {or} ~ \acrowrite {alt} ,~ } \acroifT {foreign} { \acrowrite {foreign} ,~ } \acrowrite {long} \acrogroupcite @@ -5332,7 +5418,7 @@ \begin {description} \acronymsmapF { - \item [ \acrowrite {short} \acroifT {alt} { / } \acrowrite {alt} ] + \item [ \acrowrite {short} \acroifT {alt} {/} \acrowrite {alt} ] \acrowrite {list} \acroifanyT {foreign,extra} {~(} \acrowrite {foreign} @@ -5348,6 +5434,13 @@ \end {description} } +\tl_new:N \l_acro_table_colspec_tl +\keys_define:nn {acro/templates} + { + colspec .tl_set:N = \l_acro_table_colspec_tl , + colspec .initial:n = {>{\bfseries}lp{.7\linewidth}} + } + \NewAcroTemplate[list] {tabular} { \AcroNeedPackage {array} @@ -5356,7 +5449,7 @@ \AcroAddRow { \acrowrite {short} - \acroifT {alt} { / } \acrowrite {alt} + \acroifT {alt} {/} \acrowrite {alt} & \acrowrite {list} \acroifanyT {foreign,extra} {~(} @@ -5375,7 +5468,8 @@ \acroheading \acropreamble \par \noindent - \begin {tabular} {>{\bfseries}lp{.7\linewidth}} + \exp_args:NnV + \begin {tabular} \l_acro_table_colspec_tl \AcronymTable \end {tabular} } @@ -5388,7 +5482,7 @@ \AcroAddRow { \acrowrite {short} - \acroifT {alt} { / } \acrowrite {alt} + \acroifT {alt} {/} \acrowrite {alt} & \acrowrite {list} \acroifanyT {foreign,extra} {~(} @@ -5407,20 +5501,22 @@ \acroheading \acropreamble \par \noindent - \begin {longtable} {>{\bfseries}lp{.7\linewidth}} + \exp_args:NnV + \begin {longtable} \l_acro_table_colspec_tl \AcronymTable \end {longtable} + \addtocounter {table} {-1} } - -\NewAcroTemplate[list] {longtabu} + +\NewAcroTemplate[list] {supertabular} { - \AcroNeedPackage {array,longtable,tabu} + \AcroNeedPackage {array,supertabular} \acronymsmapF { \AcroAddRow { \acrowrite {short} - \acroifT {alt} { / } \acrowrite {alt} + \acroifT {alt} {/} \acrowrite {alt} & \acrowrite {list} \acroifanyT {foreign,extra} {~(} @@ -5432,27 +5528,28 @@ \acropages { \acrotranslate {page} \nobreakspace } { \acrotranslate {pages} \nobreakspace } - \strut \tabularnewline + \tabularnewline } } - { \AcroRerun } + { \AcroRerun } \acroheading \acropreamble \par \noindent - \begin {longtabu} {>{\bfseries}lX[l]} + \exp_args:NnV + \begin {supertabular} \l_acro_table_colspec_tl \AcronymTable - \end {longtabu} + \end {supertabular} } -\NewAcroTemplate[list] {supertabular} +\NewAcroTemplate[list] {xltabular} { - \AcroNeedPackage {array,supertabular} + \AcroNeedPackage {xltabular} \acronymsmapF { \AcroAddRow { \acrowrite {short} - \acroifT {alt} { / } \acrowrite {alt} + \acroifT {alt} {/} \acrowrite {alt} & \acrowrite {list} \acroifanyT {foreign,extra} {~(} @@ -5471,13 +5568,59 @@ \acroheading \acropreamble \par \noindent - \begin {supertabular} {>{\bfseries}lp{.7\linewidth}} + \begin {xltabular} {\linewidth} {>{\bfseries}lX} \AcronymTable - \end {supertabular} + \end {xltabular} + } + +\hook_gput_code:nnn {package/tabularray/after} {acro} + { + \NewTblrTheme {acro} { \DefTblrTemplate {foot} {default} {} } + \NewTblrEnviron {actblr} + \SetTblrOuter [actblr] { + long , + expand = \AcronymTable , + theme = acro , + entry = none , + label = none + } + \SetTblrInner [actblr] { rowsep = 0pt } + } + +\NewAcroTemplate [list] {tabularray} + { + \AcroNeedPackage {tabularray} + \acronymsmapF + { + \AcroAddRow + { + \acrowrite {short} + \acroifT {alt} {/} \acrowrite {alt} + & + \acrowrite {list} + \acroifanyT {foreign,extra} {~(} + \acrowrite {foreign} + \acroifallT {foreign,extra} {,~} + \acrowrite {extra} + \acroifanyT {foreign,extra} {)} + \acropagefill + \acropages + { \acrotranslate {page} \nobreakspace } + { \acrotranslate {pages} \nobreakspace } + \strut \\ + } + } + { \AcroRerun } + \acroheading + \acropreamble + \par \noindent + \begin {actblr} { colspec = {lX[l]}, column{1} = { font = \bfseries } } + \AcronymTable + \end {actblr} } \let\l@acro\l@figure - + \NewAcroTemplate [list] {lof} { \acroheading @@ -5489,7 +5632,7 @@ \contentsline {acro} { \numberline - { \acrowrite {short} \acroifT {alt} { / } \acrowrite {alt} } + { \acrowrite {short} \acroifT {alt} {/} \acrowrite {alt} } { \acrowrite {list} \acroifanyT {foreign,extra} {~(} @@ -5514,7 +5657,7 @@ \acronymsmapF { \contentsline { \acroifchapterTF {chapter} {section} } - { \acrowrite {short} \acroifT {alt} { / } \acrowrite {alt} } + { \acrowrite {short} \acroifT {alt} {/} \acrowrite {alt} } {}{} \contentsline { \acroifchapterF {sub} section } { @@ -5954,6 +6097,6 @@ % ---------------------------------------------------------------------------- \AcroModuleEnd % finish package: -\hook_gput_code:nnn {enddocument} {acro} { \acro_close_aux: \acro_do_rerun: } +\hook_gput_code:nnn {enddocument} {acro} { \acro_do_rerun: } %---------------------------------------------------------------------------- \file_input_stop: diff --git a/Master/texmf-dist/tex/latex/acro/acro2.sty b/Master/texmf-dist/tex/latex/acro/acro2.sty index d5c7d0b59f8..599f65211b6 100644 --- a/Master/texmf-dist/tex/latex/acro/acro2.sty +++ b/Master/texmf-dist/tex/latex/acro/acro2.sty @@ -5,18 +5,18 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: https://github.com/cgnieder/acro/ +% Web: https://bitbucket.org/cgnieder/acro/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2011--2020 Clemens Niederberger % % This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c +% conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of LaTeX -% version 2008/05/04 or later. +% version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. % @@ -33,11 +33,29 @@ \RequirePackage{expl3,xparse,xtemplate,l3keys2e} \RequirePackage{etoolbox} % for the document hooks +\ExplSyntaxOn + +\tl_const:Nn \c_acro_date_tl {2020/03/07} +\tl_const:Nn \c_acro_version_major_number_tl {2} +\tl_const:Nn \c_acro_version_minor_number_tl {11} +\tl_const:Nn \c_acro_version_subrelease_tl {d} +\tl_const:Nx \c_acro_version_number_tl + { + \c_acro_version_major_number_tl . + \c_acro_version_minor_number_tl + } +\tl_const:Nx \c_acro_version_tl + { + \c_acro_version_number_tl + \c_acro_version_subrelease_tl + } +\tl_const:Nn \c_acro_info_tl {Typeset~ Acronyms} + \ProvidesExplPackage - {acro2} - {2020/03/07} - {2.11d} - {\csname c_acro_info_tl\endcsname} + {acro} + {\c_acro_date_tl} + {\c_acro_version_tl} + {\c_acro_info_tl} % -------------------------------------------------------------------------- % warning and error messages: @@ -193,6 +211,7 @@ \bool_new:N \l__acro_place_label_bool \bool_new:N \l__acro_print_only_used_bool \bool_set_true:N \l__acro_print_only_used_bool +\bool_new:N \g__acro_rerun_bool \bool_new:N \g__acro_reset_at_barrier_bool \bool_new:N \l__acro_silence_bool \bool_new:N \l__acro_single_use_bool @@ -2481,7 +2500,7 @@ \cs_new_protected:Npn \acro@pages #1#2 { \tl_gset:cn {g__acro_#1_recorded_pages_tl} {#2} } - + \cs_new_protected:Npn \acro@rerun@check { \bool_if:NT \g__acro_rerun_bool @@ -3009,7 +3028,7 @@ \bool_if:NT \l__acro_indefinite_bool { \prop_item:cn {l__acro_#2_indefinite_prop} {#1} ~ } \bool_if:NT \l__acro_upper_indefinite_bool - { + { % \bool_set_true:N \l__acro_first_upper_bool \__acro_first_upper_case:x { \prop_item:cn {l__acro_#2_indefinite_prop} {#1} } ~ } @@ -4078,18 +4097,7 @@ \tl_set:Nn \l__acro_next_pages_tl { \,\GetTranslation {acronym-next-pages}\@ } % -------------------------------------------------------------------------- -% allow for a configuration file: - -\file_if_exist:nT - { \l_acro_config_file_name_tl . \l_acro_config_file_extension_tl } - { - \@onefilewithoptions - {\l_acro_config_file_name_tl} [] [] - \l_acro_config_file_extension_tl - } - -% -------------------------------------------------------------------------- -% define user functions: +% definition file: % document commands: \NewDocumentCommand \DeclareAcronym {mm} { \acro_declare_acronym:nn {#1} {#2} } @@ -4637,4 +4645,14 @@ } % -------------------------------------------------------------------------- +% allow for a configuration file: + +\file_if_exist:nT + { \l_acro_config_file_name_tl . \l_acro_config_file_extension_tl } + { + \@onefilewithoptions + {\l_acro_config_file_name_tl} [] [] + \l_acro_config_file_extension_tl + } + \file_input_stop: |