diff options
author | Karl Berry <karl@freefriends.org> | 2020-01-05 23:48:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-01-05 23:48:36 +0000 |
commit | b8b82d8520dcef89f00ec840eb0bb213b04762ce (patch) | |
tree | 379e1e293eb65ee32a03ee7a0f146ca6392f0e5c /Master/texmf-dist/tex/latex/acro | |
parent | b175c6dcf5aa573c0549f720e4275f12126bd332 (diff) |
acro
git-svn-id: svn://tug.org/texlive/trunk@53333 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/acro')
-rw-r--r-- | Master/texmf-dist/tex/latex/acro/acro.sty | 102 |
1 files changed, 55 insertions, 47 deletions
diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty index 4f94b1304c8..03d0121d5f2 100644 --- a/Master/texmf-dist/tex/latex/acro/acro.sty +++ b/Master/texmf-dist/tex/latex/acro/acro.sty @@ -31,8 +31,8 @@ \RequirePackage{expl3,xparse,l3keys2e,xtemplate,etoolbox} \ProvidesExplPackage {acro} - {2019/10/12} - {2.10c} + {2019/12/30} + {2.10d} {Typeset Acronyms} % -------------------------------------------------------------------------- @@ -109,7 +109,12 @@ % -------------------------------------------------------------------------- % logging: -\cs_new:Npn \acro_if_log:T #1 { \use:n {#1} } +\prg_new_conditional:Npnn \acro_if_log: {p,T,F,TF} + { + \bool_if:NTF \l__acro_log_acronyms_bool + { \prg_return_true: } + { \prg_return_false: } + } \bool_new:N \l__acro_log_acronyms_bool \bool_new:N \l__acro_log_acronyms_verbose_bool @@ -440,12 +445,12 @@ \cs_new_protected:Npn \__acro_first_upper_case:n #1 { \tl_upper_case:n { \tl_head:n {#1} } \tl_tail:n {#1} } -\cs_generate_variant:Nn \__acro_first_upper_case:n { x } -\cs_generate_variant:Nn \tl_mixed_case:n { x } +\cs_generate_variant:Nn \__acro_first_upper_case:n {x} +\cs_generate_variant:Nn \tl_mixed_case:n {x} \cs_new_eq:NN \acro_first_upper_case:n \__acro_first_upper_case:n -\NewDocumentCommand \acfirstupper { m } +\NewDocumentCommand \acfirstupper {m} { \acro_first_upper_case:n {#1} } % -------------------------------------------------------------------------- @@ -660,29 +665,30 @@ { \bool_if:nT { \l__acro_hyperref_loaded_bool && \l__acro_use_hyperref_bool } { - \cs_set_eq:NN \acro_hyper_link:nn \hyperlink + \sys_if_engine_xetex:TF + { + \cs_set:Npn \acro_hyper_link:nn ##1##2 + { \hyperlink { \XeTeXLinkBox {##1} } {##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 } + { \raisebox {3ex} [0pt] { \hypertarget {##1} { } } ##2 } } } -% #1: tl var -% #2: id -% #3: text -\cs_new_protected:Npn \__acro_make_link:Nnn #1#2#3 +% #1: id +% #2: text +\cs_new_protected:Npn \__acro_make_link:nn #1#2 { \bool_if:nTF { \l__acro_use_hyperref_bool && \l__acro_hyperref_loaded_bool } { - \tl_set:Nn #1 - { - \acro_hyper_link:nn {#2} { \phantom {#3} } - \acro_if_is_single:nTF {#2} - { \hbox_overlap_left:n {#3} } - { \acro_color_link:n { \hbox_overlap_left:n {#3} } } - } + \acro_hyper_link:nn {#1} { \phantom {#2} } + \acro_if_is_single:nTF {#1} + { \hbox_overlap_left:n {#2} } + { \acro_color_link:n { \hbox_overlap_left:n {#2} } } } - { \tl_set:Nn #1 {#3} } + {#2} } \cs_generate_variant:Nn \__acro_make_link:Nnn {NnV} @@ -1426,7 +1432,7 @@ } { \l__acro_custom_short_format_tl } { \l__acro_list_short_format_tl } - \__acro_get_property:nn {short} {#1} + { \__acro_get_property:nn {short} {#1} } } } \group_end: @@ -2018,26 +2024,22 @@ \bool_if:NF \l__acro_in_list_bool { \leavevmode } \acro_activate_hyperref_support: % short: - \prop_get:NnNF \l__acro_short_prop {#1} \l__acro_tmpa_tl {} - \__acro_make_link:NnV \l__acro_short_tl {#1} \l__acro_tmpa_tl - % \acro_get_property:nn {#1} {short-format} + \prop_get:NnNF \l__acro_short_prop {#1} \l__acro_short_tl {} + % \__acro_make_link:NnV \l__acro_short_tl {#1} \l__acro_tmpa_tl % alt: - \prop_get:NnNTF \l__acro_alt_prop {#1} \l__acro_tmpa_tl - { \__acro_make_link:NnV \l__acro_alt_tl {#1} \l__acro_tmpa_tl } + \prop_get:NnNF \l__acro_alt_prop {#1} \l__acro_alt_tl + % { \__acro_make_link:NnV \l__acro_alt_tl {#1} \l__acro_tmpa_tl } { \tl_set_eq:NN \l__acro_alt_tl \l__acro_short_tl } % long: \acro_get_property:nn {#1} {long} - % \acro_get_property:nn {#1} {long-format} % foreign: \acro_get_property:nn {#1} {foreign} % foreign-lang: \acro_get_property:nn {#1} {foreign-lang} % extra: \acro_get_property:nn {#1} {extra} - % \acro_get_property:nn {#1} {extra-format} % single: \acro_get_property:nn {#1} {single} - % \acro_get_property:nn {#1} {single-format} % first-style: \acro_get_property:nn {#1} {first-style} % formatting @@ -2329,8 +2331,8 @@ \cs_new:cpn {acro_pdf_string_short_#1:n} ##1 { \acro_if_star_gobble:nTF {##1} - { \prop_item:cn {l__acro_pdfstring_short_#1_prop} } - { \prop_item:cn {l__acro_pdfstring_short_#1_prop} {##1} } + { \use:e { \prop_item:cn {l__acro_pdfstring_short_#1_prop} } } + { \use:e {\prop_item:cn {l__acro_pdfstring_short_#1_prop} {##1} } } } \cs_new:cpn {acpdfstring#1} { \use:c {acro_pdf_string_short_#1:n} } \prop_new:c {l__acro_pdfstring_alt_#1_prop} @@ -2512,9 +2514,9 @@ { \__acro_aux_file_now:x { - \token_to_str:N \acro@pages {#1} + \acro@pages {#1} { \seq_use:cn {g__acro_#1_pages_seq} {|} } ^^J - \token_to_str:N \acro@barriers {#1} + \acro@barriers {#1} { \seq_use:cn {g__acro_#1_barriers_seq} {,} } } } @@ -2561,12 +2563,15 @@ % #2: short form \cs_new_protected:Npn \acro_write_short:nn #1#2 { - \__acro_typeset:nn {short} + \__acro_make_link:nn {#1} { - \bool_if:nTF - { \l__acro_first_upper_bool } - { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } } - { \exp_not:n {#2} } + \__acro_typeset:nn {short} + { + \bool_if:nTF + { \l__acro_first_upper_bool } + { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } } + { \exp_not:n {#2} } + } } } \cs_generate_variant:Nn \acro_write_short:nn { nV , nv } @@ -2576,12 +2581,15 @@ % #2: alt form \cs_new_protected:Npn \acro_write_alt:nn #1#2 { - \__acro_typeset:nn {alt} + \__acro_make_link:nn {#1} { - \bool_if:nTF - { \l__acro_first_upper_bool && \l__acro_upper_short_bool } - { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } } - { \exp_not:n {#2} } + \__acro_typeset:nn {alt} + { + \bool_if:nTF + { \l__acro_first_upper_bool && \l__acro_upper_short_bool } + { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } } + { \exp_not:n {#2} } + } } } \cs_generate_variant:Nn \acro_write_alt:nn { nV , nv } @@ -3000,11 +3008,11 @@ \cs_new_protected:Npn \acro_write_indefinite:nn #1#2 { \bool_if:NT \l__acro_indefinite_bool - { \prop_item:cn { l__acro_#2_indefinite_prop } {#1} ~ } + { \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} } ~ + { \prop_item:cn {l__acro_#2_indefinite_prop} {#1} } ~ } } @@ -3321,7 +3329,7 @@ } \cs_generate_variant:Nn \acro_if_in_barrier:nnTF {nx} -\cs_new:Npn \acro@barriers #1#2 +\cs_new_protected:Npn \acro@barriers #1#2 { \seq_gset_split:cnn {g__acro_#1_recorded_barriers_seq} {,} {#2} } % -------------------------------------------------------------------------- @@ -3509,7 +3517,7 @@ \cs_new:Npn \acro_expandable_short:n #1 { \use:e { \prop_item:Nn \l__acro_short_prop {#1} } } - + \cs_new:Npn \acro_expandable_alt:n #1 { \use:e { \prop_item:Nn \l__acro_alt_prop {#1} } } |