summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/acro
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-01-16 22:27:46 +0000
committerKarl Berry <karl@freefriends.org>2021-01-16 22:27:46 +0000
commitfaa371183c694de87934c64d06283cbd6c1529fd (patch)
treef236f12123c94e344fac9b7e7071857f05955fd9 /Master/texmf-dist/tex/latex/acro
parent3ed15084bb84e1e7921a3e5a7a9fc11dbe5a2075 (diff)
acro (16jan21)
git-svn-id: svn://tug.org/texlive/trunk@57447 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/acro')
-rw-r--r--Master/texmf-dist/tex/latex/acro/acro-examples.sty166
-rw-r--r--Master/texmf-dist/tex/latex/acro/acro.sty350
2 files changed, 444 insertions, 72 deletions
diff --git a/Master/texmf-dist/tex/latex/acro/acro-examples.sty b/Master/texmf-dist/tex/latex/acro/acro-examples.sty
new file mode 100644
index 00000000000..01fca6ada36
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/acro/acro-examples.sty
@@ -0,0 +1,166 @@
+\RequirePackage{acro}
+\ProvidesPackage{acro-examples}[\csname c_acro_date_tl\endcsname\space v0.1
+example definitions with acro (CN)]
+
+\DeclareAcronym{afaik}{
+ short = AFAIK ,
+ long = as far as I know
+}
+\DeclareAcronym{afk}{
+ short = AFK ,
+ long = away from keyboard
+}
+\DeclareAcronym{asap}{
+ short = ASAP ,
+ long = as soon as possible
+}
+\DeclareAcronym{ba}{
+ short = BA ,
+ long = Bachelor of Arts
+}
+\DeclareAcronym{bnd}{
+ short = BND ,
+ long = Bundesnachrichtendienst
+}
+\DeclareAcronym{bs}{
+ short = BS ,
+ long = Bachelor of Science
+}
+\DeclareAcronym{cd}{
+ short = CD ,
+ long = compact disc
+}
+\DeclareAcronym{cdu}{
+ short = CDU ,
+ long = Christlich-Demokratische Union
+}
+\DeclareAcronym{ceo}{
+ short = CEO ,
+ long = chief executive officer
+}
+\DeclareAcronym{cia}{
+ short = CIA ,
+ long = Central Intelligence Agency
+}
+\DeclareAcronym{csu}{
+ short = CSU ,
+ long = Christlich-Soziale Union
+}
+\DeclareAcronym{ctan}{
+ short = CTAN ,
+ long = Comprehensive \TeX\ Archive Network
+}
+\DeclareAcronym{dea}{
+ short = DEA ,
+ long = Drug Enforcement Administration
+}
+\DeclareAcronym{diy}{
+ short = DIY ,
+ long = do it yourself
+}
+\DeclareAcronym{dpa}{
+ short = DPA ,
+ long = Deutsche Presseagentur
+}
+\DeclareAcronym{eta}{
+ short = ETA ,
+ long = estimated time of arrival
+}
+\DeclareAcronym{fbi}{
+ short = FBI ,
+ long = Federal Bureau of Investigation
+}
+\acroifpropertyTF{
+ \DeclareAcronym{hadopi}{
+ short = HADOPI ,
+ long = Haute Autorité pour la diffusion des œuvres et la protection des
+ droits sur l’Internet ,
+ short-definite = l'\nospace ,
+ long-definite = la
+ }
+}{
+ \DeclareAcronym{hadopi}{
+ short = HADOPI ,
+ long = Haute Autorité pour la diffusion des œuvres et la protection des
+ droits sur l’Internet
+ }
+}
+\DeclareAcronym{iirc}{
+ short = IIRC ,
+ long = if I remember correctly
+}
+\DeclareAcronym{imho}{
+ short = IMHO ,
+ long = in my humble opinion
+}
+\DeclareAcronym{jpg}{
+ short = JPEG ,
+ sort = jpeg ,
+ alt = JPG ,
+ long = joint photographic experts group
+}
+\DeclareAcronym{ksk}{
+ short = KSK ,
+ long = Kommando Spezialkräfte
+}
+\DeclareAcronym{lol}{
+ short = LOL ,
+ long = loughing out loud
+}
+\DeclareAcronym{lppl}{
+ short = LPPL ,
+ long = \unexpanded{\LaTeX} Project Public License
+}
+\DeclareAcronym{ma}{
+ short = MA ,
+ long = Master of Arts
+}
+\DeclareAcronym{nato}{
+ short = NATO ,
+ long = North Atlantic Treaty Organization
+}
+\DeclareAcronym{nsa}{
+ short = NSA ,
+ long = National Security Agency
+}
+\DeclareAcronym{omg}{
+ short = OMG ,
+ long = oh my god
+}
+\DeclareAcronym{otan}{
+ short = OTAN ,
+ long = Organisation du Traité de l'Atlantique Nord
+}
+\DeclareAcronym{pdf}{
+ short = PDF ,
+ long = portable document format
+}
+\DeclareAcronym{png}{
+ short = PNG ,
+ long = portable network graphics
+}
+\DeclareAcronym{rofl}{
+ short = ROFL ,
+ long = rolling on the floor laughing
+}
+\DeclareAcronym{spd}{
+ short = SPD ,
+ long = Sozialdemokratische Partei Deutschlands
+}
+\DeclareAcronym{tiff}{
+ short = TIFF ,
+ long = tagged image file format
+}
+\DeclareAcronym{ufo}{
+ short = UFO ,
+ long = unidentified flying object ,
+ long-indefinite = an
+}
+\DeclareAcronym{yolo}{
+ short = YOLO ,
+ long = you only live once
+}
+
+\endinput
+
+2021/01/13 - first version
diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty
index 8efd343d1dd..cfa5193f856 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--2020 Clemens Niederberger
+% Copyright 2011--2021 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
@@ -22,14 +22,14 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-\RequirePackage{l3keys2e}
+\RequirePackage {l3keys2e}
\ExplSyntaxOn
% setup package:
\tl_const:Nn \c_acro_package_name_tl {acro}
-\tl_const:Nn \c_acro_date_tl {2020/12/25}
+\tl_const:Nn \c_acro_date_tl {2021/01/16}
\tl_const:Nn \c_acro_version_major_number_tl {3}
-\tl_const:Nn \c_acro_version_minor_number_tl {4}
+\tl_const:Nn \c_acro_version_minor_number_tl {5}
\tl_const:Nn \c_acro_version_subrelease_tl {}
\tl_const:Nx \c_acro_version_number_tl
{
@@ -47,7 +47,7 @@
{\c_acro_package_name_tl}
{\c_acro_date_tl}
{\c_acro_version_tl}
- {\c_acro_info_tl}
+ {\c_acro_info_tl \c_space_tl (CN)}
% --------------------------------------------------------------------------
% document hooks:
@@ -84,23 +84,23 @@
\bool_new:N \g__acro_rerun_bool
\tl_new:N \g__acro_rerun_message_tl
-\tl_const:Nn \l__acro_rerun_general_tl
+\tl_const:Nn \c__acro_rerun_general_tl
{ Rerun~ to~ get~ `acro'~ synchronized. }
-\tl_const:Nn \l__acro_rerun_property_tl
+\tl_const:Nn \c__acro_rerun_property_tl
{
Acronym~ properties~ may~ have~ changed.~ Rerun~ to~ get~ them~
synchronized.
}
-\tl_const:Nn \l__acro_rerun_list_tl
+\tl_const:Nn \c__acro_rerun_list_tl
{
Empty~ acronym~ list.~ If~ you~ have~ used~ acronyms~ then~ re-compile~
to~ get~ the~ list~ filled.~ Otherwise~ remove~ \token_to_str:N
\printacronyms
}
-\msg_new:nnn {acro} {rerun} { \use:c {l__acro_rerun_#1_tl} }
+\msg_new:nnn {acro} {rerun} { \use:c {c__acro_rerun_#1_tl} }
\prg_new_conditional:Npnn \acro_if_rerun: {p,T,F,TF}
{
@@ -191,11 +191,11 @@
debug .initial:n = false ,
upgrade .bool_gset:N = \g__acro_upgrade_bool ,
upgrade .initial:n = true ,
- final .bool_set:N = \g__acro_final_bool ,
+ final .bool_gset:N = \g__acro_final_bool ,
final .initial:n = false ,
version .choice: ,
- version / 2 .code:n = \int_set:Nn \g__acro_version_int {2} ,
- version / 3 .code:n = \int_set:Nn \g__acro_version_int {3} ,
+ version / 2 .code:n = \int_gset:Nn \g__acro_version_int {2} ,
+ version / 3 .code:n = \int_gset:Nn \g__acro_version_int {3} ,
version .initial:n = 3 ,
unknown .code:n = \__acro_loadtime_warning:n {unknown-option}
}
@@ -486,10 +486,11 @@
\cs_generate_variant:Nn \tl_remove_all:Nn {NV}
\cs_generate_variant:Nn \tl_remove_once:Nn {NV}
\cs_generate_variant:Nn \tl_if_in:NnF {NV}
+\cs_generate_variant:Nn \tl_if_eq:nnTF {VV}
\cs_generate_variant:Nn \tl_put_right:Nn {Ne}
\cs_generate_variant:Nn \clist_set:Nn {Ne}
\cs_generate_variant:Nn \str_if_eq:nnT {x}
-\cs_generate_variant:Nn \str_fold_case:n {e}
+\cs_generate_variant:Nn \str_foldcase:n {e}
\cs_generate_variant:Nn \str_lowercase:n {e}
\cs_generate_variant:Nn \msg_error:nnnnn {nnnxx}
\cs_generate_variant:Nn \msg_warning:nn {nV}
@@ -648,6 +649,14 @@
\NewDocumentCommand \AcroPropertiesMap {+m}
{ \acro_properties_map:n {#1} }
+\NewDocumentCommand \AcroAcronymsMap {+m}
+ { \acro_map_acronyms:n { \tl_set:Nn \AcronymID {##1} #1 } }
+
+\NewExpandableDocumentCommand \AcroMapBreak {} { \acro_map_break: }
+
+\NewDocumentCommand \AcroPropertiesSet {m+m}
+ { \acro_properties_set:nn {#1} {#2} }
+
\NewDocumentCommand \AcroMap {m+m}
{ \acro_list_map:nn {#1} {#2} }
@@ -668,9 +677,24 @@
\NewDocumentCommand \acroloadstyle {m}
{ \acro_style_load:n {#1} }
+\NewExpandableDocumentCommand \acroifstarredTF {}
+ { \bool_if:NTF \l__acro_star_bool }
+
+\NewExpandableDocumentCommand \acroifstarredT {}
+ { \bool_if:NT \l__acro_star_bool }
+
+\NewExpandableDocumentCommand \acroifstarredF {}
+ { \bool_if:NF \l__acro_star_bool }
+
\NewExpandableDocumentCommand \acroifusedTF {m}
{ \acro_boolean_property_if:nnTF {#1} {used} }
+\NewExpandableDocumentCommand \acroifusedT {m}
+ { \acro_boolean_property_if:nnT {#1} {used} }
+
+\NewExpandableDocumentCommand \acroifusedF {m}
+ { \acro_boolean_property_if:nnF {#1} {used} }
+
\NewDocumentCommand \acuse {m}
{ \acro_use:n {#1} }
@@ -726,6 +750,16 @@
\NewDocumentCommand \MakeAcroPropertyAlias {mm}
{ \acro_property_make_alias:nn {#1} {#2} }
+\NewDocumentCommand \NewAcroPreset {m+m}
+ { \acro_preset_new:nn {#1} {#2} }
+
+\NewDocumentCommand \RenewAcroPreset {m+m}
+ { \acro_preset_renew:nn {#1} {#2} }
+
+\NewDocumentCommand \DeclareAcroPreset {m+m}
+ { \acro_preset_declare:nn {#1} {#2} }
+
+% --------------------------------------------------------------------------
\NewDocumentCommand \UseAcroTemplate {O{acronym}mO{1}}
{ \acro_template_use:nnn {#3} {#1} {#2} }
@@ -828,7 +862,7 @@
{ \acro_write:en {#1} {#2} }
}
-\NewExpandableDocumentCommand \acrofieldifTF {+m+m+m+m}
+\NewExpandableDocumentCommand \acroiffieldTF {+m+m+m+m}
{ \acro_property_if_set:nnTF {#1} {#2} {#3} {#4} }
\NewDocumentCommand \acroifanyfieldTF {mm+m+m}
@@ -866,6 +900,15 @@
\NewDocumentCommand \acrocite {}
{ \bool_set_true:N \l__acro_cite_always_bool }
+\NewExpandableDocumentCommand \acroifpropertyTF {m}
+ { \acro_property_if_exist:nTF {#1} }
+
+\NewExpandableDocumentCommand \acroifpropertyT {m}
+ { \acro_property_if_exist:nT {#1} }
+
+\NewExpandableDocumentCommand \acroifpropertyF {m}
+ { \acro_property_if_exist:nF {#1} }
+
\NewExpandableDocumentCommand \acroifbooleanTF {m}
{ \acro_boolean_property_if:enTF { \AcronymID } {#1} }
@@ -911,11 +954,11 @@
{ \acro_if_first:eTF { \AcronymID } {} {#1} }
\NewDocumentCommand \acroiftagTF {m+m+m}
- { \acro_if_tag:enTF { \AcronymID } {#1} {#2} {#3} }
+ { \acro_tag_if:enTF { \AcronymID } {#1} {#2} {#3} }
\NewDocumentCommand \acroiftagT {m+m}
- { \acro_if_tag:enT { \AcronymID } {#1} {#2} }
+ { \acro_tag_if:enT { \AcronymID } {#1} {#2} }
\NewDocumentCommand \acroiftagF {m+m}
- { \acro_if_tag:enF { \AcronymID } {#1} {#2} }
+ { \acro_tag_if:enF { \AcronymID } {#1} {#2} }
\NewDocumentCommand \acropages {mm}
{ \acro_print_pages:enn { \AcronymID } {#1} {#2} }
@@ -929,6 +972,8 @@
\NewDocumentCommand \acropagefill {}
{ \acro_if_pages:eT { \AcronymID } { \tl_use:N \l__acro_pages_fill_tl } }
+\NewDocumentCommand \acrodotfill {} { \acro_dot_fill: }
+
\NewExpandableDocumentCommand \acroifpagesTF {}
{ \acro_if_pages:eTF { \AcronymID } }
@@ -962,7 +1007,7 @@
\tl_const:Nx \c_acro_auxfile_tl { \c_sys_jobname_str .acr }
\iow_new:N \l__acro_aux_file_iow
-\tl_new:N \g__acro_mdfive_hash_tl
+\tl_new:N \l__acro_mdfive_hash_tl
\acro_at_begin_document:n
{
@@ -973,7 +1018,7 @@
}
\file_get_mdfive_hash:VN
\c_acro_auxfile_tl
- \g__acro_mdfive_hash_tl
+ \l__acro_mdfive_hash_tl
\iow_open:NV \l__acro_aux_file_iow \c_acro_auxfile_tl
}
@@ -983,7 +1028,7 @@
\file_get_mdfive_hash:VN
\c_acro_auxfile_tl
\l__acro_tmpa_tl
- \tl_if_eq:NNF \g__acro_mdfive_hash_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} } }
@@ -1092,8 +1137,8 @@
% #1: name
\cs_new_protected:Npn \__acro_auxlist_update:n #1
{
- \seq_remove_duplicates:c {g__acro_auxlist_#1_seq}
- \seq_remove_duplicates:c {g__acro_auxlist_recorded_#1_seq}
+ \seq_gremove_duplicates:c {g__acro_auxlist_#1_seq}
+ \seq_gremove_duplicates:c {g__acro_auxlist_recorded_#1_seq}
\str_set:Nx \l__acro_tmpa_str
{ \seq_use:cn {g__acro_auxlist_#1_seq} {} }
\str_set:Nx \l__acro_tmpb_str
@@ -1167,6 +1212,17 @@
needs~ a~ (possibly~ empty)~ value!
}
+\msg_new:nnn {acro} {preset-defined}
+ {
+ The~ acronym~ preset~ `#1'~ is~ already~ defined~ \msg_line_context: . \\
+ Try~ \RenewAcroPreset ~ or~ \DeclareAcroPreset ~ instead.
+ }
+
+\msg_new:nnn {acro} {preset-not-defined}
+ {
+ The~ acronym~ preset~ `#1'~ is~ not~ defined~ \msg_line_context: , yet. \\
+ Try~ \NewAcroPreset ~ or~ \DeclareAcroPreset ~ instead.
+ }
% ----------------------------------------------------------------------------
% declare properties:
@@ -1549,7 +1605,68 @@
\__acro_parse_property:nn
{#2}
}
-\cs_generate_variant:Nn \acro_properties_set:nnn {nnx,nxx,nV,nVx}
+\cs_generate_variant:Nn \acro_properties_set:nn {nV}
+
+% --------------------------------------------------------------------------
+% define a set of properties that can be assigned to acronyms
+% #1: preset name
+\prg_new_conditional:Npnn \acro_preset_if_defined:n #1 {p,T,F,TF}
+ {
+ \tl_if_exist:cTF {l__acro_preset_#1_tl}
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+
+% #1: preset name
+\cs_new_protected:Npn \acro_preset_define:n #1
+ { \tl_new:c {l__acro_preset_#1_tl} }
+
+% #1: preset name
+% #2: properties
+\cs_new_protected:Npn \acro_preset_set:nn #1#2
+ { \tl_set:cn {l__acro_preset_#1_tl} {#2} }
+
+% #1: preset name
+% #2: properties
+\cs_new_protected:Npn \acro_preset_declare:nn #1#2
+ {
+ \acro_preset_if_defined:nF {#1}
+ { \acro_preset_define:n {#1} }
+ \acro_preset_set:nn {#1} {#2}
+ }
+
+% #1: preset name
+% #2: properties
+\cs_new_protected:Npn \acro_preset_new:nn #1#2
+ {
+ \acro_preset_if_defined:nTF {#1}
+ { \msg_error:nnn {acro} {preset-defined} {#1} }
+ {
+ \acro_preset_define:n {#1}
+ \acro_preset_set:nn {#1} {#2}
+ }
+ }
+
+% #1: preset name
+% #2: properties
+\cs_new_protected:Npn \acro_preset_renew:nn #1#2
+ {
+ \acro_preset_if_defined:nTF {#1}
+ { \acro_preset_set:nn {#1} {#2} }
+ { \msg_error:nnn {acro} {preset-not-defined} {#1} }
+ }
+
+% #1: ID
+\cs_new_protected:Npn \acro_preset_set_properties:n #1
+ {
+ \acro_property_if_set:nnT {#1} {preset}
+ {
+ \tl_set_eq:Nc
+ \l__acro_tmpa_tl
+ {l__acro_preset_ \acro_property_get:nn {#1} {preset} _tl}
+ \acro_properties_set:nV {#1} \l__acro_tmpa_tl
+ }
+ }
% ----------------------------------------------------------------------------
% inspect properties:
@@ -1703,6 +1820,9 @@
\DeclareAcroProperty {alt}
\DeclareAcroProperty !{long}
+\DeclareAcroProperty{uselist}
+\DeclareAcroProperty{preset}
+
% sorting, indexing, ... :
\DeclareAcroPropertyAlias {sort} {short}
\DeclareAcroProperty {index}
@@ -1771,7 +1891,7 @@
% --------------------------------------------------------------------------
% declaration of acronyms:
-\seq_new:N \g__acro_acronyms_seq
+\seq_new:N \g_acro_acronyms_seq
\tl_new:N \l__acro_first_style_tl
@@ -1801,7 +1921,7 @@
{g__acro_#1_barriers_intarray}
{ \g_acro_barrier_total_int }
}
- \seq_gput_right:Nn \g__acro_acronyms_seq {#1}
+ \seq_gput_right:Nn \g_acro_acronyms_seq {#1}
\acro_attribute_set:nnn {acronyms} {#1} {}
% set defaults:
\__acro_set_article_defaults:n {#1}
@@ -1814,6 +1934,7 @@
{ !\acro_property_if_set_p:nn {#1} {short} }
{ \acro_property_set:nnn {#1} {short} {#1} }
\acro_property_set:nnn {#1} {id} {#1}
+ \acro_preset_set_properties:n {#1}
\acro_property_set_aliases:n {#1}
% check mandatory properties:
\acro_property_foreach_mandatory:n
@@ -1838,10 +1959,31 @@
{ \prg_return_false: }
}
+\prg_new_protected_conditional:Npnn \__acro_uselist_if_used:n #1 {T,F,TF}
+ {
+ \acro_property_if_set:nnTF {#1} {uselist}
+ {
+ \clist_set:Nx \l__acro_tmpa_clist
+ { \acro_property_get:nn {#1} {uselist} }
+ \clist_clear:N \l__acro_tmpb_clist
+ \clist_map_inline:Nn \l__acro_tmpa_clist
+ {
+ \acro_boolean_property_if:nnT {##1} {used}
+ { \clist_put_right:Nn \l__acro_tmpb_clist {##1} }
+ }
+ \tl_if_eq:VVTF \l__acro_tmpa_clist \l__acro_tmpb_clist
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ { \prg_return_false: }
+ }
+
\cs_new_protected:Npn \acro_check_definition:n #1
{
\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} } }
}
% --------------------------------------------------------------------------
@@ -1849,6 +1991,12 @@
\bool_new:N \l__acro_use_bool
\bool_set_true:N \l__acro_use_bool
+\cs_new_protected:Npn \acro_map_acronyms:n #1
+ { \seq_map_inline:Nn \g_acro_acronyms_seq {#1} }
+
+\cs_new:Npn \acro_map_break: { \seq_map_break: }
+\cs_new:Npn \acro_map_break:n { \seq_map_break:n }
+
\cs_new_protected:Npn \acro_use_false:
{ \bool_set_false:N \l__acro_use_bool }
@@ -1867,7 +2015,7 @@
\cs_generate_variant:Nn \acro_use:n {e}
\cs_new_protected:Npn \acro_use_all:
- { \seq_map_inline:Nn \g__acro_acronyms_seq { \__acro_use:n {##1} } }
+ { \seq_map_inline:Nn \g_acro_acronyms_seq { \__acro_use:n {##1} } }
\cs_new_protected:Npn \__acro_reset:n #1
{
@@ -1882,7 +2030,7 @@
{ \clist_map_inline:nn {#1} { \__acro_reset:n {##1} } }
\cs_new_protected:Npn \acro_reset_all:
- { \seq_map_inline:Nn \g__acro_acronyms_seq { \__acro_reset:n {##1} } }
+ { \seq_map_inline:Nn \g_acro_acronyms_seq { \__acro_reset:n {##1} } }
\cs_new_protected:Npn \acro_switch_off:
{ \bool_set_false:N \l__acro_use_bool }
@@ -2196,6 +2344,16 @@
\__acro_set_endings:nn {#1} {long}
}
+% #1: ending
+\cs_new_protected:Npn \acro_unset_ending:n #1
+ { \bool_set_false:c {l__acro_ending_#1_bool} }
+
+\cs_new_protected:Npn \acro_reset_endings:
+ {
+ \tl_map_tokens:Nn \l__acro_endings_tl { \acro_unset_ending:n }
+ \bool_set_false:N \l__acro_ending_bool
+ }
+
% ----------------------------------------------------------------------------
\AcroModuleEnd
\AcroModule{tools}{tools for treating different aspects}
@@ -2460,6 +2618,7 @@
% --------------------------------------------------------------------------
% indexing
\bool_new:N \l__acro_index_bool
+\bool_new:N \l__acro_index_prop_bool
\tl_new:N \l_acro_index_disable_tl
\cs_new_protected:Npn \__acro_index:n {}
@@ -2468,9 +2627,16 @@
% #1: id
\cs_new_protected:Npn \acro_index:n #1
{
- \bool_lazy_and:nnT
- { \l__acro_index_bool }
- { !\acro_boolean_property_if_p:nn {#1} {no-index} }
+ \bool_lazy_all:nT
+ {
+ { \l__acro_index_bool }
+ { !\acro_boolean_property_if_p:nn {#1} {no-index} }
+ {
+ \bool_if:NTF \l__acro_index_prop_bool
+ { \acro_property_if_set_p:nn {#1} {index} }
+ { !\acro_property_if_set_p:nn {#1} {index} }
+ }
+ }
{
\group_begin:
\acro_trailing_map:n
@@ -2500,15 +2666,26 @@
\keys_define:nn {acro/index}
{
- use .bool_set:N = \l__acro_index_bool ,
- use .initial:n = false ,
- cmd .cs_set:Np = \__acro_index:n ,
- cmd .initial:n = \index ,
- cmd .value_required:n = true ,
- disable .code:n = \tl_put_right:Nn \l_acro_index_disable_tl {#1} ,
- disable .value_required:n = true ,
- clear .code:n = \tl_clear:N \l_acro_index_disable_tl ,
- clear .value_forbidden:n = true
+ use .choice: ,
+ use / true .code:n =
+ \bool_set_true:N \l__acro_index_bool
+ \bool_set_false:N \l__acro_index_prop_bool ,
+ use / false .code:n =
+ \bool_set_false:N \l__acro_index_bool
+ \bool_set_false:N \l__acro_index_prop_bool ,
+ use / indexed .code:n =
+ \bool_set_true:N \l__acro_index_bool
+ \bool_set_true:N \l__acro_index_prop_bool ,
+ use .initial:n = false ,
+ use .default:n = true ,
+ use .initial:n = false ,
+ cmd .cs_set:Np = \__acro_index:n ,
+ cmd .initial:n = \index ,
+ cmd .value_required:n = true ,
+ disable .code:n = \tl_put_right:Nn \l_acro_index_disable_tl {#1} ,
+ disable .value_required:n = true ,
+ clear .code:n = \tl_clear:N \l_acro_index_disable_tl ,
+ clear .value_forbidden:n = true
}
\keys_set:nn {acro/index} { disable = \def\@{} }
@@ -2601,13 +2778,10 @@
}
\int_new:N \l__acro_nest_int
-\bool_new:N \g__acro_nested_bool
\prg_new_conditional:Npnn \acro_if_nested: {p,T,F,TF}
{
- \bool_lazy_and:nnTF
- { \int_compare_p:n { \l__acro_nest_int = 1 } }
- { \g__acro_nested_bool }
+ \int_compare:nNnTF \l__acro_nest_int > 1
{ \prg_return_true: }
{ \prg_return_false: }
}
@@ -2615,9 +2789,8 @@
\cs_new_protected:Npn \acro_begin:
{
\group_begin:
- \int_compare:nNnT \l__acro_nest_int > 0
- { \bool_gset_true:N \g__acro_nested_bool }
\int_incr:N \l__acro_nest_int
+ \acro_reset_endings:
\__acro_check_after_end:w
}
@@ -2636,7 +2809,6 @@
\cs_new_protected:Npn \acro_end:
{
- \acro_if_nested:T { \bool_gset_false:N \g__acro_nested_bool }
\bool_if:NT \g__acro_gobble_trail_bool
{
\bool_gset_false:N \g__acro_gobble_trail_bool
@@ -2714,8 +2886,8 @@
\int_compare:nNnTF
{
\__acro_strcmp:nn
- { \str_fold_case:e { \acro_property_get:nn {##1} {sort} } }
- { \str_fold_case:e { \acro_property_get:nn {##2} {sort} } }
+ { \str_foldcase:e { \acro_property_get:nn {##1} {sort} } }
+ { \str_foldcase:e { \acro_property_get:nn {##2} {sort} } }
} = {-1}
{ \sort_return_same: }
{ \sort_return_swapped: }
@@ -2850,8 +3022,8 @@
\keys_define:nn {acro}
{
- case-sensitive .bool_set:N = \g__acro_case_sensitive_bool ,
- case-sensitive .initial:n = true ,
+ case-sensitive .bool_gset:N = \g__acro_case_sensitive_bool ,
+ case-sensitive .initial:n = true ,
}
% ----------------------------------------------------------------------------
@@ -3028,9 +3200,7 @@
\acro_locale:nnn {#1} {#2}
{
\__acro_write:nn {#1} {#2}
- \bool_lazy_and:nnT
- { !\acro_if_nested_p: }
- { \l__acro_include_endings_bool }
+ \bool_if:NT \l__acro_include_endings_bool
{
\acro_if_ending_form:nnF {#1} {#2}
{ \__acro_ending:nn {#1} {#2} }
@@ -3038,9 +3208,7 @@
}
}
\group_end:
- \bool_lazy_or:nnF
- { \acro_if_nested_p: }
- { \l__acro_include_endings_bool }
+ \bool_if:NF \l__acro_include_endings_bool
{
\acro_if_ending_form:nnF {#1} {#2}
{ \__acro_ending:nn {#1} {#2} }
@@ -3092,7 +3260,6 @@
{
\acro_use:n {#2}
\acro_record_page:n {#2}
- % \acro_record_barrier:n {#2}
\acro_index:n {#2}
}
}
@@ -3108,6 +3275,8 @@
\tl_new:N \l__acro_begin_command_hook_tl
\tl_new:N \l__acro_end_command_hook_tl
+\tl_new:N \l_acro_id_tl
+\tl_new:N \AcronymID
% #1: csname
% #2: xparse csname
@@ -3128,8 +3297,8 @@
\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 \AcronymID { \acro_case_insensitive:n {####1} }
\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 }
@@ -3511,10 +3680,10 @@
\cs_new_protected:Npn \acro_list_choose_set:
{
\bool_if:NTF \l__acro_list_display_all_bool
- { \seq_gset_eq:NN \g__acro_list_seq \g__acro_acronyms_seq }
+ { \seq_gset_eq:NN \g__acro_list_seq \g_acro_acronyms_seq }
{
\seq_gclear:N \g__acro_list_seq
- \seq_map_inline:Nn \g__acro_acronyms_seq
+ \seq_map_inline:Nn \g_acro_acronyms_seq
{
\acro_if_single:nTF {##1}
{
@@ -3687,8 +3856,6 @@
\AcroModule{pages}{recording and printing of pages}
% ----------------------------------------------------------------------------
% record page numbers:
-\RequirePackage {zref-abspage}
-
\msg_new:nnn {acro} {no-page-range}
{
The~ list~ template~ `#1'~ cannot~ display~ a~ page~ range.
@@ -3704,10 +3871,18 @@
\cs_new_protected:Npn \acro_record_page:n #1
{
\seq_if_in:ceF {g__acro_#1_pages_seq}
- { \arabic{abspage} @ \int_use:N \g_acro_barrier_int @ \thepage }
+ {
+ \int_use:N \g_shipout_totalpages_int
+ @ \int_use:N \g_acro_barrier_int
+ @ \thepage
+ }
{
\seq_gput_right:ce {g__acro_#1_pages_seq}
- { \arabic{abspage} @ \int_use:N \g_acro_barrier_int @ \thepage }
+ {
+ \int_use:N \g_shipout_totalpages_int
+ @ \int_use:N \g_acro_barrier_int
+ @ \thepage
+ }
}
\seq_gremove_duplicates:c {g__acro_#1_pages_seq}
\acro_at_end_document:n
@@ -3730,10 +3905,8 @@
\group_end:
-\RequirePackage {zref-totpages}
-
\acro_at_begin_document:n
- { \intarray_new:Nn \g__acro_pages_intarray { \ztotpages } }
+ { \intarray_new:Nn \g__acro_pages_intarray { \PreviousTotalPages } }
% #1: id
% #2: one page
@@ -3761,8 +3934,13 @@
{
\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
+ \use:e
+ {
+ \exp_last_unbraced:Ne
+ \__acro_page_name:w
+ { \seq_item:Nn \l__acro_tmpa_seq {1} }
+ \q_stop
+ }
}
% #1: id
@@ -3946,6 +4124,25 @@
\int_new:N \l__acro_pages_seq_threshold_int
+% ----------------------------------------------------------------------------
+\cs_new_protected:Npn \acro_dot_fill:
+ {
+ \leaders \hbox
+ {
+ $\m@th
+ \mkern \@dotsep mu
+ \hbox {.}
+ \mkern \@dotsep mu$
+ }
+ \hfill
+ }
+
+\hook_gput_code:nnn {begindocument} {xsim}
+ {
+ \cs_if_exist:NT \cftdotfill
+ { \cs_set_protected:Npn \acro_dot_fill: { \cftdotfill { \cftdotsep } } }
+ }
+
\keys_define:nn {acro/pages}
{
display .choice: ,
@@ -3967,7 +4164,7 @@
{ \int_set:Nn \l__acro_pages_seq_threshold_int {#1} } ,
seq / threshold .initial:n = 3 ,
fill .tl_set:N = \l__acro_pages_fill_tl ,
- fill .initial:n = \dotfill ,
+ fill .initial:n = \acro_dot_fill: ,
sep .tl_set:N = \l__acro_pages_sep_tl ,
sep .initial:n = {,~} ,
name .bool_set:N = \l__acro_pages_name_display_bool ,
@@ -4213,6 +4410,7 @@
% --------------------------------------------------------------------------
% hyper linking
\bool_new:N \l__acro_hyperref_use_bool
+\bool_new:N \l__acro_link_only_first_bool
\cs_new_eq:NN \__acro_hyper_target:nn \use_ii:nn
\cs_new_eq:NN \__acro_hyper_link:nn \use_ii:nn
@@ -4249,6 +4447,11 @@
{ \acro_package_if_loaded_p:n {hyperref} }
{ \l__acro_hyperref_use_bool }
{ !\acro_if_single_p:n {#1} }
+ {
+ \bool_lazy_or_p:nn
+ { !\l__acro_link_only_first_bool }
+ { \l__acro_link_only_first_bool && \acro_if_first_p:n {#1} }
+ }
}
{
\bool_if:NTF \l__acro_list_bool
@@ -4312,13 +4515,16 @@
\keys_define:nn {acro}
{
- make-links .bool_set:N = \l__acro_hyperref_use_bool ,
- make-links .initial:n = false
+ make-links .bool_set:N = \l__acro_hyperref_use_bool ,
+ make-links .initial:n = false ,
+ link-only-first .bool_set:N = \l__acro_link_only_first_bool ,
+ link-only-first .initial:n = false
}
% --------------------------------------------------------------------------
% accessibility support
\bool_new:N \l__acro_accsupp_bool
+\bool_new:N \l__acro_use_accsupp_bool
\tl_new:N \l__acro_accsupp_options_tl
\tl_new:N \l__acro_accsupp_method_tl