From 4fcdfd743d454f1b328b14013b8ea93d82003568 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 6 Oct 2019 20:06:58 +0000 Subject: acro (6oct19) git-svn-id: svn://tug.org/texlive/trunk@52303 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/acro/acro.sty | 313 +++++------------------------- 1 file changed, 45 insertions(+), 268 deletions(-) (limited to 'Master/texmf-dist/tex/latex/acro') diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty index b1b49470183..d5e477a0f48 100644 --- a/Master/texmf-dist/tex/latex/acro/acro.sty +++ b/Master/texmf-dist/tex/latex/acro/acro.sty @@ -23,7 +23,7 @@ % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- % The acro package consists of the files -% - acro.sty, acro_en.tex, acro_en.pdf, README +% - acro.sty, acro_en.tex, acro_en.pdf, acro.history, README % -------------------------------------------------------------------------- % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. @@ -31,8 +31,8 @@ \RequirePackage{expl3,xparse,l3keys2e,xtemplate,etoolbox} \ProvidesExplPackage {acro} - {2019/10/02} - {2.10a} + {2019/10/06} + {2.10b} {Typeset Acronyms} % -------------------------------------------------------------------------- @@ -583,7 +583,7 @@ \cs_set_eq:NN \__acro_first_upper_case:n #1 , uc-cmd .value_required:n = true , uppercase-short .bool_set:N = \l__acro_upper_short_bool , - uppercase-short .initial:n = false + uppercase-short .initial:n = true } \AtBeginDocument @@ -741,6 +741,7 @@ \l__acro_first_only_short_bool } { + \acro_soft_upper: \acro_write_indefinite:nn {#2} {short} \acro_write_compact:nn {#2} {short} } @@ -792,7 +793,12 @@ \l__acro_first_only_long_bool || !\l__acro_first_only_short_bool } - { \acro_write_expanded:nnn {#2} {first-long} {#3} } + { + \group_begin: + \bool_set_false:N \l__acro_first_upper_bool + \acro_write_expanded:nnn {#2} {first-long} {#3} + \group_end: + } } {short} { \bool_if:nT @@ -800,7 +806,12 @@ !\l__acro_first_only_long_bool || \l__acro_first_only_short_bool } - { \acro_write_compact:nn {#2} {short} } + { + \group_begin: + \bool_set_false:N \l__acro_first_upper_bool + \acro_write_compact:nn {#2} {short} + \group_end: + } } } } @@ -886,10 +897,7 @@ \__acro_open_bracket: \__acro_print_foreign:n {#1} \__acro_foreign_sep:n {#1} - { - \bool_set_false:N \l__acro_first_upper_bool - \__acro_print_form:nnn {long} {#1} {#2} - } + \__acro_print_form:nnn {long} {#1} {#2} \__acro_print_citation:n {#1} \__acro_close_bracket: \__acro_finalize_first:n {#1} @@ -899,10 +907,7 @@ \__acro_open_bracket: \__acro_print_foreign:n {#1} \__acro_foreign_sep:n {#1} - { - \bool_set_false:N \l__acro_first_upper_bool - \__acro_print_form:nnn {short} {#1} {#2} - } + \__acro_print_form:nnn {short} {#1} {#2} \__acro_print_citation:n {#1} \__acro_close_bracket: \__acro_finalize_first:n {#1} @@ -1833,13 +1838,20 @@ % -------------------------------------------------------------------------- % automatic typesetting, the internals of \ac: % #1: id - + +\cs_new_protected:Npn \acro_soft_upper: + { + \bool_if:NF \l__acro_upper_short_bool + { \bool_set_false:N \l__acro_first_upper_bool } + } + \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_soft_upper: % this is not the first time \acro_write_indefinite:nn {#1} {short} \acro_write_compact:nn {#1} {short} @@ -1905,6 +1917,7 @@ } } { % other (e.g. short) + \acro_soft_upper: \tl_if_blank:VF \l__acro_single_tl { \tl_set_eq:cN {l__acro_#2_tl} \l__acro_single_tl } \tl_if_blank:VF \l__acro_single_format_tl @@ -2085,7 +2098,8 @@ { \acro_if_ending_form_exist:nnT {#1} {#3} { - \bool_if:nTF { \prop_item:cn {l__acro_#3_#1_form_prop} {#2} } + \bool_if:cTF + { c_ \prop_item:cn {l__acro_#3_#1_form_prop} {#2} _bool } { \prop_get:cnc {l__acro_#3_#1_prop} {#2} {l__acro_#3_tl} } { \prop_get:cnc {l__acro_#3_#1_prop} {#2} {l__acro_#3_#1_tl} } } @@ -2107,7 +2121,7 @@ { \bool_if:nT { - \prop_item:cn {l__acro_#2_##1_form_prop} {#1} + \use:c { c_ \prop_item:cn {l__acro_#2_##1_form_prop} {#1} _bool } && \use:c {l__acro_##1_bool} } @@ -2233,7 +2247,7 @@ % short-: \acro_declare_property:nnn {short_#1} {short-#1} { - \prop_put:cnn {l__acro_short_#1_form_prop} {##1} { \c_false_bool } + \prop_put:cnn {l__acro_short_#1_form_prop} {##1} {false} \prop_put:cnx {l__acro_pdfstring_short_#1_prop} {##1} { \prop_item:Nn \l__acro_short_prop {##1} \exp_not:n {##2} } } @@ -2241,14 +2255,14 @@ \acro_declare_property_generic:nnn {short_#1_form} {short-#1-form} { \__acro_property_check:nn {##1} {short-#1-form} - \prop_put:cnn {l__acro_short_#1_form_prop} {##1} { \c_true_bool } + \prop_put:cnn {l__acro_short_#1_form_prop} {##1} {true} \prop_put:cnn {l__acro_short_#1_prop} {##1} {##2} \prop_put:cnn {l__acro_pdfstring_short_#1_prop} {##1} {##2} } % alt-: \acro_declare_property:nnn {alt_#1} {alt-#1} { - \prop_put:cnn {l__acro_alt_#1_form_prop} {##1} { \c_false_bool } + \prop_put:cnn {l__acro_alt_#1_form_prop} {##1} {false} \prop_put:cnx {l__acro_pdfstring_alt_#1_prop} {##1} { \prop_item:Nn \l__acro_alt_prop {##1} \exp_not:n {##2} } } @@ -2256,28 +2270,28 @@ \acro_declare_property_generic:nnn {alt_#1_form} {alt-#1-form} { \__acro_property_check:nn {##1} {alt-#1-form} - \prop_put:cnn {l__acro_alt_#1_form_prop} {##1} { \c_true_bool } + \prop_put:cnn {l__acro_alt_#1_form_prop} {##1} {true} \prop_put:cnn {l__acro_alt_#1_prop} {##1} {##2} \prop_put:cnn {l__acro_pdfstring_alt_#1_prop} {##1} {##2} } % long-: \acro_declare_property:nnn {long_#1} {long-#1} - { \prop_put:cnn {l__acro_long_#1_form_prop} {##1} { \c_false_bool } } + { \prop_put:cnn {l__acro_long_#1_form_prop} {##1} {false} } % long--form: \acro_declare_property_generic:nnn {long_#1_form} {long-#1-form} { \__acro_property_check:nn {##1} {long-#1-form} - \prop_put:cnn {l__acro_long_#1_form_prop} {##1} { \c_true_bool } + \prop_put:cnn {l__acro_long_#1_form_prop} {##1} {true} \prop_put:cnn {l__acro_long_#1_prop} {##1} {##2} } % foreign-: % XXX \acro_declare_property:nnn {foreign_#1} {foreign-#1} - { \prop_put:cnn {l__acro_foreign_#1_form_prop} {##1} { \c_false_bool } } + { \prop_put:cnn {l__acro_foreign_#1_form_prop} {##1} {false} } % foreign--form: % XXX \acro_declare_property_generic:nnn {foreign_#1_form} {foreign-#1-form} { \__acro_property_check:nn {##1} {foreign-#1-form} - \prop_put:cnn {l__acro_foreign_#1_form_prop} {##1} { \c_true_bool } + \prop_put:cnn {l__acro_foreign_#1_form_prop} {##1} {true} \prop_put:cnn {l__acro_foreign_#1_prop} {##1} {##2} } % options: @@ -2365,7 +2379,7 @@ \tl_if_blank:nTF {#4} { \acro_set_ending_variables:nnn {long} {#1} {#3} - \acro_set_ending_variables:nnn {foreign} {#1} {#3} % XXX + \acro_set_ending_variables:nnn {foreign} {#1} {#3} } { \acro_set_ending_variables:nnn {long} {#1} {#2} @@ -2550,7 +2564,7 @@ \__acro_typeset:nn {short} { \bool_if:nTF - { \l__acro_first_upper_bool && \l__acro_upper_short_bool } + { \l__acro_first_upper_bool } { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } } { \exp_not:n {#2} } } @@ -3702,12 +3716,12 @@ {#1} {l__acro_default_short_##1_tl} \prop_put:cnx {l__acro_pdfstring_short_##1_prop} {#1} { \exp_not:n {#2} \exp_not:v {l__acro_default_short_##1_tl} } - \prop_put:cnn {l__acro_short_##1_form_prop} {#1} { \c_false_bool } + \prop_put:cnn {l__acro_short_##1_form_prop} {#1} {false} \prop_put:cnv {l__acro_alt_##1_prop} {#1} {l__acro_default_alt_##1_tl} \prop_put:cnx {l__acro_pdfstring_alt_##1_prop} {#1} { \exp_not:n {#2} \exp_not:v {l__acro_default_short_##1_tl} } - \prop_put:cnn {l__acro_alt_##1_form_prop} {#1} { \c_false_bool } + \prop_put:cnn {l__acro_alt_##1_form_prop} {#1} {false} } \prop_put:NnV \l__acro_short_indefinite_prop {#1} \l__acro_default_indefinite_tl @@ -3723,10 +3737,10 @@ \l__acro_default_indefinite_tl \acro_for_endings_do:n { - \prop_put:cnn {l__acro_long_##1_form_prop} {#1} { \c_false_bool } + \prop_put:cnn {l__acro_long_##1_form_prop} {#1} {false} \bool_if:cF {l__acro_#1_long-##1_set_bool} { \prop_put:cnv {l__acro_long_##1_prop} {#1} {l__acro_default_long_##1_tl} } - \prop_put:cnn {l__acro_foreign_##1_form_prop} {#1} { \c_false_bool } + \prop_put:cnn {l__acro_foreign_##1_form_prop} {#1} {false} \bool_if:cF {l__acro_#1_foreign-##1_set_bool} { \prop_put:cnv {l__acro_foreign_##1_prop} {#1} {l__acro_default_foreign_##1_tl} } } @@ -4546,240 +4560,3 @@ } \file_input_stop: -% -------------------------------------------------------------------------- -% HISTORY: -2012/06/22 v0.1 - first public release -2012/06/23 v0.1a - bug fix, added `strict' and `macros' option and creation of - shortcut macros - - added capitalized version of long forms - - added `sort' option -2012/06/24 v0.1b - added \Acf and \Acfp, added option `plural-ending' -2012/06/24 v0.1c - added excluded argument to \printacronyms -2012/06/24 v0.2 - renamed \NewAcronym => \DeclareAcronym - \AcronymFormat => \DeclareAcronymFormat -2012/06/25 v0.2a - new first-style's: `short' and `reversed' -2012/06/25 v0.3 - new list formats: extra-tabular, extra-longtable, - extra-tabular-rev, extra-longtable-rev - - extra precaution when using \printacronyms to avoid errors. -2012/06/27 v0.3a - new option `list-caps', \Acp added -2012/06/29 v0.3b - extended the `text' template to the `acro-first' object - - added `acro-first' instances `plain' and `plain-reversed' -2012/07/16 v0.3c - small adjustments to the documentation -2012/07/23 v0.3d - first CTAN version -2012/07/24 v0.3e - adapted to updated l3kernel -2012/09/28 v0.4 - added means to add citations to acronyms -2012/10/07 v0.4a - new options: "uc-cmd", "list-long-format" - - preliminary language support, needs package `translations' -2012/11/30 v0.5 - added starred variants of the commands that won't mark an - acronym as used - - added \acreset{} - - added preliminary support for pdf strings: in pdf strings - always the singular lowercase short version is inserted - (the equivalent of \acs) -2012/12/14 v0.6 - bug with not-colored links resolved - - bug introduced with the last update (full expansion of the - short entry) resolved - - option `xspace' added -2013/01/02 v0.6a - \acuseall -2013/01/16 v1.0 - new syntax of \DeclareAcronym - - new option `version' - - new `accsupp' acronym property - - new `sort' acronym property - - new syntax of \printacronyms - - new default: `sort=true' - - new options `page-ranges', `next-page', `next-pages', - `pages-name', `record-pages' - - no automatic label placement for page number referencing - any more -2013/01/26 v1.1 - bug fix in the plural detection - - new keys `long-pre' and `long-post' - - new keys `index', `index-sort' and `index-cmd' - - new options `index' and `index-cmd' -2013/01/29 v1.1a - added `long-format' key - - renamed `format' key into `short-format', kept `format' for - compatibility reasons -2013/02/09 v1.2 - error message instead of hanging when an undefined acronym - is used - - added `first-long-format' key and `first-long-format' option - - added \acflike and \acfplike - - improvements and bug fixes to the page recording mechanism - - new option `mark-as-used' - - new keys: `short-indefinite', `alt-indefinite' and - `long-indefinite' - - new commands: \iac, \Iac, \iacs, \Iacs, \iaca, \Iaca, \iacl, - \Iacl, \iacf, \Iacf, \iacflike and \Iacflike -2013/04/04 v1.2a - added Portuguese translations -2013/05/06 v1.3 - protected internal commands where appropriate - - new option `sort' to \printacronyms - - renamed options `print-acronyms/header' and `list-header' - into `print-acronyms/heading' and `list-heading' - - fix: added missing group to \printacronyms - - add key `foreign' - - rewritten page-recording: - * most importantly: record them at shipout; this is done - when \acro@used@once or \acro@used@twice are written to - the aux file - * no restrictions regarding \pagenumbering - * options `page-ranges' and `record-pages' are deprecated - * new options `following-page' and `following-pages' - - disable \@noitemerr in the list of acronyms: we don't need - it there but there are occasions when it is annoying - - cleaned the sty file, added a few more comments -2013/05/09 v1.3a - Bug fix: corrected wrong argument checking in \Ac, thanks - to Michel Voßkuhle -2013/05/30 v1.3b - obey \if@filesw -2013/06/16 v1.3c - added \leavevmode to \acro_get:n -2013/07/08 v1.3d - corrected wrong call of \leavevmode in the list - (list-type=list) -2013/08/07 v1.3e - bug fix in the list when testing for used acronyms - - new commands \acifused, \acfirstupper -2013/08/27 v1.4 - new property `list' -2013/09/02 v1.4a - bug fix: used acronyms are added to the list when the list - is printed before the use - - \DeclareAcronym may now be used after \begin{document} -2013/09/24 v1.4b - bug fix: only-used=false works again for only declared but - unused acronyms (only if option single is not used) -2013/11/04 v1.4c - remove \hbox from the written short form - - changed \__acro_make_link:nNN in a way that it doesn't box - its when links are deactivated -2013/11/22 v1.4d - require `l3sort' independently from the `sort' option - instead of at begin document in order to avoid conflicts - with `babel' and `french' -2013/12/18 v1.5 - new option `label=true|false' that - places \label{:} the first time an acronym is - used - - 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 -2015/04/08 v1.6a - more generalized user command definitions, see - http://tex.stackexchange.com/q/236362/ for an application -2015/05/10 v1.6b - \ProcessKeysPackageOptions , - - correct bug http://tex.stackexchange.com/q/236860/ : - option `pages = first' works again -2015/08/16 v2.0 - fix https://bitbucket.org/cgnieder/acro/issue/36 - - implement https://bitbucket.org/cgnieder/acro/issue/39 - - implement https://bitbucket.org/cgnieder/acro/issue/40 - (=> new option `group-cite-cmd') - - add ideas for https://bitbucket.org/cgnieder/acro/issue/41 - - implement https://bitbucket.org/cgnieder/acro/issue/18 - - implement https://bitbucket.org/cgnieder/acro/issue/43 - - further generalization for defining user commands: - \NewAcroCommand, \NewPseudoAcroCommand and siblings - - bug fix in indefinite versions with first-upper - - add `short--form' equivalent to - `long--form' - (https://bitbucket.org/cgnieder/acro/issue/44) - - implement https://bitbucket.org/cgnieder/acro/issue/35 - - new option `single-form' -2015/08/25 v2.0a - fix https://bitbucket.org/cgnieder/acro/issue/38 and - https://bitbucket.org/cgnieder/acro/issue/49 -2015/08/29 v2.0b - fix https://bitbucket.org/cgnieder/acro/issue/44 - - fix https://bitbucket.org/cgnieder/acro/issue/45 - - implement https://bitbucket.org/cgnieder/acro/issue/42 -2015/09/05 v2.1 - add list object type `list-of' that prints the list like a - toc or lof, new option `list-short-width', - - correct bug in the `plain' extra style - - implemented `tooltip' property - - remove \tl_to_lowercase:n -2015/10/03 v2.2 - fix https://bitbucket.org/cgnieder/acro/issue/52 - - fix typo in `list-of' object - - \DeclareAcroListStyle - - \DeclareAcroListHeading - - input `acro.cfg' if present - - all acro commands have an optional argument: \ac*[]{} -2016/01/07 v2.2a - \prop_get:Nn => \prop_item:Nn -2016/01/21 v2.2b - fix issue #59 -2016/02/02 v2.2c - fix issue #60 -2016/03/14 v2.3 - foreign-format may be a macro taking an argument - - \Aca, \Acsingle - - properties `single' and `single-format', option - `single-format' => issue #62 - - property `first-style' => issue #61 - - fix issue #64: long-post entry is now added *after* the - endings - - property `foreign-lang' - - fix issue #65 -2016/03/25 v2.4 - extend class mechanism: classes can be used like tags - - add idea of `barriers' and list local to those barriers - => new option `reset-at-barriers' - => new option `local-to-barriers' for \printacronyms - => new command \acbarrier -2016/04/14 v2.4a - if undefined acronym is used and `messages = silent' is - active don't through error -2016/05/03 v2.4b - expand `pdfstring' property before saving => issue #69 - - \ProvideAcroEnding can be used twice – it then just sets - the defaults - - the option -ending has a new syntax: - * -ending = sets all endings to - * -ending = / sets short endings to - and long endings to - - a single appearance should be treated like a first - appearance as far as citations are concerned -2016/05/25 v2.5 - some of the entries added to the aux file need to be - written \immediate in order to avoid this trap: - http://tex.stackexchange.com/q/116001/ - - cleaner interface for first-style template definitions - - new `acro-first' instances `footnote-reversed' and - `sidenote-reversed' - - new commands \DeclareAcroFirstStyle, \DeclareAcroExtraStyle - and \DeclareAcroPageStyle - - add warning `ending-before-acronyms' to options setting the - defaults of an ending; this should avoid confusion - - property declaration for acronyms should be handled by - internal functions - - improvements in the list template code - - logging info when an acronym is declared - - remove deprecated options - - new option `use-barriers' - - new option `following-pages*' - - option `page-ref' replaced by option `page-style' -2016/05/26 v2.5a - bug fix: remove erroneous group in `-ending' option -2016/05/30 v2.5b - fix issue #72 -2016/07/20 v2.6 - \l__acro_use_acronyms_bool can be used to disable \ac - e.g. in the trial phase of a table like `tabu'; interface: - \acro_switch_off: and \acswitchoff - - fix issue #79 - - fix issue #74 - - fix error: acronyms with same sort entry are not - overwritten any more in the list of acronyms -2016/08/13 v2.6a - fix issues #80 and #81 -2016/08/13 v2.6b - version stepped by accident -2016/08/16 v2.6c - really fixes issue #81 -2016/08/30 v2.6d - fix issue #82 -2016/09/04 v2.6e - fix issue in http://tex.stackexchange.com/q/270034/ -2017/01/22 v2.7 - rename \acro_get_property:nn into \__acro_get_property:nn - - \acro_get_property:nn, \acro_get_property:nnTF, - \acro_if_property:nnTF, retrieve property without error if - not set - - make \__acro_declare_property functions public - - \acro_add_action:n (adds code to \acro_get:n) -2017/02/09 v2.7a - adapt to integration of l3sort into l3kernel -2017/06/21 v2.7b - fix issue #93 -2017/08/28 v2.7c - fix issue #96 -2018/01/30 v2.8 - fix issue #94 - - document `format-include-endings', fix issue #99 - - new property `post' - - \aciffirst - - resolve issue #95 -2019/02/17 v2.9 - small redefinition of \acro_get_foreign:n which allows - `foreign-sep' to be a & - - fix issue #116 - - implemented issue #112 -2019/09/23 v2.10 - fix issue #120 - - fix isuue #128 - - fix issue #129 - - fix issue #131 - - new: \Acs \Acsp \Aca \Acap - - new: `alt-format' - - new: `uppercase-short' - - a change to how usage is determined (see def. of - \acro_is_used:nTF) -2019/10/02 v2.10 - fix newly introduced issue #135 -- cgit v1.2.3