From 9849726424e71240cf80ee4c9c8faf5869688aa1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 3 May 2016 22:18:53 +0000 Subject: acro (3may16) git-svn-id: svn://tug.org/texlive/trunk@40874 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/acro/README | 4 +- Master/texmf-dist/doc/latex/acro/acro_en.pdf | Bin 549940 -> 550587 bytes Master/texmf-dist/doc/latex/acro/acro_en.tex | 66 +++++------------ Master/texmf-dist/tex/latex/acro/acro.sty | 101 ++++++++++++++++++++------- 4 files changed, 93 insertions(+), 78 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/acro/README b/Master/texmf-dist/doc/latex/acro/README index 73d5cdf19c1..02ad15bde60 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.4a +the ACRO package v2.4b Typeset Acronyms -2016/04/14 +2016/05/03 -------------------------------------------------------------------------- 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 index fdfd3efd540..094b09e8081 100644 Binary files a/Master/texmf-dist/doc/latex/acro/acro_en.pdf and b/Master/texmf-dist/doc/latex/acro/acro_en.pdf differ diff --git a/Master/texmf-dist/doc/latex/acro/acro_en.tex b/Master/texmf-dist/doc/latex/acro/acro_en.tex index 2c0611a7894..4fc49e359bf 100644 --- a/Master/texmf-dist/doc/latex/acro/acro_en.tex +++ b/Master/texmf-dist/doc/latex/acro/acro_en.tex @@ -311,47 +311,6 @@ \pkg{zref-abspage}\footnote{\CTANurl{oberdiek}} and \needpackage{translations}~\cite{pkg:translations}. -% \section{About} -% \begin{cnltxquote}[\cite{wikipedia}] -% Acronyms and initialisms are abbreviations formed from the initial -% components in a phrase or a word. These components may be individual -% letters (as in CEO) or parts of words (as in Benelux and Ameslan). There is -% no universal agreement on the precise definition of the various terms nor on -% written usage. -% \end{cnltxquote} -% After \wikipedia{} told us what acronyms are and we won't confuse them with -% units or other kinds of abbreviations -- why would we need another package for -% them? There are several already: \pkg{acronym}~\cite{pkg:acronym}, -% \pkg{acromake}~\cite{pkg:acromake}, \pkg{acroterm}~\cite{pkg:acroterm}, the -% abbreviations package \pkg{abbrevs}~\cite{pkg:abbrevs} (the current version -% 1.4 has a bug\footnote{see \url{http://tex.stackexchange.com/q/59840/5049} for -% solutions.}, though), the nomenclature package -% \pkg{nomencl}~\cite{pkg:nomencl}, and of course the mighty -% \pkg{glossaries}~\cite{pkg:glossaries}. So there is really no \emph{need} for -% a new package. - -% On the other hand \pkg{acronym}, the best of the acronym specific packages, -% has one or two shortcomings and sometimes using \pkg{glossaries} seems a bit -% of an overkill (or simply inconvenient as one has to run -% \code{makeglossaries}, \code{makeindex} or \code{xindy}, then\footnote{Rumour -% has it there is going to be a version that can be used without running an -% external program}). So \acro\ stands somewhere in between (but closer to -% \pkg{acronym}). - -% The main reason for the existance of \acro\ is a question on \acs{tex.sx}% -% \footnote{\url{http://tex.stackexchange.com/q/59449/5049}} which intrigued me -% and in consequence led to \acro\ and it's option \option{single}. - -% \acro\ has many similarities with the \pkg{acronym} package. In fact, quite -% some macros have the same name and meaning\footnote{\emph{Not} in the sense of -% \cs*{meaning}!}. - -% Please take a minute to think and decide which package will suit your needs -% best. Are you planning to add a glossary to your book? You should probably -% go with \pkg{glossaries}, then. Are you planning to add a nomenclature? You -% may want to choose \pkg{nomencl} (or again: \pkg{glossaries}) and so on. -% \acro\ does a good job for lists of abbreviations. - \section{Basics} \subsection{Creating New Acronyms} Acronyms\changedversion{1.0} are created with the command \cs{DeclareAcronym}. @@ -469,10 +428,11 @@ documentation. \sinceversion{2.3}the style of the first appearance of the acronym, see also section~\ref{sec:opti-regard-acronyms}. %% pdfstring - \keylit{pdfstring}{\Marg{\meta{text}/\meta{plural ending}}} - used as \acs{pdf} string replacement in bookmarks when used together with the - \pkg{hyperref} package. The appended plural ending is optional. If you - leave it (\emph{and} the \code{/}) the default ending is used. + \keylit{pdfstring}{\meta{text}/\meta{plural ending}} + \changedversion{2.4b}used as \acs{pdf} string replacement in bookmarks + when used together with the \pkg{hyperref} package. The appended plural + ending is optional. If you leave it (\emph{and} the \code{/}) the default + ending is used. \meta{text} is expanded before it is saved. %% accsupp \keyval{accsupp}{text} sets the \code{ActualText} key as presented by the \pkg{accsupp} package @@ -1132,8 +1092,10 @@ There are a few options which change the general behaviour of \acro. \pkg{l3experimental} bundle) and can only be set in the preamble. %% \keychoice{cite}{\default{all},first,none}\Default{first} - This option decides whether citations that are added via \option{cite} are - added to each first, every or no appearance of an acronym. + \changedversion{2.4b}This option decides whether citations that are added + via \option{cite} are added to each first, every or no appearance of an + acronym. If \code{first} is chosen, the option \keyis{single}{true} is + active and an acronym appears only once it still will get the citation. %% \keyval{cite-cmd}{control sequence}\Default{\cs*{cite}} This option determines which command is used for the citation. Each @@ -1258,8 +1220,11 @@ possible output forms of the acronyms. \keychoice{extra-style}{default,plain,comma,paren,bracket}\Default{default} Defines the way the extra information is printed in the list. %% - \keyval{plural-ending}{tokenlist}\Default{s} - With this option the default plural ending can be set. + \keylit{plural-ending}{\meta{short}/\meta{long}}\Default{s/s} + \changedversion{2.4b}With this option the default plural ending can be + set. The appended \meta{long} ending is optional. If you leave it + (\emph{and} the \code{/}) the \meta{short} ending is used for both short + and long versions. \end{options} \begin{example}[side-by-side] @@ -1740,7 +1705,8 @@ The command's syntax and what it does is as follows: replaced by \code{\_} before \cs*{acro_\meta{name}:} is built. So if you choose \code{my-name} the corresponding macro is named \cs*{acro_my_name:}. If you use any other non-letters you are on your - own. + own. \changedversion{2.4b}If you use the command with the same \meta{name} + a second time the command only resets the defaults. Note that you \emph{must use \cs{ProvideAcroEnding} before any acronym definition}! diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty index 93db29db068..dd2db625b69 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/04/14} - {2.4a} + {2016/05/03} + {2.4b} {Typeset Acronyms} % -------------------------------------------------------------------------- @@ -71,7 +71,8 @@ } \msg_new:nnn {acro} {ending-exists} { - An~ ending~ with~ the~ name~ `#1'~ already~ exists.~ I'm~ doing~ nothing. + An~ ending~ with~ the~ name~ `#1'~ already~ exists.~ I'm~ overwriting~ + the~ defaults. } \msg_new:nnn {acro} {ending-before-acronyms} @@ -713,8 +714,8 @@ } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \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} + { \acro_cite_if:nn { \l__acro_citation_first_bool } {#1} } + \acro_index_if:nn { \l__acro_addto_index_bool } {#1} } % template for footnotes, sidenotes, ... @@ -745,8 +746,8 @@ \tl_use:N \l__acro_foreign_sep_tl \acroenparen { \acro_write_foreign:n {#1} } } - \acro_cite_if:Nn \l__acro_citation_first_bool {#1} - \acro_index_if:Nn \l__acro_addto_index_bool {#1} + \acro_cite_if:nn { \l__acro_citation_first_bool } {#1} + \acro_index_if:nn { \l__acro_addto_index_bool } {#1} } } } @@ -1191,7 +1192,7 @@ \group_end: \bool_if:NT \l__acro_foreign_bool { \acro_get_foreign:n {#1} } - \acro_cite_if:Nn \l__acro_citation_all_bool {#1} + \acro_cite_if:nn { \l__acro_citation_all_bool } {#1} } \cs_set_protected:Npn \acro_list_extra_entry:n #1 @@ -1605,6 +1606,7 @@ % single appearances: \cs_new_protected:Npn \acro_single:n #1 { + \acro_cite: \acro_single_form:nV {#1} \l__acro_single_form_tl \acro_after:n {#1} } @@ -1814,13 +1816,28 @@ \group_end: } +\prg_new_conditional:Npnn \acro_if_ending_exist:n #1 {p,T,F,TF} + { + \seq_if_in:NnTF \l__acro_endings_seq {#1} + { \prg_return_true: } + { \prg_return_false: } + } + % #1: name % #2: default short % #3: default long \cs_new_protected:Npn \acro_provide_ending:nnn #1#2#3 { - \seq_if_in:NnTF \l__acro_endings_seq {#1} - { \acro_harmless_message:nn {ending-exists} {#1} } + \acro_if_ending_exist:nTF {#1} + { + \acro_harmless_message:nn {ending-exists} {#1} + % short variables + \acro_set_ending_variables:nnn {short} {#1} {#2} + % alt variables + \acro_set_ending_variables:nnn {alt} {#1} {#2} + % long variables + \acro_set_ending_variables:nnn {long} {#1} {#3} + } { % registering: \bool_if:NT \g__acro_first_acronym_declared_bool @@ -1890,9 +1907,7 @@ alt-#1-ending .tl_set:c = {l__acro_default_alt_#1_tl} , long-#1-ending .tl_set:c = {l__acro_default_long_#1_tl} , #1-ending .code:n = - \tl_set:cn {l__acro_default_short_#1_tl} {##1} - \tl_set:cn {l__acro_default_alt_#1_tl} {##1} - \tl_set:cn {l__acro_default_long_#1_tl} {##1} + { \__acro_read_ending_settings:nww {#1} ##1// \acro_stop: } } % pdfstrings: \prop_new:c {l__acro_pdfstring_short_#1_prop} @@ -1915,17 +1930,42 @@ } % #1: short|alt|long -% #2: ending +% #2: ending name % #3: default ending \cs_new_protected:Npn \acro_define_and_set_ending_variables:nnn #1#2#3 + { + \acro_define_ending_variables:nn {#1} {#2} + \acro_set_ending_variables:nnn {#1} {#2} {#3} + } + +% #1: short|alt|long +% #2: ending name +\cs_new_protected:Npn \acro_define_ending_variables:nn #1#2 { \prop_new:c {l__acro_#1_#2_prop} \prop_new:c {l__acro_#1_#2_form_prop} \tl_new:c {l__acro_#1_#2_tl} \tl_new:c {l__acro_default_#1_#2_tl} - \tl_set:cn {l__acro_default_#1_#2_tl} {#3} } - + +% #1: short|alt|long +% #2: ending name +% #3: default ending +\cs_new_protected:Npn \acro_set_ending_variables:nnn #1#2#3 + { \tl_set:cn {l__acro_default_#1_#2_tl} {#3} } + +% #1: ending name +% #2: short (and long if #4 is blank) +% #3: long +\cs_new_protected:Npn \__acro_read_ending_settings:nww #1#2/#3/#4 \acro_stop: + { + \acro_set_ending_variables:nnn {short} {#1} {#2} + \acro_set_ending_variables:nnn {alt} {#1} {#2} + \tl_if_blank:nTF {#4} + { \acro_set_ending_variables:nnn {long} {#1} {#3} } + { \acro_set_ending_variables:nnn {long} {#1} {#2} } + } + \NewDocumentCommand \ProvideAcroEnding {mmm} { \acro_provide_ending:nnn {#1} {#2} {#3} } @@ -2237,8 +2277,8 @@ % #1: id \cs_new:Npn \acro_after:n #1 { - \acro_cite_if:Nn \l__acro_citation_all_bool {#1} - \acro_index_if:Nn \l__acro_addto_index_bool {#1} + \acro_cite_if:nn { \l__acro_citation_all_bool } {#1} + \acro_index_if:nn { \l__acro_addto_index_bool } {#1} } % -------------------------------------------------------------------------- @@ -2393,18 +2433,18 @@ \tl_set_eq:NN \l__acro_citation_connect_tl \l__acro_between_group_connect_citation_tl - \acro_cite_if:Nn \l__acro_citation_first_bool {#1} + \acro_cite_if:nn { \l__acro_citation_first_bool } {#1} \group_end: } -\cs_new_protected:Npn \acro_cite_if:Nn #1#2 - { \bool_if:NT #1 { \acro_cite:n {#2} } } +\cs_new_protected:Npn \acro_cite_if:nn #1#2 + { \bool_if:nT {#1} { \acro_cite:n {#2} } } % ---------------------------------------------------------------------------- % indexing: -\cs_new_protected:Npn \acro_index_if:Nn #1#2 +\cs_new_protected:Npn \acro_index_if:nn #1#2 { - \bool_if:nT { #1 && \l__acro_mark_as_used_bool } + \bool_if:nT { (#1) && \l__acro_mark_as_used_bool } { \prop_get:NnN \l__acro_index_cmd_prop {#2} \l__acro_tmpa_tl \prop_get:NnN \l__acro_index_sort_prop {#2} \l__acro_tmpb_tl @@ -3219,7 +3259,7 @@ \AtBeginDocument { - \@ifpackageloaded { hyperref } + \@ifpackageloaded {hyperref} { \bool_set_true:N \l__acro_hyperref_loaded_bool \pdfstringdefDisableCommands @@ -3463,10 +3503,10 @@ \cs_new_protected:Npn \__acro_declare_pdfstring:nw #1#2/#3/#4 \acro_stop: { \__acro_key_check:nn {#1} {pdfstring} - \prop_put:Nnn \l__acro_pdfstring_short_prop {#1} {#2} + \prop_put:Nnx \l__acro_pdfstring_short_prop {#1} {#2} \acro_for_endings_do:n { - \tl_if_empty:nTF {#3} + \tl_if_blank:nTF {#4} { \prop_put:cnx {l__acro_pdfstring_short_##1_prop} {#1} { \exp_not:n {#2} \exp_not:v {l__acro_default_short_##1_tl} } @@ -3909,6 +3949,15 @@ => new command \acbarrier 2016/04/14 v2.4a - if undefined acronym is used and `messages = silent' is active don't through error +2016/05/03 v2.4b - expand `pdfstring' property before saving => issue #69 + - \ProvideAcroEnding can be used twice – it then just sets + the defaults + - the option -ending has a new syntax: + * -ending = sets all endings to + * -ending = / sets short endings to + and long endings to + - a single appearance should be treated like a first + appearance as far as citations are concerned % -------------------------------------------------------------------------- % TODO: -- cgit v1.2.3