diff options
author | Karl Berry <karl@freefriends.org> | 2016-04-14 21:45:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-04-14 21:45:42 +0000 |
commit | 75abca078467cf614b05107058c1255f20163316 (patch) | |
tree | d74414841883c49b363fecca5e43e70de1408195 | |
parent | a4e3ac91784ab034090726ebb9a8718be0bdc7b6 (diff) |
acro (14apr16)
git-svn-id: svn://tug.org/texlive/trunk@40521 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 | 550009 -> 549940 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/acro/acro_en.tex | 28 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/acro/acro.sty | 275 |
4 files changed, 194 insertions, 113 deletions
diff --git a/Master/texmf-dist/doc/latex/acro/README b/Master/texmf-dist/doc/latex/acro/README index 3bd7c774078..73d5cdf19c1 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.4 +the ACRO package v2.4a Typeset Acronyms -2016/03/25 +2016/04/14 -------------------------------------------------------------------------- Clemens Niederberger Web: http://www.mychemistry.eu/forums/forum/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 c3d29648871..fdfd3efd540 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 f9a0ac9cb5c..2c0611a7894 100644 --- a/Master/texmf-dist/doc/latex/acro/acro_en.tex +++ b/Master/texmf-dist/doc/latex/acro/acro_en.tex @@ -465,8 +465,7 @@ documentation. \sinceversion{2.3}the format used for the acronym if the acronym is only used a single time. %% first-style - \keychoice{first-style}{default,plain,empty,square,short,reversed,plain-reversed,% - footnote,sidenote} + \keychoice{first-style}{default,empty,square,short,long,reversed,footnote,sidenote} \sinceversion{2.3}the style of the first appearance of the acronym, see also section~\ref{sec:opti-regard-acronyms}. %% pdfstring @@ -1250,8 +1249,8 @@ possible output forms of the acronyms. \keyval{extra-format}{format}\Default The same for the extra information. %% - \keychoice{first-style}{default,plain,empty,square,short,reversed,plain-reversed,% - footnote,sidenote}\Default{default} + \keychoice{first-style}{default,empty,square,short,long,reversed,footnote,sidenote}% + \Default{default} \changedversion{1.1}The basic style of the first appearance of an acronym. The value \code{sidenote} needs the command \cs*{sidenote} to be defined for example by the \pkg*{sidenotes} package. @@ -1267,19 +1266,17 @@ possible output forms of the acronyms. % (Keep in mind that we're in % a minipage here!) \acsetup{first-style=empty} - \acf{ny} \\ + empty: \acf{ny} \\ \acsetup{first-style=footnote} - \acf{ny} \\ + footnote: \acf{ny} \\ \acsetup{first-style=square} - \acf{ny} \\ + square: \acf{ny} \\ \acsetup{first-style=short} - \acf{ny} \\ + short: \acf{ny} \\ + \acsetup{first-style=long} + long: \acf{ny} \\ \acsetup{first-style=reversed} - \acf{ny} \\ - \acsetup{first-style=plain} - \acf{ny} \\ - \acsetup{first-style=plain-reversed} - \acf{ny} + reversed: \acf{ny} \end{example} \subsection{Options Regarding the List} @@ -1754,7 +1751,7 @@ section~\vref{sec:defining-own-acronym} for adding support for possessive forms: \begin{example} \ExplSyntaxOn - % this now only works because I've use the same already in the preamble so + % this now only works because I've used the same already in the preamble so % it does nothing here: \ProvideAcroEnding {possessive} {'s} {'s} @@ -1933,8 +1930,7 @@ If\sinceversion{2.2} you repeatedly have the same setup and definitions for \acro\ in your preamble you might want to place those in a configuration file. If \acro\ finds a file named \code{acro.cfg} present it inputs it at the end of the package. The only thing to be aware of is that this file is input like -a package which means that \code{@} is treated as a letterhas (category -code~12). +a package which means that \code{@} is treated as a letter (category code~11). \appendix diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty index d646a937712..93db29db068 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,l3sort,xparse,l3keys2e,xtemplate,etoolbox} \ProvidesExplPackage {acro} - {2016/03/25} - {2.4} + {2016/04/14} + {2.4a} {Typeset Acronyms} % -------------------------------------------------------------------------- @@ -213,6 +213,7 @@ \bool_new:N \l__acro_new_page_numbering_bool \bool_new:N \l__acro_first_use_brackets_bool \bool_new:N \l__acro_first_only_short_bool +\bool_new:N \l__acro_first_only_long_bool \bool_new:N \l__acro_first_reversed_bool \bool_new:N \l__acro_use_note_bool \bool_new:N \l__acro_extra_punct_bool @@ -500,7 +501,10 @@ % objects with three arguments: \cs_new_protected:Npn \acro_first_instance:nnnn #1#2#3#4 - { \UseInstance {acro-first} {#1} {#2} {#3} {#4} } + { + \acro_if_defined:nT {#2} + { \UseInstance {acro-first} {#1} {#2} {#3} {#4} } + } \cs_generate_variant:Nn \acro_first_instance:nnnn {VnV,VnVV} % -------------------------------------------------------------------------- @@ -576,6 +580,7 @@ brackets : boolean = true , brackets-type : tokenlist = () , only-short : boolean = false , + only-long : boolean = false , reversed : boolean = false , between : tokenlist , foreign-sep : tokenlist = { , ~ } @@ -585,76 +590,128 @@ brackets = \l__acro_first_use_brackets_bool , brackets-type = \l__acro_first_brackets_tl , only-short = \l__acro_first_only_short_bool , + only-long = \l__acro_first_only_long_bool , reversed = \l__acro_first_reversed_bool , between = \l__acro_first_between_tl , foreign-sep = \l__acro_foreign_sep_tl } { \AssignTemplateKeys - \bool_if:nT { !\l__acro_first_only_short_bool && !\l__acro_first_reversed_bool } - { - \acro_write_indefinite:nn {#1} {long} - \acro_write_expanded:nnn {#1} {first-long} {#3} - \acro_space: - \tl_if_blank:VF \l__acro_first_between_tl + \bool_if:NTF \l__acro_first_reversed_bool + { % zuerst kurze Form, dann lange Form: + \bool_if:NF \l__acro_first_only_long_bool { - \tl_use:N \l__acro_first_between_tl - \acro_space: + \acro_write_indefinite:nn {#1} {short} + \group_begin: + \acro_for_all_trailing_tokens_do:n + { \acro_deactivate_trailing_action:n {##1} } + \acro_write_compact:nn {#1} {short} + \group_end: + \bool_if:NF \l__acro_first_only_short_bool + { + \acro_space: + \tl_if_blank:VF \l__acro_first_between_tl + { + \tl_use:N \l__acro_first_between_tl + \acro_space: + } + } } + % öffnende Klammer: + \bool_if:nT + { + \l__acro_first_use_brackets_bool && + !\l__acro_first_only_short_bool && + !\l__acro_first_only_long_bool + } + { \tl_head:N \l__acro_first_brackets_tl } + % fremdsprachige Form: + \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_if_foreign:nT {#1} { \tl_use:N \l__acro_foreign_sep_tl } + } + % Artikel der Langform und Langform: + \bool_if:NF \l__acro_first_only_short_bool + { + \acro_write_indefinite:nn {#1} {long} + \acro_write_expanded:nnn {#1} {first-long} {#3} + } + % Zitat: + \bool_if:NT \l__acro_group_citation_bool + { \acro_group_cite:n {#1} } + % schließende Klammer: + \bool_if:nT + { + \l__acro_first_use_brackets_bool && + !\l__acro_first_only_short_bool && + !\l__acro_first_only_long_bool + } + { \tl_tail:N \l__acro_first_brackets_tl } } - \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_foreign_bool && - !\l__acro_first_reversed_bool && - !\l__acro_first_only_short_bool - } - { - \acro_write_foreign:n {#1} - \acro_if_foreign:nT {#1} { \tl_use:N \l__acro_foreign_sep_tl } - } - \bool_if:nT - { \l__acro_first_reversed_bool || \l__acro_first_only_short_bool } - { \acro_write_indefinite:nn {#1} {short} } - \group_begin: - \bool_if:nT - { !\l__acro_first_reversed_bool && !\l__acro_first_only_short_bool } - { - \prop_map_inline:Nn \l__acro_trailing_tokens_prop - { \acro_deactivate_trailing_action:n {##1} } - } - \acro_write_compact:nn {#1} {short} - \group_end: - \bool_if:nT - { \l__acro_group_citation_bool && !\l__acro_first_reversed_bool } - { \acro_group_cite:n {#1} } - \bool_if:nT - { \l__acro_first_use_brackets_bool && !\l__acro_first_reversed_bool } - { \tl_tail:N \l__acro_first_brackets_tl } - \bool_if:NT \l__acro_first_reversed_bool - { + { % zuerst lange Form, dann kurze Form: + % Artikel + lange Form: \bool_if:NF \l__acro_first_only_short_bool { - \tl_if_blank:VF \l__acro_first_between_tl + \acro_write_indefinite:nn {#1} {long} + \acro_write_expanded:nnn {#1} {first-long} {#3} + \bool_if:NF \l__acro_first_only_long_bool { - \tl_use:N \c_space_tl - \tl_use:N \l__acro_first_between_tl + \acro_space: + \tl_if_blank:VF \l__acro_first_between_tl + { + \tl_use:N \l__acro_first_between_tl + \acro_space: + } } - \tl_use:N \c_space_tl - \bool_if:NT \l__acro_first_use_brackets_bool - { \tl_head:N \l__acro_first_brackets_tl } - \acro_write_long:Vo \l__acro_first_long_format_tl {#3} - \acro_if_foreign:nT {#1} - { \acroenparen { \acro_write_foreign:n {#1} } } } + % öffnende Klammer: + \bool_if:nT + { + \l__acro_first_use_brackets_bool && + !\l__acro_first_only_short_bool && + !\l__acro_first_only_long_bool + } + { \tl_head:N \l__acro_first_brackets_tl } + % fremdsprachige Form: + \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_if_foreign:nT {#1} { \tl_use:N \l__acro_foreign_sep_tl } + } + % Artikel der Kurzform und Kurzform: + \bool_if:NF \l__acro_first_only_long_bool + { + \acro_write_indefinite:nn {#1} {short} + \group_begin: + \acro_for_all_trailing_tokens_do:n + { \acro_deactivate_trailing_action:n {##1} } + \acro_write_compact:nn {#1} {short} + \group_end: + } + % Zitat: \bool_if:NT \l__acro_group_citation_bool { \acro_group_cite:n {#1} } + % schließende Klammer: \bool_if:nT - { \l__acro_first_use_brackets_bool && !\l__acro_first_only_short_bool } + { + \l__acro_first_use_brackets_bool && + !\l__acro_first_only_short_bool && + !\l__acro_first_only_long_bool + } { \tl_tail:N \l__acro_first_brackets_tl } } + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \bool_if:NF \l__acro_group_citation_bool { \acro_cite_if:Nn \l__acro_citation_first_bool {#1} } \acro_index_if:Nn \l__acro_addto_index_bool {#1} @@ -738,6 +795,13 @@ brackets = false } \DeclareInstance {acro-first} + { long } + { inline } + { + only-long = true , + brackets = false + } +\DeclareInstance {acro-first} { reversed } { inline } { reversed = true } @@ -1608,9 +1672,18 @@ % -------------------------------------------------------------------------- % some helpers we'll need more often: +\seq_new:N \g__acro_declared_acronyms_seq + +\prg_new_conditional:Npnn \acro_if_defined:n #1 {p,T,F,TF} + { + \seq_if_in:NnTF \g__acro_declared_acronyms_seq {#1} + { \prg_return_true: } + { \prg_return_false: } + } + \cs_new_protected:Npn \acro_defined:n #1 { - \prop_if_in:NnF \l__acro_short_prop {#1} + \acro_if_defined:nF {#1} { \acro_serious_message:nn {undefined} {#1} } } @@ -2578,10 +2651,13 @@ { \acro_activate_trailing_action:n {#2} } \acro_new_trailing_token:n {#2} } - + \NewDocumentCommand \AcroRegisterTrailing {mm} { \acro_register_trailing_token:Nn #1 {#2} } +\cs_new_protected:Npn \acro_for_all_trailing_tokens_do:n #1 + { \prop_map_inline:Nn \l__acro_trailing_tokens_prop {#1} } + % activate a token: \cs_new_protected:Npn \acro_activate_trailing_token:n #1 { @@ -3528,6 +3604,7 @@ % internal acronym declaring function: \cs_new_protected:Npn \acro_declare_acronym:nn #1#2 { + \seq_gput_right:Nn \g__acro_declared_acronyms_seq {#1} \bool_gset_true:N \g__acro_first_acronym_declared_bool \tl_set:Nn \l__acro_current_key_tl {#1} \keys_set:nn { acro / declare-acronym } {#2} @@ -3605,44 +3682,50 @@ % -------------------------------------------------------------------------- % language support -\RequirePackage { translations } -% Listenname -\DeclareTranslationFallback { acronym-list-name } { Acronyms } -\DeclareTranslation { English } { acronym-list-name } { Acronyms } -\DeclareTranslation { American } { acronym-list-name } { Acronyms } -\DeclareTranslation { British } { acronym-list-name } { Acronyms } -\DeclareTranslation { French } { acronym-list-name } { Acronymes } -\DeclareTranslation { German } { acronym-list-name } { Abk\"urzungen } -\DeclareTranslation { Italian } { acronym-list-name } { Acronimi } -\DeclareTranslation { Portuguese } { acronym-list-name } { Acr\'onimos } -\DeclareTranslation { Spanish } { acronym-list-name } { Siglas } -\DeclareTranslation { Catalan } { acronym-list-name } { Sigles } -\DeclareTranslation { Turkish } { acronym-list-name } { K\i saltmalar } -\tl_set:Nn \l__acro_list_name_tl { \GetTranslation { acronym-list-name } } -% Seitenname -\DeclareTranslationFallback { acronym-page-name } { p. } -\DeclareTranslation { English } { acronym-page-name } { p. } -\DeclareTranslation { German } { acronym-page-name } { S. } -\DeclareTranslation { Portuguese } { acronym-page-name } { p. } -\tl_set:Nn \l__acro_page_name_tl { \GetTranslation { acronym-page-name }\@\, } -% Seitenname - Plural -\DeclareTranslationFallback { acronym-pages-name } { pp. } -\DeclareTranslation { English } { acronym-pages-name } { pp. } -\DeclareTranslation { German } { acronym-pages-name } { S. } -\DeclareTranslation { Portuguese } { acronym-pages-name } { pp. } -\tl_set:Nn \l__acro_pages_name_tl { \GetTranslation { acronym-pages-name }\@\, } -% einzelne folgende Seite -\DeclareTranslationFallback { acronym-next-page } { f. } -\DeclareTranslation { English } { acronym-next-page } { f. } -\DeclareTranslation { German } { acronym-next-page } { f. } -\DeclareTranslation { Portuguese } { acronym-next-page } { s. } -\tl_set:Nn \l__acro_next_page_tl { \,\GetTranslation {acronym-next-page }\@ } -% mehrere folgende Seiten -\DeclareTranslationFallback { acronym-next-pages } { ff. } -\DeclareTranslation { English } { acronym-next-pages } { ff. } -\DeclareTranslation { German } { acronym-next-pages } { ff. } -\DeclareTranslation { Portuguese } { acronym-next-pages } { ss. } -\tl_set:Nn \l__acro_next_pages_tl { \,\GetTranslation {acronym-next-pages }\@ } +\RequirePackage {translations} +% list name +\DeclareTranslationFallback {acronym-list-name} {Acronyms} +\DeclareTranslation {English} {acronym-list-name} {Acronyms} +\DeclareTranslation {American} {acronym-list-name} {Acronyms} +\DeclareTranslation {British} {acronym-list-name} {Acronyms} +\DeclareTranslation {French} {acronym-list-name} {Acronymes} +\DeclareTranslation {German} {acronym-list-name} {Abk\"urzungen} +\DeclareTranslation {Italian} {acronym-list-name} {Acronimi} +\DeclareTranslation {Portuguese} {acronym-list-name} {Acr\'onimos} +\DeclareTranslation {Spanish} {acronym-list-name} {Siglas} +\DeclareTranslation {Catalan} {acronym-list-name} {Sigles} +\DeclareTranslation {Turkish} {acronym-list-name} {K\i saltmalar} + +% page name +\DeclareTranslationFallback {acronym-page-name} {p.} +\DeclareTranslation {English} {acronym-page-name} {p.} +\DeclareTranslation {German} {acronym-page-name} {S.} +\DeclareTranslation {Portuguese} {acronym-page-name} {p.} + +% pages name +\DeclareTranslationFallback {acronym-pages-name} {pp.} +\DeclareTranslation {English} {acronym-pages-name} {pp.} +\DeclareTranslation {German} {acronym-pages-name} {S.} +\DeclareTranslation {Portuguese} {acronym-pages-name} {pp.} + +% following page +\DeclareTranslationFallback {acronym-next-page} {f.} +\DeclareTranslation {English} {acronym-next-page} {f.} +\DeclareTranslation {German} {acronym-next-page} {f.} +\DeclareTranslation {Portuguese} {acronym-next-page} {s.} + +% following pages +\DeclareTranslationFallback {acronym-next-pages} {ff.} +\DeclareTranslation {English} {acronym-next-pages} {ff.} +\DeclareTranslation {German} {acronym-next-pages} {ff.} +\DeclareTranslation {Portuguese} {acronym-next-pages} {ss.} + +% tokenlists using the translations: +\tl_set:Nn \l__acro_list_name_tl { \GetTranslation {acronym-list-name} } +\tl_set:Nn \l__acro_page_name_tl { \GetTranslation {acronym-page-name}\@\, } +\tl_set:Nn \l__acro_pages_name_tl { \GetTranslation {acronym-pages-name}\@\, } +\tl_set:Nn \l__acro_next_page_tl { \,\GetTranslation {acronym-next-page}\@ } +\tl_set:Nn \l__acro_next_pages_tl { \,\GetTranslation {acronym-next-pages}\@ } % -------------------------------------------------------------------------- % allow for a configuration file: @@ -3819,11 +3902,13 @@ endings - property `foreign-lang' - fix issue #65 -2016/03/?? v2.4 - extend class mechanism: classes can be used like tags +2016/03/25 v2.4 - extend class mechanism: classes can be used like tags - add idea of `barriers' and list local to those barriers => new option `reset-at-barriers' => new option `local-to-barriers' for \printacronyms => new command \acbarrier +2016/04/14 v2.4a - if undefined acronym is used and `messages = silent' is + active don't through error % -------------------------------------------------------------------------- % TODO: |