summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/acro/acro.sty473
-rw-r--r--Master/texmf-dist/tex/latex/acro/acro0.def1
-rw-r--r--Master/texmf-dist/tex/latex/acro/acro1.def51
3 files changed, 422 insertions, 103 deletions
diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty
index af47b4d9740..12deaec79fd 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}
\ProvidesExplPackage
{acro}
- {2013/01/29}
- {1.1a}
+ {2013/02/09}
+ {1.2}
{Typeset Acronyms}
% warning and error messages:
@@ -63,6 +63,7 @@
% boolean variables:
\bool_new:N \l__acro_mark_as_used_bool
+\bool_new:N \l__acro_mark_first_as_used_bool
\bool_new:N \l__acro_use_single_bool
\bool_new:N \l__acro_print_only_used_bool
\bool_set_true:N \l__acro_print_only_used_bool
@@ -74,6 +75,8 @@
\bool_new:N \l__acro_create_macros_bool
\bool_new:N \l__acro_xspace_bool
\bool_new:N \l__acro_first_upper_bool
+\bool_new:N \l__acro_indefinite_bool
+\bool_new:N \l__acro_upper_indefinite_bool
\bool_new:N \l__acro_sort_bool
\bool_set_true:N \l__acro_sort_bool
\bool_new:N \l__acro_capitalize_list_bool
@@ -91,7 +94,10 @@
\tl_new:N \l__acro_short_format_tl
\tl_new:N \l__acro_list_short_format_tl
\tl_new:N \l__acro_long_format_tl
+\tl_new:N \l__acro_first_long_format_tl
\tl_new:N \l__acro_list_long_format_tl
+\tl_new:N \l__acro_default_indefinite_tl
+\tl_set:Nn \l__acro_default_indefinite_tl { a }
\tl_new:N \l__acro_extra_format_tl
\tl_new:N \l__acro_first_instance_tl
\tl_set:Nn \l__acro_first_instance_tl { default }
@@ -137,11 +143,15 @@
\prop_new:N \l__acro_replace_plural_prop
\prop_new:N \l__acro_short_plural_prop
\prop_new:N \l__acro_long_plural_prop
+\prop_new:N \l__acro_short_indefinite_prop
+\prop_new:N \l__acro_long_indefinite_prop
+\prop_new:N \l__acro_alt_indefinite_prop
\prop_new:N \l__acro_long_pre_prop
\prop_new:N \l__acro_long_post_prop
\prop_new:N \l__acro_extra_prop
\prop_new:N \l__acro_format_prop
\prop_new:N \l__acro_long_format_prop
+\prop_new:N \l__acro_first_long_format_prop
\prop_new:N \l__acro_citation_prop
\prop_new:N \l__acro_citation_pre_prop
\prop_new:N \l__acro_citation_post_prop
@@ -162,6 +172,7 @@
\cs_new:Npn \__acro_first_upper_case:n #1
{ \tl_expandable_uppercase:n { \tl_head:n { #1 } } \tl_tail:n { #1 } }
+\cs_generate_variant:Nn \__acro_first_upper_case:n { x }
\cs_new_eq:NN \acro_first_upper_case:n \__acro_first_upper_case:n
@@ -207,7 +218,10 @@
\tl_set:Nn \l__acro_list_short_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 }
\tl_set:Nn \l__acro_list_long_format_tl { #1 } ,
+ first-long-format .code:n =
+ \tl_set:Nn \l__acro_first_long_format_tl { #1 } ,
list-short-format .tl_set:N = \l__acro_list_short_format_tl ,
list-long-format .tl_set:N = \l__acro_list_long_format_tl ,
extra-format .tl_set:N = \l__acro_extra_format_tl ,
@@ -228,6 +242,11 @@
list-table-width .dim_set:N = \l__acro_table_width_dim ,
hyperref .bool_set:N = \l__acro_use_hyperref_bool ,
only-used .bool_set:N = \l__acro_print_only_used_bool ,
+ mark-as-used .choice: ,
+ mark-as-used / first .code:n =
+ \bool_set_true:N \l__acro_mark_first_as_used_bool ,
+ mark-as-used / any .code:n =
+ \bool_set_false:N \l__acro_mark_first_as_used_bool ,
plural-ending .tl_set:N = \l__acro_default_plural_tl ,
list-caps .bool_set:N = \l__acro_capitalize_list_bool ,
cite .choice: ,
@@ -396,7 +415,8 @@
\AssignTemplateKeys
\bool_if:nT { !\l__acro_first_only_short_bool && !\l__acro_first_reversed_bool }
{
- \__acro_write_long:No \l__acro_long_format_tl { #3 }
+ \__acro_indefinite:nn { #1 } { long }
+ \__acro_write_long:No \l__acro_first_long_format_tl { #3 }
\tl_use:N \c_space_tl
\tl_if_blank:VF \l__acro_first_between_tl
{
@@ -407,6 +427,9 @@
\bool_if:nT
{ \l__acro_first_use_brackets_bool && !\l__acro_first_reversed_bool }
{ \tl_head:N \l__acro_first_brackets_tl }
+ \bool_if:nT
+ { \l__acro_first_reversed_bool || \l__acro_first_only_short_bool }
+ { \__acro_indefinite:nn { #1 } { short } }
\__acro_acc_supp:nn { #1 } { \__acro_write_short:n { #2 } }
\bool_if:nT
{ \l__acro_first_use_brackets_bool && !\l__acro_first_reversed_bool }
@@ -423,12 +446,13 @@
\bool_if:nT
{ \l__acro_first_use_brackets_bool && \l__acro_first_reversed_bool }
{ \tl_head:N \l__acro_first_brackets_tl }
- \__acro_write_long:No \l__acro_long_format_tl { #3 }
+ \__acro_write_long:No \l__acro_first_long_format_tl { #3 }
\bool_if:nT
{ \l__acro_first_use_brackets_bool && \l__acro_first_reversed_bool }
{ \tl_tail:N \l__acro_first_brackets_tl }
}
- \acro_after:n { #1 }
+ \__acro_cite_if:Nn \l__acro_citation_first_bool { #1 }
+ \__acro_index_if:Nn \l__acro_addto_index_bool { #1 }
}
% template for footnotes, sidenotes, ...
@@ -445,13 +469,15 @@
}
{
\AssignTemplateKeys
+ \__acro_indefinite:nn { #1 } { short }
\__acro_acc_supp:nn { #1 } { \__acro_write_short:n { #2 } }
\bool_if:NT \l__acro_use_note_bool
{
\__acro_note_command:n
{
- \__acro_write_long:No \l__acro_long_format_tl { #3 }
+ \__acro_write_long:No \l__acro_first_long_format_tl { #3 }
\__acro_cite_if:Nn \l__acro_citation_first_bool { #1 }
+ \__acro_index_if:Nn \l__acro_addto_index_bool { #1 }
}
}
}
@@ -550,7 +576,7 @@
{ punct = true, brackets = false }
% --------------------------------------------------------------------------
-% outputting the page numbers:
+% outputting the page numbers: (experimental, needs lots of improvements)
\bool_new:N \l__acro_page_punct_bool
\bool_new:N \l__acro_page_brackets_bool
\bool_new:N \l__acro_page_display_bool
@@ -564,17 +590,17 @@
\seq_new:c { g__acro_#1_pages_seq }
}
-\cs_new:Npn \acro@hyper@page #1
+\cs_new:Npn \ac@hp #1
{
- \tl_if_in:nnTF { #1 } { \acro@no@hyperpage }
+ \tl_if_in:nnTF { #1 } { \ac@no@hp }
{ #1 }
{ \acro_hyper_page:n { #1 } }
}
-\cs_new_protected:Npn \acro@no@hyperpage {}
+\cs_new_protected:Npn \ac@no@hp {}
\cs_new:Npn \__acro_safe_pages_aux:n #1
- { \noexpand \acro@hyper@page {#1}| }
+ { \noexpand \ac@hp {#1}| }
\cs_new_eq:NN \acro_hyper_page:n \use:n
@@ -598,6 +624,10 @@
\tl_new:N \l__acro_tmp_page_tl
\tl_new:N \l__acro_last_page_tl
+\tl_new:N \g__acro_current_page_style_tl
+\tl_new:N \g__acro_last_page_style_tl
+
+\bool_new:N \g__acro_know_page_style_bool
%TODO: this should be translated into expl3 syntax
\cs_new:Npn \__acro_if_is_number:nTF #1
@@ -616,86 +646,124 @@
}
\cs_generate_variant:Nn \__acro_convert_to_arabic:n { V }
-\cs_new:Npn \acro_record_page_number:n #1
+\cs_new:Npn \__acro_check_for_style:n #1
{
- \seq_if_empty:cTF { g__acro_#1_pages_seq }
- {% no pages recorded, yet
- \seq_gput_right:cx { g__acro_#1_pages_seq } { \thepage }
- \seq_gput_right:cx { g__acro_#1_tmp_seq } { \thepage }
+ \tl_if_in:xxT { \tl_to_str:V { \thepage } } { \tl_to_str:n { #1 } }
+ {
+ \tl_gset:Nn \g__acro_current_page_style_tl { #1 }
+ \bool_gset_true:N \g__acro_know_page_style_bool
}
+ }
+\cs_generate_variant:Nn \tl_if_in:nnT { xx }
+\cs_generate_variant:Nn \tl_to_str:n { V }
+
+\cs_new:Npn \acro_check_page_style:
+ {
+ \tl_gset:Nn \g__acro_current_page_style_tl { unknown }
+ \bool_gset_false:N \g__acro_know_page_style_bool
+ \__acro_check_for_style:n { roman }
+ \__acro_check_for_style:n { Roman }
+ \__acro_check_for_style:n { arabic }
+ }
+
+\cs_new:Npn \acro_record_page_number:n #1
+ {
+ \tl_gset_eq:NN \g__acro_last_page_style_tl \g__acro_current_page_style_tl
+ \acro_check_page_style:
+ \bool_if:NT \g__acro_know_page_style_bool
{
- \seq_get_right:cN { g__acro_#1_tmp_seq } \l__acro_tmp_page_tl
- \seq_get_right:cN { g__acro_#1_pages_seq } \l__acro_last_page_tl
- \tl_if_eq:NNTF \l__acro_tmp_page_tl \l__acro_last_page_tl
- {% range may have started
- \int_compare:nNnF
- { \value{page} }
- =
- { \__acro_convert_to_arabic:V \l__acro_tmp_page_tl }
- {
- \int_compare:nNnTF
- { \value{page} }
- =
- { \__acro_convert_to_arabic:V \l__acro_tmp_page_tl + 1 }
- {% range continues
- \seq_gput_right:cx { g__acro_#1_tmp_seq } { \thepage }
+ \seq_if_empty:cTF { g__acro_#1_pages_seq }
+ {% no pages recorded, yet
+ \seq_gput_right:cx { g__acro_#1_pages_seq }
+ { \use:c { \g__acro_current_page_style_tl } { page } }
+ \seq_gput_right:cx { g__acro_#1_tmp_seq }
+ { \use:c { \g__acro_current_page_style_tl } { page } }
+ }
+ {
+ \seq_get_right:cN { g__acro_#1_tmp_seq } \l__acro_tmp_page_tl
+ \seq_get_right:cN { g__acro_#1_pages_seq } \l__acro_last_page_tl
+ \tl_if_eq:NNTF \l__acro_tmp_page_tl \l__acro_last_page_tl
+ {% range may have started
+ \bool_if:nF
+ {
+ \int_compare_p:n
+ { \value{page} = \__acro_convert_to_arabic:V \l__acro_tmp_page_tl }
+ &&
+ \tl_if_eq_p:NN
+ \g__acro_last_page_style_tl
+ \g__acro_current_page_style_tl
}
- {% no range (any more)
- \seq_gput_right:cx { g__acro_#1_pages_seq } { \acro@no@hyperpage,~ }
- \seq_gclear:c { g__acro_#1_tmp_seq }
- \seq_gput_right:cx { g__acro_#1_tmp_seq } { \thepage }
- \seq_gput_right:cx { g__acro_#1_pages_seq } { \thepage }
+ {
+ \int_compare:nNnTF
+ { \value{page} }
+ =
+ { \__acro_convert_to_arabic:V \l__acro_tmp_page_tl + 1 }
+ {% range continues
+ \seq_gput_right:cx { g__acro_#1_tmp_seq }
+ { \use:c { \g__acro_current_page_style_tl } { page } }
+ }
+ {% no range (any more)
+ \seq_gput_right:cx { g__acro_#1_pages_seq } { \ac@no@hp,~ }
+ \seq_gclear:c { g__acro_#1_tmp_seq }
+ \seq_gput_right:cx { g__acro_#1_tmp_seq }
+ { \use:c { \g__acro_current_page_style_tl } { page } }
+ \seq_gput_right:cx { g__acro_#1_pages_seq }
+ { \use:c { \g__acro_current_page_style_tl } { page } }
+ }
}
}
- }
- {% we're in a range
- \int_compare:nNnF
- { \value{page} }
- =
- { \__acro_convert_to_arabic:V \l__acro_tmp_page_tl }
- {
- \int_compare:nNnTF
+ {% we're in a range
+ \int_compare:nNnF
{ \value{page} }
=
- { \__acro_convert_to_arabic:V \l__acro_tmp_page_tl + 1 }
- {% range continues
- \seq_gput_right:cx { g__acro_#1_tmp_seq } { \thepage }
- }
- {% no range (any more)
+ { \__acro_convert_to_arabic:V \l__acro_tmp_page_tl }
+ {
\int_compare:nNnTF
- { \__acro_convert_to_arabic:V \l__acro_tmp_page_tl }
+ { \value{page} }
=
- { \__acro_convert_to_arabic:V \l__acro_last_page_tl +1 }
- {
- \bool_if:NTF \l__acro_page_ranges_bool
- {
- \seq_gput_right:cn { g__acro_#1_pages_seq }
- { \acro@no@hyperpage,~ }
- \seq_gput_right:cx { g__acro_#1_pages_seq }
- { \l__acro_tmp_page_tl }
- }
- {
- \seq_gput_right:cn { g__acro_#1_pages_seq }
- { \acro@no@hyperpage\l__acro_next_page_tl }
- }
+ { \__acro_convert_to_arabic:V \l__acro_tmp_page_tl + 1 }
+ {% range continues
+ \seq_gput_right:cx { g__acro_#1_tmp_seq }
+ { \use:c { \g__acro_current_page_style_tl } { page } }
}
- {
- \bool_if:NTF \l__acro_page_ranges_bool
+ {% no range (any more)
+ \int_compare:nNnTF
+ { \__acro_convert_to_arabic:V \l__acro_tmp_page_tl }
+ =
+ { \__acro_convert_to_arabic:V \l__acro_last_page_tl +1 }
{
- \seq_gput_right:cn { g__acro_#1_pages_seq }
- { \acro@no@hyperpage-- }
- \seq_gput_right:cx { g__acro_#1_pages_seq }
- { \l__acro_tmp_page_tl }
+ \bool_if:NTF \l__acro_page_ranges_bool
+ {
+ \seq_gput_right:cn { g__acro_#1_pages_seq }
+ { \ac@no@hp,~ }
+ \seq_gput_right:cx { g__acro_#1_pages_seq }
+ { \l__acro_tmp_page_tl }
+ }
+ {
+ \seq_gput_right:cn { g__acro_#1_pages_seq }
+ { \ac@no@hp\l__acro_next_page_tl }
+ }
}
{
- \seq_gput_right:cn { g__acro_#1_pages_seq }
- { \acro@no@hyperpage\l__acro_next_pages_tl }
+ \bool_if:NTF \l__acro_page_ranges_bool
+ {
+ \seq_gput_right:cn { g__acro_#1_pages_seq }
+ { \ac@no@hp-- }
+ \seq_gput_right:cx { g__acro_#1_pages_seq }
+ { \l__acro_tmp_page_tl }
+ }
+ {
+ \seq_gput_right:cn { g__acro_#1_pages_seq }
+ { \ac@no@hp\l__acro_next_pages_tl }
+ }
}
+ \seq_gclear:c { g__acro_#1_tmp_seq }
+ \seq_gput_right:cx { g__acro_#1_tmp_seq }
+ { \use:c { \g__acro_current_page_style_tl } { page } }
+ \seq_gput_right:cn { g__acro_#1_pages_seq } { \ac@no@hp,~ }
+ \seq_gput_right:cx { g__acro_#1_pages_seq }
+ { \use:c { \g__acro_current_page_style_tl } { page } }
}
- \seq_gclear:c { g__acro_#1_tmp_seq }
- \seq_gput_right:cx { g__acro_#1_tmp_seq } { \thepage }
- \seq_gput_right:cn { g__acro_#1_pages_seq } { \acro@no@hyperpage,~ }
- \seq_gput_right:cx { g__acro_#1_pages_seq } { \thepage }
}
}
}
@@ -716,26 +784,26 @@
\bool_if:NTF \l__acro_page_ranges_bool
{
\seq_gput_right:cn { g__acro_#1_pages_seq }
- { \acro@no@hyperpage,~ }
+ { \ac@no@hp,~ }
\seq_gput_right:cx { g__acro_#1_pages_seq }
{ \l__acro_tmp_page_tl }
}
{
\seq_gput_right:cn { g__acro_#1_pages_seq }
- { \acro@no@hyperpage\l__acro_next_page_tl }
+ { \ac@no@hp\l__acro_next_page_tl }
}
}
{
\bool_if:NTF \l__acro_page_ranges_bool
{
\seq_gput_right:cn { g__acro_#1_pages_seq }
- { \acro@no@hyperpage-- }
+ { \ac@no@hp-- }
\seq_gput_right:cx { g__acro_#1_pages_seq }
{ \l__acro_tmp_page_tl }
}
{
\seq_gput_right:cn { g__acro_#1_pages_seq }
- { \acro@no@hyperpage\l__acro_next_pages_tl }
+ { \ac@no@hp\l__acro_next_pages_tl }
}
}
}
@@ -883,7 +951,7 @@
{
\clist_map_inline:nn { #2 }
{
- \prop_get:NnN \l__acro_class_prop { #1 } \l__acro_tmpa_tl
+ \prop_get:NnNF \l__acro_class_prop { #1 } \l__acro_tmpa_tl {}
\tl_if_eq:nVT { ##1 } \l__acro_tmpa_tl
{ \bool_set_true:N \l__acro_is_excluded_bool }
}
@@ -1178,6 +1246,7 @@
\acro_is_used:nTF { #1 }
{
% this is not the first time
+ \__acro_indefinite:nn { #1 } { short }
\__acro_acc_supp:nn
{ #1 }
{ \__acro_write_short:V \l__acro_short_tl }
@@ -1185,8 +1254,12 @@
}
{
% this is the first time
+ \bool_gset_true:c { g__acro_#1_first_use_bool }
\__acro_is_single:nTF { #1 }
- { \__acro_write_long:NV \l__acro_long_format_tl \l__acro_long_tl }
+ {
+ \__acro_indefinite:nn { #1 } { long }
+ \__acro_write_long:NV \l__acro_long_format_tl \l__acro_long_tl
+ }
{
\UseInstance { acro-first } { \l__acro_first_instance_tl }
{ #1 }
@@ -1218,17 +1291,22 @@
\cs_new:Npn \acro_get:n #1
{
+ \acro_defined:n { #1 }
\__acro_activate_hyperref_support:
- \prop_get:NnN \l__acro_short_prop { #1 } \l__acro_tmpa_tl
+ \prop_get:NnNF \l__acro_short_prop { #1 } \l__acro_tmpa_tl {}
\__acro_make_link:nNN { #1 } \l__acro_short_tl \l__acro_tmpa_tl
- \prop_get:NnN \l__acro_short_plural_prop { #1 } \l__acro_short_plural_tl
- \prop_get:NnN \l__acro_long_prop { #1 } \l__acro_long_tl
- \prop_get:NnNTF \l__acro_long_format_prop { #1 } \l__acro_custom_long_format_tl
+ \prop_get:NnNF \l__acro_short_plural_prop { #1 } \l__acro_short_plural_tl {}
+ \prop_get:NnNF \l__acro_long_prop { #1 } \l__acro_long_tl {}
+ \prop_get:NnNTF \l__acro_long_format_prop { #1 }
+ \l__acro_custom_long_format_tl
{ \bool_set_true:N \l__acro_custom_long_format_bool }
{ \bool_set_false:N \l__acro_custom_long_format_bool }
+ \prop_get:NnNF \l__acro_first_long_format_prop { #1 }
+ \l__acro_first_long_format_tl
+ {}% to avoid hanging compilation if first-long-format hasn't been set
\prop_get:NnNT \l__acro_long_pre_prop { #1 } \l__acro_long_pre_tl
{ \tl_put_left:NV \l__acro_long_tl \l__acro_long_pre_tl }
- \prop_get:NnN \l__acro_alt_prop { #1 } \l__acro_tmpb_tl
+ \prop_get:NnNF \l__acro_alt_prop { #1 } \l__acro_tmpb_tl {}
\__acro_make_link:nNN { #1 } \l__acro_alt_tl \l__acro_tmpb_tl
\prop_get:NnNTF \l__acro_format_prop { #1 } \l__acro_custom_format_tl
{ \bool_set_true:N \l__acro_custom_format_bool }
@@ -1245,7 +1323,7 @@
\bool_if:NT \l__acro_use_plural_bool
{
\bool_if:nTF { \prop_get:Nn \l__acro_replace_plural_prop { #1 } }
- { \prop_get:NnN \l__acro_long_plural_prop { #1 } \l__acro_long_tl }
+ { \prop_get:NnNF \l__acro_long_plural_prop { #1 } \l__acro_long_tl {} }
{
\tl_put_right:Nn \l__acro_long_tl
{ \prop_get:Nn \l__acro_long_plural_prop { #1 } }
@@ -1258,7 +1336,18 @@
% style for that:
\cs_new:Npn \acro_is_used:nTF #1#2#3
{
- \bool_if:cTF { g__acro_#1_used_bool }
+ \bool_if:nTF
+ {
+ \bool_if_p:c { g__acro_#1_used_bool } &&
+ (
+ (
+ \bool_if_p:c { g__acro_#1_first_use_bool } &&
+ \l__acro_mark_first_as_used_bool
+ )
+ ||
+ ! \l__acro_mark_first_as_used_bool
+ )
+ }
{ \iow_now:Nx \@auxout { \string \acro@used@twice { #1 } } #2 }
{
\iow_now:Nx \@auxout { \string \acro@used@once { #1 } }
@@ -1309,6 +1398,7 @@
{
\acro_get:n { #1 }
\acro_is_used:n { #1 }
+ \__acro_indefinite:nn { #1 } { short }
\__acro_is_single:nT { #1 }
{ \cs_set_eq:NN \acro_hyper_link:nn \use_ii:nn }
\__acro_acc_supp:nn
@@ -1322,6 +1412,7 @@
{
\acro_get:n { #1 }
\acro_is_used:n { #1 }
+ \__acro_indefinite:nn { #1 } { alt }
\__acro_is_single:nT { #1 }
{ \cs_set_eq:NN \acro_hyper_link:nn \use_ii:nn }
\__acro_acc_supp:nn
@@ -1335,6 +1426,7 @@
{
\acro_get:n { #1 }
\acro_is_used:n { #1 }
+ \__acro_indefinite:nn { #1 } { long }
\__acro_is_single:nT { #1 }
{ \cs_set_eq:NN \acro_hyper_link:nn \use_ii:nn }
\__acro_write_long:NV \l__acro_long_format_tl \l__acro_long_tl
@@ -1344,6 +1436,7 @@
% output like the first time:
\cs_new:Npn \acro_first:n #1
{
+ \bool_gset_true:c { g__acro_#1_first_use_bool }
\acro_get:n { #1 }
\acro_is_used:n { #1 }
\__acro_is_single:nT { #1 }
@@ -1354,6 +1447,20 @@
{ \l__acro_long_tl }
}
+% output like the first time with own long version:
+\cs_new:Npn \acro_first_like:nn #1#2
+ {
+ \bool_gset_true:c { g__acro_#1_first_use_bool }
+ \acro_get:n { #1 }
+ \acro_is_used:n { #1 }
+ \__acro_is_single:nT { #1 }
+ { \cs_set_eq:NN \acro_hyper_link:nn \use_ii:nn }
+ \UseInstance { acro-first } { \l__acro_first_instance_tl }
+ { #1 }
+ { \l__acro_short_tl }
+ { #2 }
+ }
+
% ----------------------------------------------------------------------------
% citations:
% #1 pre
@@ -1412,8 +1519,8 @@
% #4: replace
\cs_new:Npn \__acro_index:nnnn #1#2#3#4
{
- \prop_get:NnN \l__acro_short_prop { #2 } \l__acro_tmpa_tl
- \prop_get:NnN \l__acro_format_prop { #2 } \l__acro_tmpb_tl
+ \prop_get:NnNF \l__acro_short_prop { #2 } \l__acro_tmpa_tl {}
+ \prop_get:NnNF \l__acro_format_prop { #2 } \l__acro_tmpb_tl {}
\quark_if_no_value:VTF \l__acro_tmpb_tl
{ \tl_set:Nn \l__acro_tmpc_tl { \l__acro_short_format_tl \l__acro_tmpa_tl } }
{ \tl_set:Nn \l__acro_tmpc_tl { \l__acro_tmpb_tl \l__acro_tmpa_tl } }
@@ -1451,7 +1558,7 @@
\cs_set:Npn \__acro_acc_supp:nn #1#2
{
\prop_get:NnNF \l__acro_acc_supp_prop { #1 } \l__acro_acc_supp_tl
- { \prop_get:NnN \l__acro_short_prop { #1 } \l__acro_acc_supp_tl }
+ { \prop_get:NnNF \l__acro_short_prop { #1 } \l__acro_acc_supp_tl {} }
\bool_if:NT \l__acro_use_plural_bool
{ \tl_put_right:NV \l__acro_acc_supp_tl \l__acro_short_plural_tl }
\__acro_acc_supp_aux:Vn \l__acro_acc_supp_tl { #2 }
@@ -1460,6 +1567,19 @@
}
% --------------------------------------------------------------------------
+% indefinite articles:
+\cs_new_protected:Npn \__acro_indefinite:nn #1#2
+ {
+ \bool_if:NT \l__acro_indefinite_bool
+ { \prop_get:cn { l__acro_#2_indefinite_prop } { #1 } ~ }
+ \bool_if:NT \l__acro_upper_indefinite_bool
+ {
+ \__acro_first_upper_case:x
+ { \prop_get:cn { l__acro_#2_indefinite_prop } { #1 } } ~
+ }
+ }
+
+% --------------------------------------------------------------------------
% experimental sorting feature:
\AtBeginDocument
{
@@ -1487,7 +1607,7 @@
\seq_map_inline:Nn \l__acro_tmpa_seq
{
% get ID:
- \prop_get:NnN \l__acro_tmpa_prop { ##1 } \l__acro_tmpa_tl
+ \prop_get:NnNF \l__acro_tmpa_prop { ##1 } \l__acro_tmpa_tl {}
% get prop entry of ID in #1:
\prop_get:NVNT #1 \l__acro_tmpa_tl \l__acro_tmpb_tl
{
@@ -1528,6 +1648,26 @@
\group_end:
}
+\NewDocumentCommand \iac { sm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_indefinite_bool
+ \acro_use:n { #2 }
+ \group_end:
+ }
+
+\NewDocumentCommand \Iac { sm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_upper_indefinite_bool
+ \acro_use:n { #2 }
+ \group_end:
+ }
+
\NewDocumentCommand \Ac { sm }
{
\group_begin:
@@ -1569,6 +1709,26 @@
\group_end:
}
+\NewDocumentCommand \iacs { sm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_indefinite_bool
+ \acro_short:n { #2 }
+ \group_end:
+ }
+
+\NewDocumentCommand \Iacs { sm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_upper_indefinite_bool
+ \acro_short:n { #2 }
+ \group_end:
+ }
+
\NewDocumentCommand \acsp { sm }
{
\group_begin:
@@ -1589,6 +1749,26 @@
\group_end:
}
+\NewDocumentCommand \iaca { sm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_indefinite_bool
+ \acro_alt:n { #2 }
+ \group_end:
+ }
+
+\NewDocumentCommand \Iaca { sm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_upper_indefinite_bool
+ \acro_alt:n { #2 }
+ \group_end:
+ }
+
\NewDocumentCommand \acap { sm }
{
\group_begin:
@@ -1609,6 +1789,26 @@
\group_end:
}
+\NewDocumentCommand \iacl { sm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_indefinite_bool
+ \acro_long:n { #2 }
+ \group_end:
+ }
+
+\NewDocumentCommand \Iacl { sm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_upper_indefinite_bool
+ \acro_long:n { #2 }
+ \group_end:
+ }
+
\NewDocumentCommand \Acl { sm }
{
\group_begin:
@@ -1650,6 +1850,26 @@
\group_end:
}
+\NewDocumentCommand \iacf { sm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_indefinite_bool
+ \acro_first:n { #2 }
+ \group_end:
+ }
+
+\NewDocumentCommand \Iacf { sm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_upper_indefinite_bool
+ \acro_first:n { #2 }
+ \group_end:
+ }
+
\NewDocumentCommand \Acf { sm }
{
\group_begin:
@@ -1681,14 +1901,58 @@
\group_end:
}
+% first-like:
+\NewDocumentCommand \acflike { smm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \acro_first_like:nn { #2 } { #3 }
+ \group_end:
+ }
+
+\NewDocumentCommand \iacflike { smm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_indefinite_bool
+ \acro_first_like:nn { #2 } { #3 }
+ \group_end:
+ }
+
+\NewDocumentCommand \Iacflike { smm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_upper_indefinite_bool
+ \acro_first_like:nn { #2 } { #3 }
+ \group_end:
+ }
+
+\NewDocumentCommand \acfplike { smm }
+ {
+ \group_begin:
+ \acro_defined:n { #2 }
+ \acro_use_if:nn { #1 } { #2 }
+ \bool_set_true:N \l__acro_use_plural_bool
+ \acro_first_like:nn { #2 } { #3 }
+ \group_end:
+ }
+
% reset outputs, they'll behave like the first time again (!not like the _only_
% time!):
\cs_new:Npn \acro_reset:n #1
- { \bool_gset_false:c { g__acro_#1_used_bool } }
+ {
+ \bool_gset_false:c { g__acro_#1_used_bool }
+ \bool_gset_false:c { g__acro_#1_first_use_bool }
+ }
\cs_new:Npn \acro_mark_as_used:n #1
{
\bool_gset_true:c { g__acro_#1_used_bool }
+ \bool_gset_true:c { g__acro_#1_first_use_bool }
\acro@used@once { #1 }
}
@@ -1705,13 +1969,13 @@
{ \acro_mark_all_as_used: }
\NewDocumentCommand \acreset { > { \SplitList { , } } m }
- { \ProcessList { #1 } { \acro_reset:n } }
+ { \ProcessList { #1 } { \acro_reset:n } \ignorespaces }
\NewDocumentCommand \acuse { > { \SplitList { , } } m }
- { \ProcessList { #1 } { \acro_mark_as_used:n } }
-
-
+ { \ProcessList { #1 } { \acro_mark_as_used:n } \ignorespaces }
+% ---------------------------------------------------------------------------
+% process options:
\ProcessKeysOptions { acro }
% ---------------------------------------------------------------------------
@@ -1861,18 +2125,23 @@
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
% --------------------------------------------------------------------------
% TODO:
- Option `totoc'!?
-- Optionen `list-header = addsec|addchap' (acro-title instance)
-- acro-first instance `none', die nur die Kurzform verwendet
-- Option `list-short-format'
-
- revise list styles to allow _full_ customization by creating own instances!
this probably needs a handfull of macros that give access to the entries
without worrying about internals
- record and list _all_ pagenumbers where an acronym occurs
-- compilation halts instead of throwing an error if an undefined acronym is used
- add \ACF, \ACFP, \ACL and \ACLP that will print all words of the long form
capitalized \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/acro/acro0.def b/Master/texmf-dist/tex/latex/acro/acro0.def
index 673a6d2a164..ddca2627df6 100644
--- a/Master/texmf-dist/tex/latex/acro/acro0.def
+++ b/Master/texmf-dist/tex/latex/acro/acro0.def
@@ -72,6 +72,7 @@
{ \prop_put:Nnn \l__acro_class_prop { #2 } { #8 } }
\IfNoValueF { #9 }
{ \prop_put:Nnn \l__acro_extra_prop { #2 } { #9 } }
+ \bool_new:c { g__acro_#2_first_use_bool }
\bool_new:c { g__acro_#2_used_bool }
\bool_new:c { g__acro_#2_label_bool }
\bool_if:NT \l__acro_create_macros_bool
diff --git a/Master/texmf-dist/tex/latex/acro/acro1.def b/Master/texmf-dist/tex/latex/acro/acro1.def
index f585cadbf5d..bbb7d992daf 100644
--- a/Master/texmf-dist/tex/latex/acro/acro1.def
+++ b/Master/texmf-dist/tex/latex/acro/acro1.def
@@ -94,6 +94,10 @@
\prop_put:Nnx \l__acro_pdfstring_prop { #1 } { \exp_not:n { #2 } }
\prop_put:Nnn \l__acro_short_plural_prop
{ #1 } { \l__acro_default_plural_tl }
+ \prop_put:Nnx \l__acro_short_indefinite_prop
+ { #1 } { \l__acro_default_indefinite_tl }
+ \prop_put:Nnx \l__acro_alt_indefinite_prop
+ { #1 } { \l__acro_default_indefinite_tl }
\prop_put:Nnx \l__acro_pdfstring_plural_prop
{ #1 } { \exp_not:n { #2 } \exp_not:V \l__acro_default_plural_tl }
}
@@ -112,6 +116,8 @@
\__acro_key_check:nn { #1 } { long }
\prop_put:Nnn \l__acro_replace_plural_prop { #1 } { \c_false_bool }
\prop_put:Nnn \l__acro_long_prop { #1 } { #2 }
+ \prop_put:Nnx \l__acro_long_indefinite_prop
+ { #1 } { \l__acro_default_indefinite_tl }
\bool_if:cF { l__acro_#1_long-plural_set_bool }
{
\prop_put:Nnn \l__acro_long_plural_prop
@@ -138,6 +144,22 @@
}
\cs_generate_variant:Nn \__acro_declare_long_plural_form:nn { V }
+% short indefinite article:
+\cs_new:Npn \__acro_declare_short_indefinite:nn #1#2
+ {
+ \__acro_key_check:nn { #1 } { short-indefinite }
+ \prop_put:Nnn \l__acro_short_indefinite_prop { #1 } { #2 }
+ }
+\cs_generate_variant:Nn \__acro_declare_short_indefinite:nn { V }
+
+% long indefinite article:
+\cs_new:Npn \__acro_declare_long_indefinite:nn #1#2
+ {
+ \__acro_key_check:nn { #1 } { long-indefinite }
+ \prop_put:Nnn \l__acro_long_indefinite_prop { #1 } { #2 }
+ }
+\cs_generate_variant:Nn \__acro_declare_long_indefinite:nn { V }
+
% pre long:
\cs_new:Npn \__acro_declare_long_pre:nn #1#2
{
@@ -169,9 +191,19 @@
{
\__acro_key_check:nn { #1 } { alt }
\prop_put:Nnn \l__acro_alt_prop { #1 } { #2 }
+ \prop_put:Nnx \l__acro_alt_indefinite_prop
+ { #1 } { \l__acro_default_indefinite_tl }
}
\cs_generate_variant:Nn \__acro_declare_alt:nn { V }
+% alt. indefinite article:
+\cs_new:Npn \__acro_declare_alt_indefinite:nn #1#2
+ {
+ \__acro_key_check:nn { #1 } { alt-indefinite }
+ \prop_put:Nnn \l__acro_alt_indefinite_prop { #1 } { #2 }
+ }
+\cs_generate_variant:Nn \__acro_declare_alt_indefinite:nn { V }
+
% format:
\cs_new:Npn \__acro_declare_format:nn #1#2
{
@@ -180,7 +212,7 @@
}
\cs_generate_variant:Nn \__acro_declare_format:nn { V }
-% format:
+% long format:
\cs_new:Npn \__acro_declare_long_format:nn #1#2
{
\__acro_key_check:nn { #1 } { long-format }
@@ -188,6 +220,14 @@
}
\cs_generate_variant:Nn \__acro_declare_long_format:nn { V }
+% first long format:
+\cs_new:Npn \__acro_declare_first_long_format:nn #1#2
+ {
+ \__acro_key_check:nn { #1 } { first-long-format }
+ \prop_put:Nnn \l__acro_first_long_format_prop { #1 } { #2 }
+ }
+\cs_generate_variant:Nn \__acro_declare_first_long_format:nn { V }
+
% pdfstring:
\cs_new:Npn \__acro_declare_pdfstring:nw #1#2/#3/#4 \acro_stop:
{
@@ -310,6 +350,12 @@
\__acro_declare_long_plural:Vn \l__acro_current_key_tl { #1 } ,
long-plural-form .code:n =
\__acro_declare_long_plural_form:Vn \l__acro_current_key_tl { #1 } ,
+ short-indefinite .code:n =
+ \__acro_declare_short_indefinite:Vn \l__acro_current_key_tl { #1 } ,
+ alt-indefinite .code:n =
+ \__acro_declare_alt_indefinite:Vn \l__acro_current_key_tl { #1 } ,
+ long-indefinite .code:n =
+ \__acro_declare_long_indefinite:Vn \l__acro_current_key_tl { #1 } ,
long-pre .code:n =
\__acro_declare_long_pre:Vn \l__acro_current_key_tl { #1 } ,
long-post .code:n =
@@ -324,6 +370,8 @@
\__acro_declare_format:Vn \l__acro_current_key_tl { #1 } ,
long-format .code:n =
\__acro_declare_long_format:Vn \l__acro_current_key_tl { #1 } ,
+ first-long-format .code:n =
+ \__acro_declare_first_long_format:Vn \l__acro_current_key_tl { #1 } ,
class .code:n =
\__acro_declare_class:Vn \l__acro_current_key_tl { #1 } ,
cite .code:n =
@@ -359,6 +407,7 @@
{
\tl_set:Nn \l__acro_current_key_tl { #1 }
\keys_set:nn { acro / declare-acronym } { #2 }
+ \bool_new:c { g__acro_#1_first_use_bool }
\bool_new:c { g__acro_#1_used_bool }
\bool_new:c { g__acro_#1_label_bool }
\acro_create_page_records:n { #1 }