diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/acro/acro.sty | 1336 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/acro/acro0.def | 170 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/acro/acro1.def | 507 |
3 files changed, 876 insertions, 1137 deletions
diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty index dcde7bebdb4..8df44cda043 100644 --- a/Master/texmf-dist/tex/latex/acro/acro.sty +++ b/Master/texmf-dist/tex/latex/acro/acro.sty @@ -8,7 +8,7 @@ % Web: https://bitbucket.org/cgnieder/acro/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2011-2013 Clemens Niederberger +% Copyright 2011-2015 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -31,8 +31,8 @@ \RequirePackage{expl3,l3sort,xparse,l3keys2e,xtemplate} \ProvidesExplPackage {acro} - {2013/12/18} - {1.5} + {2015/02/26} + {1.6} {Typeset Acronyms} % -------------------------------------------------------------------------- @@ -40,7 +40,7 @@ \@ifpackagelater { expl3 } { 2012/11/21 } { } { - \PackageError { acro } { Support~package~expl3~too~old } + \PackageError {acro} { Support~package~expl3~too~old } { You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~ 'l3packages'.\MessageBreak @@ -51,54 +51,95 @@ % -------------------------------------------------------------------------- % warning and error messages: -\msg_new:nnnn { acro } { undefined } - { You've~requested~acronym~`#1'~but~it~seems~that~it~was~never~defined! } +\msg_new:nnn {acro} {undefined} { You've~requested~acronym~`#1'~\msg_line_context: \c_space_tl but~you~ - apperantly~haven't~defined~it,~yet!~Maybe~you've~mispelled~it? + apparently~haven't~defined~it,~yet!~Maybe~you've~misspelled~it? } -\msg_new:nnnn { acro } { version } - { You've~selected~the~version~option~`#1'~which~doesn't~exist. } +\msg_new:nnn {acro} {macro} { - You've~selected~the~version~option~`#1'~which~doesn't~exist.~ - I'm~using~option~`#2'~instead. - } + A~macro~with~the~csname~`#1'~already~exists.~Unless~you~set~acro's~option~ + `strict'~I~won't~redefine~it~\msg_line_context: . + } -\msg_new:nnnn { acro } { replaced } - { The~#1~`#2'~is~deprecated.~Use~`#3'~instead~\msg_line_context:. } +\msg_new:nnn {acro} {replaced} { The~#1~`#2'~you~used~\msg_line_context: \c_space_tl is~deprecated~and~has~ been~replaced~by~`#3'.~Since~I~will~not~guarantee~that~#1~will~be~kept~ forever~I~encourage~you~to~switch. } -\msg_new:nnnn { acro } { deprecated } - { The~#1~`#2'~is~deprecated.~\msg_line_context:. } +\msg_new:nnn {acro} {deprecated} { The~#1~`#2'~you~used~\msg_line_context: \c_space_tl is~deprecated~and~there~ is~no~replacement.~Since~I~will~not~guarantee~that~#1~will~be~kept~forever~ I~encourage~you~to~remove~it~from~your~document. } -\cs_new:Npn \acro_option_deprecated:nn #1#2 +% message macros: +\bool_new:N \l__acro_silence_bool + +\cs_new_protected:Npn \acro_serious_message:nn + { + \bool_if:NTF \l__acro_silence_bool + { \msg_warning:nn } + { \msg_error:nn } + } + +\cs_new_protected:Npn \acro_serious_message:nnn + { + \bool_if:NTF \l__acro_silence_bool + { \msg_warning:nnn } + { \msg_error:nnn } + } + +\cs_new_protected:Npn \acro_serious_message:nnnn + { + \bool_if:NTF \l__acro_silence_bool + { \msg_warning:nnnn } + { \msg_error:nnnn } + } + +\cs_new_protected:Npn \acro_harmless_message:nnn + { + \bool_if:NTF \l__acro_silence_bool + { \msg_info:nnn } + { \msg_warning:nnn } + } + +\cs_new_protected:Npn \acro_harmless_message:nnnn { - \tl_if_blank:nTF { #2 } - { \msg_warning:nnnn { acro } { deprecated } { option } { #1 } } - { \msg_warning:nnnnn { acro } { replaced } { option } { #1 } { #2 } } + \bool_if:NTF \l__acro_silence_bool + { \msg_info:nnnn } + { \msg_warning:nnnn } } -\cs_new:Npn \acro_command_deprecated:NN #1#2 +\cs_new_protected:Npn \acro_harmless_message:nnnnn { - \tl_if_blank:nTF { #2 } + \bool_if:NTF \l__acro_silence_bool + { \msg_info:nnnnn } + { \msg_warning:nnnnn } + } + +\cs_new_protected:Npn \acro_option_deprecated:nn #1#2 + { + \tl_if_blank:nTF {#2} + { \acro_harmless_message:nnnn {acro} {deprecated} {option} {#1 } } + { \acro_harmless_message:nnnnn {acro} {replaced} {option} {#1} {#2} } + } + +\cs_new_protected:Npn \acro_command_deprecated:NN #1#2 + { + \tl_if_blank:nTF {#2} { - \msg_warning:nnnnn { acro } { deprecated } - { command } + \acro_harmless_message:nnnnn {acro} {deprecated} + {command} { \token_to_str:N #1 } } { - \msg_warning:nnnnn { acro } { replaced } - { command } + \acro_harmless_message:nnnnn {acro} {replaced} + {command} { \token_to_str:N #1 } { \token_to_str:N #2 } } @@ -158,7 +199,6 @@ \bool_new:N \l__acro_record_pages_bool \bool_set_true:N \l__acro_record_pages_bool \bool_new:N \l__acro_addto_index_bool -\bool_new:N \l__acro_version_selected_bool \bool_new:N \l__acro_is_excluded_bool \bool_new:N \l__acro_page_punct_bool \bool_new:N \l__acro_page_brackets_bool @@ -225,9 +265,6 @@ \tl_new:N \l__acro_first_between_tl \tl_new:N \l__acro_citation_space_tl \tl_set:Nn \l__acro_citation_space_tl { \nobreakspace } -\tl_new:N \l__acro_active_version_tl -\tl_new:N \l__acro_version_zero_tl -\tl_set:Nn \l__acro_version_zero_tl { 0 } \tl_new:N \l__acro_extra_brackets_tl \tl_new:N \l__acro_extra_punct_tl \tl_new:N \l__acro_first_brackets_tl @@ -245,41 +282,6 @@ \tl_set:Nn \l__acro_label_prefix_tl { ac: } % -------------------------------------------------------------------------- -% comma list variables -\clist_new:N \l__acro_versions_clist - -% -------------------------------------------------------------------------- -% property list variables: -\prop_new:N \l__acro_short_prop -\prop_new:N \l__acro_alt_prop -\prop_new:N \l__acro_sort_prop -\prop_new:N \l__acro_long_prop -\prop_new:N \l__acro_list_prop -\prop_new:N \l__acro_class_prop -\prop_new:N \l__acro_short_plural_prop -\prop_new:N \l__acro_long_plural_prop -\prop_new:N \l__acro_replace_long_plural_prop -\prop_new:N \l__acro_short_indefinite_prop -\prop_new:N \l__acro_long_indefinite_prop -\prop_new:N \l__acro_alt_indefinite_prop -\prop_new:N \l__acro_long_pre_prop -\prop_new:N \l__acro_long_post_prop -\prop_new:N \l__acro_extra_prop -\prop_new:N \l__acro_foreign_prop -\prop_new:N \l__acro_format_prop -\prop_new:N \l__acro_long_format_prop -\prop_new:N \l__acro_first_long_format_prop -\prop_new:N \l__acro_citation_prop -\prop_new:N \l__acro_citation_pre_prop -\prop_new:N \l__acro_citation_post_prop -\prop_new:N \l__acro_pdfstring_prop -\prop_new:N \l__acro_pdfstring_plural_prop -\prop_new:N \l__acro_acc_supp_prop -\prop_new:N \l__acro_index_prop -\prop_new:N \l__acro_index_sort_prop -\prop_new:N \l__acro_index_cmd_prop - -% -------------------------------------------------------------------------- % length variables: \dim_new:N \l__acro_table_width_dim \dim_set:Nn \l__acro_table_width_dim { .7\linewidth } @@ -289,40 +291,27 @@ % small commands for use at various places \cs_new:Npn \acro_no_break: { \tex_penalty:D \c_ten_thousand } -\cs_new:Npn \__acro_first_upper_case:n #1 - { \tl_expandable_uppercase:n { \tl_head:n { #1 } } \tl_tail:n { #1 } } +\cs_new_protected:Npn \__acro_first_upper_case:n #1 + { \tl_mixed_case:n {#1} } \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 } - { \acro_first_upper_case:n { #1 } } - -% -------------------------------------------------------------------------- -% versioning: -\clist_put_right:Nn \l__acro_versions_clist { 0 } -\clist_put_right:Nn \l__acro_versions_clist { 1 } - -\cs_new_protected:Npn \__acro_select_version:n #1 - { - \clist_if_in:NnTF \l__acro_versions_clist { #1 } - { - \file_input:n { acro#1.def } - \tl_set:Nn \l__acro_active_version_tl { #1 } - } - { - \msg_warning:nnxx { acro } { version } { #1 } { 1 } - \file_input:n { acro1.def } - \tl_set:Nn \l__acro_active_version_tl { 1 } - } - \bool_set_true:N \l__acro_version_selected_bool - } + { \acro_first_upper_case:n {#1} } % -------------------------------------------------------------------------- % options: -\keys_define:nn { acro } - { - version .code:n = \__acro_select_version:n { #1 } , +\keys_define:nn {acro} + { + version .code:n = + \acro_option_deprecated:nn { version } { } , + messages .choice: , + messages / silent .code:n = + \bool_set_true:N \l__acro_silence_bool , + messages / loud .code:n = + \bool_set_false:N \l__acro_silence_bool , accsupp .bool_set:N = \l__acro_acc_supp_bool , accsupp-options .tl_set:N = \l__acro_acc_supp_options_tl , macros .bool_set:N = \l__acro_create_macros_bool , @@ -330,14 +319,14 @@ strict .bool_set:N = \l__acro_strict_bool , sort .bool_set:N = \l__acro_sort_bool , short-format .code:n = - \tl_set:Nn \l__acro_short_format_tl { #1 } - \tl_set:Nn \l__acro_list_short_format_tl { #1 } , + \tl_set:Nn \l__acro_short_format_tl {#1} + \tl_set:Nn \l__acro_list_short_format_tl {#1} , long-format .code:n = - \tl_set:Nn \l__acro_long_format_tl { #1 } - \tl_set:Nn \l__acro_first_long_format_tl { #1 } - \tl_set:Nn \l__acro_list_long_format_tl { #1 } , + \tl_set:Nn \l__acro_long_format_tl {#1} + \tl_set:Nn \l__acro_first_long_format_tl {#1} + \tl_set:Nn \l__acro_list_long_format_tl {#1} , first-long-format .code:n = - \tl_set:Nn \l__acro_first_long_format_tl { #1 } , + \tl_set:Nn \l__acro_first_long_format_tl {#1} , display-foreign .bool_set:N = \l__acro_foreign_bool , foreign-format .tl_set:N = \l__acro_foreign_format_tl , list-short-format .tl_set:N = \l__acro_list_short_format_tl , @@ -372,7 +361,7 @@ list-type .tl_set:N = \l__acro_list_type_tl , list-header .code:n = \acro_option_deprecated:nn { list-header } { list-heading } - \tl_set:Nn \l__acro_list_title_tl { #1 } , + \tl_set:Nn \l__acro_list_title_tl {#1} , list-heading .tl_set:N = \l__acro_list_title_tl , list-name .tl_set:N = \l__acro_list_name_tl , list-table-width .dim_set:N = \l__acro_table_width_dim , @@ -397,11 +386,11 @@ \bool_set_true:N \l__acro_citation_first_bool , cite-all .default:n = all , cite-cmd .code:n = - \cs_set:Npn \__acro_citation_cmd:w { #1 } , + \cs_set:Npn \__acro_citation_cmd:w {#1} , cite-space .tl_set:N = \l__acro_citation_space_tl , index .bool_set:N = \l__acro_addto_index_bool , index-cmd .code:n = - \cs_set:Npn \__acro_index_cmd:n { #1 } , + \cs_set:Npn \__acro_index_cmd:n {#1} , uc-cmd .code:n = \cs_set_eq:NN \__acro_first_upper_case:n #1 } @@ -410,9 +399,9 @@ { \bool_if:NTF \l__acro_xspace_bool { - \@ifpackageloaded { xspace } + \@ifpackageloaded {xspace} { } - { \RequirePackage { xspace } } + { \RequirePackage {xspace} } \cs_new_eq:NN \acro_xspace: \xspace } { \cs_new:Npn \acro_xspace: {} } @@ -423,7 +412,7 @@ % -------------------------------------------------------------------------- % setup command: \NewDocumentCommand \acsetup { m } - { \keys_set:nn { acro } { #1 } \ignorespaces } + { \keys_set:nn {acro} {#1} \ignorespaces } % -------------------------------------------------------------------------- % typeset the short form: @@ -456,8 +445,8 @@ \exp_args:Nx #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 } } + { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } } + { \exp_not:n {#2} } } } \group_end: @@ -475,7 +464,7 @@ { \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 } } } @@ -486,13 +475,13 @@ { \tl_set:Nn #2 { - \acro_hyper_link:nn { #1 } { \phantom { #3 } } - \__acro_is_single:nTF { #1 } - { \hbox_overlap_left:n { #3 } } - { \acro_color_link:n { \hbox_overlap_left:n { #3 } } } + \acro_hyper_link:nn {#1} { \phantom {#3} } + \__acro_is_single:nTF {#1} + { \hbox_overlap_left:n {#3} } + { \acro_color_link:n { \hbox_overlap_left:n {#3} } } } } - { \tl_set:Nn #2 { #3 } } + { \tl_set:Nn #2 {#3} } } \cs_new:Npn \acro_color_link:n #1 @@ -508,10 +497,10 @@ \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn \fi \fi - { \textcolor { \@linkcolor } { #1 } } - { #1 } + { \textcolor { \@linkcolor } {#1} } + {#1} } - { #1 } + {#1} } \AtBeginDocument{ @@ -520,7 +509,7 @@ % -------------------------------------------------------------------------- % output style of the first time an acronym is used -\cs_new:Npn \__acro_note_command:n #1 { #1 } +\cs_new:Npn \__acro_note_command:n #1 {#1} % #1: id % #2: short @@ -550,8 +539,8 @@ \AssignTemplateKeys \bool_if:nT { !\l__acro_first_only_short_bool && !\l__acro_first_reversed_bool } { - \__acro_indefinite:nn { #1 } { long } - \__acro_write_long:No \l__acro_first_long_format_tl { #3 } + \__acro_indefinite:nn {#1} { long } + \__acro_write_long:No \l__acro_first_long_format_tl {#3} \tl_use:N \c_space_tl \tl_if_blank:VF \l__acro_first_between_tl { @@ -569,7 +558,7 @@ !\l__acro_first_only_short_bool } { - \prop_get:NnNT \l__acro_foreign_prop { #1 } \l__acro_foreign_tl + \prop_get:NnNT \l__acro_foreign_prop {#1} \l__acro_foreign_tl { \group_begin: \tl_use:N \l__acro_foreign_format_tl @@ -580,8 +569,8 @@ } \bool_if:nT { \l__acro_first_reversed_bool || \l__acro_first_only_short_bool } - { \__acro_indefinite:nn { #1 } { short } } - \__acro_acc_supp:nn { #1 } { \__acro_write_short:n { #2 } } + { \__acro_indefinite:nn {#1} { short } } + \__acro_acc_supp:nn {#1} { \__acro_write_short:n {#2} } \bool_if:nT { \l__acro_first_use_brackets_bool && !\l__acro_first_reversed_bool } { \tl_tail:N \l__acro_first_brackets_tl } @@ -597,10 +586,10 @@ \bool_if:nT { \l__acro_first_use_brackets_bool && \l__acro_first_reversed_bool } { \tl_head:N \l__acro_first_brackets_tl } - \__acro_write_long:No \l__acro_first_long_format_tl { #3 } + \__acro_write_long:No \l__acro_first_long_format_tl {#3} \bool_if:nT { \l__acro_foreign_bool && \l__acro_first_reversed_bool } { - \prop_get:NnNT \l__acro_foreign_prop { #1 } \l__acro_foreign_tl + \prop_get:NnNT \l__acro_foreign_prop {#1} \l__acro_foreign_tl { \tl_use:N \l__acro_foreign_sep_tl \group_begin: @@ -613,15 +602,15 @@ { \l__acro_first_use_brackets_bool && \l__acro_first_reversed_bool } { \tl_tail:N \l__acro_first_brackets_tl } } - \__acro_cite_if:Nn \l__acro_citation_first_bool { #1 } - \__acro_index_if:Nn \l__acro_addto_index_bool { #1 } + \__acro_cite_if:Nn \l__acro_citation_first_bool {#1} + \__acro_index_if:Nn \l__acro_addto_index_bool {#1} } % template for footnotes, sidenotes, ... \DeclareTemplateInterface { acro-first } { note } { 3 } { use-note : boolean = true , - note-command : function 1 = \footnote { #1 } , + note-command : function 1 = \footnote {#1} , foreign-sep : tokenlist = ~ } @@ -633,16 +622,16 @@ } { \AssignTemplateKeys - \__acro_indefinite:nn { #1 } { short } - \__acro_acc_supp:nn { #1 } { \__acro_write_short:n { #2 } } + \__acro_indefinite:nn {#1} { short } + \__acro_acc_supp:nn {#1} { \__acro_write_short:n {#2} } \bool_if:NT \l__acro_use_note_bool { \__acro_note_command:n { - \__acro_write_long:No \l__acro_first_long_format_tl { #3 } + \__acro_write_long:No \l__acro_first_long_format_tl {#3} \bool_if:NT \l__acro_foreign_bool { - \prop_get:NnNT \l__acro_foreign_prop { #1 } \l__acro_foreign_tl + \prop_get:NnNT \l__acro_foreign_prop {#1} \l__acro_foreign_tl { \tl_use:N \l__acro_foreign_sep_tl ( @@ -653,8 +642,8 @@ ) } } - \__acro_cite_if:Nn \l__acro_citation_first_bool { #1 } - \__acro_index_if:Nn \l__acro_addto_index_bool { #1 } + \__acro_cite_if:Nn \l__acro_citation_first_bool {#1} + \__acro_index_if:Nn \l__acro_addto_index_bool {#1} } } } @@ -690,7 +679,7 @@ \DeclareInstance { acro-first } { sidenote } { note } - { note-command = \sidenote { #1 } } + { note-command = \sidenote {#1} } \DeclareInstance { acro-first } { empty } { note } @@ -732,7 +721,7 @@ { \tl_use:N \l__acro_extra_punct_tl \tl_use:N \c_space_tl } \bool_if:NT \l__acro_extra_use_brackets_bool { \tl_head:N \l__acro_extra_brackets_tl } - \__acro_write_long:Nn \l__acro_extra_format_tl { #1 } + \__acro_write_long:Nn \l__acro_extra_format_tl {#1} \bool_if:NT \l__acro_extra_use_brackets_bool { \tl_tail:N \l__acro_extra_brackets_tl } } @@ -759,17 +748,17 @@ \tl_new:c { g__acro_#1_recorded_pages_tl } } -\cs_new_protected:Npn \acro_hyper_page:n #1 { \use:n { #1 } } +\cs_new_protected:Npn \acro_hyper_page:n #1 { \use:n {#1} } -\cs_new:Npn \acro_get_thepage:nnn #1#2#3 { \acro_hyper_page:n { #1 } } +\cs_new:Npn \acro_get_thepage:nnn #1#2#3 { \acro_hyper_page:n {#1} } \cs_new:Npn \acro_get_thepage_from:N #1 { \exp_after:wN \acro_get_thepage:nnn #1 } -\cs_new:Npn \acro_get_page_number:nnn #1#2#3 { #2 } +\cs_new:Npn \acro_get_page_number:nnn #1#2#3 {#2} \cs_new:Npn \acro_get_page_number_from:N #1 { \exp_after:wN \acro_get_page_number:nnn #1 } -\cs_new:Npn \acro_get_abspage:nnn #1#2#3 { #3 } +\cs_new:Npn \acro_get_abspage:nnn #1#2#3 {#3} \cs_new:Npn \acro_get_abspage_from:N #1 { \exp_after:wN \acro_get_abspage:nnn #1 } @@ -807,23 +796,23 @@ { \tl_if_blank:VTF \l__acro_last_page_tl {% we're at the beginning - \seq_put_right:Nn \l__acro_tmpa_seq { ##1 } - \tl_set:Nn \l__acro_last_page_tl { ##1 } + \seq_put_right:Nn \l__acro_tmpa_seq {##1} + \tl_set:Nn \l__acro_last_page_tl {##1} } {% we'at least at the second page % current page: - \tl_set:Nn \l__acro_current_page_tl { ##1 } + \tl_set:Nn \l__acro_current_page_tl {##1} % last page: \seq_get_right:NN \l__acro_tmpa_seq \l__acro_last_page_tl \tl_if_eq:NNTF \l__acro_current_page_tl \l__acro_last_page_tl {% there were more than one appearance on the current page - \seq_put_right:Nn \l__acro_tmpa_seq { ##1 } + \seq_put_right:Nn \l__acro_tmpa_seq {##1} } {% new page \acro_determine_page_ranges:NNn \l__acro_tmpa_seq \l__acro_write_pages_tl - { ##1 } + {##1} } } } @@ -866,7 +855,7 @@ } {% same kind of page numbering, one page ahead % => possible range - \seq_put_right:Nn #1 { #3 } + \seq_put_right:Nn #1 {#3} } {% any possible range ended \tl_put_right:Nn #2 { \acro_page_range_comma: } @@ -903,31 +892,11 @@ } } \seq_clear:N #1 - \seq_put_right:Nn #1 { #3 } + \seq_put_right:Nn #1 {#3} } } \cs_generate_variant:Nn \acro_determine_page_ranges:NNn { NNV } -\AtBeginDocument - { - \bool_if:nT - { - \tl_if_eq_p:NN \l__acro_active_version_tl \l__acro_version_zero_tl - || - !\l__acro_list_all_pages_bool - } - { - \cs_set:Npn \acro_print_page_numbers:n #1 - { - \acro_no_break: - \skip_horizontal:N \l__acro_page_space_dim - \acro_no_break: - \tl_use:N \l__acro_page_name_tl - \pageref{\l__acro_label_prefix_tl #1} - } - } - } - % -------------------------------------------------------------------------- \DeclareObjectType { acro-page-number } { 1 } @@ -959,7 +928,7 @@ \tl_use:N \c_space_tl \bool_if:NT \l__acro_page_brackets_bool { \tl_head:N \l__acro_page_brackets_tl } - \acro_print_page_numbers:n { #1 } + \acro_print_page_numbers:n {#1} \bool_if:NT \l__acro_page_brackets_bool { \tl_tail:N \l__acro_page_brackets_tl } } @@ -978,7 +947,7 @@ % -------------------------------------------------------------------------- % the title of the list: -\cs_new:Npn \acro_list_title_format:n #1 { #1 } +\cs_new:Npn \acro_list_title_format:n #1 {#1} \DeclareObjectType { acro-title } { 1 } @@ -989,30 +958,32 @@ { name-format = \acro_list_title_format:n } { \AssignTemplateKeys - \acro_list_title_format:n { #1 } + \acro_list_title_format:n {#1} } % the different styles: \DeclareInstance { acro-title } { chapter* } { sectioning } - { name-format = \chapter* { #1 } } + { name-format = \chapter* {#1} } \DeclareInstance { acro-title } { part* } { sectioning } - { name-format = \part* { #1 } } + { name-format = \part* {#1} } \DeclareInstance { acro-title } { section* } { sectioning } - { name-format = \section* { #1 } } + { name-format = \section* {#1} } \DeclareInstance { acro-title } { subsection* } { sectioning } - { name-format = \subsection* { #1 } } + { name-format = \subsection* {#1} } \DeclareInstance { acro-title } { chapter } { sectioning } - { name-format = \chapter { #1 } } + { name-format = \chapter {#1} } \DeclareInstance { acro-title } { part } { sectioning } - { name-format = \part { #1 } } + { name-format = \part {#1} } \DeclareInstance { acro-title } { section } { sectioning } - { name-format = \section { #1 } } + { name-format = \section {#1} } \DeclareInstance { acro-title } { subsection } { sectioning } - { name-format = \subsection { #1 } } + { name-format = \subsection {#1} } \DeclareInstance { acro-title } { addchap } { sectioning } - { name-format = \addchap { #1 } } + { name-format = \addchap {#1} } \DeclareInstance { acro-title } { addsec } { sectioning } - { name-format = \addsec { #1 } } + { name-format = \addsec {#1} } +\DeclareInstance { acro-title } { none } { sectioning } + { name-format = \use_none:n {#1} } % -------------------------------------------------------------------------- % outputting the whole list @@ -1024,16 +995,16 @@ \cs_new_protected:Npn \acro_is_excluded:nnF #1#2#3 { \bool_set_false:N \l__acro_is_excluded_bool - \tl_if_empty:nTF { #2 } - { #3 } + \tl_if_empty:nTF {#2} + {#3} { - \clist_map_inline:nn { #2 } + \clist_map_inline:nn {#2} { - \prop_get:NnNF \l__acro_class_prop { #1 } \l__acro_tmpa_tl {} - \tl_if_eq:VnT \l__acro_tmpa_tl { ##1 } + \prop_get:NnNF \l__acro_class_prop {#1} \l__acro_tmpa_tl {} + \tl_if_eq:VnT \l__acro_tmpa_tl {##1} { \bool_set_true:N \l__acro_is_excluded_bool } } - \bool_if:NF \l__acro_is_excluded_bool { #3 } + \bool_if:NF \l__acro_is_excluded_bool {#3} } } @@ -1047,7 +1018,7 @@ \cs_new_protected:Npn \acro_get_foreign:n #1 { - \prop_get:NnNT \l__acro_foreign_prop { #1 } \l__acro_foreign_tl + \prop_get:NnNT \l__acro_foreign_prop {#1} \l__acro_foreign_tl { \tl_use:N \l__acro_foreign_sep_tl \group_begin: @@ -1063,7 +1034,7 @@ { \prop_map_inline:Nn \l__acro_short_prop { - \acro_get:n { ##1 } + \acro_get:n {##1} \bool_if:nT { \bool_if_p:c { g__acro_##1_in_list_bool } && @@ -1080,39 +1051,39 @@ ( !\l__acro_use_single_bool && !\l__acro_print_only_used_bool ) } { - \acro_is_excluded:nnF { ##1 } { #2 } + \acro_is_excluded:nnF {##1} {#2} { - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { - \acro_print_list_short:nn { ##1 } { ##2 } + \acro_print_list_short:nn {##1} {##2} \bool_if:NT \l__acro_capitalize_list_bool { \bool_set_true:N \l__acro_first_upper_bool } - \acro_print_list_long:n { ##1 } + \acro_print_list_long:n {##1} \bool_set_false:N \l__acro_first_upper_bool \bool_if:NT \l__acro_foreign_bool - { \acro_get_foreign:n { ##1 } } - \acro_print_list_extra:n { ##1 } - \acro_print_list_page:n { ##1 } + { \acro_get_foreign:n {##1} } + \acro_print_list_extra:n {##1} + \acro_print_list_page:n {##1} } { - \clist_map_inline:nn { #1 } + \clist_map_inline:nn {#1} { - \prop_get:NnNT \l__acro_class_prop { ##1 } \l__acro_tmpa_tl + \prop_get:NnNT \l__acro_class_prop {##1} \l__acro_tmpa_tl { \tl_set:Nn \l__acro_tmpb_tl { ####1 } \tl_trim_spaces:N \l__acro_tmpa_tl \tl_trim_spaces:N \l__acro_tmpb_tl \tl_if_eq:NNT \l__acro_tmpa_tl \l__acro_tmpb_tl { - \acro_print_list_short:nn { ##1 } { ##2 } + \acro_print_list_short:nn {##1} { ##2 } \bool_if:NT \l__acro_capitalize_list_bool { \bool_set_true:N \l__acro_first_upper_bool } - \acro_print_list_long:n { ##1 } + \acro_print_list_long:n {##1} \bool_set_false:N \l__acro_first_upper_bool \bool_if:NT \l__acro_foreign_bool - { \acro_get_foreign:n { ##1 } } - \acro_print_list_extra:n { ##1 } - \acro_print_list_page:n { ##1 } + { \acro_get_foreign:n {##1} } + \acro_print_list_extra:n {##1} + \acro_print_list_page:n {##1} } } } @@ -1123,10 +1094,10 @@ } % list template: -\DeclareTemplateInterface { acro-list } { list } { 3 } +\DeclareTemplateInterface {acro-list} {list} {3} { foreign-sep : tokenlist = { ~ } } -\DeclareTemplateCode { acro-list } { list } { 3 } +\DeclareTemplateCode {acro-list} {list} {3} { foreign-sep = \l__acro_foreign_sep_tl } { \AssignTemplateKeys @@ -1137,10 +1108,10 @@ \item [ \acro_hyper_target:nn - { ##1 } + {##1} { \__acro_acc_supp:nn - { ##1 } + {##1} { \__acro_write_short:n { \l__acro_list_short_format_tl { ##2 } } } } ] @@ -1149,15 +1120,15 @@ { \__acro_write_long:Nf \l__acro_list_long_format_tl { - \prop_if_in:NnTF \l__acro_list_prop { ##1 } - { \prop_get:Nn \l__acro_list_prop { ##1 } } - { \prop_get:Nn \l__acro_long_prop { ##1 } } + \prop_if_in:NnTF \l__acro_list_prop {##1} + { \prop_get:Nn \l__acro_list_prop {##1} } + { \prop_get:Nn \l__acro_long_prop {##1} } } - \__acro_cite_if:Nn \l__acro_citation_all_bool { ##1 } + \__acro_cite_if:Nn \l__acro_citation_all_bool {##1} } \cs_set_protected:Npn \acro_print_list_extra:n ##1 { - \prop_get:NnNT \l__acro_extra_prop { ##1 } \l__acro_tmpa_tl + \prop_get:NnNT \l__acro_extra_prop {##1} \l__acro_tmpa_tl { \UseInstance { acro-extra } { \l__acro_extra_instance_tl } { \l__acro_tmpa_tl } @@ -1166,15 +1137,15 @@ \cs_set:Npn \acro_print_list_page:n ##1 { \bool_if:nT { \cs_if_exist_p:c { acro@##1@once } } - { \UseInstance { acro-page-number } { \l__acro_page_instance_tl } { ##1 } } + { \UseInstance { acro-page-number } { \l__acro_page_instance_tl } {##1} } } - \begin { #1 } - \acro_list_allow_items:nn { #2 } { #3 } - \end { #1 } + \begin {#1} + \acro_list_allow_items:nn {#2} {#3} + \end {#1} } % table template: -\DeclareTemplateInterface { acro-list } { table } { 3 } +\DeclareTemplateInterface {acro-list} {table} {3} { table : tokenlist = longtable , table-spec : tokenlist = lp{\l__acro_table_width_dim} , @@ -1193,10 +1164,10 @@ \cs_set:Npn \acro_print_list_short:nn ##1##2 { \acro_hyper_target:nn - { ##1 } + {##1} { \__acro_acc_supp:nn - { ##1 } + {##1} { \__acro_write_short:n { \l__acro_list_short_format_tl { ##2 } } } } & @@ -1205,15 +1176,15 @@ { \__acro_write_long:Nf \l__acro_list_long_format_tl { - \prop_if_in:NnTF \l__acro_list_prop { ##1 } - { \prop_get:Nn \l__acro_list_prop { ##1 } } - { \prop_get:Nn \l__acro_long_prop { ##1 } } + \prop_if_in:NnTF \l__acro_list_prop {##1} + { \prop_get:Nn \l__acro_list_prop {##1} } + { \prop_get:Nn \l__acro_long_prop {##1} } } - \__acro_cite_if:Nn \l__acro_citation_all_bool { ##1 } + \__acro_cite_if:Nn \l__acro_citation_all_bool {##1} } \cs_set_protected:Npn \acro_print_list_extra:n ##1 { - \prop_get:NnNT \l__acro_extra_prop { ##1 } \l__acro_tmpa_tl + \prop_get:NnNT \l__acro_extra_prop {##1} \l__acro_tmpa_tl { \UseInstance { acro-extra } { \l__acro_extra_instance_tl } { \l__acro_tmpa_tl } @@ -1222,11 +1193,11 @@ \cs_set:Npn \acro_print_list_page:n ##1 { \bool_if:nT { \cs_if_exist_p:c { acro@##1@once } } - { \UseInstance { acro-page-number } { \l__acro_page_instance_tl } { ##1 } } + { \UseInstance { acro-page-number } { \l__acro_page_instance_tl } {##1} } \tabularnewline } \exp_args:Noo \begin { \l__acro_list_table_tl } { \l__acro_list_table_spec_tl } - \acro_list_allow_items:nn { #2 } { #3 } + \acro_list_allow_items:nn {#2} {#3} \exp_args:No \end { \l__acro_list_table_tl } } @@ -1248,10 +1219,10 @@ \cs_set:Npn \acro_print_list_short:nn ##1##2 { \acro_hyper_target:nn - { ##1 } + {##1} { \__acro_acc_supp:nn - { ##1 } + {##1} { \__acro_write_short:n { \l__acro_list_short_format_tl { ##2 } } } } & @@ -1260,16 +1231,16 @@ { \__acro_write_long:Nf \l__acro_list_long_format_tl { - \prop_if_in:NnTF \l__acro_list_prop { ##1 } - { \prop_get:Nn \l__acro_list_prop { ##1 } } - { \prop_get:Nn \l__acro_long_prop { ##1 } } + \prop_if_in:NnTF \l__acro_list_prop {##1} + { \prop_get:Nn \l__acro_list_prop {##1} } + { \prop_get:Nn \l__acro_long_prop {##1} } } - \__acro_cite_if:Nn \l__acro_citation_all_bool { ##1 } + \__acro_cite_if:Nn \l__acro_citation_all_bool {##1} & } \cs_set_protected:Npn \acro_print_list_extra:n ##1 { - \prop_get:NnNT \l__acro_extra_prop { ##1 } \l__acro_tmpa_tl + \prop_get:NnNT \l__acro_extra_prop {##1} \l__acro_tmpa_tl { \UseInstance { acro-extra } { \l__acro_extra_instance_tl } { \l__acro_tmpa_tl } @@ -1279,11 +1250,11 @@ \cs_set:Npn \acro_print_list_page:n ##1 { \bool_if:nT { \cs_if_exist_p:c { acro@##1@once } } - { \UseInstance { acro-page-number } { \l__acro_page_instance_tl } { ##1 } } + { \UseInstance { acro-page-number } { \l__acro_page_instance_tl } {##1} } \tabularnewline } \exp_args:Noo \begin { \l__acro_list_table_tl } { \l__acro_list_table_spec_tl } - \acro_list_allow_items:nn { #2 } { #3 } + \acro_list_allow_items:nn {#2} {#3} \exp_args:No \end { \l__acro_list_table_tl } } @@ -1305,8 +1276,8 @@ \cs_set:Npn \acro_print_list_short:nn ##1##2 { \acro_hyper_target:nn - { ##1 } - { \__acro_acc_supp:nn { ##1 } { \__acro_write_short:n { ##2 } } } + {##1} + { \__acro_acc_supp:nn {##1} { \__acro_write_short:n { ##2 } } } & } \cs_set_protected:Npn \acro_print_list_extra:n ##1 @@ -1315,16 +1286,16 @@ { \bool_set_true:N \l__acro_first_upper_bool } \__acro_write_long:Nf \l__acro_long_format_tl { - \prop_if_in:NnTF \l__acro_list_prop { ##1 } - { \prop_get:Nn \l__acro_list_prop { ##1 } } - { \prop_get:Nn \l__acro_long_prop { ##1 } } + \prop_if_in:NnTF \l__acro_list_prop {##1} + { \prop_get:Nn \l__acro_list_prop {##1} } + { \prop_get:Nn \l__acro_long_prop {##1} } } - \__acro_cite_if:Nn \l__acro_citation_all_bool { ##1 } + \__acro_cite_if:Nn \l__acro_citation_all_bool {##1} & } \cs_set_protected:Npn \acro_print_list_long:n ##1 { - \prop_get:NnNT \l__acro_extra_prop { ##1 } \l__acro_tmpa_tl + \prop_get:NnNT \l__acro_extra_prop {##1} \l__acro_tmpa_tl { \UseInstance { acro-extra } { \l__acro_extra_instance_tl } { \l__acro_tmpa_tl } @@ -1334,16 +1305,16 @@ \cs_set:Npn \acro_print_list_page:n ##1 { \bool_if:nT { \cs_if_exist_p:c { acro@##1@once } } - { \UseInstance { acro-page-number } { \l__acro_page_instance_tl } { ##1 } } + { \UseInstance { acro-page-number } { \l__acro_page_instance_tl } {##1} } \tabularnewline } \exp_args:Noo \begin { \l__acro_list_table_tl } { \l__acro_list_table_spec_tl } - \acro_list_allow_items:nn { #2 } { #3 } + \acro_list_allow_items:nn {#2} {#3} \exp_args:No \end { \l__acro_list_table_tl } } % the different styles: -\DeclareInstance { acro-list } { list } +\DeclareInstance {acro-list} {list} { list } { } \DeclareInstance { acro-list } { tabular } @@ -1371,27 +1342,27 @@ \cs_new_protected:Npn \acro_use:n #1 { % get the acronym and the plural settings: - \acro_get:n { #1 } - \acro_is_used:nTF { #1 } + \acro_get:n {#1} + \acro_is_used:nTF {#1} { % this is not the first time - \__acro_indefinite:nn { #1 } { short } + \__acro_indefinite:nn {#1} {short} \__acro_acc_supp:nn - { #1 } + {#1} { \__acro_write_short:V \l__acro_short_tl } - \acro_after:n { #1 } + \acro_after:n {#1} } { % this is the first time \bool_gset_true:c { g__acro_#1_first_use_bool } - \__acro_is_single:nTF { #1 } + \__acro_is_single:nTF {#1} { - \__acro_indefinite:nn { #1 } { long } + \__acro_indefinite:nn {#1} {long} \__acro_write_long:NV \l__acro_long_format_tl \l__acro_long_tl } { - \UseInstance { acro-first } { \l__acro_first_instance_tl } - { #1 } + \UseInstance {acro-first} { \l__acro_first_instance_tl } + {#1} { \l__acro_short_tl } { \l__acro_long_tl } } @@ -1406,7 +1377,7 @@ \cs_new_protected:Npn \acro_use_if:n #1 { - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { \bool_set_true:N \l__acro_mark_as_used_bool } { \bool_set_false:N \l__acro_mark_as_used_bool } } @@ -1415,36 +1386,36 @@ % some helpers we'll need more often: \cs_new_protected:Npn \acro_defined:n #1 { - \prop_if_in:NnF \l__acro_short_prop { #1 } - { \msg_error:nnx { acro } { undefined } { #1 } } + \prop_if_in:NnF \l__acro_short_prop {#1} + { \acro_serious_message:nnn {acro} {undefined} {#1} } } \cs_new_protected:Npn \acro_get:n #1 { \bool_if:NF \l__acro_in_list_bool { \leavevmode } - \acro_defined:n { #1 } + % \acro_defined:n {#1} \__acro_activate_hyperref_support: - \prop_get:NnNF \l__acro_short_prop { #1 } \l__acro_tmpa_tl {} - \__acro_make_link:nNN { #1 } \l__acro_short_tl \l__acro_tmpa_tl - \prop_get:NnNF \l__acro_short_plural_prop { #1 } \l__acro_short_plural_tl {} - \prop_get:NnNF \l__acro_long_prop { #1 } \l__acro_long_tl {} - \prop_get:NnNTF \l__acro_long_format_prop { #1 } + \prop_get:NnNF \l__acro_short_prop {#1} \l__acro_tmpa_tl {} + \__acro_make_link:nNN {#1} \l__acro_short_tl \l__acro_tmpa_tl + \prop_get:NnNF \l__acro_short_plural_prop {#1} \l__acro_short_plural_tl {} + \prop_get:NnNF \l__acro_long_prop {#1} \l__acro_long_tl {} + \prop_get:NnNTF \l__acro_long_format_prop {#1} \l__acro_custom_long_format_tl { \bool_set_true:N \l__acro_custom_long_format_bool } { \bool_set_false:N \l__acro_custom_long_format_bool } - \prop_get:NnNF \l__acro_first_long_format_prop { #1 } + \prop_get:NnNF \l__acro_first_long_format_prop {#1} \l__acro_first_long_format_tl {}% to avoid hanging compilation if first-long-format hasn't been set - \prop_get:NnNT \l__acro_long_pre_prop { #1 } \l__acro_long_pre_tl + \prop_get:NnNT \l__acro_long_pre_prop {#1} \l__acro_long_pre_tl { \tl_put_left:NV \l__acro_long_tl \l__acro_long_pre_tl } - \prop_get:NnNF \l__acro_alt_prop { #1 } \l__acro_tmpb_tl {} - \__acro_make_link:nNN { #1 } \l__acro_alt_tl \l__acro_tmpb_tl - \prop_get:NnNTF \l__acro_format_prop { #1 } \l__acro_custom_format_tl + \prop_get:NnNF \l__acro_alt_prop {#1} \l__acro_tmpb_tl {} + \__acro_make_link:nNN {#1} \l__acro_alt_tl \l__acro_tmpb_tl + \prop_get:NnNTF \l__acro_format_prop {#1} \l__acro_custom_format_tl { \bool_set_true:N \l__acro_custom_format_bool } { \bool_set_false:N \l__acro_custom_format_bool } - \__acro_set_plural:n { #1 } - \prop_get:NnNT \l__acro_long_post_prop { #1 } \l__acro_long_post_tl + \__acro_set_plural:n {#1} + \prop_get:NnNT \l__acro_long_post_prop {#1} \l__acro_long_post_tl { \tl_put_right:NV \l__acro_long_tl \l__acro_long_post_tl } } @@ -1452,11 +1423,11 @@ { \bool_if:NT \l__acro_use_plural_bool { - \bool_if:nTF { \prop_get:Nn \l__acro_replace_long_plural_prop { #1 } } - { \prop_get:NnNF \l__acro_long_plural_prop { #1 } \l__acro_long_tl {} } + \bool_if:nTF { \prop_get:Nn \l__acro_long_plural_form_prop {#1} } + { \prop_get:NnNF \l__acro_long_plural_prop {#1} \l__acro_long_tl {} } { \tl_put_right:Nn \l__acro_long_tl - { \prop_get:Nn \l__acro_long_plural_prop { #1 } } + { \prop_get:Nn \l__acro_long_plural_prop {#1} } } } } @@ -1484,7 +1455,7 @@ { \iow_shipout_x:Nn \@auxout { - \token_to_str:N \acro@used@twice { #1 } + \token_to_str:N \acro@used@twice {#1} { \thepage } { \arabic{page} } { \arabic{abspage} } @@ -1492,7 +1463,7 @@ } { \iow_shipout_x:Nn \@auxout - { \token_to_str:N \acro@used@twice { #1 } {} {} {} } + { \token_to_str:N \acro@used@twice {#1} {} {} {} } } \fi \prg_return_true: @@ -1503,7 +1474,7 @@ % \if@filesw \iow_shipout_x:Nn \@auxout { - \token_to_str:N \acro@used@once { #1 } + \token_to_str:N \acro@used@once {#1} { \thepage } { \arabic{page} } { \arabic{abspage} } @@ -1513,13 +1484,7 @@ \bool_if:nT { !\bool_if_p:c { g__acro_#1_label_bool } && - ( - \tl_if_eq_p:NN - \l__acro_active_version_tl - \l__acro_version_zero_tl - || - \l__acro_place_label_bool - ) + \l__acro_place_label_bool } { \bool_gset_true:c { g__acro_#1_label_bool } @@ -1530,7 +1495,7 @@ { \if@filesw \iow_shipout_x:Nn \@auxout - { \token_to_str:N \acro@used@once { #1 } {} {} {} } + { \token_to_str:N \acro@used@once {#1} {} {} {} } \fi } \prg_return_false: @@ -1538,34 +1503,52 @@ } \cs_new:Npn \acro_is_used:n #1 - { \acro_is_used:nTF { #1 } { } { } } + { \acro_is_used:nTF {#1} { } { } } % -------------------------------------------------------------------------- % the commands for the auxiliary file: \cs_new_protected:Npn \acro@used@once #1#2#3#4 { - \cs_gset_nopar:cpn { acro@#1@once } { #1 } + \cs_gset_nopar:cpn { acro@#1@once } {#1} \bool_gset_true:c { g__acro_#1_in_list_bool } \tl_if_empty:nF { #2#3#4 } { \seq_gput_right:cn { g__acro_#1_pages_seq } { {#2}{#3}{#4} } } } \cs_new_protected:Npn \acro@used@twice #1#2#3#4 { - \cs_gset_nopar:cpn { acro@#1@twice } { #1 } + \cs_gset_nopar:cpn { acro@#1@twice } {#1} \tl_if_empty:nF { #2#3#4 } { \seq_gput_right:cn { g__acro_#1_pages_seq } { {#2}{#3}{#4} } } } \cs_new_protected:Npn \acro@pages #1#2 - { \tl_gset:cn { g__acro_#1_recorded_pages_tl } { #2 } } + { \tl_gset:cn { g__acro_#1_recorded_pages_tl } {#2} } + +\bool_new:N \g__acro_rerun_bool + +\cs_new_protected:Npn \acro@rerun@check + { + \bool_if:NT \g__acro_rerun_bool + { + \@latex@warning@no@line + {Acronyms~ may~ have~ changed.~ Please~ rerun~ LaTeX} + } + } \AtEndDocument { - \cs_set_protected:Npn \acro@used@twice #1#2#3#4 + \bool_gset_false:N \g__acro_rerun_bool + \cs_gset_protected:Npn \acro@used@once #1#2#3#4 { - \tl_set:Nn \l__acro_tmpa_tl { #1 } + \tl_set:Nn \l__acro_tmpa_tl {#1} + \tl_if_eq:cNF { acro@#1@once } \l__acro_tmpa_tl + { \bool_gset_true:N \g__acro_rerun_bool } + } + \cs_gset_protected:Npn \acro@used@twice #1#2#3#4 + { + \tl_set:Nn \l__acro_tmpa_tl {#1} \tl_if_eq:cNF { acro@#1@twice } \l__acro_tmpa_tl - { \@tempswatrue } + { \bool_gset_true:N \g__acro_rerun_bool } } \prop_map_inline:Nn \l__acro_short_prop { @@ -1574,12 +1557,13 @@ \if@filesw \iow_shipout_x:Nn \@auxout { - \token_to_str:N \acro@pages { #1 } + \token_to_str:N \acro@pages {#1} { \seq_use:cnnn { g__acro_#1_pages_seq } { | } { | } { | } } } \fi } } + \iow_shipout_x:Nn \@auxout { \acro@rerun@check } } % if `acro' is deactivated prevent unnecessary errors from aux file: @@ -1590,7 +1574,8 @@ { \token_to_str:N \providecommand \token_to_str:N \acro@used@once [4] {} ^^J \token_to_str:N \providecommand \token_to_str:N \acro@used@twice [4] {} ^^J - \token_to_str:N \providecommand \token_to_str:N \acro@pages [2] {} + \token_to_str:N \providecommand \token_to_str:N \acro@pages [2] {} ^^J + \token_to_str:N \providecommand \token_to_str:N \acro@rerun@check {} } } \fi @@ -1598,60 +1583,60 @@ % -------------------------------------------------------------------------- \cs_new:Npn \acro_after:n #1 { - \__acro_cite_if:Nn \l__acro_citation_all_bool { #1 } - \__acro_index_if:Nn \l__acro_addto_index_bool { #1 } + \__acro_cite_if:Nn \l__acro_citation_all_bool {#1} + \__acro_index_if:Nn \l__acro_addto_index_bool {#1} } % the standard internals: \cs_new_protected:Npn \acro_short:n #1 { - \acro_get:n { #1 } - \acro_is_used:n { #1 } - \__acro_indefinite:nn { #1 } { short } - \__acro_is_single:nT { #1 } + \acro_get:n {#1} + \acro_is_used:n {#1} + \__acro_indefinite:nn {#1} { short } + \__acro_is_single:nT {#1} { \cs_set_eq:NN \acro_hyper_link:nn \use_ii:nn } \__acro_acc_supp:nn - { #1 } + {#1} { \__acro_write_short:V \l__acro_short_tl } - \acro_after:n { #1 } + \acro_after:n {#1} } % get alternative entry: \cs_new_protected:Npn \acro_alt:n #1 { - \acro_get:n { #1 } - \acro_is_used:n { #1 } - \__acro_indefinite:nn { #1 } { alt } - \__acro_is_single:nT { #1 } + \acro_get:n {#1} + \acro_is_used:n {#1} + \__acro_indefinite:nn {#1} { alt } + \__acro_is_single:nT {#1} { \cs_set_eq:NN \acro_hyper_link:nn \use_ii:nn } \__acro_acc_supp:nn - { #1 } + {#1} { \__acro_write_short:V \l__acro_alt_tl } - \acro_after:n { #1 } + \acro_after:n {#1} } % get long entry: \cs_new_protected:Npn \acro_long:n #1 { - \acro_get:n { #1 } - \acro_is_used:n { #1 } - \__acro_indefinite:nn { #1 } { long } - \__acro_is_single:nT { #1 } + \acro_get:n {#1} + \acro_is_used:n {#1} + \__acro_indefinite:nn {#1} { long } + \__acro_is_single:nT {#1} { \cs_set_eq:NN \acro_hyper_link:nn \use_ii:nn } \__acro_write_long:NV \l__acro_long_format_tl \l__acro_long_tl - \acro_after:n { #1 } + \acro_after:n {#1} } % output like the first time: \cs_new_protected:Npn \acro_first:n #1 { \bool_gset_true:c { g__acro_#1_first_use_bool } - \acro_get:n { #1 } - \acro_is_used:n { #1 } - \__acro_is_single:nT { #1 } + \acro_get:n {#1} + \acro_is_used:n {#1} + \__acro_is_single:nT {#1} { \cs_set_eq:NN \acro_hyper_link:nn \use_ii:nn } \UseInstance { acro-first } { \l__acro_first_instance_tl } - { #1 } + {#1} { \l__acro_short_tl } { \l__acro_long_tl } } @@ -1660,14 +1645,14 @@ \cs_new_protected:Npn \acro_first_like:nn #1#2 { \bool_gset_true:c { g__acro_#1_first_use_bool } - \acro_get:n { #1 } - \acro_is_used:n { #1 } - \__acro_is_single:nT { #1 } + \acro_get:n {#1} + \acro_is_used:n {#1} + \__acro_is_single:nT {#1} { \cs_set_eq:NN \acro_hyper_link:nn \use_ii:nn } \UseInstance { acro-first } { \l__acro_first_instance_tl } - { #1 } + {#1} { \l__acro_short_tl } - { #2 } + {#2} } % ---------------------------------------------------------------------------- @@ -1679,12 +1664,12 @@ % #3 key \cs_new:Npn \__acro_cite:nnn #1#2#3 { - \quark_if_no_value:nTF { #1 } - { \__acro_citation_cmd:w { #3 } } + \quark_if_no_value:nTF {#1} + { \__acro_citation_cmd:w {#3} } { - \quark_if_no_value:nTF { #2 } - { \__acro_citation_cmd:w [ #1 ] { #3 } } - { \__acro_citation_cmd:w [ #1 ] [ #2 ] { #3 } } + \quark_if_no_value:nTF {#2} + { \__acro_citation_cmd:w [ #1 ] {#3} } + { \__acro_citation_cmd:w [ #1 ] [ #2 ] {#3} } } } \cs_generate_variant:Nn \__acro_cite:nnn { VVV } @@ -1693,10 +1678,10 @@ { \bool_if:NT #1 { - \prop_get:NnNT \l__acro_citation_prop { #2 } \l__acro_tmpa_tl + \prop_get:NnNT \l__acro_citation_prop {#2} \l__acro_tmpa_tl { - \prop_get:NnN \l__acro_citation_pre_prop { #2 } \l__acro_tmpb_tl - \prop_get:NnN \l__acro_citation_post_prop { #2 } \l__acro_tmpc_tl + \prop_get:NnN \l__acro_citation_pre_prop {#2} \l__acro_tmpb_tl + \prop_get:NnN \l__acro_citation_post_prop {#2} \l__acro_tmpc_tl \acro_no_break: \tl_use:N \l__acro_citation_space_tl \__acro_cite:VVV @@ -1713,12 +1698,12 @@ { \bool_if:nT { #1 && \l__acro_mark_as_used_bool } { - \prop_get:NnN \l__acro_index_cmd_prop { #2 } \l__acro_tmpa_tl - \prop_get:NnN \l__acro_index_sort_prop { #2 } \l__acro_tmpb_tl - \prop_get:NnN \l__acro_index_prop { #2 } \l__acro_tmpc_tl + \prop_get:NnN \l__acro_index_cmd_prop {#2} \l__acro_tmpa_tl + \prop_get:NnN \l__acro_index_sort_prop {#2} \l__acro_tmpb_tl + \prop_get:NnN \l__acro_index_prop {#2} \l__acro_tmpc_tl \__acro_index:VnVV \l__acro_tmpa_tl - { #2 } + {#2} \l__acro_tmpb_tl \l__acro_tmpc_tl } @@ -1732,16 +1717,16 @@ % #4: replace \cs_new_protected:Npn \__acro_index:nnnn #1#2#3#4 { - \prop_get:NnNF \l__acro_short_prop { #2 } \l__acro_index_short_tl {} - \prop_get:NnNF \l__acro_format_prop { #2 } \l__acro_index_format_tl {} + \prop_get:NnNF \l__acro_short_prop {#2} \l__acro_index_short_tl {} + \prop_get:NnNF \l__acro_format_prop {#2} \l__acro_index_format_tl {} \quark_if_no_value:VTF \l__acro_index_format_tl { \tl_set:Nn \l__acro_tmpa_tl { \l__acro_short_format_tl \l__acro_index_short_tl } } { \tl_set:Nn \l__acro_tmpa_tl { \l__acro_index_format_tl \l__acro_index_short_tl } } - \quark_if_no_value:nF { #1 } - { \cs_set:Npn \__acro_index_cmd:n { #1 } } + \quark_if_no_value:nF {#1} + { \cs_set:Npn \__acro_index_cmd:n {#1} } \quark_if_no_value:nTF { #4 } { - \quark_if_no_value:nTF { #3 } + \quark_if_no_value:nTF {#3} { \__acro_index_cmd:n { #2 @ { \l__acro_tmpa_tl } } } { \__acro_index_cmd:n { #3 @ { \l__acro_tmpa_tl } } } } @@ -1768,14 +1753,14 @@ \RequirePackage { accsupp } \cs_set_protected:Npn \__acro_acc_supp:nn #1#2 { - \prop_get:NnNF \l__acro_acc_supp_prop { #1 } \l__acro_acc_supp_tl - { \prop_get:NnNF \l__acro_short_prop { #1 } \l__acro_acc_supp_tl {} } + \prop_get:NnNF \l__acro_acc_supp_prop {#1} \l__acro_acc_supp_tl + { \prop_get:NnNF \l__acro_short_prop {#1} \l__acro_acc_supp_tl {} } \bool_if:NT \l__acro_use_plural_bool { \tl_put_right:NV \l__acro_acc_supp_tl \l__acro_short_plural_tl } \acro_acc_supp:VVn \l__acro_acc_supp_tl \l__acro_acc_supp_options_tl - { #2 } + {#2} } } } @@ -1785,16 +1770,53 @@ \cs_new_protected:Npn \__acro_indefinite:nn #1#2 { \bool_if:NT \l__acro_indefinite_bool - { \prop_get:cn { l__acro_#2_indefinite_prop } { #1 } ~ } + { \prop_get:cn { l__acro_#2_indefinite_prop } {#1} ~ } \bool_if:NT \l__acro_upper_indefinite_bool { \__acro_first_upper_case:x - { \prop_get:cn { l__acro_#2_indefinite_prop } { #1 } } ~ + { \prop_get:cn { l__acro_#2_indefinite_prop } {#1} } ~ } } % -------------------------------------------------------------------------- % experimental sorting feature: + +% the following code is an adaption of expl3 code used for \str_if_eq:NN(TF) +\luatex_if_engine:TF + { + \tl_set:Nn \l__acro_tmpa_tl + { + acro ~ = ~ acro ~ or ~ { ~ } ~ + function ~ acro.strcmp ~ (A, B) ~ + if ~ A ~ == ~ B ~ then ~ + tex.write ("0") ~ + elseif ~ A ~ < ~ B ~ then ~ + tex.write ("-1") ~ + else ~ + tex.write ("1") ~ + end ~ + end + } + \luatex_directlua:D { \l__acro_tmpa_tl } + \cs_new_protected:Npn \acro_strcmp:nn #1#2 + { + \luatex_directlua:D + { + acro.strcmp + ( + " \__acro_escape_x:n {#1} " , + " \__acro_escape_x:n {#2} " + ) + } + } + \cs_new:Npn \__acro_escape_x:n #1 + { + \luatex_luaescapestring:D + { \etex_detokenize:D \exp_after:wN { \luatex_expanded:D {#1} } } + } + } + { \cs_new_eq:NN \acro_strcmp:nn \pdftex_strcmp:D } + \AtBeginDocument { \bool_if:NT \l__acro_sort_bool @@ -1807,12 +1829,12 @@ \prop_map_inline:Nn \l__acro_sort_prop { \seq_put_right:Nn \l__acro_tmpa_seq { ##2 } - \prop_put:Nnn \l__acro_tmpa_prop { ##2 } { ##1 } + \prop_put:Nnn \l__acro_tmpa_prop { ##2 } {##1} } \seq_sort:Nn \l__acro_tmpa_seq { \tl_to_lowercase:n { - \int_compare:nTF { \pdftex_strcmp:D { ##1 } { ##2 } = -1 } + \int_compare:nTF { \acro_strcmp:nn {##1} { ##2 } = -1 } { \sort_ordered: } { \sort_reversed: } } @@ -1820,7 +1842,7 @@ \seq_map_inline:Nn \l__acro_tmpa_seq { % get ID: - \prop_get:NnNF \l__acro_tmpa_prop { ##1 } \l__acro_tmpa_tl {} + \prop_get:NnNF \l__acro_tmpa_prop {##1} \l__acro_tmpa_tl {} % get prop entry of ID in #1: \prop_get:NVNT #1 \l__acro_tmpa_tl \l__acro_tmpb_tl { @@ -1849,72 +1871,72 @@ \NewDocumentCommand \ac { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } - \acro_use:n { #2 } + \acro_use:n {#2} \group_end: } \NewDocumentCommand \iac { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_indefinite_bool - \acro_use:n { #2 } + \acro_use:n {#2} \group_end: } \NewDocumentCommand \Iac { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_upper_indefinite_bool - \acro_use:n { #2 } + \acro_use:n {#2} \group_end: } \NewDocumentCommand \Ac { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_first_upper_bool - \acro_use:n { #2 } + \acro_use:n {#2} \group_end: } \NewDocumentCommand \acp { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_use_plural_bool - \acro_use:n { #2 } + \acro_use:n {#2} \group_end: } \NewDocumentCommand \Acp { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_use_plural_bool \bool_set_true:N \l__acro_first_upper_bool - \acro_use:n { #2 } + \acro_use:n {#2} \group_end: } @@ -1922,47 +1944,47 @@ \NewDocumentCommand \acs { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } - \acro_short:n { #2 } + \acro_short:n {#2} \group_end: } \NewDocumentCommand \iacs { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_indefinite_bool - \acro_short:n { #2 } + \acro_short:n {#2} \group_end: } \NewDocumentCommand \Iacs { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_upper_indefinite_bool - \acro_short:n { #2 } + \acro_short:n {#2} \group_end: } \NewDocumentCommand \acsp { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_use_plural_bool - \acro_short:n { #2 } + \acro_short:n {#2} \group_end: } @@ -1970,47 +1992,47 @@ \NewDocumentCommand \aca { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } - \acro_alt:n { #2 } + \acro_alt:n {#2} \group_end: } \NewDocumentCommand \iaca { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_indefinite_bool - \acro_alt:n { #2 } + \acro_alt:n {#2} \group_end: } \NewDocumentCommand \Iaca { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_upper_indefinite_bool - \acro_alt:n { #2 } + \acro_alt:n {#2} \group_end: } \NewDocumentCommand \acap { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_use_plural_bool - \acro_alt:n { #2 } + \acro_alt:n {#2} \group_end: } @@ -2018,72 +2040,72 @@ \NewDocumentCommand \acl { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } - \acro_long:n { #2 } + \acro_long:n {#2} \group_end: } \NewDocumentCommand \iacl { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_indefinite_bool - \acro_long:n { #2 } + \acro_long:n {#2} \group_end: } \NewDocumentCommand \Iacl { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_upper_indefinite_bool - \acro_long:n { #2 } + \acro_long:n {#2} \group_end: } \NewDocumentCommand \Acl { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_first_upper_bool - \acro_long:n { #2 } + \acro_long:n {#2} \group_end: } \NewDocumentCommand \aclp { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_use_plural_bool - \acro_long:n { #2 } + \acro_long:n {#2} \group_end: } \NewDocumentCommand \Aclp { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_use_plural_bool \bool_set_true:N \l__acro_first_upper_bool - \acro_long:n { #2 } + \acro_long:n {#2} \group_end: } @@ -2091,72 +2113,72 @@ \NewDocumentCommand \acf { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } - \acro_first:n { #2 } + \acro_first:n {#2} \group_end: } \NewDocumentCommand \iacf { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_indefinite_bool - \acro_first:n { #2 } + \acro_first:n {#2} \group_end: } \NewDocumentCommand \Iacf { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_upper_indefinite_bool - \acro_first:n { #2 } + \acro_first:n {#2} \group_end: } \NewDocumentCommand \Acf { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_first_upper_bool - \acro_first:n { #2 } + \acro_first:n {#2} \group_end: } \NewDocumentCommand \acfp { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_use_plural_bool - \acro_first:n { #2 } + \acro_first:n {#2} \group_end: } \NewDocumentCommand \Acfp { sm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_use_plural_bool \bool_set_true:N \l__acro_first_upper_bool - \acro_first:n { #2 } + \acro_first:n {#2} \group_end: } @@ -2164,47 +2186,47 @@ \NewDocumentCommand \acflike { smm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } - \acro_first_like:nn { #2 } { #3 } + \acro_first_like:nn {#2} {#3} \group_end: } \NewDocumentCommand \iacflike { smm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_indefinite_bool - \acro_first_like:nn { #2 } { #3 } + \acro_first_like:nn {#2} {#3} \group_end: } \NewDocumentCommand \Iacflike { smm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_upper_indefinite_bool - \acro_first_like:nn { #2 } { #3 } + \acro_first_like:nn {#2} {#3} \group_end: } \NewDocumentCommand \acfplike { smm } { \group_begin: - \acro_defined:n { #2 } - \IfBooleanTF { #1 } + \acro_defined:n {#2} + \IfBooleanTF {#1} { \acro_use_if:n { * } } { \acro_use_if:n { } } \bool_set_true:N \l__acro_use_plural_bool - \acro_first_like:nn { #2 } { #3 } + \acro_first_like:nn {#2} {#3} \group_end: } @@ -2221,36 +2243,30 @@ \bool_gset_true:c { g__acro_#1_used_bool } \bool_gset_true:c { g__acro_#1_first_use_bool } \bool_gset_true:c { g__acro_#1_in_list_bool } - \cs_if_exist:cTF { acro@#1@once } - { \cs_gset_nopar:cpn { acro@#1@twice } { #1 } } - { - \cs_gset_nopar:cpn { acro@#1@once } { #1 } - \cs_gset_nopar:cpn { acro@#1@twice } { #1 } - } \if@filesw \iow_shipout_x:Nn \@auxout - { \token_to_str:N \acro@used@once { #1 } {} {} {} } + { \token_to_str:N \acro@used@once {#1} {} {} {} } \iow_shipout_x:Nn \@auxout - { \token_to_str:N \acro@used@twice { #1 } {} {} {} } + { \token_to_str:N \acro@used@twice {#1} {} {} {} } \fi } \cs_new_protected:Npn \acro_reset_all: - { \prop_map_inline:Nn \l__acro_short_prop { \acro_reset:n { ##1 } } } + { \prop_map_inline:Nn \l__acro_short_prop { \acro_reset:n {##1} } } \cs_new_protected:Npn \acro_mark_all_as_used: - { \prop_map_inline:Nn \l__acro_short_prop { \acro_mark_as_used:n { ##1 } } } + { \prop_map_inline:Nn \l__acro_short_prop { \acro_mark_as_used:n {##1} } } \DeclareExpandableDocumentCommand \acifused { m } - { \acro_if_acronym_used:nTF { #1 } } + { \acro_if_acronym_used:nTF {#1} } \prg_new_conditional:Npnn \acro_if_acronym_used:n #1 { TF } { \bool_if:nTF { \bool_if_p:c { g__acro_#1_used_bool } && - ( !\__acro_is_single_p:n { #1 } ) + ( !\__acro_is_single_p:n {#1} ) } { \prg_return_true: } { \prg_return_false: } @@ -2263,14 +2279,14 @@ { \acro_mark_all_as_used: } \NewDocumentCommand \acreset { > { \SplitList { , } } m } - { \ProcessList { #1 } { \acro_reset:n } \ignorespaces } + { \ProcessList {#1} { \acro_reset:n } \ignorespaces } \NewDocumentCommand \acuse { > { \SplitList { , } } m } - { \ProcessList { #1 } { \acro_mark_as_used:n } \ignorespaces } + { \ProcessList {#1} { \acro_mark_as_used:n } \ignorespaces } % --------------------------------------------------------------------------- % process options: -\ProcessKeysOptions { acro } +\ProcessKeysOptions {acro} % --------------------------------------------------------------------------- % PDF bookmark support @@ -2280,22 +2296,27 @@ \cs_new:Npn \acpdfstringplural { \acro_pdf_string_plural:n } -% TODO: why did I do this instead of \tl_if_eq:nnTF ? -\cs_new:Npn \acro_tl_if_eq:nnTF #1#2 - { \ifx#1#2\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi } +\prg_new_conditional:Npnn \acro_if_star_gobble:n #1 {TF} + { + \if_meaning:w *#1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } \cs_new:Npn \acro_pdf_string:n #1 { - \acro_tl_if_eq:nnTF {*} {#1} + \acro_if_star_gobble:nTF {#1} { \prop_get:Nn \l__acro_pdfstring_prop } - { \prop_get:Nn \l__acro_pdfstring_prop { #1 } } + { \prop_get:Nn \l__acro_pdfstring_prop {#1} } } \cs_new:Npn \acro_pdf_string_plural:n #1 { - \acro_tl_if_eq:nnTF {*} {#1} + \acro_if_star_gobble:nTF {#1} { \prop_get:Nn \l__acro_pdfstring_plural_prop } - { \prop_get:Nn \l__acro_pdfstring_plural_prop { #1 } } + { \prop_get:Nn \l__acro_pdfstring_plural_prop {#1} } } \AtBeginDocument @@ -2322,11 +2343,399 @@ \cs_set_eq:NN \Acfp \acpdfstringplural \cs_set_eq:NN \acap \acpdfstringplural } - \cs_set_protected:Npn \acro_hyper_page:n #1 { \hyperpage { #1 } } + \cs_set_protected:Npn \acro_hyper_page:n #1 { \hyperpage {#1} } } {} } % -------------------------------------------------------------------------- +% additional variables: +\tl_new:N \l__acro_current_key_tl + +% -------------------------------------------------------------------------- +% key and order checking +\msg_new:nnn {acro} {no-id} + { Something~has~gone~wrong,~you've~probably~forgotten~to~set~the~acronym~ID. } + +\msg_new:nnn {acro} {before-short} + { + You've~set~The~key~`#2'~before~the~`short'~key~for~acronym~`#1'~but~ + needs~to~be~set~after~it. + } + +\msg_new:nnn {acro} {missing} + { The~`#2'~key~for~acronym~`#1'~is~missing. } + +\msg_new:nnn {acro} {doubled-key} + { + It~seems~to~me~you~have~used~the~`#1'~key~before.~If~you~haven't~there's~ + something~different~wrong~and~I'm~lost.~You~'re~on~your~own~now. + } + +\cs_new_protected:Npn \__acro_key_check:nn #1#2 + { + \tl_if_blank:VT \l__acro_current_key_tl + { \acro_serious_message:nn {acro} {no-id} } + \bool_if:cF { l__acro_#1_short_set_bool } + { \acro_serious_message:nnnn {acro} {before-short} {#1} {#2} } + \bool_new:c { l__acro_#1_#2_set_bool } + \bool_set_true:c { l__acro_#1_#2_set_bool } + } + +\cs_new_protected:Npn \__acro_first_key_check:n #1 + { + \cs_if_exist:cTF { l__acro_#1_short_set_bool } + { + \bool_if:cT { l__acro_#1_short_set_bool } + { \acro_serious_message:nnn {acro} {doubled-key} {#1} } + } + { + \bool_new:c { l__acro_#1_short_set_bool } + \bool_set_true:c { l__acro_#1_short_set_bool } + } + } + +% -------------------------------------------------------------------------- +% the internal key selection functions for \DeclareAcronym: + +% #1: name in associated cs +% #2: key name +% #3: action +\cs_new_protected:Npn \acro_declare_key_generic:nnn #1#2#3 + { + \prop_new:c { l__acro_#1_prop } + \cs_new_protected:cpn { __acro_declare_#1:nn } ##1##2 + { + #3 + } + \cs_generate_variant:cn { __acro_declare_#1:nn } { V } + \keys_define:nn { acro / declare-acronym } + { + #2 .code:n = + \use:c {__acro_declare_#1:Vn} \l__acro_current_key_tl {##1} + } + } +\cs_generate_variant:Nn \cs_generate_variant:Nn {c} + +% #1: name in associated cs +% #2: key name +% #3: action +\cs_new_protected:Npn \acro_declare_key:nnn #1#2#3 + { + \acro_declare_key_generic:nnn {#1} {#2} + { + \__acro_key_check:nn {##1} {#2} + \prop_put:cnn { l__acro_#1_prop } {##1} {##2} + #3 + } + } + +% #1: name in associated cs +% #2: key name +\cs_new_protected:Npn \acro_declare_key:nn #1#2 + { \acro_declare_key:nnn {#1} {#2} {} } +\cs_generate_variant:Nn \acro_declare_key:nn { V } + +\cs_new_protected:Npn \acro_declare_simple_key:n #1 + { + \tl_set:Nn \l__acro_tmpa_tl {#1} + \tl_replace_all:Nnn \l__acro_tmpa_tl {-} {_} + \acro_declare_key:Vn \l__acro_tmpa_tl {#1} + } + +% #1: new alias key +% #2: old key +\cs_new_protected:Npn \acro_declare_key_alias:nn #1#2 + { + \keys_define:nn { acro / declare-acronym } + { #1 .meta:n = { #2 = {##1} } } + } + +% -------------------------------------------------------------------------- +% declare the keys for \DeclareAcronym: +% short: +\acro_declare_key_generic:nnn {short} {short} + { + \__acro_first_key_check:n {#1} + \prop_put:Nnn \l__acro_short_prop {#1} {#2} + \prop_put:Nnn \l__acro_sort_prop {#1} {#1} + \prop_put:Nnn \l__acro_index_sort_prop {#1} {#1} + \prop_put:Nnn \l__acro_alt_prop {#1} {#2} + \prop_put:Nnx \l__acro_pdfstring_prop {#1} { \exp_not:n {#2} } + \prop_put:Nnn \l__acro_short_plural_prop + {#1} { \l__acro_default_plural_tl } + \prop_put:Nnx \l__acro_short_indefinite_prop + {#1} { \l__acro_default_indefinite_tl } + \prop_put:Nnx \l__acro_alt_indefinite_prop + {#1} { \l__acro_default_indefinite_tl } + \prop_put:Nnx \l__acro_pdfstring_plural_prop + {#1} { \exp_not:n {#2} \exp_not:V \l__acro_default_plural_tl } + } + +% short plural: +\acro_declare_simple_key:n {short-plural} + +% long: +\acro_declare_key:nnn {long} {long} + { + \prop_put:Nnn \l__acro_long_plural_form_prop {#1} { \c_false_bool } + \prop_put:Nnx \l__acro_long_indefinite_prop + {#1} { \l__acro_default_indefinite_tl } + \bool_if:cF { l__acro_#1_long-plural_set_bool } + { + \prop_put:Nnn \l__acro_long_plural_prop + {#1} { \l__acro_default_plural_tl } + } + } + +% list: +\acro_declare_simple_key:n {list} + +% long plural: +\acro_declare_key:nnn {long_plural} {long-plural} + { \prop_put:Nnn \l__acro_long_plural_form_prop {#1} { \c_false_bool } } + +% long plural form: +\acro_declare_key_generic:nnn {long_plural_form} {long-plural-form} + { + \__acro_key_check:nn {#1} { long-plural-form } + \prop_put:Nnn \l__acro_long_plural_form_prop {#1} { \c_true_bool } + \prop_put:Nnn \l__acro_long_plural_prop {#1} {#2} + } + +% short indefinite article: +\acro_declare_simple_key:n {short-indefinite} + +% long indefinite article: +\acro_declare_simple_key:n {long-indefinite} + +% pre long: +\acro_declare_simple_key:n {long-pre} + +% post long: +\acro_declare_simple_key:n {long-post} + +% sort: +\acro_declare_key:nnn {sort} {sort} + { + \bool_if:cF { l__acro_#1_index-sort_set_bool } + { \prop_put:Nnn \l__acro_index_sort_prop {#1} {#2} } + } + +% alternative: +\acro_declare_key:nnn {alt} {alt} + { + \prop_put:Nnx \l__acro_alt_indefinite_prop + {#1} { \l__acro_default_indefinite_tl } + } + +% alt. indefinite article: +\acro_declare_simple_key:n {alt-indefinite} + +% foreign: +\acro_declare_simple_key:n {foreign} + +% format: +\acro_declare_simple_key:n {format} + +% short format: +\acro_declare_key_alias:nn {short-format} {format} + +% long format: +\acro_declare_simple_key:n {long-format} + +% first long format: +\acro_declare_simple_key:n {first-long-format} + +% pdfstring: +\prop_new:N \l__acro_pdfstring_prop +\prop_new:N \l__acro_pdfstring_plural_prop +\cs_new_protected:Npn \__acro_declare_pdfstring:nw #1#2/#3/#4 \acro_stop: + { + \__acro_key_check:nn {#1} { pdfstring } + \prop_put:Nnx \l__acro_pdfstring_prop {#1} {#2} + \tl_if_empty:nTF { #3 } + { + \prop_put:Nnx \l__acro_pdfstring_plural_prop + {#1} { \exp_not:n {#2} \exp_not:V \l__acro_default_plural_tl } + } + { + \prop_put:Nnx \l__acro_pdfstring_plural_prop + {#1} { \exp_not:n { #2#3 } } + } + } +\cs_generate_variant:Nn \__acro_declare_pdfstring:nw { V } +\keys_define:nn { acro / declare-acronym } + { + pdfstring .code:n = + \__acro_declare_pdfstring:Vw \l__acro_current_key_tl #1 // \acro_stop: , + } + +% class: +\acro_declare_simple_key:n {class} + +% extra information: +\acro_declare_simple_key:n {extra} + +% acc supp: +\acro_declare_key:nn {acc_supp} {accsupp} + +% citation: +\prop_new:N \l__acro_citation_prop +\prop_new:N \l__acro_citation_pre_prop +\prop_new:N \l__acro_citation_post_prop +\cs_new_protected:Npn \__acro_declare_citation:nw #1#2[#3]#4[#5]#6#7 \acro_stop: + { + % no options: #1: ID, #2: key, #3 is blank + % 1 option: #1: ID, #4: key, #3: option, #5 is blank + % 2 options: #1: ID: #6: key, #3: first option, #5: second option + \tl_if_blank:nF { #2#4#6 } + { + \tl_if_empty:nTF { #3 } + { \__acro_declare_citation_aux:nnnn {#1} { } { } {#2} } + { + \tl_if_empty:nTF { #5 } + { \__acro_declare_citation_aux:nnnn {#1} { #3 } { } { #4 } } + { \__acro_declare_citation_aux:nnnn {#1} { #3 } { #5 } { #6 } } + } + } + } +\cs_generate_variant:Nn \__acro_declare_citation:nw { V } + +\keys_define:nn { acro / declare-acronym } + { + cite .code:n = + \__acro_declare_citation:Vw + \l__acro_current_key_tl #1 [][] \scan_stop: \acro_stop: + } + +\cs_new_protected:Npn \__acro_declare_citation_aux:nnnn #1#2#3#4 + { + \__acro_key_check:nn {#1} { cite } + \prop_put:Nnn \l__acro_citation_prop {#1} { #4 } + \tl_if_empty:nF {#2} + { \prop_put:Nnn \l__acro_citation_pre_prop {#1} {#2} } + \tl_if_empty:nF { #3 } + { \prop_put:Nnn \l__acro_citation_post_prop {#1} { #3 } } + } + +% TODO: +% add index entries, by default \index{<sort>@<short>} +% index: overwrite default <sort>@<short> entry completely +% index-sort: overwrite the <sort> part of <sort>@<short> entry + +% need to take care of custom index cmd, at least +% - \index{} +% - \index[]{} +% question is, though, if it should be the same one for all acronyms? +% I go for yes but would also add a `post' key that allows to add arbitrary +% TeX code after an acronym is typeset + +% index: +\acro_declare_simple_key:n {index} + +% index-sort: +\acro_declare_simple_key:n {index-sort} + +% index-cmd: +\acro_declare_simple_key:n {index-cmd} + +% -------------------------------------------------------------------------- +% acronym macros: +\cs_new_protected:Npn \acro_define_acronym_macro:n #1 + { + \bool_if:NT \l__acro_create_macros_bool + { + \cs_if_exist:cTF {#1} + { + \bool_if:NTF \l__acro_strict_bool + { \cs_set:cpn {#1} { \ac {#1} \acro_xspace: } } + { \acro_serious_message:nnn {acro} {macro} {#1} } + } + { \cs_new:cpn {#1} { \ac {#1} \acro_xspace: } } + } + } + +% -------------------------------------------------------------------------- +% internal acronym declaring function: +\cs_new_protected:Npn \acro_declare_acronym:nn #1#2 + { + \tl_set:Nn \l__acro_current_key_tl {#1} + \keys_set:nn { acro / declare-acronym } {#2} + \bool_new:c { g__acro_#1_first_use_bool } + \bool_new:c { g__acro_#1_used_bool } + \bool_new:c { g__acro_#1_label_bool } + \bool_new:c { g__acro_#1_in_list_bool } + \bool_if:NF \l__acro_print_only_used_bool + { \bool_gset_true:c { g__acro_#1_in_list_bool } } + \acro_create_page_records:n {#1} + \acro_define_acronym_macro:n {#1} + \tl_clear:N \l__acro_current_key_tl + \bool_if:cF { l__acro_#1_short_set_bool } + { \acro_serious_message:nnnn {acro} {missing} {#1} {short} } + \bool_if:cF { l__acro_#1_long_set_bool } + { \acro_serious_message:nnnn {acro} {missing} {#1} {long} } + } + +% -------------------------------------------------------------------------- +% the user command: +\NewDocumentCommand \DeclareAcronym { mm } + { \acro_declare_acronym:nn {#1} {#2} } + +% -------------------------------------------------------------------------- +% print the list: +% #1: list of classes +% #2: list of excluded classes +\tl_new:N \l__acro_included_classes_tl +\tl_new:N \l__acro_excluded_classes_tl + +\cs_new_protected:Npn \acro_use_list_instance:nn #1#2 + { + \UseInstance { acro-list } { \l__acro_list_instance_tl } + { \l__acro_list_type_tl } {#1} {#2} + } +\cs_generate_variant:Nn \acro_use_list_instance:nn { VV } + +\keys_define:nn { acro / print-acronyms } + { + include-classes .tl_set:N = \l__acro_included_classes_tl , + exclude-classes .tl_set:N = \l__acro_excluded_classes_tl , + name .tl_set:N = \l__acro_list_name_tl , + header .code:n = + \acro_option_deprecated:nn { header } { heading } + \tl_set:Nn \l__acro_list_title_tl {#1} , + heading .tl_set:N = \l__acro_list_title_tl , + sort .bool_set:N = \l__acro_sort_bool + } + +\cs_new_protected:Npn \acro_print_acronyms:n #1 + { + \group_begin: + % this is a cheap trick to prevent the \@noitemerr + % if one forgot to delete either the aux file or + % remove \printacronyms -- but it's local: + \cs_set:Npn \@noitemerr {} + \tl_clear:N \l__acro_included_classes_tl + \tl_clear:N \l__acro_excluded_classes_tl + \keys_set:nn { acro / print-acronyms } {#1} + \iow_now:Nx \@auxout { \string \acro@print@list } + \bool_if:NT \l__acro_sort_bool + { \acro_sort_prop:N \l__acro_short_prop } + \UseInstance { acro-title } { \l__acro_list_title_tl } + { \l__acro_list_name_tl } + \cs_if_exist:NTF \acro@printed@list + { + \acro_use_list_instance:VV + \l__acro_included_classes_tl + \l__acro_excluded_classes_tl + } + { \@latex@warning@no@line {Rerun~to~get~acronym~list~right} } + \group_end: + } + +\NewDocumentCommand \printacronyms { O{} } + { \acro_print_acronyms:n {#1} } + +% -------------------------------------------------------------------------- % language support \RequirePackage { translations } % Listenname @@ -2367,11 +2776,6 @@ \DeclareTranslation { Portuguese } { acronym-next-pages } { ss. } \tl_set:Nn \l__acro_next_pages_tl { \,\GetTranslation {acronym-next-pages }\@ } -% -------------------------------------------------------------------------- -% load default version -\bool_if:NF \l__acro_version_selected_bool - { \__acro_select_version:n { 1 } } - \tex_endinput:D % -------------------------------------------------------------------------- % HISTORY: @@ -2478,9 +2882,21 @@ - new option `pages=first|all' that determines if in the list of acronyms all appearances are listed or only the first time; implicitly sets `label=true' +2015/02/26 v1.6 - new `acro-title' instance `none' + - change of expl3's tl uppercasing function (adapt to updates + of l3kernel and friends + - new package option `messages=silent|loud' + - fix issue https://bitbucket.org/cgnieder/acro/issue/23/ + - fix issue https://bitbucket.org/cgnieder/acro/issue/24/ + - fix issue https://bitbucket.org/cgnieder/acro/issue/28/ + - drop support for version 0 % -------------------------------------------------------------------------- % TODO: +- extend option `macros' to also define uppercase macros, possibly as a choice +- https://bitbucket.org/cgnieder/acro/issue/18 +- options user1, user2, user3? (Genitiv lang, Akkusativ lang,...) Bsp: ``des + Bundesinstituts für Risikobewertung'' - Option `totoc'!? - revise list styles to allow _full_ customization by creating own instances! this probably needs a handfull of macros that give access to the entries diff --git a/Master/texmf-dist/tex/latex/acro/acro0.def b/Master/texmf-dist/tex/latex/acro/acro0.def deleted file mode 100644 index cff564c2fc3..00000000000 --- a/Master/texmf-dist/tex/latex/acro/acro0.def +++ /dev/null @@ -1,170 +0,0 @@ -% -------------------------------------------------------------------------- -% the ACRO package -% -% Typeset Acronyms -% -% -------------------------------------------------------------------------- -% Clemens Niederberger -% Web: https://bitbucket.org/cgnieder/acro/ -% E-Mail: contact@mychemistry.eu -% -------------------------------------------------------------------------- -% Copyright 2011-2013 Clemens Niederberger -% -% This work may be distributed and/or modified under the -% 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 2005/12/01 or later. -% -% This work has the LPPL maintenance status `maintained'. -% -% The Current Maintainer of this work is Clemens Niederberger. -% -------------------------------------------------------------------------- -% The acro package consists of the files -% - acro.sty, acro0.def, acro1.def, acro_en.tex, acro_en.pdf, README -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- -\ProvidesFile{acro0.def} - -% -------------------------------------------------------------------------- -% adding an acronym, internal command: -% #1: use/replace plural (boolean) -% #2: id -% #3: short -% #4: short plural -% #5: alt -% #6: long -% #7: long plural -% #8: class -% #9: extra -\cs_new:Npn \acro_new:nnnnnnnnn #1#2#3#4#5#6#7#8#9 - { - \IfBooleanTF { #1 } - { \prop_put:Nnn \l__acro_replace_long_plural_prop { #2 } { \c_true_bool } } - { \prop_put:Nnn \l__acro_replace_long_plural_prop { #2 } { \c_false_bool } } - \prop_put:Nnn \l__acro_short_prop { #2 } { #3 } - \prop_put:Nnn \l__acro_sort_prop { #2 } { #2 } - \prop_put:Nnn \l__acro_pdfstring_prop { #2 } { #3 } - \acro_create_page_records:n { #2 } - \IfNoValueTF { #4 } - { - \prop_put:Nnn \l__acro_short_plural_prop - { #2 } { \l__acro_default_plural_tl } - \prop_put:Nnx \l__acro_pdfstring_plural_prop - { #2 } { \exp_not:n { #3 } \exp_not:V \l__acro_default_plural_tl } - } - { - \prop_put:Nnn \l__acro_short_plural_prop { #2 } { #4 } - \prop_put:Nnx \l__acro_pdfstring_plural_prop { #2 } { \exp_not:n { #3 #4 } } - } - \IfNoValueTF { #5 } - { \prop_put:Nnn \l__acro_alt_prop { #2 } { #2 } } - { \prop_put:Nnn \l__acro_alt_prop { #2 } { #5 } } - \prop_put:Nnn \l__acro_long_prop { #2 } { #6 } - \IfNoValueTF { #7 } - { \prop_put:Nnn \l__acro_long_plural_prop { #2 } { \l__acro_default_plural_tl } } - { \prop_put:Nnn \l__acro_long_plural_prop { #2 } { #7 } } - \IfNoValueF { #8 } - { \prop_put:Nnn \l__acro_class_prop { #2 } { #8 } } - \IfNoValueF { #9 } - { \prop_put:Nnn \l__acro_extra_prop { #2 } { #9 } } - \bool_new:c { g__acro_#2_first_use_bool } - \bool_new:c { g__acro_#2_used_bool } - \bool_new:c { g__acro_#2_in_list_bool } - \bool_new:c { g__acro_#2_label_bool } - \bool_if:NT \l__acro_create_macros_bool - { - \cs_if_exist:cTF { #2 } - { - \bool_if:NT \l__acro_strict_bool - { \cs_set:cpn { #2 } { \ac { #2 } \acro_xspace: } } - } - { \cs_new:cpn { #2 } { \ac { #2 } \acro_xspace: } } - } - } - -% set custom format: -\cs_new:Npn \acro_format:nn #1#2 - { \prop_put:Nnn \l__acro_format_prop { #1 } { #2 } } - -% add citation: -\cs_new:Npn \acro_citation:nnnn #1#2#3#4 - { - \prop_put:Nnn \l__acro_citation_prop { #1 } { #4 } - \IfNoValueF { #2 } - { \prop_put:Nnn \l__acro_citation_pre_prop { #1 } { #2 } } - \IfNoValueF { #3 } - { \prop_put:Nnn \l__acro_citation_post_prop { #1 } { #3 } } - } - -% add pdfstring: -\cs_new:Npn \acro_pdfstring:nnn #1#2#3 - { - \prop_put:Nnx \l__acro_pdfstring_prop { #1 } { #2 } - \IfNoValueTF { #3 } - { - \prop_put:Nnx \l__acro_pdfstring_plural_prop - { #1 } { #2 \l__acro_default_plural_tl } - } - { - \prop_put:Nnx \l__acro_pdfstring_plural_prop - { #1 } { #2 #3 } - } - } - -% -------------------------------------------------------------------------- -% USER COMMANDS -% adding an acronym, user command: -% #1: use/replace plural (boolean) -% #2: id -% #3: short -% #4: short plural -% #5: alt -% #6: long -% #7: long plural -% #8: class -% #9: extra -\NewDocumentCommand \DeclareAcronym - { sm>{\SplitArgument{1}{,}}mo>{\SplitArgument{1}{,}}+mgo } - { \acro_new:nnnnnnnnn { #1 } { #2 } #3 { #4 } #5 { #7 } { #6 } } -\@onlypreamble \DeclareAcronym - -\NewDocumentCommand \DeclareAcronymFormat { mm } - { \acro_format:nn { #1 } { #2 } } -\@onlypreamble \DeclareAcronymFormat - -\NewDocumentCommand \DeclareAcronymCitation { moom } - { \acro_citation:nnnn { #1 } { #2 } { #3 } { #4 } } -\@onlypreamble \DeclareAcronymCitation - -\NewDocumentCommand \DeclareAcronymPDFString - { m >{ \SplitArgument { 1 } { , } } m } - { \acro_pdfstring:nnn { #1 } #2 } -\@onlypreamble \DeclareAcronymPDFstring - -% -------------------------------------------------------------------------- -% print the list: -\cs_new:Npn \acro_print_acronyms:nn #1#2 - { - \iow_now:Nx \@auxout { \string \acro@print@list } - \bool_if:NT \l__acro_sort_bool - { \acro_sort_prop:N \l__acro_short_prop } - \UseInstance { acro-title } { \l__acro_list_title_tl } - { \l__acro_list_name_tl } - \cs_if_exist:NTF \acro@printed@list - { - \UseInstance { acro-list } { \l__acro_list_instance_tl } - { \l__acro_list_type_tl } { #1 } { #2 } - } - { \@latex@warning@no@line {Rerun~to~get~acronym~list~right} } - } - -% user command: -\NewDocumentCommand \printacronyms { G{}O{} } - { \acro_print_acronyms:nn { #1 } { #2 } } - -\tex_endinput:D diff --git a/Master/texmf-dist/tex/latex/acro/acro1.def b/Master/texmf-dist/tex/latex/acro/acro1.def deleted file mode 100644 index 22f931cc59c..00000000000 --- a/Master/texmf-dist/tex/latex/acro/acro1.def +++ /dev/null @@ -1,507 +0,0 @@ -% -------------------------------------------------------------------------- -% the ACRO package -% -% Typeset Acronyms -% -% -------------------------------------------------------------------------- -% Clemens Niederberger -% Web: https://bitbucket.org/cgnieder/acro/ -% E-Mail: contact@mychemistry.eu -% -------------------------------------------------------------------------- -% Copyright 2011-2013 Clemens Niederberger -% -% This work may be distributed and/or modified under the -% 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 2005/12/01 or later. -% -% This work has the LPPL maintenance status `maintained'. -% -% The Current Maintainer of this work is Clemens Niederberger. -% -------------------------------------------------------------------------- -% The acro package consists of the files -% - acro.sty, acro0.def, acro1.def, acro_en.tex, acro_en.pdf, README -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- -\ProvidesFile{acro1.def} - -% -------------------------------------------------------------------------- -% additional variables: -\tl_new:N \l__acro_current_key_tl - -% -------------------------------------------------------------------------- -% key and order checking -\msg_new:nnnn { acro } { no-id } - { Something~has~gone~wrong,~you've~probably~forgotten~to~set~the~acronym~ID. } - { Something~has~gone~wrong,~you've~probably~forgotten~to~set~the~acronym~ID. } - -\msg_new:nnnn { acro } { before-short } - { The~key~`#2'~needs~to~be~set~after~`short'. } - { - You've~set~The~key~`#2'~before~the~`short'~key~for~acronym~`#1'~but~ - needs~to~be~set~after~it. - } - -\msg_new:nnnn { acro } { missing } - { The~`#2'~key~for~acronym~`#1'~is~missing. } - { The~`#2'~key~for~acronym~`#1'~is~missing. } - -\msg_new:nnnn { acro } { doubled-key } - { It~seems~to~me~you~have~used~the~`#1'~key~before. } - { - It~seems~to~me~you~have~used~the~`#1'~key~before.~If~you~haven't~there's~ - something~different~wrong~and~I'm~lost.~You~'re~on~your~own~now. - } - -\cs_new_protected:Npn \__acro_key_check:nn #1#2 - { - \tl_if_blank:VT \l__acro_current_key_tl - { \msg_error:nn { acro } { no-id } } - \bool_if:cF { l__acro_#1_short_set_bool } - { \msg_error:nnxx { acro } { before-short } { #1 } { #2 } } - \bool_new:c { l__acro_#1_#2_set_bool } - \bool_set_true:c { l__acro_#1_#2_set_bool } - } - -\cs_new_protected:Npn \__acro_first_key_check:n #1 - { - \cs_if_exist:cTF { l__acro_#1_short_set_bool } - { - \bool_if:cT { l__acro_#1_short_set_bool } - { \msg_error:nnx { acro } { doubled-key } { #1 } } - } - { - \bool_new:c { l__acro_#1_short_set_bool } - \bool_set_true:c { l__acro_#1_short_set_bool } - } - } - -% -------------------------------------------------------------------------- -% the internal selection functions: -% short: -\cs_new_protected:Npn \__acro_declare_short:nn #1#2 - { - \__acro_first_key_check:n { #1 } - \prop_put:Nnn \l__acro_short_prop { #1 } { #2 } - \prop_put:Nnn \l__acro_sort_prop { #1 } { #1 } - \prop_put:Nnn \l__acro_index_sort_prop { #1 } { #1 } - \prop_put:Nnn \l__acro_alt_prop { #1 } { #2 } - \prop_put:Nnx \l__acro_pdfstring_prop { #1 } { \exp_not:n { #2 } } - \prop_put:Nnn \l__acro_short_plural_prop - { #1 } { \l__acro_default_plural_tl } - \prop_put:Nnx \l__acro_short_indefinite_prop - { #1 } { \l__acro_default_indefinite_tl } - \prop_put:Nnx \l__acro_alt_indefinite_prop - { #1 } { \l__acro_default_indefinite_tl } - \prop_put:Nnx \l__acro_pdfstring_plural_prop - { #1 } { \exp_not:n { #2 } \exp_not:V \l__acro_default_plural_tl } - } -\cs_generate_variant:Nn \__acro_declare_short:nn { V } - -% short plural: -\cs_new_protected:Npn \__acro_declare_short_plural:nn #1#2 - { - \__acro_key_check:nn { #1 } { short-plural } - \prop_put:Nnn \l__acro_short_plural_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_short_plural:nn { V } - -% long: -\cs_new_protected:Npn \__acro_declare_long:nn #1#2 - { - \__acro_key_check:nn { #1 } { long } - \prop_put:Nnn \l__acro_replace_long_plural_prop { #1 } { \c_false_bool } - \prop_put:Nnn \l__acro_long_prop { #1 } { #2 } - \prop_put:Nnx \l__acro_long_indefinite_prop - { #1 } { \l__acro_default_indefinite_tl } - \bool_if:cF { l__acro_#1_long-plural_set_bool } - { - \prop_put:Nnn \l__acro_long_plural_prop - { #1 } { \l__acro_default_plural_tl } - } - } -\cs_generate_variant:Nn \__acro_declare_long:nn { V } - -% list: -\cs_new_protected:Npn \__acro_declare_list:nn #1#2 - { - \__acro_key_check:nn { #1 } { list } - \prop_put:Nnn \l__acro_list_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_list:nn { V } - -% long plural: -\cs_new_protected:Npn \__acro_declare_long_plural:nn #1#2 - { - \__acro_key_check:nn { #1 } { long-plural } - \prop_put:Nnn \l__acro_replace_long_plural_prop { #1 } { \c_false_bool } - \prop_put:Nnn \l__acro_long_plural_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_long_plural:nn { V } - -% long plural form: -\cs_new_protected:Npn \__acro_declare_long_plural_form:nn #1#2 - { - \__acro_key_check:nn { #1 } { long-plural-form } - \prop_put:Nnn \l__acro_replace_long_plural_prop { #1 } { \c_true_bool } - \prop_put:Nnn \l__acro_long_plural_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_long_plural_form:nn { V } - -% short indefinite article: -\cs_new_protected:Npn \__acro_declare_short_indefinite:nn #1#2 - { - \__acro_key_check:nn { #1 } { short-indefinite } - \prop_put:Nnn \l__acro_short_indefinite_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_short_indefinite:nn { V } - -% long indefinite article: -\cs_new_protected:Npn \__acro_declare_long_indefinite:nn #1#2 - { - \__acro_key_check:nn { #1 } { long-indefinite } - \prop_put:Nnn \l__acro_long_indefinite_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_long_indefinite:nn { V } - -% pre long: -\cs_new_protected:Npn \__acro_declare_long_pre:nn #1#2 - { - \__acro_key_check:nn { #1 } { long-pre } - \prop_put:Nnn \l__acro_long_pre_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_long_pre:nn { V } - -% post long: -\cs_new_protected:Npn \__acro_declare_long_post:nn #1#2 - { - \__acro_key_check:nn { #1 } { long-post } - \prop_put:Nnn \l__acro_long_post_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_long_post:nn { V } - -% sort: -\cs_new_protected:Npn \__acro_declare_sort:nn #1#2 - { - \__acro_key_check:nn { #1 } { sort } - \prop_put:Nnn \l__acro_sort_prop { #1 } { #2 } - \bool_if:cF { l__acro_#1_index-sort_set_bool } - { \prop_put:Nnn \l__acro_index_sort_prop { #1 } { #2 } } - } -\cs_generate_variant:Nn \__acro_declare_sort:nn { V } - -% alternative: -\cs_new_protected:Npn \__acro_declare_alt:nn #1#2 - { - \__acro_key_check:nn { #1 } { alt } - \prop_put:Nnn \l__acro_alt_prop { #1 } { #2 } - \prop_put:Nnx \l__acro_alt_indefinite_prop - { #1 } { \l__acro_default_indefinite_tl } - } -\cs_generate_variant:Nn \__acro_declare_alt:nn { V } - -% alt. indefinite article: -\cs_new_protected:Npn \__acro_declare_alt_indefinite:nn #1#2 - { - \__acro_key_check:nn { #1 } { alt-indefinite } - \prop_put:Nnn \l__acro_alt_indefinite_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_alt_indefinite:nn { V } - -% foreign: -\cs_new_protected:Npn \__acro_declare_foreign:nn #1#2 - { - \__acro_key_check:nn { #1 } { alt } - \prop_put:Nnn \l__acro_foreign_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_foreign:nn { V } - -% format: -\cs_new_protected:Npn \__acro_declare_format:nn #1#2 - { - \__acro_key_check:nn { #1 } { format } - \prop_put:Nnn \l__acro_format_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_format:nn { V } - -% long format: -\cs_new_protected:Npn \__acro_declare_long_format:nn #1#2 - { - \__acro_key_check:nn { #1 } { long-format } - \prop_put:Nnn \l__acro_long_format_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_long_format:nn { V } - -% first long format: -\cs_new_protected:Npn \__acro_declare_first_long_format:nn #1#2 - { - \__acro_key_check:nn { #1 } { first-long-format } - \prop_put:Nnn \l__acro_first_long_format_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_first_long_format:nn { V } - -% pdfstring: -\cs_new_protected:Npn \__acro_declare_pdfstring:nw #1#2/#3/#4 \acro_stop: - { - \__acro_key_check:nn { #1 } { pdfstring } - \prop_put:Nnx \l__acro_pdfstring_prop { #1 } { #2 } - \tl_if_empty:nTF { #3 } - { - \prop_put:Nnx \l__acro_pdfstring_plural_prop - { #1 } { \exp_not:n { #2 } \exp_not:V \l__acro_default_plural_tl } - } - { - \prop_put:Nnx \l__acro_pdfstring_plural_prop - { #1 } { \exp_not:n { #2#3 } } - } - } -\cs_generate_variant:Nn \__acro_declare_pdfstring:nw { V } - -% class: -\cs_new_protected:Npn \__acro_declare_class:nn #1#2 - { - \__acro_key_check:nn { #1 } { class } - \prop_put:Nnn \l__acro_class_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_class:nn { V } - -% extra information: -\cs_new_protected:Npn \__acro_declare_extra:nn #1#2 - { - \__acro_key_check:nn { #1 } { extra } - \prop_put:Nnn \l__acro_extra_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_extra:nn { V } - -% acc supp: -\cs_new_protected:Npn \__acro_declare_acc_supp:nn #1#2 - { - \__acro_key_check:nn { #1 } { accsupp } - \prop_put:Nnn \l__acro_acc_supp_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_acc_supp:nn { V } - -% citation: -\cs_new_protected:Npn \__acro_declare_citation:nw #1#2[#3]#4[#5]#6#7 \acro_stop: - { - % no options: #1: ID, #2: key, #3 is blank - % 1 option: #1: ID, #4: key, #3: option, #5 is blank - % 2 options: #1: ID: #6: key, #3: first option, #5: second option - \tl_if_blank:nF { #2#4#6 } - { - \tl_if_empty:nTF { #3 } - { \__acro_declare_citation_aux:nnnn { #1 } { } { } { #2 } } - { - \tl_if_empty:nTF { #5 } - { \__acro_declare_citation_aux:nnnn { #1 } { #3 } { } { #4 } } - { \__acro_declare_citation_aux:nnnn { #1 } { #3 } { #5 } { #6 } } - } - } - } -\cs_generate_variant:Nn \__acro_declare_citation:nw { V } - -\cs_new_protected:Npn \__acro_declare_citation_aux:nnnn #1#2#3#4 - { - \__acro_key_check:nn { #1 } { cite } - \prop_put:Nnn \l__acro_citation_prop { #1 } { #4 } - \tl_if_empty:nF { #2 } - { \prop_put:Nnn \l__acro_citation_pre_prop { #1 } { #2 } } - \tl_if_empty:nF { #3 } - { \prop_put:Nnn \l__acro_citation_post_prop { #1 } { #3 } } - } - -% TODO: -% add index entries, by default \index{<sort>@<short>} -% index: overwrite default <sort>@<short> entry completely -% index-sort: overwrite the <sort> part of <sort>@<short> entry - -% need to take care of custom index cmd, at least -% - \index{} -% - \index[]{} -% question is, though, if it should be the same one for all acronyms? -% I go for yes but would also add a `post' key that allows to add arbitrary -% TeX code after an acronym is typeset - -% index: -\cs_new_protected:Npn \__acro_declare_index:nn #1#2 - { - \__acro_key_check:nn { #1 } { index } - \prop_put:Nnn \l__acro_index_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_index:nn { V } - -% index-sort: -\cs_new_protected:Npn \__acro_declare_index_sort:nn #1#2 - { - \__acro_key_check:nn { #1 } { index-sort } - \prop_put:Nnn \l__acro_index_sort_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_index_sort:nn { V } - -% index-cmd: -\cs_new_protected:Npn \__acro_declare_index_cmd:nn #1#2 - { - \__acro_key_check:nn { #1 } { index-cmd } - \prop_put:Nnn \l__acro_index_cmd_prop { #1 } { #2 } - } -\cs_generate_variant:Nn \__acro_declare_index_cmd:nn { V } - -% -------------------------------------------------------------------------- -% the keys of \DeclareAcronym -\keys_define:nn { acro / declare-acronym } - { - short .code:n = - \__acro_declare_short:Vn \l__acro_current_key_tl { #1 } , - short-plural .code:n = - \__acro_declare_short_plural:Vn \l__acro_current_key_tl { #1 } , -% short-plural-form .code:n = -% \__acro_declare_short_plural_form:Vn \l__acro_current_key_tl { #1 } , - alt .code:n = - \__acro_declare_alt:Vn \l__acro_current_key_tl { #1 } , - long .code:n = - \__acro_declare_long:Vn \l__acro_current_key_tl { #1 } , - long-plural .code:n = - \__acro_declare_long_plural:Vn \l__acro_current_key_tl { #1 } , - long-plural-form .code:n = - \__acro_declare_long_plural_form:Vn \l__acro_current_key_tl { #1 } , - list .code:n = - \__acro_declare_list:Vn \l__acro_current_key_tl { #1 } , - short-indefinite .code:n = - \__acro_declare_short_indefinite:Vn \l__acro_current_key_tl { #1 } , - alt-indefinite .code:n = - \__acro_declare_alt_indefinite:Vn \l__acro_current_key_tl { #1 } , - long-indefinite .code:n = - \__acro_declare_long_indefinite:Vn \l__acro_current_key_tl { #1 } , - long-pre .code:n = - \__acro_declare_long_pre:Vn \l__acro_current_key_tl { #1 } , - long-post .code:n = - \__acro_declare_long_post:Vn \l__acro_current_key_tl { #1 } , - sort .code:n = - \__acro_declare_sort:Vn \l__acro_current_key_tl { #1 } , - extra .code:n = - \__acro_declare_extra:Vn \l__acro_current_key_tl { #1 } , - foreign .code:n = - \__acro_declare_foreign:Vn \l__acro_current_key_tl { #1 } , - format .code:n = - \__acro_declare_format:Vn \l__acro_current_key_tl { #1 } , - short-format .code:n = - \__acro_declare_format:Vn \l__acro_current_key_tl { #1 } , - long-format .code:n = - \__acro_declare_long_format:Vn \l__acro_current_key_tl { #1 } , - first-long-format .code:n = - \__acro_declare_first_long_format:Vn \l__acro_current_key_tl { #1 } , - class .code:n = - \__acro_declare_class:Vn \l__acro_current_key_tl { #1 } , - cite .code:n = - \__acro_declare_citation:Vw \l__acro_current_key_tl #1 [][] \scan_stop: \acro_stop: , - pdfstring .code:n = - \__acro_declare_pdfstring:Vw \l__acro_current_key_tl #1 // \acro_stop: , - accsupp .code:n = - \__acro_declare_acc_supp:Vn \l__acro_current_key_tl { #1 } , - index .code:n = - \__acro_declare_index:Vn \l__acro_current_key_tl { #1 } , - index-sort .code:n = - \__acro_declare_index_sort:Vn \l__acro_current_key_tl { #1 } , - index-cmd .code:n = - \__acro_declare_index_cmd:Vn \l__acro_current_key_tl { #1 } - } - -\cs_new_protected:Npn \acro_define_acronym_macro:n #1 - { - \bool_if:NT \l__acro_create_macros_bool - { - \cs_if_exist:cTF { #1 } - { - \bool_if:NT \l__acro_strict_bool - { \cs_set:cpn { #1 } { \ac { #1 } \acro_xspace: } } - } - { \cs_new:cpn { #1 } { \ac { #1 } \acro_xspace: } } - } - } - -% -------------------------------------------------------------------------- -% internal acronym declaring function: -\cs_new_protected:Npn \acro_declare_acronym:nn #1#2 - { - \tl_set:Nn \l__acro_current_key_tl { #1 } - \keys_set:nn { acro / declare-acronym } { #2 } - \bool_new:c { g__acro_#1_first_use_bool } - \bool_new:c { g__acro_#1_used_bool } - \bool_new:c { g__acro_#1_label_bool } - \bool_new:c { g__acro_#1_in_list_bool } - \bool_if:NF \l__acro_print_only_used_bool - { \bool_gset_true:c { g__acro_#1_in_list_bool } } - \acro_create_page_records:n { #1 } - \acro_define_acronym_macro:n { #1 } - \tl_clear:N \l__acro_current_key_tl - \bool_if:cF { l__acro_#1_short_set_bool } - { \msg_error:nnxx { acro } { missing } { #1 } { short } } - \bool_if:cF { l__acro_#1_long_set_bool } - { \msg_error:nnxx { acro } { missing } { #1 } { long } } - } - -% -------------------------------------------------------------------------- -% the user command: -\NewDocumentCommand \DeclareAcronym { mm } - { \acro_declare_acronym:nn { #1 } { #2 } } -% \@onlypreamble\DeclareAcronym - -% -------------------------------------------------------------------------- -% print the list: -% #1: list of classes -% #2: list of excluded classes -\tl_new:N \l__acro_included_classes_tl -\tl_new:N \l__acro_excluded_classes_tl - -\cs_new_protected:Npn \acro_use_list_instance:nn #1#2 - { - \UseInstance { acro-list } { \l__acro_list_instance_tl } - { \l__acro_list_type_tl } { #1 } { #2 } - } -\cs_generate_variant:Nn \acro_use_list_instance:nn { VV } - -\keys_define:nn { acro / print-acronyms } - { - include-classes .tl_set:N = \l__acro_included_classes_tl , - exclude-classes .tl_set:N = \l__acro_excluded_classes_tl , - name .tl_set:N = \l__acro_list_name_tl , - header .code:n = - \acro_option_deprecated:nn { header } { heading } - \tl_set:Nn \l__acro_list_title_tl { #1 } , - heading .tl_set:N = \l__acro_list_title_tl , - sort .bool_set:N = \l__acro_sort_bool - } - -\cs_new_protected:Npn \acro_print_acronyms:n #1 - { - \group_begin: - % this is a cheap trick to prevent the \@noitemerr - % if one forgot to delete either the aux file or - % remove \printacronyms -- but it's local: - \cs_set:Npn \@noitemerr {} - \tl_clear:N \l__acro_included_classes_tl - \tl_clear:N \l__acro_excluded_classes_tl - \keys_set:nn { acro / print-acronyms } { #1 } - \iow_now:Nx \@auxout { \string \acro@print@list } - \bool_if:NT \l__acro_sort_bool - { \acro_sort_prop:N \l__acro_short_prop } - \UseInstance { acro-title } { \l__acro_list_title_tl } - { \l__acro_list_name_tl } - \cs_if_exist:NTF \acro@printed@list - { - \acro_use_list_instance:VV - \l__acro_included_classes_tl - \l__acro_excluded_classes_tl - } - { \@latex@warning@no@line {Rerun~to~get~acronym~list~right} } - \group_end: - } - -\NewDocumentCommand \printacronyms { O{} } - { \acro_print_acronyms:n { #1 } } -\tex_endinput:D |