summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/acro/acro.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-01-04 22:27:40 +0000
committerKarl Berry <karl@freefriends.org>2022-01-04 22:27:40 +0000
commit13355ac3b8b66a661b20f355d5d6a5da4ea21c87 (patch)
tree6bb1922d2d21c560fc76236ad572707ccec96d44 /Master/texmf-dist/tex/latex/acro/acro.sty
parentc8f183597c1e8036a2111089484e2055ba9e89c3 (diff)
acro (4jan22)
git-svn-id: svn://tug.org/texlive/trunk@61488 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/acro/acro.sty')
-rw-r--r--Master/texmf-dist/tex/latex/acro/acro.sty122
1 files changed, 73 insertions, 49 deletions
diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty
index cfa5193f856..140b54ad8f0 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://github.com/cgnieder/acro/
% E-Mail: contact@mychemistry.eu
% --------------------------------------------------------------------------
-% Copyright 2011--2021 Clemens Niederberger
+% Copyright 2011--2022 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
@@ -27,9 +27,9 @@
% setup package:
\tl_const:Nn \c_acro_package_name_tl {acro}
-\tl_const:Nn \c_acro_date_tl {2021/01/16}
+\tl_const:Nn \c_acro_date_tl {2022/01/04}
\tl_const:Nn \c_acro_version_major_number_tl {3}
-\tl_const:Nn \c_acro_version_minor_number_tl {5}
+\tl_const:Nn \c_acro_version_minor_number_tl {6}
\tl_const:Nn \c_acro_version_subrelease_tl {}
\tl_const:Nx \c_acro_version_number_tl
{
@@ -75,7 +75,7 @@
\msg_new:nnn {acro} {unknown-option}
{
Unknown~ option~ `#1' \\
- I~ dont'~ know~ the~ option~ `#1'.~ Please~ make~ sure~ there~ is~ no~
+ I~ don't~ know~ the~ option~ `#1'.~ Please~ make~ sure~ there~ is~ no~
typo.~ Check~ the~ manual~ for~ help.
}
@@ -190,7 +190,7 @@
debug .bool_gset:N = \g__acro_debug_bool ,
debug .initial:n = false ,
upgrade .bool_gset:N = \g__acro_upgrade_bool ,
- upgrade .initial:n = true ,
+ upgrade .initial:n = false ,
final .bool_gset:N = \g__acro_final_bool ,
final .initial:n = false ,
version .choice: ,
@@ -481,6 +481,7 @@
\cs_generate_variant:Nn \seq_set_split:Nnn {Nne}
\cs_generate_variant:Nn \clist_if_empty:nTF {e}
\cs_generate_variant:Nn \clist_item:nn {e}
+\cs_generate_variant:Nn \clist_count:n {e}
\cs_generate_variant:Nn \int_set:Nn {Nx}
\cs_generate_variant:Nn \tl_set:Nn {Ne}
\cs_generate_variant:Nn \tl_remove_all:Nn {NV}
@@ -747,7 +748,7 @@
\acro_property_make_alias:nn {#6} {#7}
}
-\NewDocumentCommand \MakeAcroPropertyAlias {mm}
+\NewDocumentCommand \MakeAcroPropertyAlias{mm}
{ \acro_property_make_alias:nn {#1} {#2} }
\NewDocumentCommand \NewAcroPreset {m+m}
@@ -778,6 +779,11 @@
\NewDocumentCommand \DeclareAcronym {m+m}
{ \acro_declare_acronym:nn {#1} {#2} }
+% declaring acronyms in the document body does not work,
+% cf. https://tex.stackexchange.com/q/568856/
+% so lets prevent people from doing so:
+\@onlypreamble \DeclareAcronym
+
\NewDocumentCommand \DeclareAcroEnding {mmm}
{ \acro_declare_ending:nnn {#1} {#2} {#3} }
@@ -1009,27 +1015,8 @@
\iow_new:N \l__acro_aux_file_iow
\tl_new:N \l__acro_mdfive_hash_tl
-\acro_at_begin_document:n
- {
- \legacy_if:nT {@filesw}
- {
- \iow_now:Nx \@auxout
- { \token_to_str:N \providecommand \token_to_str:N \ACRO [1] {} }
- }
- \file_get_mdfive_hash:VN
- \c_acro_auxfile_tl
- \l__acro_mdfive_hash_tl
- \iow_open:NV \l__acro_aux_file_iow \c_acro_auxfile_tl
- }
-
\cs_new_protected:Npn \acro_close_aux:
{
- \iow_close:N \l__acro_aux_file_iow
- \file_get_mdfive_hash:VN
- \c_acro_auxfile_tl
- \l__acro_tmpa_tl
- \tl_if_eq:NNF \l__acro_mdfive_hash_tl \l__acro_tmpa_tl
- { \acro_rerun:n {general} }
\legacy_if:nT {@filesw}
{ \iow_now:Nx \@auxout { \token_to_str:N \ACRO {readaux} } }
}
@@ -1037,7 +1024,7 @@
\cs_new_protected:Npn \acro_write_to_aux:n #1
{
\legacy_if:nT {@filesw}
- { \iow_now:Nn \l__acro_aux_file_iow {#1} }
+ { \iow_now:Nn \@auxout {#1} }
}
\cs_generate_variant:Nn \acro_write_to_aux:n {x}
@@ -1978,14 +1965,20 @@
{ \prg_return_false: }
}
-\cs_new_protected:Npn \acro_check_definition:n #1
+\cs_new_protected:Npn \acro_check_definition:nT #1#2
{
- \acro_if_defined:nF {#1}
- { \msg_error:nnn {acro} {undefined} {#1} }
- \acro_boolean_property_if:nnF {#1} {used}
- { \__acro_uselist_if_used:nT {#1} { \acro_use:n {#1} } }
+ \acro_if_defined:nTF {#1}
+ {
+ \acro_boolean_property_if:nnF {#1} {used}
+ { \__acro_uselist_if_used:nT {#1} { \__acro_use:n {#1} } }
+ #2
+ }
+ { \acro_acronym_undefined:n {#1} }
}
+\cs_new_protected:Npn \acro_acronym_undefined:n #1
+ { \msg_error:nnn {acro} {undefined} {#1} }
+
% --------------------------------------------------------------------------
% use and reset:
\bool_new:N \l__acro_use_bool
@@ -2936,7 +2929,8 @@
\bool_if:NT \l__acro_barriers_bool
{
\int_compare:nNnTF
- { \intarray_count:c {g__acro_#1_barriers_intarray} } > 0
+ { \intarray_count:c {g__acro_#1_barriers_intarray} } < \g_acro_barrier_int
+ { \acro_rerun:n {barriers} }
{
\intarray_gset:cnn {g__acro_#1_barriers_intarray}
{ \int_use:N \g_acro_barrier_int }
@@ -2946,14 +2940,16 @@
+1
}
}
- { \acro_rerun:n {barriers} }
}
}
% #1: id
\cs_new:Npn \acro_barrier_usage:n #1
{
- \clist_if_empty:eTF { \acro_property_get:nn {#1} {barriers} }
+ \int_compare:nNnTF
+ { \clist_count:e { \acro_property_get:nn {#1} {barriers} } }
+ <
+ \g_acro_barrier_int
{0}
{
\clist_item:en
@@ -3022,8 +3018,9 @@
\keys_define:nn {acro}
{
- case-sensitive .bool_gset:N = \g__acro_case_sensitive_bool ,
- case-sensitive .initial:n = true ,
+ case-sensitive .bool_gset:N = \g__acro_case_sensitive_bool ,
+ case-insensitive .bool_gset_inverse:N = \g__acro_case_sensitive_bool ,
+ case-sensitive .initial:n = true
}
% ----------------------------------------------------------------------------
@@ -3295,15 +3292,18 @@
\acro_begin:
\l__acro_begin_command_hook_tl
\cs_set:Npn \nospace { \exp:w \exp_end_continue_f:w }
- \acro_check_definition:n {####1}
- \keys_set:nV {acro} \l__acro_options_tl
- \tl_set:Ne \l_acro_id_tl { \acro_case_insensitive:n {####1} }
- \tl_set_eq:NN \AcronymID \l_acro_id_tl
- ##3
- \acro_finalize:ne
- { \l__acro_star_bool }
- { \acro_case_insensitive:n {####1} }
- \l__acro_end_command_hook_tl
+ \acro_check_definition:nT
+ {####1}
+ {
+ \keys_set:nV {acro} \l__acro_options_tl
+ \tl_set:Ne \l_acro_id_tl { \acro_case_insensitive:n {####1} }
+ \tl_set_eq:NN \AcronymID \l_acro_id_tl
+ ##3
+ \acro_finalize:ne
+ { \l__acro_star_bool }
+ { \acro_case_insensitive:n {####1} }
+ \l__acro_end_command_hook_tl
+ }
\acro_end:
}
\use:x
@@ -3842,8 +3842,8 @@
\acro_if_komascript:TF
{
\cs_if_exist:NTF \chapter
- { \keys_set:nn {acro/list}{ heading = addchap } }
- { \keys_set:nn {acro/list}{ heading = addsec } }
+ { \keys_set:nn {acro/list}{ heading = addchap* } }
+ { \keys_set:nn {acro/list}{ heading = addsec* } }
}
{
\cs_if_exist:NTF \chapter
@@ -4411,12 +4411,17 @@
% hyper linking
\bool_new:N \l__acro_hyperref_use_bool
\bool_new:N \l__acro_link_only_first_bool
+\bool_new:N \l__acro_link_back_bool
\cs_new_eq:NN \__acro_hyper_target:nn \use_ii:nn
\cs_new_eq:NN \__acro_hyper_link:nn \use_ii:nn
+\cs_new_eq:NN \__acro_hyper_back_target:nn \use_ii:nn
+\cs_new_eq:NN \__acro_hyper_back_link:nn \use_ii:nn
\cs_generate_variant:Nn \__acro_hyper_target:nn {e}
\cs_generate_variant:Nn \__acro_hyper_link:nn {e}
+\cs_generate_variant:Nn \__acro_hyper_back_target:nn {e}
+\cs_generate_variant:Nn \__acro_hyper_back_link:nn {e}
\cs_new_protected:Npn \__acro_activate_hyperref_support:
{
@@ -4432,6 +4437,8 @@
{ \cs_set_eq:NN \__acro_hyper_link:nn \hyperlink }
\cs_set:Npn \__acro_hyper_target:nn ##1##2
{ \raisebox {3ex} [0pt] { \hypertarget {##1} { } } ##2 }
+ \cs_set_eq:NN \__acro_hyper_back_link:nn \__acro_hyper_link:nn
+ \cs_set_eq:NN \__acro_hyper_back_target:nn \__acro_hyper_target:nn
}
}
@@ -5050,9 +5057,22 @@
\acro_new_patch:n {tabu}
\acro_new_patch:n {ltxtable}
\acro_new_patch:n {caption}
+\acro_new_patch:n {maketitle}
\AtEndPreamble
{
+ % maketitle:
+ \acro_if_patch:nT {maketitle}
+ {
+ \pretocmd \maketitle
+ { \acswitchoff }
+ {}
+ { \msg_error:nnn {acro} {patch} {maketitle} }
+ \apptocmd \maketitle
+ { \acswitchon }
+ {}
+ { \msg_error:nnn {acro} {patch} {maketitle} }
+ }
% floats:
\acro_if_patch:nT {floats}
{
@@ -5219,7 +5239,7 @@
)
}
}
-
+
\NewAcroTemplate {footnote}
{
\acrowrite {short}
@@ -5278,6 +5298,8 @@
{
\NewAcroTemplate[heading] {addsec}
{ \addsec { \acrolistname } }
+ \NewAcroTemplate[heading] {addsec*}
+ { \addsec* { \acrolistname } }
}
\cs_if_exist:NT \chapter
@@ -5290,6 +5312,8 @@
{
\NewAcroTemplate[heading] {addchap}
{ \addchap { \acrolistname } }
+ \NewAcroTemplate[heading] {addchap*}
+ { \addchap* { \acrolistname } }
}
}
@@ -5534,7 +5558,7 @@
{
Fallback = pp\abbrdot ,
English = pp\abbrdot ,
- French = pp\abbrdot ,
+ French = p\abbrdot ,
German = S\abbrdot ,
Italian = pp\abbrdot ,
Portuguese = pp\abbrdot ,