diff options
author | Karl Berry <karl@freefriends.org> | 2016-03-14 21:24:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-03-14 21:24:09 +0000 |
commit | a067ac95d311257396b00e472c84f8c8d069db02 (patch) | |
tree | 3a96e6bb25761a5c7d98bc9560c21f106fb93336 /Master | |
parent | f9ac0eb7dec4057b4a1b00376562de0062c5b7c6 (diff) |
acro (14mar16)
git-svn-id: svn://tug.org/texlive/trunk@40022 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/acro/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/acro/acro_en.pdf | bin | 555909 -> 544763 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/acro/acro_en.tex | 143 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/acro/acro.sty | 258 |
4 files changed, 287 insertions, 118 deletions
diff --git a/Master/texmf-dist/doc/latex/acro/README b/Master/texmf-dist/doc/latex/acro/README index baf376efc9f..d20ee643b21 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.2c +the ACRO package v2.3 Typeset Acronyms -2016/02/02 +2016/03/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 181eeec0cc3..5012ce361e9 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 f6ea1e12ee5..102da540681 100644 --- a/Master/texmf-dist/doc/latex/acro/acro_en.tex +++ b/Master/texmf-dist/doc/latex/acro/acro_en.tex @@ -1,8 +1,8 @@ % arara: pdflatex -% !arara: biber +% arara: biber +% arara: pdflatex % arara: pdflatex % arara: pdflatex -% !arara: pdflatex % -------------------------------------------------------------------------- % the ACRO package % @@ -187,7 +187,8 @@ { short = ECU , long = Steuerger\"at , - foreign = Electronic Control Unit + foreign = Electronic Control Unit , + foreign-lang = english } \DeclareAcronym{id} { @@ -308,46 +309,46 @@ \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{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} @@ -423,6 +424,19 @@ documentation. \keyval{foreign}{original long form} \sinceversion{1.3}can be useful when dealing with acronyms in foreign languages, see section~\vref{ssec:foreign} for details. + %% foreign-lang + \keyval{foreign-lang}{language} + \sinceversion{2.3}the \pkg{babel}~\cite{pkg:babel} or + \pkg{polyglossia}~\cite{pkg:polyglossia} language of the foreign form. + This language is used to wrap the entry with + \cs*{foreignlanguage}\marg{language} if either \pkg{babel} or + \pkg{polyglossia} is loaded. You'll need to take care that the + corresponding language is loaded by \pkg{babel} or \pkg{polyglossia}. + %% single + \keyval{single}{text} + \sinceversion{2.3}if provided \meta{text} will be used instead of the long + form if the acronym is only used a single time \emph{and} the option + \keyis{single}{true} is active. %% sort \keyval{sort}{text} if used the acronym will be sorted according to this key instead of its @@ -444,6 +458,15 @@ documentation. \keyval{first-long-format}{\TeX{} code} the format used for the first long form of the acronym as set with \cs{ac}, \cs{acf} or \cs{acflike} and their uppercase, plural and indefinite forms. + %% single-format + \keyval{single-format}{\TeX{} code} + \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} + \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 @@ -703,11 +726,16 @@ document: \ac{ecu}\\ \ac{ecu} \end{example} -That's why I decided to add the following key: +That's why I decided to add the following properties: \begin{options} \keyval{foreign}{original long form} A description for an acronym originating in another language than the document language. + \keyval{foreign-lang}{language} + \sinceversion{2.3}The \pkg{babel}~\cite{pkg:babel} or + \pkg{polyglossia}~\cite{pkg:polyglossia} language of the foreign form. + This language is used to wrap the entry with + \cs*{foreignlanguage}\marg{language}. \end{options} Here is the definition of the above mentioned \ac{ecu} acronym: @@ -715,7 +743,8 @@ Here is the definition of the above mentioned \ac{ecu} acronym: \DeclareAcronym{ecu}{ short = ECU , long = Steuerger\"at , - foreign = Electronic Control Unit + foreign = Electronic Control Unit , + foreign-lang = english } \end{sourcecode} As you have seen this adds the \option{foreign} entry to the first appearance @@ -1154,7 +1183,7 @@ options or via the setup command: we could have used these before: \nato, \ny \end{example} -\subsection{Options Regarding Acronyms} +\subsection{Options Regarding Acronyms}\label{sec:opti-regard-acronyms} The options described in this section all influence the layout of one of the possible output forms of the acronyms. \begin{options} @@ -1172,6 +1201,11 @@ possible output forms of the acronyms. The format for the \option{foreign} entry when it appears as part of the first appearance of an acronym. %% + \keyval{single-format}{format}\Default + \sinceversion{2.3}% + The format for the acronym when it is used only once. If not specified + the formatting according to \option{single-form} is used. + %% \keyval{first-long-format}{format}\Default \sinceversion{1.2}% The format for the long form on first usage (with \cs{ac}, \cs{acf} or @@ -1182,6 +1216,10 @@ possible output forms of the acronyms. not used this is the same as \option{short-format}. Please be aware that a call of \option{short-format} after this one will overwrite it again. %% + \keyval{list-short-width}{dim}\Default{3em} + \sinceversion{2.1}This option controls the width reserved for the short + forms of the acronyms in the \code{lof} list style. + %% \keyval{list-long-format}{format}\Default An extra format for the long entries in the list. If not used this is the same as \option{long-format}. Please be aware that a call of @@ -1418,12 +1456,13 @@ written to the \code{aux} file and only read in during the next run. \section{Language Support} -\acro\ detects if packages \pkg*{babel} or \pkg*{polyglossia} are being loaded -and tries to adapt certain strings to match the chosen language. However, due -to my limited language knowledge only a few translations are provided. I'll -show how the English translations are defined so you can add the translations -to your preamble if needed. Even better would be you'd send me a short email -at \href{mailto:contact@mychemistry.eu}{contact@mychemistry.eu} with the +\acro\ detects if packages \pkg{babel}~\cite{pkg:babel} or +\pkg{polyglossia}~\cite{pkg:babel} are being loaded and tries to adapt certain +strings to match the chosen language. However, due to my limited language +knowledge only a few translations are provided. I'll show how the English +translations are defined so you can add the translations to your preamble if +needed. Even better would be you'd send me a short email at +\href{mailto:contact@mychemistry.eu}{contact@mychemistry.eu} with the appropriate translations for your language and I'll add them to \acro. \begin{sourcecode} diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty index 9e058b76913..a566c25a487 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/02/02} - {2.2c} + {2016/03/14} + {2.3} {Typeset Acronyms} % -------------------------------------------------------------------------- @@ -229,6 +229,7 @@ \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_single_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_tl @@ -238,8 +239,10 @@ \tl_new:N \l__acro_foreign_format_tl \tl_new:N \l__acro_foreign_list_format_tl \tl_set:Nn \l__acro_foreign_list_format_tl { \acroenparen } +\tl_new:N \l__acro_foreign_lang_tl \tl_new:N \l__acro_first_instance_tl \tl_set:Nn \l__acro_first_instance_tl { default } +\tl_new:N \l__acro_first_style_tl \tl_new:N \l__acro_extra_instance_tl \tl_set:Nn \l__acro_extra_instance_tl { default } \tl_new:N \l__acro_page_instance_tl @@ -265,6 +268,7 @@ \tl_new:N \l__acro_short_tl \tl_new:N \l__acro_alt_tl \tl_new:N \l__acro_long_tl +\tl_new:N \l__acro_single_tl \tl_new:N \l__acro_long_pre_tl \tl_new:N \l__acro_long_post_tl \tl_new:N \l__acro_custom_format_tl @@ -343,6 +347,8 @@ first-long-format .code:n = \tl_set:Nn \l__acro_first_long_format_tl {#1} , first-long-format .value_required:n = true , + single-format .tl_set:N = \l__acro_single_format_tl , + single-format .value_required:n = true , format-include-endings .bool_set:N = \l__acro_include_endings_format_bool , display-foreign .bool_set:N = \l__acro_foreign_bool , foreign-format .tl_set:N = \l__acro_foreign_format_tl , @@ -603,14 +609,8 @@ !\l__acro_first_only_short_bool } { - \prop_get:NnNT \l__acro_foreign_prop {#1} \l__acro_foreign_tl - { - \group_begin: - \tl_use:N \l__acro_foreign_format_tl - \tl_use:N \l__acro_foreign_tl - \group_end: - \tl_use:N \l__acro_foreign_sep_tl - } + \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 } @@ -643,20 +643,10 @@ \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} - \bool_if:NT \l__acro_foreign_bool - { - \prop_get:NnNT \l__acro_foreign_prop {#1} \l__acro_foreign_tl - { - \tl_use:N \l__acro_foreign_sep_tl - \group_begin: - \tl_use:N \l__acro_foreign_format_tl - \tl_use:N \l__acro_foreign_tl - \group_end: - } - } + \acro_if_foreign:nT {#1} + { \acroenparen { \acro_write_foreign:n {#1} } } } - \bool_if:nT - { \l__acro_group_citation_bool && !\l__acro_first_reversed_bool } + \bool_if:NT \l__acro_group_citation_bool { \acro_group_cite:n {#1} } \bool_if:nT { \l__acro_first_use_brackets_bool && !\l__acro_first_only_short_bool } @@ -690,18 +680,10 @@ \__acro_note_command:n { \acro_write_long:Vo \l__acro_first_long_format_tl {#3} - \bool_if:NT \l__acro_foreign_bool + \acro_if_foreign:nT {#1} { - \prop_get:NnNT \l__acro_foreign_prop {#1} \l__acro_foreign_tl - { - \tl_use:N \l__acro_foreign_sep_tl - ( - \group_begin: - \tl_use:N \l__acro_foreign_format_tl - \tl_use:N \l__acro_foreign_tl - \group_end: - ) - } + \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} @@ -1147,20 +1129,6 @@ \cs_new_protected:Npn \acro_print_list_entry:nnnn #1#2#3#4 { #1 #2 #3 #4 } -\cs_new:Npn \acroenparen #1 { ( #1 ) } - -\cs_new_protected:Npn \acro_get_foreign:n #1 - { - \prop_get:NnNT \l__acro_foreign_prop {#1} \l__acro_foreign_tl - { - \tl_use:N \l__acro_foreign_sep_tl - \group_begin: - \tl_use:N \l__acro_foreign_list_format_tl - { \tl_use:N \l__acro_foreign_tl } - \group_end: - } - } - \cs_new_protected:Npn \acro_for_all_acronyms_do:n #1 { \prop_map_inline:Nn \l__acro_short_prop {#1} } @@ -1224,7 +1192,7 @@ % -------------------------------------------------------------------------- % declare templates for the list: -% list template: +% `list' template: \DeclareTemplateInterface {acro-list} {list} {2} { foreign-sep : tokenlist = {~} , @@ -1265,7 +1233,7 @@ } } -% list-of template: +% `list-of' template: \DeclareTemplateInterface {acro-list} {list-of} {2} { foreign-sep : tokenlist = {~} , @@ -1354,7 +1322,7 @@ } } -% table template: +% `table' template: \DeclareTemplateInterface {acro-list} {table} {2} { table : tokenlist = tabular , @@ -1397,7 +1365,7 @@ } } -% extra-table template: +% `extra-table' template: \DeclareTemplateInterface {acro-list} {extra-table} {2} { table : tokenlist = tabular , @@ -1526,7 +1494,13 @@ \bool_gset_true:c { g__acro_#1_first_use_bool } \acro_if_is_single:nTF {#1} { \acro_single:n {#1} } - { + { + \tl_if_blank:VF \l__acro_first_style_tl + { + \tl_set_eq:NN + \l__acro_first_instance_tl + \l__acro_first_style_tl + } \acro_first_instance:VnVV \l__acro_first_instance_tl {#1} @@ -1536,6 +1510,13 @@ } } +% single appearances: +\cs_new_protected:Npn \acro_single:n #1 + { + \acro_single_form:nV {#1} \l__acro_single_form_tl + \acro_after:n {#1} + } + % #1: ID % #2: long|first|<other> \cs_new_protected:Npn \acro_single_form:nn #1#2 @@ -1544,27 +1525,50 @@ \str_case:nnF {#2} { {long} { - \acro_write_expanded:nnV {#1} {long} \l__acro_long_tl - \acro_cite:n {#1} + \tl_if_blank:VT \l__acro_single_format_tl + { + \bool_if:NTF \l__acro_custom_long_format_bool + { + \tl_set_eq:NN + \l__acro_single_format_tl + \l__acro_custom_long_format_tl + } + { + \tl_set_eq:NN + \l__acro_single_format_tl + \l__acro_long_format_tl + } + } + \tl_if_blank:VT \l__acro_single_tl + { \tl_set_eq:NN \l__acro_single_tl \l__acro_long_tl } + \acro_write_long:VV \l__acro_single_format_tl \l__acro_single_tl } {first} { + \tl_if_blank:VF \l__acro_single_format_tl + { + \tl_set_eq:NN + \l__acro_first_long_format_tl + \l__acro_single_format_tl + } + \tl_if_blank:VT \l__acro_single_tl + { \tl_set_eq:NN \l__acro_single_tl \l__acro_long_tl } \acro_first_instance:VnVV \l__acro_first_instance_tl {#1} \l__acro_short_tl - \l__acro_long_tl + \l__acro_single_tl } } { % other (e.g. short) + \tl_if_blank:VF \l__acro_single_tl + { \tl_set_eq:cN {l__acro_#2_tl} \l__acro_single_tl } + \tl_if_blank:VF \l__acro_single_format_tl + { \tl_set_eq:cN {l__acro_#2_format_tl} \l__acro_single_format_tl } \acro_write_compact:nn {#1} {#2} - \acro_cite:n {#1} } } \cs_generate_variant:Nn \acro_single_form:nn {nV} -\cs_new_protected:Npn \acro_single:n #1 - { \acro_single_form:nV {#1} \l__acro_single_form_tl } - \prg_new_conditional:Npnn \acro_if_is_single:n #1 { p,T,TF } { \bool_if:nTF { !\l__acro_use_single_bool || \cs_if_exist_p:c { acro@#1@twice } } @@ -1597,8 +1601,19 @@ \prop_get:NnNF \l__acro_long_prop {#1} \l__acro_long_tl {} % foreign: \prop_get:NnNF \l__acro_foreign_prop {#1} \l__acro_foreign_tl {} + % foreign: + \prop_get:NnNF \l__acro_foreign_lang_prop {#1} \l__acro_foreign_lang_tl {} + % \tl_if_blank:VF \l__acro_foreign_lang_tl + % { + % \tl_set:Nx \l__acro_foreign_lang_tl + % { \baselanguage \l__acro_foreign_lang_tl } + % } % extra: \prop_get:NnNF \l__acro_extra_prop {#1} \l__acro_extra_tl {} + % single: + \prop_get:NnNF \l__acro_single_prop {#1} \l__acro_single_tl {} + % single: + \prop_get:NnNF \l__acro_first_style_prop {#1} \l__acro_first_style_tl {} % formatting \prop_get:NnNTF \l__acro_long_format_prop {#1} \l__acro_custom_long_format_tl @@ -1610,13 +1625,16 @@ \prop_get:NnNTF \l__acro_format_prop {#1} \l__acro_custom_format_tl { \bool_set_true:N \l__acro_custom_format_bool } { \bool_set_false:N \l__acro_custom_format_bool } + \prop_get:NnNF \l__acro_single_format_prop {#1} + \l__acro_single_format_tl + {} \acro_for_endings_do:n { \bool_if:cT {l__acro_##1_bool} { \__acro_set_ending_for:nnn {##1} {#1} {long} } } - \prop_get:NnNT \l__acro_long_post_prop {#1} \l__acro_long_post_tl - { \tl_put_right:NV \l__acro_long_tl \l__acro_long_post_tl } + \prop_get:NnNF \l__acro_long_post_prop {#1} \l__acro_long_post_tl + { \tl_clear:N \l__acro_long_post_tl } \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 } } @@ -1664,7 +1682,12 @@ { \acro_for_endings_do:n { - \bool_if:nT { \prop_item:cn {l__acro_#2_##1_form_prop} {#1} } + \bool_if:nT + { + \prop_item:cn {l__acro_#2_##1_form_prop} {#1} + && + \use:c {l__acro_##1_bool} + } { \prop_get:cncF {l__acro_#2_##1_prop} {#1} {l__acro_#2_tl} {} } } } @@ -2005,6 +2028,72 @@ } \cs_generate_variant:Nn \acro_write_long:nn { VV,Vo,Vf,Vn,vn } +\prg_new_conditional:Npnn \acro_if_foreign:n #1 {T,F,TF} + { + \bool_if:nTF + { + \l__acro_foreign_bool + && + \prop_if_in_p:Nn \l__acro_foreign_prop {#1} + } + { \prg_return_true: } + { \prg_return_false: } + } + +\cs_new_protected:Npn \acro_foreign_language:nn #1#2 {} +\AtBeginDocument{ + \cs_if_exist:NTF \foreignlanguage + { + \cs_set_protected:Npn \acro_foreign_language:nn #1#2 + { + \tl_if_blank:nTF {#1} + {#2} + { \foreignlanguage {#1} {#2} } + } + } + { + \cs_set_protected:Npn \acro_foreign_language:nn #1#2 + { \use_ii:nn {#1} {#2} } + } +} +\cs_generate_variant:Nn \acro_foreign_language:nn {VV} + +\cs_new_protected:Npn \acro_write_foreign:n #1 + { + \acro_if_foreign:nT {#1} + { + \prop_get:NnNT \l__acro_foreign_prop {#1} \l__acro_foreign_tl + { + \group_begin: + \tl_use:N \l__acro_foreign_format_tl + { + \acro_foreign_language:VV + \l__acro_foreign_lang_tl + \l__acro_foreign_tl + } + \group_end: + } + } + } + +\cs_new:Npn \acroenparen #1 { ( #1 ) } + +\cs_new_protected:Npn \acro_get_foreign:n #1 + { + \prop_get:NnNT \l__acro_foreign_prop {#1} \l__acro_foreign_tl + { + \tl_use:N \l__acro_foreign_sep_tl + \group_begin: + \tl_use:N \l__acro_foreign_list_format_tl + { + \acro_foreign_language:VV + \l__acro_foreign_lang_tl + \l__acro_foreign_tl + } + \group_end: + } + } + % -------------------------------------------------------------------------- % #1: id % #2: short|alt @@ -2033,6 +2122,8 @@ \tl_replace_all:Nnn \l__acro_tmpa_tl {-} {_} \acro_write_long:vn {l__acro_ \l__acro_tmpa_tl _format_tl} {#3} \acro_endings:nn {#1} {long} + \tl_if_in:nnT {#2} {long} + { \l__acro_long_post_tl } } \cs_generate_variant:Nn \acro_write_expanded:nnn { nnV } @@ -2123,6 +2214,12 @@ \acro_is_used:n {#1} \acro_if_is_single:nT {#1} { \cs_set_eq:NN \acro_hyper_link:nn \use_ii:nn } + \tl_if_blank:VF \l__acro_first_style_tl + { + \tl_set_eq:NN + \l__acro_first_instance_tl + \l__acro_first_style_tl + } \acro_first_instance:VnVV \l__acro_first_instance_tl {#1} @@ -2762,6 +2859,13 @@ \acro_single:n {#1} } +\NewAcroCommand \Acsingle + { + \acro_get:n {#1} + \acro_first_upper: + \acro_single:n {#1} + } + % short: \NewAcroCommand \acs { \acro_short:n {#1} } @@ -2789,6 +2893,12 @@ \NewAcroCommand \aca { \acro_alt:n {#1} } +\NewAcroCommand \Aca + { + \acro_first_upper: + \acro_alt:n {#1} + } + \NewAcroCommand \iaca { \acro_indefinite: @@ -3116,6 +3226,8 @@ } } +\acro_declare_simple_key:n{first-style} + % list: \acro_declare_simple_key:n {list} @@ -3162,6 +3274,9 @@ % foreign: \acro_declare_simple_key:n {foreign} +% foreign: +\acro_declare_simple_key:n {foreign-lang} + % format: \acro_declare_simple_key:n {format} @@ -3178,7 +3293,7 @@ \prop_new:N \l__acro_pdfstring_short_prop \cs_new_protected:Npn \__acro_declare_pdfstring:nw #1#2/#3/#4 \acro_stop: { - \__acro_key_check:nn {#1} { pdfstring } + \__acro_key_check:nn {#1} {pdfstring} \prop_put:Nnn \l__acro_pdfstring_short_prop {#1} {#2} \acro_for_endings_do:n { @@ -3228,6 +3343,12 @@ % extra information: \acro_declare_simple_key:n {extra} +% single appearances: +\acro_declare_simple_key:n {single} + +% single format: +\acro_declare_simple_key:n {single-format} + % acc supp: \acro_declare_key:nn {acc_supp} {accsupp} @@ -3593,6 +3714,15 @@ 2016/01/07 v2.2a - \prop_get:Nn => \prop_item:Nn 2016/01/21 v2.2b - fix issue #59 2016/02/02 v2.2c - fix issue #60 +2016/03/14 v2.3 - foreign-format may be a macro taking an argument + - \Aca, \Acsingle + - properties `single' and `single-format', option + `single-format' => issue #62 + - property `first-style' => issue #61 + - fix issue #64: long-post entry is now added *after* the + endings + - property `foreign-lang' + - fix issue #65 % -------------------------------------------------------------------------- update => http://tex.stackexchange.com/questions/236362 |