summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-05-06 22:03:16 +0000
committerKarl Berry <karl@freefriends.org>2013-05-06 22:03:16 +0000
commitd3df91a3632548c96324059eb602b185dd93b149 (patch)
treeca899936eab87c9bf6795fb97d27984d4e449d69
parent3cc021afee4ab842395ab6c2e6149770382699c6 (diff)
acro (6may13)
git-svn-id: svn://tug.org/texlive/trunk@30248 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/acro/README4
-rw-r--r--Master/texmf-dist/doc/latex/acro/acro_en.pdfbin492735 -> 498728 bytes
-rw-r--r--Master/texmf-dist/doc/latex/acro/acro_en.tex152
-rw-r--r--Master/texmf-dist/tex/latex/acro/acro.sty1036
-rw-r--r--Master/texmf-dist/tex/latex/acro/acro1.def124
5 files changed, 801 insertions, 515 deletions
diff --git a/Master/texmf-dist/doc/latex/acro/README b/Master/texmf-dist/doc/latex/acro/README
index 7c6ef9d0199..6ea84b6b0fb 100644
--- a/Master/texmf-dist/doc/latex/acro/README
+++ b/Master/texmf-dist/doc/latex/acro/README
@@ -1,9 +1,9 @@
--------------------------------------------------------------------------
-the ACRO package v1.2a
+the ACRO package v1.3
Typeset Acronyms
-2013/04/04
+2013/05/06
--------------------------------------------------------------------------
Clemens Niederberger
Web: https://bitbucket.org/cgnieder/acro/
diff --git a/Master/texmf-dist/doc/latex/acro/acro_en.pdf b/Master/texmf-dist/doc/latex/acro/acro_en.pdf
index 8a9aab7756e..ea5ff1f0aaa 100644
--- a/Master/texmf-dist/doc/latex/acro/acro_en.pdf
+++ b/Master/texmf-dist/doc/latex/acro/acro_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/acro/acro_en.tex b/Master/texmf-dist/doc/latex/acro/acro_en.tex
index 28d3f2aa069..905ba1c3b3c 100644
--- a/Master/texmf-dist/doc/latex/acro/acro_en.tex
+++ b/Master/texmf-dist/doc/latex/acro/acro_en.tex
@@ -38,6 +38,7 @@
% https://bitbucket.org/cgnieder/cnpkgdoc/
% the class is licensed LPPL 1.3 or later
%
+\PassOptionsToPackage{supstfm=libertinesups}{superiors}
\documentclass[DIV10,toc=index,toc=bib,hyperfootnotes=false]{cnpkgdoc}
\docsetup{
pkg = {[single,macros,accsupp,index]acro} ,
@@ -53,6 +54,7 @@
\acsetup{hyperref}
\cnpkgusecolorscheme{friendly}
+\usepackage{libertinehologopatch}
\usepackage{fnpct}
\renewcommand*\othersectionlevelsformat[3]{%
\textcolor{main}{#3\autodot}\enskip}
@@ -154,7 +156,7 @@
suffix_3p "\\nohyperpage{\\,ff.}"
\end{filecontents*}
\indexsetup{noclearpage,othercode=\footnotesize}
-\makeindex[options={-s \jobname.ist},intoc,columns=3]
+\makeindex[options={-s \jobname.ist},intoc,columns=3,columnsep=1em]
\TitlePicture{\parbox{.75\linewidth}{%
\acro not only allows you to create acronyms in a simple way but also lets you
@@ -192,6 +194,12 @@
long = Compact Disc ,
short-format = \scshape
}
+\DeclareAcronym{ecu}
+ {
+ short = ECU ,
+ long = Steuergerät ,
+ foreign = Electronic Control Unit
+ }
\DeclareAcronym{id}
{
short = id ,
@@ -304,8 +312,8 @@ terms of the \LaTeX{} Project Public License, version 1.3 or later
\acro loads and needs the following packages: \paket*{expl3}\footnote{\CTANurl{l3kernel}},
\paket*{xparse}, \paket*{xtemplate}, \paket*{l3keys2e}\footnote{All three part of
-the \CTANlink{l3packages} bundle} and \paket*{translations}\footnote{Part of the
-\CTANlink{exsheets} bundle.}.
+the \CTANlink{l3packages} bundle}, \paket{zref-abspage} and \paket*{translations}%
+\footnote{Part of the \CTANlink{exsheets} bundle.}.
\section{About}
\begin{zitat}[\cite{wikipedia}]
@@ -342,7 +350,8 @@ some macros have the same name and meaning\footnote{\emph{Not} in the sense of
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 \paket{glossaries}, then. Are you planning to add a nomenclature? You
-may want to choose \paket{nomencl} and so on\ldots
+may want to choose \paket{nomencl} (or again: \paket{glossaries}) and so on.
+\acro does a good job for lists of abbreviations.
\section{Updating from Version~0.\versionstar}
@@ -355,7 +364,7 @@ Versions~0.\versionstar{} also set labels when an acronym was used the first tim
version~1.0 doesn't do that any more. \key{version}{0} sets them as expected.
Note that \key{version}{0} \emph{does not and will not} support new features of
-any kind.
+any kind, at least not explicitly.
With version~1.0 acronyms are declared with a key/value syntax similar to the
way in package \paket{glossaries} glossary entries are defined. This was made
@@ -417,6 +426,11 @@ are not described immediately but at appropriate places in the documentation.
%% extra
\Option{extra}{<text>}\newline
extra information to be added in the list of acronyms.
+ %% foreign
+ \Option{foreign}{<original long form>}\newline
+ \sinceversion{1.3}%
+ can be useful when dealing with acronyms in foreign languages, see
+ section~\ref{ssec:foreign} for details.
%% sort
\Option{sort}{<text>}\newline
if used the acronym will be sorted according to this key instead of its \acs{id}.
@@ -666,6 +680,40 @@ for the impact of the following example.
across North America and Europe, the newest of which, Albania and
Croatia, joined in April 2009.
\end{beispiel}
+
+\subsection{Foreign Language Acronyms}\secidx[foreign language acronyms]{Basics}\label{ssec:foreign}
+\noindent\sinceversion{1.3}I repeatedly read the wish for being able to add
+translations to acronyms when the acronyms stem from another language than
+the document language, \textit{i.e.}, something like the following in a German
+document:
+\begin{beispiel}
+ \ac{ecu}\\
+ \ac{ecu}
+\end{beispiel}
+That's why I decided to add the following key:
+\begin{beschreibung}
+ \Option{foreign}{<original long form>}
+\end{beschreibung}
+
+Here is the definition of the above mentioned \ac{ecu} acronym:
+\begin{beispiel}[code only]
+ \DeclareAcronym{ecu}
+ {
+ short = ECU ,
+ long = Steuergerät ,
+ foreign = Electronic Control Unit
+ }
+\end{beispiel}
+As you have seen this adds the \key{foreign} entry to the first appearance of
+an acronym. It is also added in parentheses to the list of acronyms after the
+\key{long} entry. Actually the entry there is the argument to the following
+command:
+\begin{beschreibung}
+ \Befehl{acroenparen}{<arg>}\newline
+ Places \code{<arg>} in parentheses: \cmd{acroenparen}{example}:
+ \acroenparen{example}. See page~\pageref{key:list-foreign-format} for a way
+ to customize this other than redefining it.
+\end{beschreibung}
\secidx*{Basics}
\section{Additional Commands and Possibilities}\secidx{Additional Commands}
@@ -815,10 +863,10 @@ should get uppercase letters instead of lowercase ones.
\noindent\sinceversion{1.1}\acro has the package option \key{index}. If it is
used an index entry will be recorded every time an \emph{unstarred} acronym
command is used. The index entry will be \code{<id>@<short>}, \code{<sort>@<short>}
-if the \key{sort} key has been set, \code{<index-sort>@<short>}if the
+if the \key{sort} key has been set, \code{<index-sort>@<short>} if the
\key{index-sort} has been set, or \code{<index>} if the key \key{index} has been
-set for the specific acronym. The short version appearing there are formatted
-according to the chosen format, of course.
+set for the specific acronym. The short versions appearing there are formatted
+according to the chosen format of the corresponding acronym, of course.
This document demonstrates the feature. You can find every acronym that has been
declared in the index. In order to allow flexibility the indexing command can be
@@ -847,8 +895,10 @@ The commands takes a few options, namely the following ones:
be in the list.
\Option{name}{<name of the list>}\newline
sets the name for the list.
- \Option{header}{<sectioning command without leading backslash>}\Default{section*}
- sets the sectioning command for the header of the list.
+ \Option{heading}{<sectioning command without leading backslash>}\Default{section*}
+ \changedversion{1.3}sets the sectioning command for the heading of the list.
+ \Option{sort}{\default{true}|false}\Default{true}
+ \sinceversion{1.3}set sorting for the list only.
\end{beschreibung}
\begin{beispiel}[code only]
\acsetup{extra-style=comma}
@@ -881,7 +931,7 @@ There are a few options which change the general behaviour of \acro.
prior to v1.0.
%%
\Option{single}{\default{true}|false}\Default{false}
- If set to \code{true} an acronym that's used only once '(with \cmd{ac}) in a
+ If set to \code{true} an acronym that's used only once (with \cmd{ac}) in a
document will only print the long form and will not be printed in the list.
%%
\Option{hyperref}{\default{true}|false}\Default{false}
@@ -890,8 +940,8 @@ There are a few options which change the general behaviour of \acro.
%%
\Option{record-pages}{\default{true}|false}\Default{true}
Since \acro can handle arabic, roman and Roman page numbers but \emph{not}
- any other kind of numbering this option enables to turn the page number
- recording of for these cases as it would lead to errors else. This affects
+ any other kind of numbering this option allows to turn the page number
+ recording off for these cases as it would lead to errors else. This affects
the whole document and can only be set in the preamble! It means you cannot
have page numbers in the list of acronyms in this case.
%%
@@ -986,6 +1036,11 @@ possible output forms of the acronyms.
\Option{long-format}{<format>}\Default
The same for the long forms.
%%
+ \Option{foreign-format}{<format>}\Default
+ \sinceversion{1.3}%
+ The format for the \key{foreign} entry when it appears as part of the first
+ appearance of an acronym.
+ %%
\Option{first-long-format}{<format>}\Default
\sinceversion{1.2}%
The format for the long form on first usage (with \cmd{ac}, \cmd{acf} or
@@ -1001,6 +1056,10 @@ possible output forms of the acronyms.
as \key{long-format}. Please be aware that a call of \key{long-format} after
this one will overwrite it again.
%%
+ \Option{list-foreign-format}{<format>}\Default{\cmd{acroenparen}}
+ The format for the \key{foreign} entry as it appears in the list. This may be
+ code that ends with a macro that takes a mandatory argument.
+ %%
\Option{extra-format}{<format>}\Default
The same for the extra information.
%%
@@ -1055,18 +1114,24 @@ possible output forms of the acronyms.
time being there are many translations missing, yet. Please notify me if you
find your language missing.
%%
- \Option{page-ranges}{\default{true}|false}\Default{true}
- \sinceversion{1.0}If set to \code{false} ranges will be set by appending
- \code{f} or \code{ff}, respectively.
+ \Option{following-page}{\default{true}|false}\Default{false}
+ \sinceversion{1.3}If set to \code{true} a page range in the list of acronyms
+ that consists of two pages will be written by the first page and an appended
+ \code{f}. This depends on the option \key{next-page}.
+ %%
+ \Option{following-pages}{\default{true}|false}\Default{false}
+ \sinceversion{1.3}If set to \code{true} a page range in the list of acronyms
+ that set consists of more than two pages will be written by the first page
+ and an appended \code{ff}. This depends on the option \key{next-pages}.
%%
\Option{next-page}{<text>}\Default{\cmd*{,}f.\cmd*{@}}
- \sinceversion{1.0}Appended to a page number when \key{page-ranges} is set to
+ \sinceversion{1.0}Appended to a page number when \key{following-page} is set to
\code{false} and the range is only 2 pages long. This is automatically
translated to the active language. However, for the time being there are many
translations missing, yet. Please notify me if you find your language missing.
%%
\Option{next-pages}{<text>}\Default{\cmd*{,}ff.\cmd*{@}}
- \sinceversion{1.0}Appended to a page number when \key{page-ranges} is set to
+ \sinceversion{1.0}Appended to a page number when \key{following-pages} is set to
\code{false} and the range is more than 2 pages long. This is automatically
translated to the active language. However, for the time being there are many
translations missing, yet. Please notify me if you find your language missing.
@@ -1084,13 +1149,13 @@ possible output forms of the acronyms.
The values \code{extra-longtable} and \code{extra-longtable-rev} put the extra
information in a column of its own.
%%
- \Option{list-header}{chapter|chapter*|section|section*|subsection|subsection*|\\
+ \Option{list-heading}{chapter|chapter*|section|section*|subsection|subsection*|\\
addchap|addsec}\Default{section*}
- \changedversion{1.1}The header type of the list. The last two only work with
+ \changedversion{1.3}The heading type of the list. The last two only work with
a \KOMAScript{} class that also defines the appropriate command.
%%
\Option{list-name}{<list name>}\Default{Acronyms}
- The name of the list. This is what's written in the list-header. This is
+ The name of the list. This is what's written in the list-heading. This is
automatically translated to the active language. However, for the time being
there are many translations missing, yet. Please notify me if you find your
language missing.
@@ -1131,18 +1196,11 @@ pages an acronym appeared on. With \paket{hyperref} the pages are referenced
using \cmd*{hyperpage}.
There are some options that control how this list will be typeset, e.g.,
-\key{page-ranges}, \key{next-pages} or the option \key{page-ref} itself. It is
-important to mention that the page list will always take two compilation runs
-until changes in the options or the actual page numbers affect it. This is due to
-the fact that the updated sequence is first written to the \code{aux} file and
-only read in during the next run.
-
-There is another important fact: \acro can only handle arabic and lowercase and
-uppercase roman page numbering. If you happen to choose a different numbering
-style you either have to use the package option \key{record-pages}{false} which
-means you will have to pass on page numbers in the list of acronyms, or you need
-to make sure that you only use the \emph{starred} versions of the \cmd{ac} commands
-on these pages so acronyms don't count as used there!
+\key{following-page}, \key{next-pages} or the option \key{page-ref} itself. It is
+important to mention that the page list will always take at least two compilation
+runs until changes in the options or the actual page numbers affect it. This is
+due to the fact that the updated sequence is first written to the \code{aux} file
+and only read in during the next run.
\secidx*{About Page Ranges}
\section{Language Support}\secidx{Language Support}
@@ -1200,29 +1258,29 @@ description ask me for the documentation to version~0.6a.
\section{All Acronyms Used in this Documentation}\label{sec:documentation_acronyms}
\begin{beispiel}[code only]
\acsetup{
- list-type = table,
- list-style = longtable,
- list-header = subsection*,
- extra-style = comma,
- page-ref = comma
+ list-type = table,
+ list-style = longtable,
+ list-heading = subsection*,
+ extra-style = comma,
+ page-ref = comma
}
\printacronyms[name=All Acronyms]
\end{beispiel}
\acsetup{
- list-type = table,
- list-style = longtable,
- list-header = subsection*,
- extra-style = comma,
- page-ref = comma
+ list-type = table,
+ list-style = longtable,
+ list-heading = subsection*,
+ extra-style = comma,
+ page-ref = comma
}
\printacronyms[name=All Acronyms]
\begin{beispiel}[code only]
\acsetup{
- list-type = table,
- list-style = longtable,
- list-header = subsection*,
- page-ref = comma
+ list-type = table,
+ list-style = longtable,
+ list-heading = subsection*,
+ page-ref = comma
}
\printacronyms[include-classes=city,name=City Acronyms]
\end{beispiel}
diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty
index 5b56c7c2318..aacff0250f5 100644
--- a/Master/texmf-dist/tex/latex/acro/acro.sty
+++ b/Master/texmf-dist/tex/latex/acro/acro.sty
@@ -31,10 +31,25 @@
\RequirePackage{expl3,xparse,l3keys2e,xtemplate}
\ProvidesExplPackage
{acro}
- {2013/04/04}
- {1.2a}
+ {2013/05/06}
+ {1.3}
{Typeset Acronyms}
+% --------------------------------------------------------------------------
+% check expl3 version:
+\@ifpackagelater { expl3 } { 2012/11/21 }
+ { }
+ {
+ \PackageError { acro } { Support~package~expl3~too~old }
+ {
+ You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~
+ 'l3packages'.\MessageBreak
+ Loading~acro~will~abort!
+ }
+ \tex_endinput:D
+ }
+
+% --------------------------------------------------------------------------
% warning and error messages:
\msg_new:nnnn { acro } { undefined }
{ You've~requested~acronym~`#1'~but~it~seems~that~it~was~never~defined! }
@@ -50,6 +65,46 @@
I'm~using~option~`#2'~instead.
}
+\msg_new:nnnn { acro } { replaced }
+ { The~#1~`#2'~is~deprecated.~Use~`#3'~instead~\msg_line_context:. }
+ {
+ The~#1~`#2'~you~used~\msg_line_context: \c_space_tl is~deprecated~and~has~
+ been~replaced~by~`#3'.~Since~I~will~not~guarantee~that~#1~will~be~kept~
+ forever~I~encourage~you~to~switch.
+ }
+
+\msg_new:nnnn { acro } { deprecated }
+ { The~#1~`#2'~is~deprecated.~\msg_line_context:. }
+ {
+ The~#1~`#2'~you~used~\msg_line_context: \c_space_tl is~deprecated~and~there~
+ is~no~replacement.~Since~I~will~not~guarantee~that~#1~will~be~kept~forever~
+ I~encourage~you~to~remove~it~from~your~document.
+ }
+
+\cs_new:Npn \acro_option_deprecated:nn #1#2
+ {
+ \tl_if_blank:nTF { #2 }
+ { \msg_warning:nnnn { acro } { deprecated } { option } { #1 } }
+ { \msg_warning:nnnnn { acro } { replaced } { option } { #1 } { #2 } }
+ }
+
+\cs_new:Npn \acro_command_deprecated:NN #1#2
+ {
+ \tl_if_blank:nTF { #2 }
+ {
+ \msg_warning:nnnnn { acro } { deprecated }
+ { command }
+ { \token_to_str:N #1 }
+ }
+ {
+ \msg_warning:nnnnn { acro } { replaced }
+ { command }
+ { \token_to_str:N #1 }
+ { \token_to_str:N #2 }
+ }
+ }
+
+% --------------------------------------------------------------------------
% temporary variables
\tl_new:N \l__acro_tmpa_tl
\tl_new:N \l__acro_tmpb_tl
@@ -58,39 +113,67 @@
\prop_new:N \l__acro_tmpb_prop
\seq_new:N \l__acro_tmpa_seq
\seq_new:N \l__acro_tmpb_seq
+\int_new:N \l__acro_tmpa_int
+\int_new:N \l__acro_tmpb_int
+\int_new:N \l__acro_tmpc_int
+\int_new:N \l__acro_tmpd_int
-\tl_new:N \l__acro_ignore_tl
+% --------------------------------------------------------------------------
+% variants of kernel commands
+\cs_generate_variant:Nn \quark_if_no_value:nTF { V }
+\cs_generate_variant:Nn \tl_put_right:Nn { NV }
+\cs_generate_variant:Nn \tl_if_eq:nnT { V }
+\cs_generate_variant:Nn \tl_if_eq:nnF { V }
+\cs_generate_variant:Nn \seq_use:Nnnn { c }
+\cs_generate_variant:Nn \seq_gset_split:Nnn { c }
+% --------------------------------------------------------------------------
% 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_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
-\bool_new:N \l__acro_use_plural_bool
-\bool_new:N \l__acro_hyperref_loaded_bool
-\bool_new:N \l__acro_use_hyperref_bool
-\bool_new:N \l__acro_custom_format_bool
-\bool_new:N \l__acro_strict_bool
-\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_new:N \l__acro_use_plural_bool
+\bool_new:N \l__acro_hyperref_loaded_bool
+\bool_new:N \l__acro_use_hyperref_bool
+\bool_new:N \l__acro_custom_format_bool
+\bool_new:N \l__acro_strict_bool
+\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_foreign_bool
+\bool_set_true:N \l__acro_foreign_bool
+\bool_new:N \l__acro_sort_bool
\bool_set_true:N \l__acro_sort_bool
-\bool_new:N \l__acro_capitalize_list_bool
-\bool_new:N \l__acro_citation_all_bool
-\bool_new:N \l__acro_citation_first_bool
+\bool_new:N \l__acro_capitalize_list_bool
+\bool_new:N \l__acro_citation_all_bool
+\bool_new:N \l__acro_citation_first_bool
\bool_set_true:N \l__acro_citation_first_bool
-\bool_new:N \l__acro_acc_supp_bool
-\bool_new:N \l__acro_page_ranges_bool
-\bool_set_true:N \l__acro_page_ranges_bool
-\bool_new:N \l__acro_record_pages_bool
+\bool_new:N \l__acro_acc_supp_bool
+\bool_new:N \l__acro_following_page_bool
+\bool_new:N \l__acro_following_pages_bool
+\bool_new:N \l__acro_record_pages_bool
\bool_set_true:N \l__acro_record_pages_bool
-\bool_new:N \l__acro_addto_index_bool
+\bool_new:N \l__acro_addto_index_bool
+\bool_new:N \l__acro_version_selected_bool
+\bool_new:N \l__acro_is_excluded_bool
+\bool_new:N \l__acro_page_punct_bool
+\bool_new:N \l__acro_page_brackets_bool
+\bool_new:N \l__acro_page_display_bool
+\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_reversed_bool
+\bool_new:N \l__acro_use_note_bool
+\bool_new:N \l__acro_extra_punct_bool
+\bool_new:N \l__acro_extra_use_brackets_bool
-% tokenlist variables:
+% --------------------------------------------------------------------------
+% token list variables:
+\tl_new:N \l__acro_ignore_tl
\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
@@ -99,6 +182,11 @@
\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_foreign_tl
+\tl_new:N \l__acro_foreign_sep_tl
+\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_first_instance_tl
\tl_set:Nn \l__acro_first_instance_tl { default }
\tl_new:N \l__acro_extra_instance_tl
@@ -133,7 +221,27 @@
\tl_new:N \l__acro_first_between_tl
\tl_new:N \l__acro_citation_space_tl
\tl_set:Nn \l__acro_citation_space_tl { \nobreakspace }
+\tl_new:N \l__acro_active_version_tl
+\tl_new:N \l__acro_version_zero_tl
+\tl_set:Nn \l__acro_version_zero_tl { 0 }
+\tl_new:N \l__acro_extra_brackets_tl
+\tl_new:N \l__acro_extra_punct_tl
+\tl_new:N \l__acro_first_brackets_tl
+\tl_new:N \l__acro_page_punct_tl
+\tl_new:N \l__acro_page_brackets_tl
+\tl_new:N \l__acro_last_page_tl
+\tl_new:N \l__acro_current_page_tl
+\tl_new:N \l__acro_list_table_tl
+\tl_new:N \l__acro_list_table_spec_tl
+\tl_new:N \l__acro_index_short_tl
+\tl_new:N \l__acro_index_format_tl
+\tl_new:N \l__acro_acc_supp_tl
+
+% --------------------------------------------------------------------------
+% comma list variables
+\clist_new:N \l__acro_versions_clist
+% --------------------------------------------------------------------------
% property list variables:
\prop_new:N \l__acro_short_prop
\prop_new:N \l__acro_alt_prop
@@ -149,6 +257,7 @@
\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_foreign_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
@@ -162,13 +271,15 @@
\prop_new:N \l__acro_index_sort_prop
\prop_new:N \l__acro_index_cmd_prop
+% --------------------------------------------------------------------------
% length variables:
\dim_new:N \l__acro_table_width_dim
\dim_set:Nn \l__acro_table_width_dim { .7\linewidth }
+\dim_new:N \l__acro_page_space_dim
-\cs_new:Npn \__acro_citation_cmd:w { \cite }
-\cs_new:Npn \__acro_no_break: { \tex_penalty:D \c_ten_thousand }
-\cs_new:Npn \__acro_index_cmd:n { \index }
+% --------------------------------------------------------------------------
+% small commands for use at various places
+\cs_new:Npn \acro_no_break: { \tex_penalty:D \c_ten_thousand }
\cs_new:Npn \__acro_first_upper_case:n #1
{ \tl_expandable_uppercase:n { \tl_head:n { #1 } } \tl_tail:n { #1 } }
@@ -178,17 +289,10 @@
% --------------------------------------------------------------------------
% versioning:
-\tl_new:N \l__acro_active_version_tl
-\tl_new:N \l__acro_version_zero_tl
-\tl_set:Nn \l__acro_version_zero_tl { 0 }
-
-\clist_new:N \l__acro_versions_clist
\clist_put_right:Nn \l__acro_versions_clist { 0 }
\clist_put_right:Nn \l__acro_versions_clist { 1 }
-\bool_new:N \l__acro_version_selected_bool
-
-\cs_new:Npn \__acro_select_version:n #1
+\cs_new_protected:Npn \__acro_select_version:n #1
{
\clist_if_in:NnTF \l__acro_versions_clist { #1 }
{
@@ -203,7 +307,7 @@
\bool_set_true:N \l__acro_version_selected_bool
}
-
+% --------------------------------------------------------------------------
% options:
\keys_define:nn { acro }
{
@@ -222,8 +326,11 @@
\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 } ,
+ display-foreign .bool_set:N = \l__acro_foreign_bool ,
+ foreign-format .tl_set:N = \l__acro_foreign_format_tl ,
list-short-format .tl_set:N = \l__acro_list_short_format_tl ,
list-long-format .tl_set:N = \l__acro_list_long_format_tl ,
+ list-foreign-format .tl_set:N = \l__acro_foreign_list_format_tl ,
extra-format .tl_set:N = \l__acro_extra_format_tl ,
single .bool_set:N = \l__acro_use_single_bool ,
first-style .tl_set:N = \l__acro_first_instance_tl ,
@@ -231,13 +338,22 @@
page-ref .tl_set:N = \l__acro_page_instance_tl ,
page-name .tl_set:N = \l__acro_page_name_tl ,
pages-name .tl_set:N = \l__acro_pages_name_tl ,
- page-ranges .bool_set:N = \l__acro_page_ranges_bool ,
- record-pages .bool_set:N = \l__acro_record_pages_bool ,
+ page-ranges .code:n =
+ \bool_set_false:N \l__acro_following_page_bool
+ \bool_set_false:N \l__acro_following_pages_bool
+ \acro_option_deprecated:nn { pages-ranges } { } ,
+ following-page .bool_set:N = \l__acro_following_page_bool ,
+ following-pages .bool_set:N = \l__acro_following_pages_bool ,
+ record-pages .code:n =
+ \acro_option_deprecated:nn { record-pages } { } ,
next-page .tl_set:N = \l__acro_next_page_tl ,
next-pages .tl_set:N = \l__acro_next_pages_tl ,
list-style .tl_set:N = \l__acro_list_instance_tl ,
list-type .tl_set:N = \l__acro_list_type_tl ,
- list-header .tl_set:N = \l__acro_list_title_tl ,
+ list-header .code:n =
+ \acro_option_deprecated:nn { list-header } { list-heading }
+ \tl_set:Nn \l__acro_list_title_tl { #1 } ,
+ list-heading .tl_set:N = \l__acro_list_title_tl ,
list-name .tl_set:N = \l__acro_list_name_tl ,
list-table-width .dim_set:N = \l__acro_table_width_dim ,
hyperref .bool_set:N = \l__acro_use_hyperref_bool ,
@@ -284,10 +400,12 @@
{ \cs_set_eq:NN \acro_record_page_number:n \use_none:n }
}
+% --------------------------------------------------------------------------
% setup command:
\NewDocumentCommand \acsetup { m }
{ \keys_set:nn { acro } { #1 } \ignorespaces }
+% --------------------------------------------------------------------------
% typeset the short form:
\cs_new:Npn \__acro_write_short:n #1
{
@@ -307,12 +425,13 @@
% TODO: rethink the formatting mechanism
% right now a custom format gets applied additionally to the global one
% although before it
-\cs_new:Npn \__acro_write_long:Nn #1#2
+\cs_new_protected:Npn \__acro_write_long:Nn #1#2
{
\mode_if_horizontal:F { \leavevmode }
\group_begin:
- \bool_if:NT \l__acro_custom_long_format_bool
+ \bool_if:NTF \l__acro_custom_long_format_bool
{ \l__acro_custom_long_format_tl }
+ { \use:n }
{
\exp_args:Nx #1
{
@@ -328,9 +447,9 @@
% --------------------------------------------------------------------------
% hyperref support
\cs_new_eq:NN \acro_hyper_target:nn \use_ii:nn
-\cs_new_eq:NN \acro_hyper_link:nn \use_ii:nn
+\cs_new_eq:NN \acro_hyper_link:nn \use_ii:nn
-\cs_new:Npn \__acro_activate_hyperref_support:
+\cs_new_protected:Npn \__acro_activate_hyperref_support:
{
\bool_if:nT { \l__acro_hyperref_loaded_bool && \l__acro_use_hyperref_bool }
{
@@ -340,7 +459,7 @@
}
}
-\cs_new:Npn \__acro_make_link:nNN #1#2#3
+\cs_new_protected:Npn \__acro_make_link:nNN #1#2#3
{
\tl_set:Nn #2
{
@@ -374,19 +493,11 @@
}
\AtBeginDocument{
- \cs_if_exist:NF \textcolor
- { \cs_new_eq:NN \textcolor \use_ii:nn }
+ \cs_if_exist:NF \textcolor { \cs_new_eq:NN \textcolor \use_ii:nn }
}
% --------------------------------------------------------------------------
% output style of the first time an acronym is used
-\bool_new:N \l__acro_first_use_brackets_bool
-\bool_new:N \l__acro_first_only_short_bool
-\bool_new:N \l__acro_first_reversed_bool
-\bool_new:N \l__acro_use_note_bool
-
-\tl_new:N \l__acro_first_brackets_tl
-
\cs_new:Npn \__acro_note_command:n #1 { #1 }
% #1: id
@@ -402,6 +513,7 @@
only-short : boolean = false ,
reversed : boolean = false ,
between : tokenlist ,
+ foreign-sep : tokenlist = { , ~ }
}
\DeclareTemplateCode { acro-first } { inline } { 3 }
{
@@ -410,6 +522,7 @@
only-short = \l__acro_first_only_short_bool ,
reversed = \l__acro_first_reversed_bool ,
between = \l__acro_first_between_tl ,
+ foreign-sep = \l__acro_foreign_sep_tl
}
{
\AssignTemplateKeys
@@ -428,6 +541,22 @@
{ \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
+ }
+ {
+ \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
+ }
+ }
+ \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 } }
@@ -447,6 +576,17 @@
{ \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_first_long_format_tl { #3 }
+ \bool_if:nT { \l__acro_foreign_bool && \l__acro_first_reversed_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:
+ }
+ }
\bool_if:nT
{ \l__acro_first_use_brackets_bool && \l__acro_first_reversed_bool }
{ \tl_tail:N \l__acro_first_brackets_tl }
@@ -459,13 +599,15 @@
\DeclareTemplateInterface { acro-first } { note } { 3 }
{
use-note : boolean = true ,
- note-command : function 1 = \footnote { #1 }
+ note-command : function 1 = \footnote { #1 } ,
+ foreign-sep : tokenlist = ~
}
\DeclareTemplateCode { acro-first } { note } { 3 }
{
use-note = \l__acro_use_note_bool ,
- note-command = \__acro_note_command:n
+ note-command = \__acro_note_command:n ,
+ foreign-sep = \l__acro_foreign_sep_tl
}
{
\AssignTemplateKeys
@@ -476,6 +618,19 @@
\__acro_note_command:n
{
\__acro_write_long:No \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_cite_if:Nn \l__acro_citation_first_bool { #1 }
\__acro_index_if:Nn \l__acro_addto_index_bool { #1 }
}
@@ -532,11 +687,6 @@
% --------------------------------------------------------------------------
% formatting the extras information:
-\bool_new:N \l__acro_extra_punct_bool
-\bool_new:N \l__acro_extra_use_brackets_bool
-\tl_new:N \l__acro_extra_brackets_tl
-\tl_new:N \l__acro_extra_punct_tl
-
\DeclareObjectType { acro-extra } { 1 }
\DeclareTemplateInterface { acro-extra } { default } { 1 }
@@ -570,272 +720,177 @@
{ brackets = false , punct = true , punct-symbol = . }
\DeclareInstance { acro-extra } { plain } { default }
{ brackets = false , punct = false }
-\DeclareInstance { acro-extra } { paren } { default } { }
-\DeclareInstance { acro-extra } { bracket } { default } { brackets-type=[] }
+\DeclareInstance { acro-extra } { paren } { default }
+ { punct = true , punct-symbol = }
+\DeclareInstance { acro-extra } { bracket } { default }
+ { punct = true , punct-symbol = , brackets-type=[] }
\DeclareInstance { acro-extra } { comma } { default }
{ punct = true, brackets = false }
% --------------------------------------------------------------------------
-% 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
-\tl_new:N \l__acro_page_punct_tl
-\tl_new:N \l__acro_page_brackets_tl
-\dim_new:N \l__acro_page_space_dim
+% outputting the page numbers:
+\RequirePackage { zref-abspage }
-\cs_new:Npn \acro_create_page_records:n #1
+\cs_new_protected:Npn \acro_create_page_records:n #1
{
- \seq_new:c { g__acro_#1_tmp_seq }
\seq_new:c { g__acro_#1_pages_seq }
+ \tl_new:c { g__acro_#1_recorded_pages_tl }
}
-\cs_new:Npn \ac@hp #1
- {
- \tl_if_in:nnTF { #1 } { \ac@no@hp }
- { #1 }
- { \acro_hyper_page:n { #1 } }
- }
-
-\cs_new_protected:Npn \ac@no@hp {}
-
-\cs_new:Npn \__acro_safe_pages_aux:n #1
- { \noexpand \ac@hp {#1}| }
-
-\cs_new_eq:NN \acro_hyper_page:n \use:n
-
-\cs_new:Npn \acro_safe_pages:n #1
- {
- \iow_now:Nx \@auxout
- {
- \exp_not:n { \global \@namedef } { acro@#1@pages }
- { \seq_map_function:cN { g__acro_#1_pages_seq } \__acro_safe_pages_aux:n }
- }
- }
-
-\AtEndDocument
- {
- \prop_map_inline:Nn \l__acro_short_prop
- {
- \acro_finalize_page_numbers:n { #1 }
- \acro_safe_pages:n { #1 }
- }
- }
-
-\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
+\cs_new_protected:Npn \acro_hyper_page:n #1 { \use:n { #1 } }
-%TODO: this should be translated into expl3 syntax
-\cs_new:Npn \__acro_if_is_number:nTF #1
- {
- \if!\ifnum9<1#1!\expandafter\expandafter\expandafter\@firstoftwo\fi
- \else
- \expandafter\@secondoftwo
- \fi
- }
+\cs_new:Npn \acro_get_thepage:nnn #1#2#3 { \acro_hyper_page:n { #1 } }
+\cs_new:Npn \acro_get_thepage_from:N #1
+ { \exp_after:wN \acro_get_thepage:nnn #1 }
-\cs_new:Npn \__acro_convert_to_arabic:n #1
- {
- \__acro_if_is_number:nTF { #1 }
- { #1 }
- { \exp_args:Nf \int_from_roman:n { \tl_expandable_lowercase:n { #1 } } }
- }
-\cs_generate_variant:Nn \__acro_convert_to_arabic:n { V }
+\cs_new:Npn \acro_get_page_number:nnn #1#2#3 { #2 }
+\cs_new:Npn \acro_get_page_number_from:N #1
+ { \exp_after:wN \acro_get_page_number:nnn #1 }
-\cs_new:Npn \__acro_check_for_style:n #1
- {
- \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_get_abspage:nnn #1#2#3 { #3 }
+\cs_new:Npn \acro_get_abspage_from:N #1
+ { \exp_after:wN \acro_get_abspage:nnn #1 }
-\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_page_range_comma: {}
-\cs_new:Npn \acro_record_page_number:n #1
+\cs_new_protected:Npn \acro_print_page_numbers: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_if_empty:cF { g__acro_#1_pages_seq }
{
- \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 } }
+ % have the numbers changed?
+ \tl_set:Nx \l__acro_tmpa_tl
+ { \seq_use:cnnn { g__acro_#1_pages_seq } { | } { | } { | } }
+ \tl_if_eq:cNF { g__acro_#1_recorded_pages_tl } \l__acro_tmpa_tl
+ {
+ \@latex@warning@no@line
+ {Rerun~to~get~page~numbers~of~acronym~#1~in~acronym~list~right}
}
+ \tl_clear:N \l__acro_write_pages_tl
+ \tl_clear:N \l__acro_last_page_tl
+ \tl_clear:N \l__acro_current_page_tl
+ \seq_set_eq:Nc \l__acro_tmpb_seq { g__acro_#1_pages_seq }
+ \seq_remove_duplicates:N \l__acro_tmpb_seq
+ \seq_clear:N \l__acro_tmpa_seq
+ \cs_set_protected:Npn \acro_page_range_comma:
+ { \cs_set:Npn \acro_page_range_comma: { ,~ } }
+ % get the numbers:
+ \int_compare:nNnTF { \seq_count:N \l__acro_tmpb_seq } = { 1 }
{
- \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
+ \l__acro_page_name_tl
+ \seq_get_right:cN { g__acro_#1_pages_seq } \l__acro_tmpa_tl
+ \acro_get_thepage_from:N \l__acro_tmpa_tl
+ }
+ { \l__acro_pages_name_tl
+ \seq_map_inline:cn { g__acro_#1_pages_seq }
+ {
+ \tl_if_blank:VTF \l__acro_last_page_tl
+ {% we're at the beginning
+ \seq_put_right:Nn \l__acro_tmpa_seq { ##1 }
+ \tl_set:Nn \l__acro_last_page_tl { ##1 }
}
- {
- \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'at least at the second page
+ % current page:
+ \tl_set:Nn \l__acro_current_page_tl { ##1 }
+ % last page:
+ \seq_get_right:NN \l__acro_tmpa_seq \l__acro_last_page_tl
+ \tl_if_eq:NNTF \l__acro_current_page_tl \l__acro_last_page_tl
+ {% there were more than one appearance on the current page
+ \seq_put_right:Nn \l__acro_tmpa_seq { ##1 }
+ }
+ {% new page
+ \acro_determine_page_ranges:NNn
+ \l__acro_tmpa_seq
+ \l__acro_write_pages_tl
+ { ##1 }
+ }
}
}
- {% we're in a range
- \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 }
- { \use:c { \g__acro_current_page_style_tl } { page } }
- }
- {% 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 }
- {
- \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 }
- }
- }
- {
- \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_if_empty:NF \l__acro_tmpa_seq
+ {
+ \acro_determine_page_ranges:NNV
+ \l__acro_tmpa_seq
+ \l__acro_write_pages_tl
+ \l__acro_current_page_tl
}
+ \tl_use:N \l__acro_write_pages_tl
+ \tl_clear:N \l__acro_write_pages_tl
}
}
- }
-
-\cs_new:Npn \acro_finalize_page_numbers:n #1
- {
- \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:NNF \l__acro_tmp_page_tl \l__acro_last_page_tl
+ \seq_clear:N \l__acro_tmpa_seq
+ \seq_clear:N \l__acro_tmpb_seq
+ }
+
+\cs_new:Npn \acro_determine_page_ranges:NNn #1#2#3
+ {
+ \seq_remove_duplicates:N #1
+ % current page:
+ \int_set:Nn \l__acro_tmpa_int { \acro_get_abspage:nnn #3 }
+ \int_set:Nn \l__acro_tmpb_int { \acro_get_page_number:nnn #3 }
+ % last page:
+ \seq_get_right:NN #1 \l__acro_last_page_tl
+ \int_set:Nn \l__acro_tmpc_int
+ { \acro_get_abspage_from:N \l__acro_last_page_tl }
+ \int_set:Nn \l__acro_tmpd_int
+ { \acro_get_page_number_from:N \l__acro_last_page_tl }
+ \bool_if:nTF
{
+ \int_compare_p:nNn
+ { \l__acro_tmpa_int - \l__acro_tmpc_int }
+ =
+ { \l__acro_tmpb_int - \l__acro_tmpd_int }
+ &&
+ \int_compare_p:nNn
+ { \l__acro_tmpb_int - \l__acro_tmpd_int } = {1}
+ }
+ {% same kind of page numbering, one page ahead
+ % => possible range
+ \seq_put_right:Nn #1 { #3 }
+ }
+ {% any possible range ended
+ \tl_put_right:Nn #2 { \acro_page_range_comma: }
\int_compare:nNnTF
- { \__acro_convert_to_arabic:V \l__acro_tmp_page_tl }
- =
- { \__acro_convert_to_arabic:V \l__acro_last_page_tl +1 }
- {
- \bool_if:NTF \l__acro_page_ranges_bool
+ { \seq_count:N #1 } > {2}
+ {% real range
+ \seq_get_left:NN #1 \l__acro_tmpa_tl
+ \tl_put_right:Nx #2 { \acro_get_thepage_from:N \l__acro_tmpa_tl }
+ \bool_if:NTF \l__acro_following_pages_bool
+ { \tl_put_right:Nn #2 { \l__acro_next_pages_tl } }
{
- \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 }
+ \tl_put_right:Nn #2 { -- }
+ \seq_get_right:NN #1 \l__acro_tmpa_tl
+ \tl_put_right:Nx #2 { \acro_get_thepage_from:N \l__acro_tmpa_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 }
+ \int_compare:nNnTF
+ { \seq_count:N #1 } = {2}
+ {% range of two pages
+ \seq_get_left:NN #1 \l__acro_tmpa_tl
+ \tl_put_right:Nx #2 { \acro_get_thepage_from:N \l__acro_tmpa_tl }
+ \bool_if:NTF \l__acro_following_page_bool
+ { \tl_put_right:Nn #2 { \l__acro_next_page_tl } }
+ {
+ \tl_put_right:Nn #2 { ,~ }
+ \seq_get_right:NN #1 \l__acro_tmpa_tl
+ \tl_put_right:Nx #2 { \acro_get_thepage_from:N \l__acro_tmpa_tl }
+ }
}
- {
- \seq_gput_right:cn { g__acro_#1_pages_seq }
- { \ac@no@hp\l__acro_next_pages_tl }
+ {% no range at all
+ \seq_get_right:NN #1 \l__acro_tmpa_tl
+ \tl_put_right:Nx #2 { \acro_get_thepage_from:N \l__acro_tmpa_tl }
}
}
+ \seq_clear:N #1
+ \seq_put_right:Nn #1 { #3 }
}
}
-
-\cs_new:Npn \acro_print_page_numbers:n #1
- {
- \cs_if_exist:cTF { acro@#1@pages }
- {
- \tl_set_eq:Nc \l__acro_tmpa_tl { acro@#1@pages }
- \__acro_print_page_numbers:n { #1 }
- }
- { ?? }
- }
-
-\cs_new:Npn \__acro_print_page_numbers:n #1
- {
- \seq_set_split:NnV \l__acro_tmpb_seq { | } \l__acro_tmpa_tl
- \seq_pop_right:NN \l__acro_tmpb_seq \l__acro_ignore_tl
- \int_compare:nNnTF { \seq_count:N \l__acro_tmpb_seq } = { 1 }
- { \l__acro_page_name_tl } { \l__acro_pages_name_tl }
- \acro_no_break:
- \skip_horizontal:N \l__acro_page_space_dim
- \acro_no_break:
- \seq_map_inline:Nn \l__acro_tmpb_seq { ##1 }
- }
+\cs_generate_variant:Nn \acro_determine_page_ranges:NNn { NNV }
\AtBeginDocument
{
\tl_if_eq:NNT \l__acro_active_version_tl \l__acro_version_zero_tl
{
- \cs_set:Npn \__acro_print_page_numbers:n #1
+ \cs_set:Npn \acro_print_page_numbers:n #1
{
\acro_no_break:
\skip_horizontal:N \l__acro_page_space_dim
@@ -846,8 +901,7 @@
}
}
-\cs_new:Npn \acro_no_break: { \tex_penalty:D \c_ten_thousand }
-
+% --------------------------------------------------------------------------
\DeclareObjectType { acro-page-number } { 1 }
\DeclareTemplateInterface { acro-page-number } { default } { 1 }
@@ -937,13 +991,10 @@
% outputting the whole list
\DeclareObjectType { acro-list } { 3 }
-% excluded items:
-\bool_new:N \l__acro_is_excluded_bool
-\cs_generate_variant:Nn \tl_if_eq:nnT { nV }
% #1: id
% #2: excluded classes
% #3: continue if not excluded
-\cs_new:Npn \acro_is_excluded:nnF #1#2#3
+\cs_new_protected:Npn \acro_is_excluded:nnF #1#2#3
{
\bool_set_false:N \l__acro_is_excluded_bool
\tl_if_empty:nTF { #2 }
@@ -952,7 +1003,7 @@
\clist_map_inline:nn { #2 }
{
\prop_get:NnNF \l__acro_class_prop { #1 } \l__acro_tmpa_tl {}
- \tl_if_eq:nVT { ##1 } \l__acro_tmpa_tl
+ \tl_if_eq:VnT \l__acro_tmpa_tl { ##1 }
{ \bool_set_true:N \l__acro_is_excluded_bool }
}
\bool_if:NF \l__acro_is_excluded_bool { #3 }
@@ -965,9 +1016,23 @@
\cs_new:Npn \acro_print_list_extra:n #1 { }
\cs_new:Npn \acro_print_list_page:n #1 { }
+\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:
+ }
+ }
+
% Test, if acronyms should be printed or not; needs testing for in/excluded
% classes and options `only-used' and `single':
-\cs_new:Npn \acro_list_allow_items:nn #1#2
+\cs_new_protected:Npn \acro_list_allow_items:nn #1#2
{
\prop_map_inline:Nn \l__acro_short_prop
{
@@ -988,6 +1053,8 @@
{ \bool_set_true:N \l__acro_first_upper_bool }
\acro_print_list_long:n { ##1 }
\bool_set_false:N \l__acro_first_upper_bool
+ \bool_if:NT \l__acro_foreign_bool
+ { \acro_get_foreign:n { ##1 } }
\acro_print_list_extra:n { ##1 }
\acro_print_list_page:n { ##1 }
}
@@ -1006,6 +1073,8 @@
{ \bool_set_true:N \l__acro_first_upper_bool }
\acro_print_list_long:n { ##1 }
\bool_set_false:N \l__acro_first_upper_bool
+ \bool_if:NT \l__acro_foreign_bool
+ { \acro_get_foreign:n { ##1 } }
\acro_print_list_extra:n { ##1 }
\acro_print_list_page:n { ##1 }
}
@@ -1019,10 +1088,10 @@
% list template:
\DeclareTemplateInterface { acro-list } { list } { 3 }
- { }
+ { foreign-sep : tokenlist = { ~ } }
\DeclareTemplateCode { acro-list } { list } { 3 }
- { }
+ { foreign-sep = \l__acro_foreign_sep_tl }
{
\AssignTemplateKeys
\__acro_activate_hyperref_support:
@@ -1045,7 +1114,7 @@
{ \prop_get:Nn \l__acro_long_prop { ##1 } }
\__acro_cite_if:Nn \l__acro_citation_all_bool { ##1 }
}
- \cs_set:Npn \acro_print_list_extra:n ##1
+ \cs_set_protected:Npn \acro_print_list_extra:n ##1
{
\prop_get:NnNT \l__acro_extra_prop { ##1 } \l__acro_tmpa_tl
{
@@ -1064,19 +1133,18 @@
}
% table template:
-\tl_new:N \l__acro_list_table_tl
-\tl_new:N \l__acro_list_table_spec_tl
-
\DeclareTemplateInterface { acro-list } { table } { 3 }
{
- table : tokenlist = longtable ,
- table-spec : tokenlist = lp{\l__acro_table_width_dim}
+ table : tokenlist = longtable ,
+ table-spec : tokenlist = lp{\l__acro_table_width_dim} ,
+ foreign-sep : tokenlist = { ~ }
}
\DeclareTemplateCode { acro-list } { table } { 3 }
{
- table = \l__acro_list_table_tl ,
- table-spec = \l__acro_list_table_spec_tl
+ table = \l__acro_list_table_tl ,
+ table-spec = \l__acro_list_table_spec_tl ,
+ foreign-sep = \l__acro_foreign_sep_tl
}
{
\AssignTemplateKeys
@@ -1098,7 +1166,7 @@
{ \prop_get:Nn \l__acro_long_prop { ##1 } }
\__acro_cite_if:Nn \l__acro_citation_all_bool { ##1 }
}
- \cs_set:Npn \acro_print_list_extra:n ##1
+ \cs_set_protected:Npn \acro_print_list_extra:n ##1
{
\prop_get:NnNT \l__acro_extra_prop { ##1 } \l__acro_tmpa_tl
{
@@ -1150,7 +1218,7 @@
\__acro_cite_if:Nn \l__acro_citation_all_bool { ##1 }
&
}
- \cs_set:Npn \acro_print_list_extra:n ##1
+ \cs_set_protected:Npn \acro_print_list_extra:n ##1
{
\prop_get:NnNT \l__acro_extra_prop { ##1 } \l__acro_tmpa_tl
{
@@ -1192,7 +1260,7 @@
{ \__acro_acc_supp:nn { ##1 } { \__acro_write_short:n { ##2 } } }
&
}
- \cs_set:Npn \acro_print_list_extra:n ##1
+ \cs_set_protected:Npn \acro_print_list_extra:n ##1
{
\bool_if:NT \l__acro_capitalize_list_bool
{ \bool_set_true:N \l__acro_first_upper_bool }
@@ -1201,7 +1269,7 @@
\__acro_cite_if:Nn \l__acro_citation_all_bool { ##1 }
&
}
- \cs_set:Npn \acro_print_list_long:n ##1
+ \cs_set_protected:Npn \acro_print_list_long:n ##1
{
\prop_get:NnNT \l__acro_extra_prop { ##1 } \l__acro_tmpa_tl
{
@@ -1222,24 +1290,32 @@
}
% the different styles:
-\DeclareInstance { acro-list } { list } { list } { }
-\DeclareInstance { acro-list } { tabular } { table }
+\DeclareInstance { acro-list } { list }
+ { list }
+ { }
+\DeclareInstance { acro-list } { tabular }
+ { table }
+ { table = tabular }
+\DeclareInstance { acro-list } { longtable }
+ { table }
+ { table = longtable }
+\DeclareInstance { acro-list } { extra-longtable }
+ { extra-table }
+ { table = longtable }
+\DeclareInstance { acro-list } { extra-tabular }
+ { extra-table }
{ table = tabular }
-\DeclareInstance { acro-list } { longtable } { table }
+\DeclareInstance { acro-list } { extra-longtable-rev }
+ { extra-table-rev }
{ table = longtable }
-\DeclareInstance { acro-list } { extra-longtable } { extra-table }
- { table = longtable }
-\DeclareInstance { acro-list } { extra-tabular } { extra-table }
- { table = tabular }
-\DeclareInstance { acro-list } { extra-longtable-rev } { extra-table-rev }
- { table = longtable }
-\DeclareInstance { acro-list } { extra-tabular-rev } { extra-table-rev }
- { table = tabular }
+\DeclareInstance { acro-list } { extra-tabular-rev }
+ { extra-table-rev }
+ { table = tabular }
% --------------------------------------------------------------------------
% automatic typesetting, the internals of \ac:
% #1: id
-\cs_new:Npn \acro_use:n #1
+\cs_new_protected:Npn \acro_use:n #1
{
% get the acronym and the plural settings:
\acro_get:n { #1 }
@@ -1269,27 +1345,28 @@
}
}
-\cs_new:Npn \__acro_is_single:nTF #1#2#3
+\prg_new_conditional:Npnn \__acro_is_single:n #1 { T,TF }
{
\bool_if:nTF { !\l__acro_use_single_bool || \cs_if_exist_p:c { acro@#1@twice } }
- { #3 } { #2 }
+ { \prg_return_false: } { \prg_return_true: }
}
-\cs_new:Npn \__acro_is_single:nT #1#2
+\cs_new_protected:Npn \acro_use_if:n #1
{
- \bool_if:nF { !\l__acro_use_single_bool || \cs_if_exist_p:c { acro@#1@twice } }
- { #2 }
+ \tl_if_blank:nTF { #1 }
+ { \bool_set_true:N \l__acro_mark_as_used_bool }
+ { \bool_set_false:N \l__acro_mark_as_used_bool }
}
% --------------------------------------------------------------------------
% some helpers we'll need more often:
-\cs_new:Npn \acro_defined:n #1
+\cs_new_protected:Npn \acro_defined:n #1
{
\prop_if_in:NnF \l__acro_short_prop { #1 }
{ \msg_error:nnx { acro } { undefined } { #1 } }
}
-\cs_new:Npn \acro_get:n #1
+\cs_new_protected:Npn \acro_get:n #1
{
\acro_defined:n { #1 }
\__acro_activate_hyperref_support:
@@ -1316,9 +1393,7 @@
{ \tl_put_right:NV \l__acro_long_tl \l__acro_long_post_tl }
}
-\cs_generate_variant:Nn \tl_put_right:Nn { NV }
-
-\cs_new:Npn \__acro_set_plural:n #1
+\cs_new_protected:Npn \__acro_set_plural:n #1
{
\bool_if:NT \l__acro_use_plural_bool
{
@@ -1334,7 +1409,7 @@
% --------------------------------------------------------------------------
% enable us to know if the acronym is used only once and provide a different
% style for that:
-\cs_new:Npn \acro_is_used:nTF #1#2#3
+\prg_new_protected_conditional:Npnn \acro_is_used:n #1 { TF }
{
\bool_if:nTF
{
@@ -1348,11 +1423,33 @@
! \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 } }
- \bool_if:NT \l__acro_mark_as_used_bool
+ \bool_if:NTF \l__acro_mark_as_used_bool
+ {
+ \iow_shipout_x:Nn \@auxout
+ {
+ \token_to_str:N \acro@used@twice { #1 }
+ { \thepage }
+ { \arabic{page} }
+ { \arabic{abspage} }
+ }
+ }
{
+ \iow_shipout_x:Nn \@auxout
+ { \token_to_str:N \acro@used@twice { #1 } {} {} {} }
+ }
+ \prg_return_true:
+ }
+ {
+ \bool_if:NTF \l__acro_mark_as_used_bool
+ {
+ \iow_shipout_x:Nn \@auxout
+ {
+ \token_to_str:N \acro@used@once { #1 }
+ { \thepage }
+ { \arabic{page} }
+ { \arabic{abspage} }
+ }
\bool_if:nT
{
!\bool_if_p:c { g__acro_#1_label_bool } &&
@@ -1364,25 +1461,64 @@
}
\bool_gset_true:c { g__acro_#1_used_bool }
}
- #3
+ {
+ \iow_shipout_x:Nn \@auxout
+ { \token_to_str:N \acro@used@once { #1 } {} {} {} }
+ }
+ \prg_return_false:
}
}
\cs_new:Npn \acro_is_used:n #1
{ \acro_is_used:nTF { #1 } { } { } }
-\cs_new:Npn \acro@used@once #1
- { \expandafter\xdef\csname acro@#1@once \endcsname { #1 } }
-\cs_new:Npn \acro@used@twice #1
- { \expandafter\xdef\csname acro@#1@twice \endcsname { #1 } }
+% --------------------------------------------------------------------------
+% the commands for the auxiliary file:
+\cs_new_protected:Npn \acro@used@once #1#2#3#4
+ {
+ \expandafter\xdef\csname acro@#1@once \endcsname { #1 }
+ \tl_if_empty:nF { #2#3#4 }
+ { \seq_gput_right:cn { g__acro_#1_pages_seq } { {#2}{#3}{#4} } }
+ }
+\cs_new_protected:Npn \acro@used@twice #1#2#3#4
+ {
+ \expandafter\xdef\csname acro@#1@twice \endcsname { #1 }
+ \tl_if_empty:nF { #2#3#4 }
+ { \seq_gput_right:cn { g__acro_#1_pages_seq } { {#2}{#3}{#4} } }
+ }
+
+\cs_new_protected:Npn \acro@pages #1#2
+ { \tl_gset:cn { g__acro_#1_recorded_pages_tl } { #2 } }
\AtEndDocument
{
- \cs_set:Npn \acro@used@twice #1
+ \cs_set_protected:Npn \acro@used@twice #1#2#3#4
+ {
+ \tl_set:Nn \l__acro_tmpa_tl { #1 }
+ \tl_if_eq:cNF { acro@#1@twice } \l__acro_tmpa_tl
+ { \@tempswatrue }
+ }
+ \prop_map_inline:Nn \l__acro_short_prop
{
- \def\reserved@a{#1}%
- \expandafter\ifx\csname acro@#1@twice \endcsname\reserved@a\else
- \@tempswatrue\fi
+ \seq_if_empty:cF { g__acro_#1_pages_seq }
+ {
+ \iow_shipout_x:Nn \@auxout
+ {
+ \token_to_str:N \acro@pages { #1 }
+ { \seq_use:cnnn { g__acro_#1_pages_seq } { | } { | } { | } }
+ }
+ }
+ }
+ }
+
+% if `acro' is deactivated prevent unnecessary errors from aux file:
+\AtBeginDocument
+ {
+ \iow_now:Nx \@auxout
+ {
+ \token_to_str:N \providecommand \token_to_str:N \acro@used@once [4] {} ^^J
+ \token_to_str:N \providecommand \token_to_str:N \acro@used@twice [4] {} ^^J
+ \token_to_str:N \providecommand \token_to_str:N \acro@pages [2] {}
}
}
@@ -1394,7 +1530,7 @@
}
% the standard internals:
-\cs_new:Npn \acro_short:n #1
+\cs_new_protected:Npn \acro_short:n #1
{
\acro_get:n { #1 }
\acro_is_used:n { #1 }
@@ -1408,7 +1544,7 @@
}
% get alternative entry:
-\cs_new:Npn \acro_alt:n #1
+\cs_new_protected:Npn \acro_alt:n #1
{
\acro_get:n { #1 }
\acro_is_used:n { #1 }
@@ -1422,7 +1558,7 @@
}
% get long entry:
-\cs_new:Npn \acro_long:n #1
+\cs_new_protected:Npn \acro_long:n #1
{
\acro_get:n { #1 }
\acro_is_used:n { #1 }
@@ -1434,7 +1570,7 @@
}
% output like the first time:
-\cs_new:Npn \acro_first:n #1
+\cs_new_protected:Npn \acro_first:n #1
{
\bool_gset_true:c { g__acro_#1_first_use_bool }
\acro_get:n { #1 }
@@ -1448,7 +1584,7 @@
}
% output like the first time with own long version:
-\cs_new:Npn \acro_first_like:nn #1#2
+\cs_new_protected:Npn \acro_first_like:nn #1#2
{
\bool_gset_true:c { g__acro_#1_first_use_bool }
\acro_get:n { #1 }
@@ -1463,6 +1599,8 @@
% ----------------------------------------------------------------------------
% citations:
+\cs_new:Npn \__acro_citation_cmd:w { \cite } %{}
+
% #1 pre
% #2 post
% #3 key
@@ -1478,7 +1616,7 @@
}
\cs_generate_variant:Nn \__acro_cite:nnn { VVV }
-\cs_new:Npn \__acro_cite_if:Nn #1#2
+\cs_new_protected:Npn \__acro_cite_if:Nn #1#2
{
\bool_if:NT #1
{
@@ -1486,7 +1624,7 @@
{
\prop_get:NnN \l__acro_citation_pre_prop { #2 } \l__acro_tmpb_tl
\prop_get:NnN \l__acro_citation_post_prop { #2 } \l__acro_tmpc_tl
- \__acro_no_break:
+ \acro_no_break:
\tl_use:N \l__acro_citation_space_tl
\__acro_cite:VVV
\l__acro_tmpb_tl
@@ -1498,7 +1636,7 @@
% ----------------------------------------------------------------------------
% indexing:
-\cs_new: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 }
{
@@ -1513,33 +1651,33 @@
}
}
+\cs_new:Npn \__acro_index_cmd:n { \index }
+
% #1: cmd
% #2: key
% #3: sort
% #4: replace
-\cs_new:Npn \__acro_index:nnnn #1#2#3#4
+\cs_new_protected:Npn \__acro_index:nnnn #1#2#3#4
{
- \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 } }
+ \prop_get:NnNF \l__acro_short_prop { #2 } \l__acro_index_short_tl {}
+ \prop_get:NnNF \l__acro_format_prop { #2 } \l__acro_index_format_tl {}
+ \quark_if_no_value:VTF \l__acro_index_format_tl
+ { \tl_set:Nn \l__acro_tmpa_tl { \l__acro_short_format_tl \l__acro_index_short_tl } }
+ { \tl_set:Nn \l__acro_tmpa_tl { \l__acro_index_format_tl \l__acro_index_short_tl } }
\quark_if_no_value:nF { #1 }
{ \cs_set:Npn \__acro_index_cmd:n { #1 } }
\quark_if_no_value:nTF { #4 }
{
\quark_if_no_value:nTF { #3 }
- { \__acro_index_cmd:n { #2 @ { \l__acro_tmpc_tl } } }
- { \__acro_index_cmd:n { #3 @ { \l__acro_tmpc_tl } } }
+ { \__acro_index_cmd:n { #2 @ { \l__acro_tmpa_tl } } }
+ { \__acro_index_cmd:n { #3 @ { \l__acro_tmpa_tl } } }
}
{ \__acro_index_cmd:n { #4 } }
}
\cs_generate_variant:Nn \__acro_index:nnnn { VnVV }
-\cs_generate_variant:Nn \quark_if_no_value:nTF { V }
% ----------------------------------------------------------------------------
% accessability support
-\tl_new:N \l__acro_acc_supp_tl
\cs_new_eq:NN \__acro_acc_supp:nn \use_ii:nn
\cs_new:Npn \__acro_acc_supp_aux:nn #1#2
@@ -1555,7 +1693,7 @@
\bool_if:NT \l__acro_acc_supp_bool
{
\RequirePackage { accsupp }
- \cs_set:Npn \__acro_acc_supp:nn #1#2
+ \cs_set_protected:Npn \__acro_acc_supp:nn #1#2
{
\prop_get:NnNF \l__acro_acc_supp_prop { #1 } \l__acro_acc_supp_tl
{ \prop_get:NnNF \l__acro_short_prop { #1 } \l__acro_acc_supp_tl {} }
@@ -1586,7 +1724,7 @@
\bool_if:NT \l__acro_sort_bool
{
\RequirePackage { l3sort }
- \cs_new:Npn \acro_sort_prop:N #1
+ \cs_new_protected:Npn \acro_sort_prop:N #1
{
\seq_clear:N \l__acro_tmpa_seq
\prop_clear:N \l__acro_tmpa_prop
@@ -1623,18 +1761,12 @@
% --------------------------------------------------------------------------
% regarding list printing:
-\cs_new:Npn \acro@print@list
- { \cs_if_exist:NF \acro@printed@list { \cs_new:Npn \acro@printed@list {} } }
-
-\cs_new:Npn \acro_use_if:nn #1#2
- {
- \IfBooleanTF { #1 }
- { \bool_set_false:N \l__acro_mark_as_used_bool }
- {
- \acro_record_page_number:n { #2 }
- \bool_set_true:N \l__acro_mark_as_used_bool
- }
- }
+% this command ensures that a rerun warning is given when \printacronyms
+% is set the first time. This mechanism doesn't make very much sense,
+% should be replaced by a different and more efficient one
+%
+\cs_new_protected:Npn \acro@print@list
+ { \cs_if_exist:NF \acro@printed@list { \cs_new:Npn \acro@printed@list { printed } } }
% --------------------------------------------------------------------------
% the user commands:
@@ -1643,7 +1775,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\acro_use:n { #2 }
\group_end:
}
@@ -1652,7 +1786,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_indefinite_bool
\acro_use:n { #2 }
\group_end:
@@ -1662,7 +1798,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_upper_indefinite_bool
\acro_use:n { #2 }
\group_end:
@@ -1682,7 +1820,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_use_plural_bool
\acro_use:n { #2 }
\group_end:
@@ -1692,7 +1832,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_use_plural_bool
\bool_set_true:N \l__acro_first_upper_bool
\acro_use:n { #2 }
@@ -1704,7 +1846,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\acro_short:n { #2 }
\group_end:
}
@@ -1713,7 +1857,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_indefinite_bool
\acro_short:n { #2 }
\group_end:
@@ -1723,7 +1869,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_upper_indefinite_bool
\acro_short:n { #2 }
\group_end:
@@ -1733,7 +1881,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_use_plural_bool
\acro_short:n { #2 }
\group_end:
@@ -1744,7 +1894,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\acro_alt:n { #2 }
\group_end:
}
@@ -1753,7 +1905,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_indefinite_bool
\acro_alt:n { #2 }
\group_end:
@@ -1763,7 +1917,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_upper_indefinite_bool
\acro_alt:n { #2 }
\group_end:
@@ -1773,7 +1929,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_use_plural_bool
\acro_alt:n { #2 }
\group_end:
@@ -1784,7 +1942,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\acro_long:n { #2 }
\group_end:
}
@@ -1793,7 +1953,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_indefinite_bool
\acro_long:n { #2 }
\group_end:
@@ -1803,7 +1965,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_upper_indefinite_bool
\acro_long:n { #2 }
\group_end:
@@ -1813,7 +1977,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_first_upper_bool
\acro_long:n { #2 }
\group_end:
@@ -1823,7 +1989,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_use_plural_bool
\acro_long:n { #2 }
\group_end:
@@ -1833,7 +2001,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_use_plural_bool
\bool_set_true:N \l__acro_first_upper_bool
\acro_long:n { #2 }
@@ -1845,7 +2015,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\acro_first:n { #2 }
\group_end:
}
@@ -1854,7 +2026,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_indefinite_bool
\acro_first:n { #2 }
\group_end:
@@ -1864,7 +2038,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_upper_indefinite_bool
\acro_first:n { #2 }
\group_end:
@@ -1874,7 +2050,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_first_upper_bool
\acro_first:n { #2 }
\group_end:
@@ -1884,7 +2062,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_use_plural_bool
\acro_first:n { #2 }
\group_end:
@@ -1894,7 +2074,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_use_plural_bool
\bool_set_true:N \l__acro_first_upper_bool
\acro_first:n { #2 }
@@ -1906,7 +2088,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\acro_first_like:nn { #2 } { #3 }
\group_end:
}
@@ -1915,7 +2099,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_indefinite_bool
\acro_first_like:nn { #2 } { #3 }
\group_end:
@@ -1925,7 +2111,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_upper_indefinite_bool
\acro_first_like:nn { #2 } { #3 }
\group_end:
@@ -1935,7 +2123,9 @@
{
\group_begin:
\acro_defined:n { #2 }
- \acro_use_if:nn { #1 } { #2 }
+ \IfBooleanTF { #1 }
+ { \acro_use_if:n { * } }
+ { \acro_use_if:n { } }
\bool_set_true:N \l__acro_use_plural_bool
\acro_first_like:nn { #2 } { #3 }
\group_end:
@@ -1943,23 +2133,25 @@
% reset outputs, they'll behave like the first time again (!not like the _only_
% time!):
-\cs_new:Npn \acro_reset:n #1
+\cs_new_protected:Npn \acro_reset:n #1
{
\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
+\cs_new_protected: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 }
+ \cs_if_exist:cTF { acro@#1@once }
+ { \cs_gset:cpn { acro@#1@twice } { #1 } }
+ { \cs_gset:cpn { acro@#1@once } { #1 } }
}
-\cs_new:Npn \acro_reset_all:
+\cs_new_protected:Npn \acro_reset_all:
{ \prop_map_inline:Nn \l__acro_short_prop { \acro_reset:n { ##1 } } }
-\cs_new:Npn \acro_mark_all_as_used:
+\cs_new_protected:Npn \acro_mark_all_as_used:
{ \prop_map_inline:Nn \l__acro_short_prop { \acro_mark_as_used:n { ##1 } } }
\NewDocumentCommand \acresetall {}
@@ -1986,6 +2178,7 @@
\cs_new:Npn \acpdfstringplural
{ \acro_pdf_string_plural:n }
+% TODO: why did I do this instead of \tl_if_eq:nnTF ?
\cs_new:Npn \acro_tl_if_eq:nnTF #1#2
{ \ifx#1#2\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi }
@@ -2027,7 +2220,7 @@
\cs_set_eq:NN \Acfp \acpdfstringplural
\cs_set_eq:NN \acap \acpdfstringplural
}
- \cs_set_eq:NN \acro_hyper_page:n \hyperpage
+ \cs_set_protected:Npn \acro_hyper_page:n #1 { \hyperpage { #1 } }
} {}
}
@@ -2141,6 +2334,22 @@
- new commands: \iac, \Iac, \iacs, \Iacs, \iaca, \Iaca, \iacl,
\Iacl, \iacf, \Iacf, \iacflike and \Iacflike
2013/04/04 v1.2a - added Portuguese translations
+2013/05/06 v1.3 - protected internal commands where appropriate
+ - new option `sort' to \printacronyms
+ - renamed options `print-acronyms/header' and `list-header'
+ into `print-acronyms/heading' and `list-heading'
+ - fix: added missing group to \printacronyms
+ - add key `foreign'
+ - rewritten page-recording:
+ * most importantly: record them at shipout; this is done
+ when \acro@used@once or \acro@used@twice are written to
+ the aux file
+ * no restrictions regarding \pagenumbering
+ * options `page-ranges' and `record-pages' are deprecated
+ * new options `following-page' and `following-pages'
+ - disable \@noitemerr in the list of acronyms: we don't need
+ it there but there are occasions when it is annoying
+ - cleaned the sty file, added a few more comments
% --------------------------------------------------------------------------
% TODO:
@@ -2148,6 +2357,5 @@
- 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
- 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/acro1.def b/Master/texmf-dist/tex/latex/acro/acro1.def
index bbb7d992daf..925db9a97e2 100644
--- a/Master/texmf-dist/tex/latex/acro/acro1.def
+++ b/Master/texmf-dist/tex/latex/acro/acro1.def
@@ -58,7 +58,7 @@
something~different~wrong~and~I'm~lost.~You~'re~on~your~own~now.
}
-\cs_new:Npn \__acro_key_check:nn #1#2
+\cs_new_protected:Npn \__acro_key_check:nn #1#2
{
\tl_if_blank:VT \l__acro_current_key_tl
{ \msg_error:nn { acro } { no-id } }
@@ -68,7 +68,7 @@
\bool_set_true:c { l__acro_#1_#2_set_bool }
}
-\cs_new:Npn \__acro_first_key_check:n #1
+\cs_new_protected:Npn \__acro_first_key_check:n #1
{
\cs_if_exist:cTF { l__acro_#1_short_set_bool }
{
@@ -84,7 +84,7 @@
% --------------------------------------------------------------------------
% the internal selection functions:
% short:
-\cs_new:Npn \__acro_declare_short:nn #1#2
+\cs_new_protected:Npn \__acro_declare_short:nn #1#2
{
\__acro_first_key_check:n { #1 }
\prop_put:Nnn \l__acro_short_prop { #1 } { #2 }
@@ -103,7 +103,7 @@
}
\cs_generate_variant:Nn \__acro_declare_short:nn { V }
-\cs_new:Npn \__acro_declare_short_plural:nn #1#2
+\cs_new_protected:Npn \__acro_declare_short_plural:nn #1#2
{
\__acro_key_check:nn { #1 } { short-plural }
\prop_put:Nnn \l__acro_short_plural_prop { #1 } { #2 }
@@ -111,7 +111,7 @@
\cs_generate_variant:Nn \__acro_declare_short_plural:nn { V }
% long:
-\cs_new:Npn \__acro_declare_long:nn #1#2
+\cs_new_protected:Npn \__acro_declare_long:nn #1#2
{
\__acro_key_check:nn { #1 } { long }
\prop_put:Nnn \l__acro_replace_plural_prop { #1 } { \c_false_bool }
@@ -127,7 +127,7 @@
\cs_generate_variant:Nn \__acro_declare_long:nn { V }
% long plural:
-\cs_new:Npn \__acro_declare_long_plural:nn #1#2
+\cs_new_protected:Npn \__acro_declare_long_plural:nn #1#2
{
\__acro_key_check:nn { #1 } { long-plural }
\prop_put:Nnn \l__acro_replace_plural_prop { #1 } { \c_false_bool }
@@ -136,7 +136,7 @@
\cs_generate_variant:Nn \__acro_declare_long_plural:nn { V }
% long plural form:
-\cs_new:Npn \__acro_declare_long_plural_form:nn #1#2
+\cs_new_protected:Npn \__acro_declare_long_plural_form:nn #1#2
{
\__acro_key_check:nn { #1 } { long-plural-form }
\prop_put:Nnn \l__acro_replace_plural_prop { #1 } { \c_true_bool }
@@ -145,7 +145,7 @@
\cs_generate_variant:Nn \__acro_declare_long_plural_form:nn { V }
% short indefinite article:
-\cs_new:Npn \__acro_declare_short_indefinite:nn #1#2
+\cs_new_protected: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 }
@@ -153,7 +153,7 @@
\cs_generate_variant:Nn \__acro_declare_short_indefinite:nn { V }
% long indefinite article:
-\cs_new:Npn \__acro_declare_long_indefinite:nn #1#2
+\cs_new_protected: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 }
@@ -161,7 +161,7 @@
\cs_generate_variant:Nn \__acro_declare_long_indefinite:nn { V }
% pre long:
-\cs_new:Npn \__acro_declare_long_pre:nn #1#2
+\cs_new_protected:Npn \__acro_declare_long_pre:nn #1#2
{
\__acro_key_check:nn { #1 } { long-pre }
\prop_put:Nnn \l__acro_long_pre_prop { #1 } { #2 }
@@ -169,7 +169,7 @@
\cs_generate_variant:Nn \__acro_declare_long_pre:nn { V }
% post long:
-\cs_new:Npn \__acro_declare_long_post:nn #1#2
+\cs_new_protected:Npn \__acro_declare_long_post:nn #1#2
{
\__acro_key_check:nn { #1 } { long-post }
\prop_put:Nnn \l__acro_long_post_prop { #1 } { #2 }
@@ -177,7 +177,7 @@
\cs_generate_variant:Nn \__acro_declare_long_post:nn { V }
% sort:
-\cs_new:Npn \__acro_declare_sort:nn #1#2
+\cs_new_protected:Npn \__acro_declare_sort:nn #1#2
{
\__acro_key_check:nn { #1 } { sort }
\prop_put:Nnn \l__acro_sort_prop { #1 } { #2 }
@@ -187,7 +187,7 @@
\cs_generate_variant:Nn \__acro_declare_sort:nn { V }
% alternative:
-\cs_new:Npn \__acro_declare_alt:nn #1#2
+\cs_new_protected:Npn \__acro_declare_alt:nn #1#2
{
\__acro_key_check:nn { #1 } { alt }
\prop_put:Nnn \l__acro_alt_prop { #1 } { #2 }
@@ -197,15 +197,23 @@
\cs_generate_variant:Nn \__acro_declare_alt:nn { V }
% alt. indefinite article:
-\cs_new:Npn \__acro_declare_alt_indefinite:nn #1#2
+\cs_new_protected: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 }
+% foreign:
+\cs_new_protected:Npn \__acro_declare_foreign:nn #1#2
+ {
+ \__acro_key_check:nn { #1 } { alt }
+ \prop_put:Nnn \l__acro_foreign_prop { #1 } { #2 }
+ }
+\cs_generate_variant:Nn \__acro_declare_foreign:nn { V }
+
% format:
-\cs_new:Npn \__acro_declare_format:nn #1#2
+\cs_new_protected:Npn \__acro_declare_format:nn #1#2
{
\__acro_key_check:nn { #1 } { format }
\prop_put:Nnn \l__acro_format_prop { #1 } { #2 }
@@ -213,7 +221,7 @@
\cs_generate_variant:Nn \__acro_declare_format:nn { V }
% long format:
-\cs_new:Npn \__acro_declare_long_format:nn #1#2
+\cs_new_protected:Npn \__acro_declare_long_format:nn #1#2
{
\__acro_key_check:nn { #1 } { long-format }
\prop_put:Nnn \l__acro_long_format_prop { #1 } { #2 }
@@ -221,7 +229,7 @@
\cs_generate_variant:Nn \__acro_declare_long_format:nn { V }
% first long format:
-\cs_new:Npn \__acro_declare_first_long_format:nn #1#2
+\cs_new_protected: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 }
@@ -229,7 +237,7 @@
\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:
+\cs_new_protected:Npn \__acro_declare_pdfstring:nw #1#2/#3/#4 \acro_stop:
{
\__acro_key_check:nn { #1 } { pdfstring }
\prop_put:Nnx \l__acro_pdfstring_prop { #1 } { #2 }
@@ -246,7 +254,7 @@
\cs_generate_variant:Nn \__acro_declare_pdfstring:nw { V }
% class:
-\cs_new:Npn \__acro_declare_class:nn #1#2
+\cs_new_protected:Npn \__acro_declare_class:nn #1#2
{
\__acro_key_check:nn { #1 } { class }
\prop_put:Nnn \l__acro_class_prop { #1 } { #2 }
@@ -254,7 +262,7 @@
\cs_generate_variant:Nn \__acro_declare_class:nn { V }
% extra information:
-\cs_new:Npn \__acro_declare_extra:nn #1#2
+\cs_new_protected:Npn \__acro_declare_extra:nn #1#2
{
\__acro_key_check:nn { #1 } { extra }
\prop_put:Nnn \l__acro_extra_prop { #1 } { #2 }
@@ -262,7 +270,7 @@
\cs_generate_variant:Nn \__acro_declare_extra:nn { V }
% acc supp:
-\cs_new:Npn \__acro_declare_acc_supp:nn #1#2
+\cs_new_protected:Npn \__acro_declare_acc_supp:nn #1#2
{
\__acro_key_check:nn { #1 } { accsupp }
\prop_put:Nnn \l__acro_acc_supp_prop { #1 } { #2 }
@@ -270,7 +278,7 @@
\cs_generate_variant:Nn \__acro_declare_acc_supp:nn { V }
% citation:
-\cs_new:Npn \__acro_declare_citation:nw #1#2[#3]#4[#5]#6#7 \acro_stop:
+\cs_new_protected:Npn \__acro_declare_citation:nw #1#2[#3]#4[#5]#6#7 \acro_stop:
{
% no options: #1: ID, #2: key, #3 is blank
% 1 option: #1: ID, #4: key, #3: option, #5 is blank
@@ -288,7 +296,7 @@
}
\cs_generate_variant:Nn \__acro_declare_citation:nw { V }
-\cs_new:Npn \__acro_declare_citation_aux:nnnn #1#2#3#4
+\cs_new_protected:Npn \__acro_declare_citation_aux:nnnn #1#2#3#4
{
\__acro_key_check:nn { #1 } { cite }
\prop_put:Nnn \l__acro_citation_prop { #1 } { #4 }
@@ -311,7 +319,7 @@
% TeX code after an acronym is typeset
% index:
-\cs_new:Npn \__acro_declare_index:nn #1#2
+\cs_new_protected:Npn \__acro_declare_index:nn #1#2
{
\__acro_key_check:nn { #1 } { index }
\prop_put:Nnn \l__acro_index_prop { #1 } { #2 }
@@ -319,7 +327,7 @@
\cs_generate_variant:Nn \__acro_declare_index:nn { V }
% index-sort:
-\cs_new:Npn \__acro_declare_index_sort:nn #1#2
+\cs_new_protected:Npn \__acro_declare_index_sort:nn #1#2
{
\__acro_key_check:nn { #1 } { index-sort }
\prop_put:Nnn \l__acro_index_sort_prop { #1 } { #2 }
@@ -327,7 +335,7 @@
\cs_generate_variant:Nn \__acro_declare_index_sort:nn { V }
% index-cmd:
-\cs_new:Npn \__acro_declare_index_cmd:nn #1#2
+\cs_new_protected:Npn \__acro_declare_index_cmd:nn #1#2
{
\__acro_key_check:nn { #1 } { index-cmd }
\prop_put:Nnn \l__acro_index_cmd_prop { #1 } { #2 }
@@ -364,6 +372,8 @@
\__acro_declare_sort:Vn \l__acro_current_key_tl { #1 } ,
extra .code:n =
\__acro_declare_extra:Vn \l__acro_current_key_tl { #1 } ,
+ foreign .code:n =
+ \__acro_declare_foreign:Vn \l__acro_current_key_tl { #1 } ,
format .code:n =
\__acro_declare_format:Vn \l__acro_current_key_tl { #1 } ,
short-format .code:n =
@@ -388,7 +398,7 @@
\__acro_declare_index_cmd:Vn \l__acro_current_key_tl { #1 }
}
-\cs_new:Npn \acro_define_acronym_macro:n #1
+\cs_new_protected:Npn \acro_define_acronym_macro:n #1
{
\bool_if:NT \l__acro_create_macros_bool
{
@@ -403,7 +413,7 @@
% --------------------------------------------------------------------------
% internal acronym declaring function:
-\cs_new:Npn \acro_declare_acronym:nn #1#2
+\cs_new_protected:Npn \acro_declare_acronym:nn #1#2
{
\tl_set:Nn \l__acro_current_key_tl { #1 }
\keys_set:nn { acro / declare-acronym } { #2 }
@@ -432,7 +442,7 @@
\tl_new:N \l__acro_included_classes_tl
\tl_new:N \l__acro_excluded_classes_tl
-\cs_new:Npn \acro_use_list_instance:nn #1#2
+\cs_new_protected:Npn \acro_use_list_instance:nn #1#2
{
\UseInstance { acro-list } { \l__acro_list_instance_tl }
{ \l__acro_list_type_tl } { #1 } { #2 }
@@ -441,29 +451,39 @@
\keys_define:nn { acro / print-acronyms }
{
- include-classes .tl_set:N = \l__acro_included_classes_tl ,
- exclude-classes .tl_set:N = \l__acro_excluded_classes_tl ,
- name .tl_set:N = \l__acro_list_name_tl ,
- header .tl_set:N = \l__acro_list_title_tl
- }
-
-\cs_new:Npn \acro_print_acronyms:n #1
- {
- \tl_clear:N \l__acro_included_classes_tl
- \tl_clear:N \l__acro_excluded_classes_tl
- \keys_set:nn { acro / print-acronyms } { #1 }
- \iow_now:Nx \@auxout { \string \acro@print@list }
- \bool_if:NT \l__acro_sort_bool
- { \acro_sort_prop:N \l__acro_short_prop }
- \UseInstance { acro-title } { \l__acro_list_title_tl }
- { \l__acro_list_name_tl }
- \cs_if_exist:NTF \acro@printed@list
- {
- \acro_use_list_instance:VV
- \l__acro_included_classes_tl
- \l__acro_excluded_classes_tl
- }
- { \@latex@warning@no@line {Rerun~to~get~acronym~list~right} }
+ include-classes .tl_set:N = \l__acro_included_classes_tl ,
+ exclude-classes .tl_set:N = \l__acro_excluded_classes_tl ,
+ name .tl_set:N = \l__acro_list_name_tl ,
+ header .code:n =
+ \acro_option_deprecated:nn { header } { heading }
+ \tl_set:Nn \l__acro_list_title_tl { #1 } ,
+ heading .tl_set:N = \l__acro_list_title_tl ,
+ sort .bool_set:N = \l__acro_sort_bool
+ }
+
+\cs_new_protected:Npn \acro_print_acronyms:n #1
+ {
+ \group_begin:
+ % this is a cheap trick to prevent the \@noitemerr
+ % if one forgot to delete either the aux file or
+ % remove \printacronyms -- but it's local:
+ \cs_set:Npn \@noitemerr {}
+ \tl_clear:N \l__acro_included_classes_tl
+ \tl_clear:N \l__acro_excluded_classes_tl
+ \keys_set:nn { acro / print-acronyms } { #1 }
+ \iow_now:Nx \@auxout { \string \acro@print@list }
+ \bool_if:NT \l__acro_sort_bool
+ { \acro_sort_prop:N \l__acro_short_prop }
+ \UseInstance { acro-title } { \l__acro_list_title_tl }
+ { \l__acro_list_name_tl }
+ \cs_if_exist:NTF \acro@printed@list
+ {
+ \acro_use_list_instance:VV
+ \l__acro_included_classes_tl
+ \l__acro_excluded_classes_tl
+ }
+ { \@latex@warning@no@line {Rerun~to~get~acronym~list~right} }
+ \group_end:
}
\NewDocumentCommand \printacronyms { O{} }