diff options
author | Karl Berry <karl@freefriends.org> | 2019-09-24 20:06:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-09-24 20:06:00 +0000 |
commit | b932b40952f8a44a92f75a5c8a4fd0e6ee763a7a (patch) | |
tree | a1d3afb4b264c3edb52df67f3d8852af19d8a543 | |
parent | 45684d5bf92989769a95867aad2b7fcc669374fc (diff) |
acro (24sep19)
git-svn-id: svn://tug.org/texlive/trunk@52170 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/acro/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/acro/acro_en.pdf | bin | 567835 -> 563627 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/acro/acro_en.tex | 57 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/acro/acro.sty | 280 |
4 files changed, 228 insertions, 113 deletions
diff --git a/Master/texmf-dist/doc/latex/acro/README b/Master/texmf-dist/doc/latex/acro/README index 89f9d59cdf2..c9a69ddaee1 100644 --- a/Master/texmf-dist/doc/latex/acro/README +++ b/Master/texmf-dist/doc/latex/acro/README @@ -1,9 +1,9 @@ -------------------------------------------------------------------------- -the ACRO package v2.9 +the ACRO package v2.10 Typeset Acronyms -2019/02/17 +2019/09/23 -------------------------------------------------------------------------- Clemens Niederberger Web: https://bitbucket.org/cgnieder/acro diff --git a/Master/texmf-dist/doc/latex/acro/acro_en.pdf b/Master/texmf-dist/doc/latex/acro/acro_en.pdf Binary files differindex a0cd8ab700d..e816f76124a 100644 --- a/Master/texmf-dist/doc/latex/acro/acro_en.pdf +++ b/Master/texmf-dist/doc/latex/acro/acro_en.pdf diff --git a/Master/texmf-dist/doc/latex/acro/acro_en.tex b/Master/texmf-dist/doc/latex/acro/acro_en.tex index ad807a43d01..c7caf4b7bc9 100644 --- a/Master/texmf-dist/doc/latex/acro/acro_en.tex +++ b/Master/texmf-dist/doc/latex/acro/acro_en.tex @@ -1,8 +1,8 @@ -% !arara: pdflatex: { action: nonstopmode } +% arara: pdflatex: { action: nonstopmode } % !arara: biber % !arara: pdflatex: { action: nonstopmode } -% arara: pdflatex: { action: nonstopmode } -% arara: pdflatex: { action: nonstopmode } +% !arara: pdflatex: { action: nonstopmode } +% !arara: pdflatex: { action: nonstopmode } % -------------------------------------------------------------------------- % the ACRO package % @@ -322,7 +322,7 @@ documentation. \keyval{foreign-plural}{text}\Default{s} The\sinceversion{2.9} plural ending appended to the foreign form. %% foreign-plural-form - \keyval{long-plural-form}{text} + \keyval{foreign-plural-form}{text} Plural\sinceversion{2.9} lforeign form of the acronym; replaces the foreign form when used instead of appending the plural ending. %% list @@ -390,6 +390,10 @@ documentation. %% long-format \keyval{long-format}{\TeX{} code} The format used for the long form of the acronym. + %% short-format + \keyval{alt-format}{\TeX{} code} + The\sinceversion{2.10} format used for the alternative form of the + acronym. If this is not given the short format will be used. %% first-long-format \keyval{first-long-format}{\TeX{} code} The format used for the first long form of the acronym as set with \cs{ac}, @@ -521,36 +525,54 @@ This is an example of the logging info with \keyis{log}{true} or \subsection{Using the Acronyms -- the Commands}\label{sec:using-acronyms-comm} Acronyms are used with one of the following commands: \begin{commands} + %% \command{ac}[\sarg\marg{id}] basic command; the first output is different from subsequent ones. \command{Ac}[\sarg\marg{id}] - same as \cs{ac} but capitalizes the first letter of the long form. + same as \cs{ac} but capitalizes the first letter. + %% \command{acs}[\sarg\marg{id}] \h{s}hort form; the actual acronym. + \command{Acs}[\sarg\marg{id}] + same\sinceversion{2.10} as \cs{acs} but capitalizes the first letter. + %% \command{acl}[\sarg\marg{id}] \h{l}ong form; the meaning of the acronym. \command{Acl}[\sarg\marg{id}] same as \cs{acl} but capitalizes first letter. + %% \command{aca}[\sarg\marg{id}] \h{a}lternative short form as specified in the \option{alt} key of \cs{DeclareAcronym}; if it hasn't been specified this is identical to \cs{acs}. + \command{Aca}[\sarg\marg{id}] + same\sinceversion{2.10} as \cs{aca} but capitalizes the first letter. + %% \command{acf}[\sarg\marg{id}] first form; output like the first time \cs{ac} is output. \command{Acf}[\sarg\marg{id}] - same as \cs{acf} but capitalizes first letter of the long form. + same as \cs{acf} but capitalizes first letter. + %% \command{acp}[\sarg\marg{id}] \h{p}lural form of \cs{ac}; \command{Acp}[\sarg\marg{id}] - same as \cs{acp} but capitalizes first letter of the long form. + same as \cs{acp} but capitalizes first letter. + %% \command{acsp}[\sarg\marg{id}] plural form of \cs{acs}; + \command{Acsp}[\sarg\marg{id}] + same\sinceversion{2.10} as \cs{acsp} but capitalizes the first letter. + %% \command{aclp}[\sarg\marg{id}] plural form of \cs{acl}; \command{Aclp}[\sarg\marg{id}] same as \cs{aclp} but capitalizes first letter. + %% \command{acap}[\sarg\marg{id}] plural form of \cs{aca}; + \command{Acap}[\sarg\marg{id}] + same\sinceversion{2.10} as \cs{acap} but capitalizes the first letter. + %% \command{acfp}[\sarg\marg{id}] plural form of \cs{acf}; \command{Acfp}[\sarg\marg{id}] @@ -1104,10 +1126,16 @@ There are a few options which change the general behaviour of \acro. then already existing macros will be overwritten. %% \keybool{sort}\Default{true} - If set to \code{true} the acronym list will be sorted automatically. The + If set to \code{true} the acronym list will be sorted alphabetically. The entries are sorted by their \acs{id} ignoring upper and lower case. This option needs the experimental package \pkg{l3sort} (from the \pkg{l3experimental} bundle) and can only be set in the preamble. + If set to \code{false} the acronyms are listed in order of their + declaration. + %% + \keybool{display-foreign}\Default{true} + When set to \code{false} any \option{foreign} option is ignored and + foreign forms are not displayed. %% \keychoice{cite}{\default{all},first,none}\Default{first} \changedversion{2.4b}This option decides whether citations that are added @@ -1167,15 +1195,20 @@ There are a few options which change the general behaviour of \acro. the like commands. You can change it to another one like for example \cs*{makefirstuc}\footnote{from the \pkg{mfirstuc} package} or \cs*{MakeTextUppercase}\footnote{from the \pkg*{textcase} package}. + %% + \keybool{uppercase-short}\Default{false} + If\sinceversion{2.10} set to \code{true} commands like \cs{Ac}, \cs{Acs} or + \cs{Aca} will uppercase the first letter of the short or alternative + version. \end{options} -All options of this and the following sections can be set up either as package -options or via the setup command: +All options of this and the following sections can be set via the setup command: \begin{commands} \command{acsetup}[\marg{options}] Set up \acro\ anywhere in the document. Or separate package loading from setup. \end{commands} +They might work as package options as well but \emph{I do not recommend it}. \begin{example} % with \acsetup{macros} @@ -1660,6 +1693,9 @@ commands\footnote{Which is why you need to use them inside an expl3 \command*{acro_add_action:n}[ \marg{code}] Adds\sinceversion{2.7} code to \cs*{acro_get:n}. Inside of \meta{code} you can refer to the \ac{id} of the acronym with \verbcode+#1+. + The \cs*{acro_get:n} command is called the first macro that is called by + \cs*{acro_use:n} which for example enables conditionals to test for + certain acronym properties. \command*{acro_get_property:nn}[\TF\ \marg{id} \marg{property} \marg{true} \marg{false}] Fetches\sinceversion{2.7} the property \meta{property} of the acronym @@ -2129,4 +2165,3 @@ letter (category code~11). \printacronyms \end{document} - diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty index 21f721615e9..2b5cde75b30 100644 --- a/Master/texmf-dist/tex/latex/acro/acro.sty +++ b/Master/texmf-dist/tex/latex/acro/acro.sty @@ -31,8 +31,8 @@ \RequirePackage{expl3,xparse,l3keys2e,xtemplate,etoolbox} \ProvidesExplPackage {acro} - {2019/02/17} - {2.9} + {2019/09/23} + {2.10} {Typeset Acronyms} % -------------------------------------------------------------------------- @@ -310,11 +310,13 @@ \bool_new:N \l__acro_hyperref_loaded_bool \bool_new:N \l__acro_use_hyperref_bool \bool_new:N \l__acro_xspace_bool -\bool_new:N \l__acro_custom_format_bool +\bool_new:N \l__acro_custom_short_format_bool +\bool_new:N \l__acro_custom_alt_format_bool \bool_new:N \l__acro_custom_long_format_bool \bool_new:N \l__acro_strict_bool \bool_new:N \l__acro_create_macros_bool \bool_new:N \l__acro_first_upper_bool +\bool_new:N \l__acro_upper_short_bool \bool_new:N \l__acro_indefinite_bool \bool_new:N \l__acro_upper_indefinite_bool \bool_new:N \l__acro_foreign_bool @@ -377,7 +379,7 @@ \tl_new:N \l__acro_list_name_tl \tl_new:N \l__acro_list_before_tl \tl_new:N \l__acro_list_after_tl -\tl_new:N \l__acro_custom_format_tl +\tl_new:N \l__acro_custom_short_format_tl \tl_new:N \l__acro_first_between_tl \tl_new:N \l__acro_citation_connect_tl \tl_new:N \l__acro_between_group_connect_citation_tl @@ -470,6 +472,8 @@ \tl_set_eq:NN \l__acro_alt_format_tl \l__acro_short_format_tl \tl_set:Nn \l__acro_list_short_format_tl {#1} , short-format .value_required:n = true , + alt-format .code:n = + \tl_set:Nn \l__acro_alt_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} @@ -574,7 +578,9 @@ index-cmd .value_required:n = true , uc-cmd .code:n = \cs_set_eq:NN \__acro_first_upper_case:n #1 , - uc-cmd .value_required:n = true + uc-cmd .value_required:n = true , + uppercase-short .bool_set:N = \l__acro_upper_short_bool , + uppercase-short .initial:n = false } \AtBeginDocument @@ -811,15 +817,18 @@ % #1: id \cs_new_protected:Npn \__acro_print_foreign:n #1 { - \bool_if:nT - { - \l__acro_foreign_bool && - !\l__acro_first_only_short_bool && - !\l__acro_first_only_long_bool - } + \acro_if_foreign:nT {#1} { - \acro_write_foreign:n {#1} - \acro_endings:nn {#1} {foreign} + \bool_if:nT + { + \l__acro_foreign_bool && + !\l__acro_first_only_short_bool && + !\l__acro_first_only_long_bool + } + { + \acro_write_foreign:n {#1} + \acro_endings:nn {#1} {foreign} + } } } @@ -874,7 +883,10 @@ \__acro_open_bracket: \__acro_print_foreign:n {#1} \__acro_foreign_sep:n {#1} - \__acro_print_form:nnn {long} {#1} {#2} + { + \bool_set_false:N \l__acro_first_upper_bool + \__acro_print_form:nnn {long} {#1} {#2} + } \__acro_print_citation:n {#1} \__acro_close_bracket: \__acro_finalize_first:n {#1} @@ -884,7 +896,10 @@ \__acro_open_bracket: \__acro_print_foreign:n {#1} \__acro_foreign_sep:n {#1} - \__acro_print_form:nnn {short} {#1} {#2} + { + \bool_set_false:N \l__acro_first_upper_bool + \__acro_print_form:nnn {short} {#1} {#2} + } \__acro_print_citation:n {#1} \__acro_close_bracket: \__acro_finalize_first:n {#1} @@ -1394,11 +1409,8 @@ \acro_acc_supp:nn {#1} { - \acro_write_short:nn {#1} - { - \l__acro_list_short_format_tl - { \__acro_get_property:nn {short} {#1} } - } + \l__acro_list_short_format_tl + \__acro_get_property:nn {short} {#1} } } } @@ -1528,18 +1540,20 @@ \tl_clear:N #1 \acro_for_all_acronyms_do:n {% ##1: id; ##2: short form - \acro_get:n {##1} - \acro_if_entry:nnnT {##1} {#2} {#3} - { - \tl_put_right:Nn #1 - { - \acro_print_list_entry:nnnn - { \acro_list_entry:nn {short} {##1} } - { \acro_list_entry:nn {long} {##1} } - { \acro_list_entry:nn {extra} {##1} } - { \acro_list_entry:nn {page} {##1} } - } - } + \group_begin: + \acro_get:n {##1} + \acro_if_entry:nnnT {##1} {#2} {#3} + { + \tl_gput_right:Nn #1 + { + \acro_print_list_entry:nnnn + { \acro_list_entry:nn {short} {##1} } + { \acro_list_entry:nn {long} {##1} } + { \acro_list_entry:nn {extra} {##1} } + { \acro_list_entry:nn {page} {##1} } + } + } + \group_end: } } @@ -1982,7 +1996,7 @@ \prop_get:NnNF \l__acro_short_prop {#1} \l__acro_tmpa_tl {} \__acro_make_link:NnV \l__acro_short_tl {#1} \l__acro_tmpa_tl % \acro_get_property:nn {#1} {short-format} - % alt: + % alt: \prop_get:NnNTF \l__acro_alt_prop {#1} \l__acro_tmpa_tl { \__acro_make_link:NnV \l__acro_alt_tl {#1} \l__acro_tmpa_tl } { \tl_set_eq:NN \l__acro_alt_tl \l__acro_short_tl } @@ -2007,9 +2021,12 @@ { \bool_set_true:N \l__acro_custom_long_format_bool } { \bool_set_false:N \l__acro_custom_long_format_bool } \acro_get_property:nn {#1} {first-long-format} - \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 } + \prop_get:NnNTF \l__acro_format_prop {#1} \l__acro_custom_short_format_tl + { \bool_set_true:N \l__acro_custom_short_format_bool } + { \bool_set_false:N \l__acro_custom_short_format_bool } + \prop_get:NnNTF \l__acro_alt_format_prop {#1} \l__acro_custom_alt_format_tl + { \bool_set_true:N \l__acro_custom_alt_format_bool } + { \bool_set_false:N \l__acro_custom_alt_format_bool } \acro_get_property:nn {#1} {single-format} \acro_for_endings_do:n { @@ -2104,31 +2121,50 @@ \cs_new_protected:Npn \__acro_endings:nn #1#2 { - \bool_if:NTF \l__acro_include_endings_format_bool + \acro_for_endings_do:n { - \str_if_eq:nnTF {long} {#2} - { - \bool_if:NTF \l__acro_custom_long_format_bool - { \l__acro_custom_long_format_tl } - { \tl_use:c {l__acro_#2_format_tl} } - } - { - \bool_if:NTF \l__acro_custom_format_bool - { \l__acro_custom_format_tl } - { \tl_use:c {l__acro_#2_format_tl} } - } + \__acro_set_ending_for:nnn {##1} {#1} {#2} + \bool_if:cT {l__acro_##1_bool} + { \__acro_ending_format:nn {#2} { \tl_use:c {l__acro_#2_##1_tl} } } } - { \use:n } + } + +% #1: long|short|alt +% #2: string +\cs_new_protected:Npn \__acro_ending_format:nn #1#2 + { + \bool_if:NTF \l__acro_include_endings_format_bool { - \acro_for_endings_do:n + \str_case:nn {#1} { - \__acro_set_ending_for:nnn {##1} {#1} {#2} - \bool_if:cT {l__acro_##1_bool} - { \tl_use:c {l__acro_#2_##1_tl} } + {long} + { + \bool_if:NTF \l__acro_custom_long_format_bool + { \l__acro_custom_long_format_tl } + { + \bool_if:NTF \l__acro_first_instance_bool + { \l__acro_first_long_format_tl } + { \l__acro_long_format_tl } + } + } + {short} + { + \bool_if:NTF \l__acro_custom_short_format_bool + { \l__acro_custom_short_format_tl } + { \l__acro_short_format_tl } + } + {alt} + { + \bool_if:NTF \l__acro_custom_alt_format_bool + { \l__acro_custom_alt_format_tl } + { \l__acro_alt_format_tl } + } } } + { \use:n } + {#2} } - + \prg_new_conditional:Npnn \acro_if_ending_exist:n #1 {p,T,F,TF} { \seq_if_in:NnTF \l__acro_endings_seq {#1} @@ -2377,7 +2413,10 @@ } \bool_gset_true:c { g__acro_#1_used_bool } } - { \__acro_aux_file:Nxxxx \acro@used@once {#1} {} {} {} } + {} + % I can't remember why I want an empty first use case for starred + % acronyms… + % { \__acro_aux_file:Nxxxx \acro@used@once {#1} {} {} {} } \prg_return_false: } } @@ -2475,18 +2514,34 @@ \fi % -------------------------------------------------------------------------- +% #1: short|alt|long +% #2: string to be typeset +\cs_new_protected:Npn \__acro_typeset:nn #1#2 + { + \mode_if_horizontal:F { \leavevmode } + \group_begin: + \use:x + { + \bool_if:cTF {l__acro_custom_#1_format_bool} + { \exp_not:v {l__acro_custom_#1_format_tl} } + { \exp_not:v {l__acro_#1_format_tl} } + {#2} + } + \group_end: + } + % typeset the short form: % #1: ID % #2: short form \cs_new_protected:Npn \acro_write_short:nn #1#2 { - \mode_if_horizontal:F { \leavevmode } - \group_begin: - \bool_if:NTF \l__acro_custom_format_bool - { \l__acro_custom_format_tl } - { \l__acro_short_format_tl } - {#2} - \group_end: + \__acro_typeset:nn {short} + { + \bool_if:nTF + { \l__acro_first_upper_bool && \l__acro_upper_short_bool } + { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } } + { \exp_not:n {#2} } + } } \cs_generate_variant:Nn \acro_write_short:nn { nV , nv } @@ -2495,13 +2550,13 @@ % #2: alt form \cs_new_protected:Npn \acro_write_alt:nn #1#2 { - \mode_if_horizontal:F { \leavevmode } - \group_begin: - \bool_if:NTF \l__acro_custom_format_bool - { \l__acro_custom_format_tl } - { \l__acro_alt_format_tl } - {#2} - \group_end: + \__acro_typeset:nn {alt} + { + \bool_if:nTF + { \l__acro_first_upper_bool && \l__acro_upper_short_bool } + { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } } + { \exp_not:n {#2} } + } } \cs_generate_variant:Nn \acro_write_alt:nn { nV , nv } @@ -2513,23 +2568,15 @@ % #2: long form \cs_new_protected:Npn \acro_write_long:nn #1#2 { - \mode_if_horizontal:F { \leavevmode } - \group_begin: - \bool_if:NTF \l__acro_custom_long_format_bool - { \l__acro_custom_long_format_tl } - { \use:n } + \__acro_typeset:nn {long} { - \use:x - { - \exp_not:n {#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 {#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} } + } } - \group_end: } \cs_generate_variant:Nn \acro_write_long:nn { VV,Vo,Vf,V,v,vv } @@ -3112,7 +3159,6 @@ { activate-trailing-tokens .code:n = \clist_map_inline:nn {#1} { \acro_activate_trailing_token:n {##1} } , - activate-trailing-tokens .initial:n = dot , deactivate-trailing-tokens .code:n = \clist_map_inline:nn {#1} { \acro_deactivate_trailing_token:n {##1} } } @@ -3734,6 +3780,9 @@ % short format: \acro_declare_property_alias:nn {short-format} {format} +% alt format: +\acro_declare_simple_property:n {alt-format} + % long format: \acro_declare_simple_property:n {long-format} @@ -4195,28 +4244,30 @@ \AcroRegisterTrailing - {dash} \AcroRegisterTrailing \babelhyphen {babel-hyphen} +\keys_set:nn {acro} { activate-trailing-tokens = dot } + % -------------------------------------------------------------------------- % the user commands % automatic: \NewAcroCommand \ac { \acro_use:n {#1} } -\NewAcroCommand \iac +\NewAcroCommand \Ac { - \acro_indefinite: + \acro_first_upper: \acro_use:n {#1} } -\NewAcroCommand \Iac +\NewAcroCommand \iac { - \acro_first_upper: \acro_indefinite: \acro_use:n {#1} } -\NewAcroCommand \Ac +\NewAcroCommand \Iac { \acro_first_upper: + \acro_indefinite: \acro_use:n {#1} } @@ -4250,6 +4301,12 @@ \NewAcroCommand \acs { \acro_short:n {#1} } +\NewAcroCommand \Acs + { + \acro_first_upper: + \acro_short:n {#1} + } + \NewAcroCommand \iacs { \acro_indefinite: @@ -4269,6 +4326,13 @@ \acro_short:n {#1} } +\NewAcroCommand \Acsp + { + \acro_first_upper: + \acro_plural: + \acro_short:n {#1} + } + % alt: \NewAcroCommand \aca { \acro_alt:n {#1} } @@ -4298,26 +4362,33 @@ \acro_alt:n {#1} } +\NewAcroCommand \Acap + { + \acro_first_upper: + \acro_plural: + \acro_alt:n {#1} + } + % long: \NewAcroCommand \acl { \acro_long:n {#1} } -\NewAcroCommand \iacl +\NewAcroCommand \Acl { - \acro_indefinite: + \acro_first_upper: \acro_long:n {#1} } -\NewAcroCommand \Iacl +\NewAcroCommand \iacl { - \acro_first_upper: \acro_indefinite: \acro_long:n {#1} } -\NewAcroCommand \Acl +\NewAcroCommand \Iacl { \acro_first_upper: + \acro_indefinite: \acro_long:n {#1} } @@ -4338,22 +4409,22 @@ \NewAcroCommand \acf { \acro_first:n {#1} } -\NewAcroCommand \iacf +\NewAcroCommand \Acf { - \acro_indefinite: + \acro_first_upper: \acro_first:n {#1} } -\NewAcroCommand \Iacf +\NewAcroCommand \iacf { - \acro_first_upper: \acro_indefinite: \acro_first:n {#1} } -\NewAcroCommand \Acf +\NewAcroCommand \Iacf { \acro_first_upper: + \acro_indefinite: \acro_first:n {#1} } @@ -4690,6 +4761,15 @@ `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) % -------------------------------------------------------------------------- % TODO: |