summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/acro/acro.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/acro/acro.sty')
-rw-r--r--macros/latex/contrib/acro/acro.sty99
1 files changed, 62 insertions, 37 deletions
diff --git a/macros/latex/contrib/acro/acro.sty b/macros/latex/contrib/acro/acro.sty
index 1e1bfb4baa..d3ab51cf9b 100644
--- a/macros/latex/contrib/acro/acro.sty
+++ b/macros/latex/contrib/acro/acro.sty
@@ -27,10 +27,10 @@
% setup package:
\tl_const:Nn \c_acro_package_name_tl {acro}
-\tl_const:Nn \c_acro_date_tl {2020/11/08}
+\tl_const:Nn \c_acro_date_tl {2020/11/21}
\tl_const:Nn \c_acro_version_major_number_tl {3}
-\tl_const:Nn \c_acro_version_minor_number_tl {2}
-\tl_const:Nn \c_acro_version_subrelease_tl {a}
+\tl_const:Nn \c_acro_version_minor_number_tl {3}
+\tl_const:Nn \c_acro_version_subrelease_tl {}
\tl_const:Nx \c_acro_version_number_tl
{
\c_acro_version_major_number_tl .
@@ -656,7 +656,7 @@
\clist_map_inline:nn {#1}
{
\acro_package_if_loaded:nF {##1}
- { \msg_error:nnen {acro} {package-needed} { \TemplateName } {##1} }
+ { \msg_error:nnen {acro} {package-needed} { \AcroTemplateName } {##1} }
}
}
@@ -921,7 +921,7 @@
{ \acro_print_pages:enn { \AcronymID } {#1} {#2} }
\NewDocumentCommand \acronopagerange {}
- { \acro_no_page_ranges:e { \TemplateName } }
+ { \acro_no_page_ranges:e { \AcroTemplateName } }
\NewDocumentCommand \acropagefill {}
{ \acro_if_pages:eT { \AcronymID } { \tl_use:N \l__acro_pages_fill_tl } }
@@ -1718,7 +1718,7 @@
\DeclareAcroProperty {foreign-locale}
% additional properties:
-\DeclareAcroPropertyAlias {single} {long}
+\DeclareAcroProperty {single}
\DeclareAcroPropertyAlias {list} {long}
\DeclareAcroPropertyAlias {first-long} {long}
\DeclareAcroProperty {extra}
@@ -1734,7 +1734,7 @@
\DeclareAcroPropertyAlias {long-format} {format}
\DeclareAcroPropertyAlias {first-long-format} {long-format}
\DeclareAcroProperty {foreign-format}
-\DeclareAcroProperty {single-format}
+% \DeclareAcroProperty {single-format}
\DeclareAcroProperty {list-format}
\DeclareAcroProperty {extra-format}
@@ -1745,7 +1745,6 @@
\acro_list_add:nn {short} {#1-acc}
}
-\DeclareAcroPropertyAlias {single-acc} {long-acc}
\acro_list_map:nn {long}
{
\DeclareAcroPropertyAlias {#1-acc} {#1}
@@ -2008,10 +2007,7 @@
\cs_new_protected:Npn \acro_new_format:n #1
{
\tl_new:c {l__acro_format_#1_tl}
- \keys_define:nn {acro/format}
- {
- #1 .tl_set:c = l__acro_format_#1_tl
- }
+ \keys_define:nn {acro/format} { #1 .tl_set:c = l__acro_format_#1_tl }
}
\acro_new_format:n {short}
@@ -2026,7 +2022,7 @@
{
format .meta:n = { format/short = #1 , format/long = #1 } ,
format / replace .bool_set:N = \l__acro_format_replace_bool ,
- format / replace .initial:n = false
+ format / replace .initial:n = true
}
% ----------------------------------------------------------------------------
@@ -2413,8 +2409,9 @@
\str_case:nnTF {#1}
{ {true} {} {false} {} }
{ \use:c {bool_set_#1:N} \l__acro_cite_group_bool }
- { \msg_error:nnn {kernel} {boolean-values-only} {group} } ,
+ { \msg_error:nnn {acro} {boolean-values-only} {cite/group} } ,
group .initial:n = false ,
+ group .default:n = true ,
display .choice: ,
display/all .code:n =
\bool_set_true:N \l__acro_cite_bool
@@ -2432,6 +2429,12 @@
group / cmd .initial:n = \cite
}
+\msg_new:nnn {acro} {boolean-values-only}
+ {
+ The~ option~ `#1'~ can~ only~ receive~ boolean~ values,~ i.e.~ either~
+ `true'~ or~ `false'.
+ }
+
% --------------------------------------------------------------------------
% indexing
\bool_new:N \l__acro_index_bool
@@ -3273,6 +3276,7 @@
\cs_new_protected:Npn \acro_template_use:nnn #1#2#3
{
\bool_set_false:N \l__acro_tmpa_bool
+ \bool_set_false:N \l__acro_tmpb_bool
\bool_lazy_and:nnT
{ \l__acro_use_only_first_bool }
{ \l__acro_use_bool }
@@ -3289,12 +3293,16 @@
{ !\l__acro_first_bool }
{ \acro_if_single_p:V \l_acro_id_tl }
{
- \acro_property_if_set:VnTF \l_acro_id_tl {single-style}
+ \acro_property_if_set:VnTF \l_acro_id_tl {single}
+ { \bool_set_true:N \l__acro_tmpb_bool }
{
- \tl_set:Ne \l__acro_tmpa_tl
- { \acro_property_get:Vn \l_acro_id_tl {single-style} }
+ \acro_property_if_set:VnTF \l_acro_id_tl {single-style}
+ {
+ \tl_set:Ne \l__acro_tmpa_tl
+ { \acro_property_get:Vn \l_acro_id_tl {single-style} }
+ }
+ { \tl_set_eq:NN \l__acro_tmpa_tl \l__acro_single_tl }
}
- { \tl_set_eq:NN \l__acro_tmpa_tl \l__acro_single_tl }
}
{
\acro_if_first:VTF \l_acro_id_tl
@@ -3310,12 +3318,16 @@
}
}
{single} {
- \acro_property_if_set:VnTF \l_acro_id_tl {single-style}
+ \acro_property_if_set:VnTF \l_acro_id_tl {single}
+ { \bool_set_true:N \l__acro_tmpb_bool }
{
- \tl_set:Ne \l__acro_tmpa_tl
- { \acro_property_get:Vn \l_acro_id_tl {single-style} }
+ \acro_property_if_set:VnTF \l_acro_id_tl {single-style}
+ {
+ \tl_set:Ne \l__acro_tmpa_tl
+ { \acro_property_get:Vn \l_acro_id_tl {single-style} }
+ }
+ { \tl_set_eq:NN \l__acro_tmpa_tl \l__acro_single_tl }
}
- { \tl_set_eq:NN \l__acro_tmpa_tl \l__acro_single_tl }
}
}
{ \tl_set:Nn \l__acro_tmpa_tl {#3} }
@@ -3328,7 +3340,9 @@
}
{ \tl_set_eq:NN \l__acro_tmpa_tl \l__acro_first_style_tl }
}
- \__acro_template_use:nnV {#1} {#2} \l__acro_tmpa_tl
+ \bool_if:NTF \l__acro_tmpb_bool
+ { \__acro_template_use:nnn {#1} {#2} {single} }
+ { \__acro_template_use:nnV {#1} {#2} \l__acro_tmpa_tl }
}
\cs_generate_variant:Nn \acro_template_use:nnn {nnV}
@@ -3589,7 +3603,8 @@
postamble .tl_set:N = \l__acro_postamble_tl ,
postamble .initial:n = ,
name .tl_set:N = \l__acro_list_name_tl ,
- name .initial:n = \acro_translate:n {list-name}
+ name .initial:n = \acro_translate:n {list-name} ,
+ pages .meta:nn = {acro/pages} {#1}
}
\acro_if_komascript:TF
@@ -3670,13 +3685,22 @@
}
{
\bool_if:NT \l__acro_pages_name_display_bool {#2}
- \pageref { \l_acro_label_prefix_tl #1 }
+ \acro_print_first_page:n {#1}
}
}
}
\cs_generate_variant:Nn \acro_print_pages:nnn {e}
% #1: id
+\cs_set_protected:Npn \acro_print_first_page:n #1
+ {
+ \seq_set_split:Nnx \l__acro_tmpa_seq {|}
+ { \acro_property_get:nn {#1} {pages} }
+ \exp_last_unbraced:Ne
+ \__acro_page_name:w { \seq_item:Nn \l__acro_tmpa_seq {1} } \q_stop
+ }
+
+% #1: id
% #2: one page
% #3: more than one page
\cs_set_protected:Npn \acro_print_page_ranges:nnn #1#2#3
@@ -3769,6 +3793,7 @@
}
}
}
+ \int_compare:nNnTF { \seq_count:N \l__acro_tmpb_seq } = 1 {#2} {#3}
\seq_use:Nn \l__acro_tmpb_seq { \l__acro_pages_sep_tl }
}
@@ -3838,13 +3863,13 @@
}
\prg_generate_conditional_variant:Nnn \acro_if_pages:n {e} {p,T,F,TF}
-\acro_at_begin_document:n
- {
- \bool_lazy_and:nnT
- { \l__acro_pages_display_bool }
- { !\l__acro_pages_all_bool }
- { \bool_set_true:N \l__acro_label_bool }
- }
+% \acro_at_begin_document:n
+% {
+% \bool_lazy_and:nnT
+% { \l__acro_pages_display_bool }
+% { !\l__acro_pages_all_bool }
+% { \bool_set_true:N \l__acro_label_bool }
+% }
% #1: style name
\cs_new_protected:Npn \acro_no_page_ranges:n #1
@@ -4945,11 +4970,10 @@
}
\NewAcroTemplate {long}
- {
- \acroifTF {single}
- { \acrowrite {single} }
- { \acrowrite {long} }
- }
+ { \acrowrite {long} }
+
+\NewAcroTemplate {single}
+ { \acrowrite {single} }
\NewAcroTemplate {short}
{ \acrowrite {short} }
@@ -5491,6 +5515,7 @@
\acro_removed_property:n {long-pre}
\acro_removed_property:n {after-citation}
\acro_removed_property:n {index-cmd}
+\acro_removed_property:n {single-format}
% ----------------------------------------------------------------------------
% old functions