texlive[41386] Master/texmf-dist: acro (31may16)
commits+karl at tug.org
commits+karl at tug.org
Sun Jun 12 01:20:16 CEST 2016
Revision: 41386
http://tug.org/svn/texlive?view=revision&revision=41386
Author: karl
Date: 2016-06-12 01:20:16 +0200 (Sun, 12 Jun 2016)
Log Message:
-----------
acro (31may16)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/acro/README
trunk/Master/texmf-dist/doc/latex/acro/acro_en.pdf
trunk/Master/texmf-dist/doc/latex/acro/acro_en.tex
trunk/Master/texmf-dist/tex/latex/acro/acro.sty
Modified: trunk/Master/texmf-dist/doc/latex/acro/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/acro/README 2016-06-11 23:20:06 UTC (rev 41385)
+++ trunk/Master/texmf-dist/doc/latex/acro/README 2016-06-11 23:20:16 UTC (rev 41386)
@@ -1,9 +1,9 @@
--------------------------------------------------------------------------
-the ACRO package v2.4b
+the ACRO package v2.5b
Typeset Acronyms
-2016/05/03
+2016/05/30
--------------------------------------------------------------------------
Clemens Niederberger
Web: http://www.mychemistry.eu/forums/forum/acro/
Modified: trunk/Master/texmf-dist/doc/latex/acro/acro_en.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/acro/acro_en.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/acro/acro_en.tex 2016-06-11 23:20:06 UTC (rev 41385)
+++ trunk/Master/texmf-dist/doc/latex/acro/acro_en.tex 2016-06-11 23:20:16 UTC (rev 41386)
@@ -39,17 +39,20 @@
\usepackage[single,macros,accsupp,index]{acro}
\setcnltx{
package = {acro} ,
+ info = {Typeset Acronyms and other Abbreviations} ,
authors = Clemens Niederberger ,
email = contact at mychemistry.eu ,
url = https://bitbucket.org/cgnieder/acro/ ,
abstract = {%
- \acro\ not only allows you to create acronyms in a simple way but also lets
- you add them to different classes of acronyms. Lists can be created of
- separate classes wherever you want the list to appear.\par
- \acro\ also provides an option \option{single} which ignores acronyms that are
- used only once in the whole document.\par
+ \acro\ allows you to define and use abbreviations in a simple way.
+ Abbreviations can be divided into different classes of abbreviations.
+ Lists of abbreviations can be created (also of separate classes of
+ abbreviations) and printed wherever you want the lists to appear.\par
+ \acro\ provides an option \option{single} which ignores abbreviations that
+ are used only once in the whole document.\par
As an experimental feature \acro\ also offers the option \option{sort} which
- automatically sorts the list created by \cs{printacronyms}.%
+ automatically sorts the list created by \cs{printacronyms}.\par
+ \acro\ also has the feature of creating \emph{local} lists
} ,
add-cmds = {
ac, Ac, aca, Aca, acap, Acap, acbarrier, acdot, acf, Acf, acflike, acg,
@@ -56,8 +59,9 @@
acfp, Acfp, acfplike, aciftrailing, acl, Acl, aclp, Aclp, acp, Acp,
AcroRegisterTrailing, acs, Acs, acsingle, Acsingle, acsp, Acsp, acspace,
acreset, acresetall, acsetup,
- DeclareAcroCommand, DeclareAcronym, DeclareAcroListHeading,
- DeclareAcroListStyle, DeclarePseudoAcroCommand,
+ DeclareAcroCommand, DeclareAcronym, DeclareAcroExtraStyle,
+ DeclareAcroFirstStyle, DeclareAcroListHeading,
+ DeclareAcroListStyle, DeclareAcroPageStyle, DeclarePseudoAcroCommand,
iac, Iac, iaca, Iaca, iacs, Iacs, iacl, Iacl, iacf, Iacf, iacflike,
Iacflike,
NewAcroCommand, NewPseudoAcroCommand,
@@ -72,7 +76,11 @@
index-setup = { level = \section , headers={\indexname}{\indexname} }
}
-\acsetup{hyperref}
+\acsetup{
+ use-barriers = true ,
+ hyperref = true ,
+ log
+}
\usepackage{varioref}
@@ -199,6 +207,7 @@
\DeclareAcronym{jpg}
{
short = JPEG ,
+ sort = jpeg ,
alt = JPG ,
long = Joint Photographic Experts Group
}
@@ -313,7 +322,7 @@
\section{Basics}
\subsection{Creating New Acronyms}
-Acronyms\changedversion{1.0} are created with the command \cs{DeclareAcronym}.
+Acronyms are created with the command \cs{DeclareAcronym}.
\begin{commands}
\command{DeclareAcronym}[\marg{id}\marg{list of keys}]
The basic command for declaring an acronym.
@@ -324,7 +333,7 @@
\begin{options}
%% short
\keyval{short}{text}\Default!
- the short form of the acronym. This option is required: an acronym must
+ The short form of the acronym. This option is required: an acronym must
have a short form. If this is set it \emph{must} be set as first option!
If another option is set first and notices the \option{short} option
missing it assumes that the \acs{id} should be used as short version and
@@ -331,63 +340,63 @@
sets it accordingly. A warning will be written to the log then.
%% long
\keyval{long}{text}\Default!
- the long form of the acronym. This option is required: an acronym must
+ The long form of the acronym. This option is required: an acronym must
have a description.
%% short-plural
\keyval{short-plural}{text}\Default{s}
- the plural ending appended to the short form.
+ The plural ending appended to the short form.
%% short-plural-form
\keyval{short-plural-form}{text}
- the\sinceversion{2.0}plural short form of the acronym; replaces the short
+ The\sinceversion{2.0}plural short form of the acronym; replaces the short
form when used instead of appending the plural ending.
%% long-plural
\keyval{long-plural}{text}\Default{s}
- the plural ending appended to the long form.
+ The plural ending appended to the long form.
%% long-plural-form
\keyval{long-plural-form}{text}
- plural long form of the acronym; replaces the long form when used
+ Plural long form of the acronym; replaces the long form when used
instead of appending the plural ending.
%% alt-plural
\keyval{alt-plural}{text}\Default{s}
- the\sinceversion{2.0} plural ending appended to the alternative form.
+ The\sinceversion{2.0} plural ending appended to the alternative form.
%% alt-plural-form
\keyval{alt-plural-form}{text}
- the\sinceversion{2.0}plural alternative form of the acronym; replaces the
+ The\sinceversion{2.0}plural alternative form of the acronym; replaces the
alternative form when used instead of appending the plural ending.
%% list
\keyval{list}{text}
- \sinceversion{1.4}if specified this will be written in the list as
- description instead of the long form.
+ If specified this will be written in the list as description instead of
+ the long form.
%% short-indefinite
\keyval{short-indefinite}{text}\Default{a}
- \sinceversion{1.2}indefinite article for the short form.
+ Indefinite article for the short form.
%% long-indefinite
\keyval{long-indefinite}{text}\Default{a}
- \sinceversion{1.2}indefinite article for the long form.
+ Indefinite article for the long form.
%% long-pre
\keyval{long-pre}{text}
- \sinceversion{1.1}\meta{text} is prepended to the long form in the text
- but not in the list of acronyms.
+ \meta{text} is prepended to the long form in the text but not in the list
+ of acronyms.
%% long-post
\keyval{long-post}{text}
- \sinceversion{1.1}\meta{text} is appended to the long form in the text but
- not in the list of acronyms.
+ \meta{text} is appended to the long form in the text but not in the list
+ of acronyms.
%% alt
\keyval{alt}{text}
- alternative short form.
+ Alternative short form.
%% alt-indefinite
\keyval{alt-indefinite}{text}\Default{a}
- \sinceversion{1.2}indefinite article for the alternative form.
+ Indefinite article for the alternative form.
%% extra
\keyval{extra}{text}
- extra information to be added in the list of acronyms.
+ Extra information to be added in the list of acronyms.
%% foreign
\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.
+ 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
+ \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
@@ -395,70 +404,70 @@
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
+ \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
+ If used the acronym will be sorted according to this key instead of its
\acs{id}.
%% class
\keyval{class}{csv list}
- the\changedversion{2.4} class(es) the acronym belongs to.
+ The\changedversion{2.4} class(es) the acronym belongs to.
%% cite
\keylit{cite}{\oarg{prenote}\oarg{postnote}\marg{citation keys}}
- a citation that is printed to the acronym according to an option explained
+ A citation that is printed to the acronym according to an option explained
later.
%% short-format
\keyval{short-format}{\TeX{} code}
- the format used for the short form of the acronym.
+ The format used for the short form of the acronym.
%% long-format
\keyval{long-format}{\TeX{} code}
- the format used for the long form of the acronym.
+ The format used for the long form of the acronym.
%% first-long-format
\keyval{first-long-format}{\TeX{} code}
- the format used for the first long form of the acronym as set with \cs{ac},
+ 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
+ \sinceversion{2.3}The format used for the acronym if the acronym is only
used a single time.
%% first-style
- \keychoice{first-style}{default,empty,square,short,long,reversed,footnote,sidenote}
- \sinceversion{2.3}the style of the first appearance of the acronym, see
+ \keychoice{first-style}{default,empty,square,short,long,reversed,footnote,sidenote,%
+ footnote-reversed,sidenote-reversed}
+ \sinceversion{2.3}The style of the first appearance of the acronym, see
also section~\ref{sec:opti-regard-acronyms}.
%% pdfstring
\keylit{pdfstring}{\meta{text}/\meta{plural ending}}
- \changedversion{2.4b}used as \acs{pdf} string replacement in bookmarks
+ \changedversion{2.4b}Used as \acs{pdf} string replacement in bookmarks
when used together with the \pkg{hyperref} package. The appended plural
ending is optional. If you leave it (\emph{and} the \code{/}) the default
ending is used. \meta{text} is expanded before it is saved.
%% accsupp
\keyval{accsupp}{text}
- sets the \code{ActualText} key as presented by the \pkg{accsupp} package
+ Sets the \code{ActualText} key as presented by the \pkg{accsupp} package
for the acronym.
%% tooltip
\keyval{tooltip}{text}
- \sinceversion{2.1}sets the tooltip description for an acronym. For
+ \sinceversion{2.1}Sets the tooltip description for an acronym. For
actually getting tooltips you also need an appropriate setting of the
\option{tooltip-cmd} option or to set the package option
\option{tooltip}.
%% index-sort
\keyval{index-sort}{text}
- \sinceversion{1.1}If you use the package option \option{index} every
- occurrence of an acronym is recorded to the index and sorted by its
- \acs{id} or (if set) by the value of the \option{sort} key. This key
- allows to set an individual sorting option for the index. See
- section~\vref{ssec:index} for details.
+ If you use the package option \option{index} every occurrence of an
+ acronym is recorded to the index and sorted by its \acs{id} or (if set) by
+ the value of the \option{sort} key. This key allows to set an individual
+ sorting option for the index. See section~\vref{ssec:index} for details.
%% index
\keyval{index}{text}
- \sinceversion{1.1}This key allows to overwrite the automatic index entry
- with an arbitrary one. See section~\vref{ssec:index} for details.
+ This key allows to overwrite the automatic index entry with an arbitrary
+ one. See section~\vref{ssec:index} for details.
%% index-cmd
\keyval{index-cmd}{control sequence}
- \sinceversion{1.1}This key let's you set an individual index creating
- command for this acronym. It should be a command that takes one mandatory
- argument. See section~\vref{ssec:index} for details.
+ This key let's you set an individual index creating command for this
+ acronym. It should be a command that takes one mandatory argument. See
+ section~\vref{ssec:index} for details.
\end{options}
In its simplest form an acronym needs a short and a long form. Please note
@@ -514,6 +523,35 @@
The first appearance now looks as follows\footnote{The appearance of the
citation of course depends on the citation style you're using.}: \acf{ny}.
+\subsection{Logging of Acronyms}
+When you activate \acro's option\sinceversion{2.5} \option{log} \acro' writes
+information about the acronyms it defines to the log file.
+\begin{options}
+ \keychoice{log}{\default{true},false,silent,verbose}\Default{false}
+ When set to \code{true}/\code{silent} \acro{} writes the main properties
+ of an acronym to the log file. When set to \code{verbose} \acro' writes
+ \emph{all} properties of an acronym to the log file.
+\end{options}
+
+This is an example of the logging info with \keyis{log}{true} or
+\keyis{log}{silent}.
+\begin{sourcecode}
+ =================================================
+ | acro info -- defining new acronym:
+ | ID = {jpg}
+ | short = {JPEG}
+ | long = {Joint Photographic Experts Group}
+ | alt = {JPG}
+ | sort = {jpeg}
+ | class = {}
+ | list = {}
+ | extra = {}
+ | foreign = {}
+ | pdfstring = {}
+ | cite = {}
+ =================================================
+\end{sourcecode}
+
\subsection{Using the Acronyms -- the Commands}\label{sec:using-acronyms-comm}
Acronyms are used with one of the following commands:
\begin{commands}
@@ -557,10 +595,9 @@
been used with \emph{any} of the output commands before it is \emph{not} the
first time any more.
-\sinceversion{0.5}If you use the starred variant an acronym will not be marked
-as used. This proves useful if an acronym is typeset in a section title, for
-example, since then the appearance in the table of contents won't mark it as
-used.
+If you use the starred variant an acronym will not be marked as used. This
+proves useful if an acronym is typeset in a section title, for example, since
+then the appearance in the table of contents won't mark it as used.
\begin{example}[side-by-side]
% preamble:
@@ -643,6 +680,7 @@
% preamble:
% \DeclareAcronym{jpg}{
% short = JPEG ,
+ % sort = jpeg ,
% alt = JPG ,
% long = Joint Photographic Experts Group
% }
@@ -679,10 +717,9 @@
\end{example}
\subsection{Foreign Language Acronyms}\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, \latin{i.e.}, something like the following in a German
-document:
+I repeatedly read the wish for being able to add translations to acronyms when
+the acronyms stem from another language than the document language,
+\latin{i.e.}, something like the following in a German document:
\begin{example}[side-by-side]
\ac{ecu}\\
\ac{ecu}
@@ -721,7 +758,7 @@
\section{Additional Commands and Possibilities}
\subsection{Indefinite Forms}
-\noindent\sinceversion{1.2}%
+
Unlike many other languages\footnote{Let's better say: unlike the other
languages where I know at least the basics.} in English the indefinite
article is not determined by the grammatical case, gender or number but by the
@@ -746,18 +783,17 @@
\subsection{Uppercasing}
\begin{commands}
\command{acfirstupper}[\marg{token list}]
- \sinceversion{1.3e}This command uppercases the first token in \meta{token
- list}. The command is less powerful than \cs{makefirstuc} that is
- provided by the \pkg{mfirstuc} package~\cite{pkg:mfirstuc} but it is
- expandable. Obvious downsides are for example that it does not uppercase
- accented letters.
+ This command uppercases the first token in \meta{token list}. The
+ command is less powerful than \cs{makefirstuc} that is provided by the
+ \pkg{mfirstuc} package~\cite{pkg:mfirstuc} but it is expandable. Obvious
+ downsides are for example that it does not uppercase accented letters.
\end{commands}
\subsection{Simulating the First Appearance}\label{sec:simul-first-appe}
-Users\sinceversion{1.2} told me\footnote{Well -- one, to be precise ;)} that
-there are cases when it might be useful to have the the acronym typeset
-according to the \option{first-style} but with another text than the long
-form. For such cases \acro\ offers the following commands.
+Users told me\footnote{Well -- one, to be precise ;)} that there are cases
+when it might be useful to have the the acronym typeset according to the
+\option{first-style} but with another text than the long form. For such cases
+\acro\ offers the following commands.
\begin{commands}
\command{acflike}[\sarg\marg{id}\marg{instead of long form}]
Write some alternative long form for acronym with \acs{id} \meta{id} as if
@@ -833,16 +869,15 @@
used for the first time you can call one of these commands:
\begin{commands}
\command{acreset}[\marg{comma separated list of ids}]
- \sinceversion{0.5}This will reset a used acronym such that the next use of
- \cs{ac} will again print it as if it were used the first time. This will
- \emph{not} remove an acronym from being printed in the list if it actually
- \emph{has} been used before.
+ This will reset a used acronym such that the next use of \cs{ac} will
+ again print it as if it were used the first time. This will \emph{not}
+ remove an acronym from being printed in the list if it actually \emph{has}
+ been used before.
\command{acresetall}
Reset all acronyms.
\command{acifused}[\marg{id}\marg{true}\marg{false}]
- \sinceversion{1.3e}This command tests if the acronym with \ac{id}
- \meta{id} has already been used and either puts \code{true} or
- \code{false} in the input stream.
+ This command tests if the acronym with \ac{id} \meta{id} has already been
+ used and either puts \code{true} or \code{false} in the input stream.
\end{commands}
\begin{example}[side-by-side]
\acreset{ny}\ac{ny}
@@ -852,12 +887,11 @@
used:
\begin{commands}
\command{acuse}[\marg{comma separated list of ids}]
- \sinceversion{0.5}This has the same effect as if an acronym had been used
- twice, that is, further uses of \cs{ac} will print the short form and the
- acronym will in any case be printed in the list (as long as its class is
- not excluded).
+ This has the same effect as if an acronym had been used twice, that is,
+ further uses of \cs{ac} will print the short form and the acronym will in
+ any case be printed in the list (as long as its class is not excluded).
\command{acuseall}
- \sinceversion{0.6a}Mark all acronyms as used.
+ Mark all acronyms as used.
\end{commands}
\subsection{\cs*{ac} and Friends in \acs*{pdf} Bookmarks, Accessibility
@@ -869,11 +903,11 @@
the point of having macros to get output for you if you have to specify it
manually after all?
-That is why \acro\ offers\sinceversion{0.5} a preliminary solution for this.
-In a bookmark every \cs{ac} like command falls back to a simple text string
-typesetting what \cs{acs} would do (or \cs{acsp} for plural forms). These
-text strings both can accessed manually and can be modified to an output
-reserved for \acs{pdf} bookmarks.
+That is why \acro\ offers a preliminary solution for this. In a bookmark
+every \cs{ac} like command falls back to a simple text string typesetting what
+\cs{acs} would do (or \cs{acsp} for plural forms). These text strings both
+can accessed manually and can be modified to an output reserved for \acs{pdf}
+bookmarks.
\begin{commands}
\command{acpdfstring}[\marg{id}]
@@ -916,10 +950,10 @@
\begin{options}
\keyval{accsupp}{text}
- \sinceversion{1.0}Key for \cs{DeclareAcronym} to set the \code{ActualText}
- property of \cs*{BeginAccSupp} (see \pkg{accsupp}'s documentation for
- details) to be used for an acronym. It only has an effect when the
- package option \option{accsupp} is used, too.
+ Key for \cs{DeclareAcronym} to set the \code{ActualText} property of
+ \cs*{BeginAccSupp} (see \pkg{accsupp}'s documentation for details) to be
+ used for an acronym. It only has an effect when the package option
+ \option{accsupp} is used, too.
\end{options}
\subsubsection{Tooltips}
@@ -950,9 +984,9 @@
``inner'' acronyms are disabled.
\subsection{Adding Acronyms to the Index}\label{ssec:index}
-\noindent\sinceversion{1.1}\acro\ has the package option \option{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{\meta{id}@\meta{short}},
+\acro\ has the package option \option{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{\meta{id}@\meta{short}},
\code{\meta{sort}@\meta{short}} if the \option{sort} key has been set,
\code{\meta{index-sort}@\meta{short}} if the \option{index-sort} has been set,
or \meta{index} if the key \option{index} has been set for the specific
@@ -970,8 +1004,8 @@
appreciate an email.
\section{Printing the List}\label{sec:print_lists}
-\noindent\changedversion{1.0}Printing the whole list of acronyms is easy: just
-place \cs{printacronyms} where ever you want the list to be.
+Printing the whole list of acronyms is easy: just place \cs{printacronyms}
+where ever you want the list to be.
\begin{commands}
\command{printacronyms}[\oarg{options}]
Print the list of acronyms.
@@ -983,15 +1017,17 @@
the list.
\keyval{exclude-classes}{list of classes}
Takes a comma-separated list of the classes of acronyms that should
- \emph{not} be in the list.
+ \emph{not} be in the list. \emph{Note that this list overwrites any
+ entries in \option{include-classes}!} If a class is both included and
+ excluded then the corresponding acronyms will not be added to the list.
\keyval{name}{name of the list}
sets the name for the list.
\keyval{heading}{sectioning command without leading backslash}%
\Default{section*}
- \changedversion{1.3}Sets the sectioning command for the heading of the
- list. A special value is \code{none} which suppresses the heading.
+ Sets the sectioning command for the heading of the list. A special value
+ is \code{none} which suppresses the heading.
\keybool{sort}\Default{true}
- \sinceversion{1.3}Set sorting for this list only.
+ Set sorting for this list only.
\keybool{local-to-barriers}\Default{false}
This\sinceversion{2.4} option can be used to create a list of only the
acronyms of the current \enquote{barrier group}, see
@@ -1024,10 +1060,9 @@
% prior to v1.0.
%%
\keychoice{messages}{silent,loud}\Default{loud}
- \sinceversion{1.6}Setting \keyis{messages}{silent} will turn all of
- \acro's error messages into warnings and all of \acro's warnings into info
- messages. Be sure to check the log file carefully if you decide to set
- this option.
+ Setting \keyis{messages}{silent} will turn all of \acro's error messages
+ into warnings and all of \acro's warnings into info messages. Be sure to
+ check the log file carefully if you decide to set this option.
\keybool{single}\Default{false}
If set to \code{true} an acronym that's used only once (with \cs{ac}) in a
document will only print the acronym in a specified form and will not be
@@ -1034,7 +1069,7 @@
printed in the list.
%%
\keychoice{single-form}{long,short,alt,first}\Default{long}
- \sinceversion{2.}Determines how a single appearance of an acronym is
+ \sinceversion{2.0}Determines how a single appearance of an acronym is
printed if \keyis{single}{true} has been chosen.
%%
\keybool{hyperref}\Default{false}
@@ -1042,22 +1077,14 @@
their list entry.
%%
\keybool{label}\Default{false}
- \sinceversion{1.5}If set to \code{true} this option will place
+ If set to \code{true} this option will place
\cs*{label}\Marg{\meta{prefix}\meta{id}} the first time the acronym with
- \ac{id} \meta{id} is used.
+ \ac{id} \meta{id} is used.
%%
\keyval{label-prefix}{text}\Default{ac:}
- \sinceversion{1.5}The prefix for the \cs*{label} that is placed when
- option \keyis{label}{true} is used.
+ The prefix for the \cs*{label} that is placed when option
+ \keyis{label}{true} is used.
%%
- \keybool{record-pages}\Default{true}
- Since \acro\ can handle arabic, roman and Roman page numbers but
- \emph{not} 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.
- Or rather: you can if you use \keyis{pages}{first}.
- %%
\keybool{only-used}\Default{true}
This option is \code{true} as default. It means that only acronyms that
are actually used in the document are printed in the list. If
@@ -1065,7 +1092,6 @@
written to the list.
%%
\keychoice{mark-as-used}{first,any}\Default{any}
- \sinceversion{1.2}%
This option determines wether an acronym is mark as used when the
\emph{first} form is used the first time (with \cs{ac}, \cs{acf} or
\cs{acflike} and their uppercase, plural and indefinite forms) or when any
@@ -1077,9 +1103,9 @@
will \emph{not} be overwritten.
%%
\keybool{xspace}\Default{false}
- \sinceversion{0.6}If set to \code{true} this option will append
- \cs*{xspace} from the \pkg*{xspace} package to the commands created with
- the \option{macros} option.
+ If set to \code{true} this option will append \cs*{xspace} from the
+ \pkg*{xspace} package to the commands created with the \option{macros}
+ option.
%%
\keybool{strict}\Default{false}
If set to \code{true} and the option \keyis{macros}{true} is in effect
@@ -1120,17 +1146,15 @@
key as argument is valid, for example \pkg*{biblatex}'s \cs*{footcite}.
%%
\keybool{index}\Default{false}
- \sinceversion{1.1}If set to \code{true} an index entry will be recorded
- every time an \emph{unstarred} acronym command is used for the
- corresponding acronym.
+ If set to \code{true} an index entry will be recorded every time an
+ \emph{unstarred} acronym command is used for the corresponding acronym.
%%
\keyval{index-cmd}{control sequence}\Default{\cs*{index}}
- \sinceversion{1.1}Chooses the index command that is used when option
- \option{index} has been set to \code{true}.
+ Chooses the index command that is used when option \option{index} has been
+ set to \code{true}.
%%
\keybool{accsupp}\Default{false}
- \sinceversion{1.0}Activates the access support as provided by the
- \pkg{accsupp} package.
+ Activates the access support as provided by the \pkg{accsupp} package.
%%
\keybool{tooltip}\Default{false}
\sinceversion{2.1}Activates tooltip support for \acro\ using the
@@ -1175,7 +1199,6 @@
The same for the long forms.
%%
\keyval{foreign-format}{format}\Default
- \sinceversion{1.3}%
The format for the \option{foreign} entry when it appears as part of the
first appearance of an acronym.
%%
@@ -1185,14 +1208,13 @@
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
\cs{acflike} and their uppercase, plural and indefinite forms).
%%
\keyval{list-short-format}{format}\Default
- \sinceversion{1.1}An extra format for the short entries in the list. If
- 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.
+ An extra format for the short entries in the list. If 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
@@ -1211,11 +1233,11 @@
\keyval{extra-format}{format}\Default
The same for the extra information.
%%
- \keychoice{first-style}{default,empty,square,short,long,reversed,footnote,sidenote}%
- \Default{default}
- \changedversion{1.1}The basic style of the first appearance of an
- acronym. The value \code{sidenote} needs the command \cs*{sidenote} to be
- defined for example by the \pkg*{sidenotes} package.
+ \keychoice{first-style}{default,empty,square,short,long,reversed,footnote,sidenote,%
+ footnote-reversed,sidenote-reversed}\Default{default}
+ The basic style of the first appearance of an acronym. The value
+ \code{sidenote} needs the command \cs*{sidenote} to be defined (for
+ example by the \pkg*{sidenotes} package).
%%
\keychoice{extra-style}{default,plain,comma,paren,bracket}\Default{default}
Defines the way the extra information is printed in the list.
@@ -1241,13 +1263,17 @@
\acsetup{first-style=long}
long: \acf{ny} \\
\acsetup{first-style=reversed}
- reversed: \acf{ny}
+ reversed: \acf{ny} \\
+ \acsetup{
+ first-style = footnote-reversed
+ }
+ footnote-reversed: \acf{ny}
\end{example}
\subsection{Options Regarding the List}
\begin{options}
%%
- \keychoice{page-ref}{none,plain,comma,paren}\Default{none}
+ \keychoice{page-style}{none,plain,comma,paren}\Default{none}
If this option is set to a value other than \code{none} the page numbers
of the an acronym appeared on are printed in the list. Please note that
this is an experimental feature and might fail in quite a number of cases.
@@ -1254,9 +1280,10 @@
If you notice anything please send me an email!
%%
\keychoice{pages}{all,first}\Default{all}
- \sinceversion{1.5}If the option \option{page-ref} has any value other than
- \code{none} this option determines wether all usages of the acronyms are
- listed or only the first time. Implicitly sets \keyis{label}{true}.
+ If the option \option{page-style} has any value other than \code{none}
+ this option determines wether all usages of the acronyms are listed or
+ only the first time. Implicitly sets \keyis{label}{true}.
+ %%
\keyval{page-name}{page name}\Default{p.\cs*{@}\cs*{,}}
The ``name'' of the page label. This is automatically translated to the
active language. However for the time being there are many translations
@@ -1263,33 +1290,38 @@
missing, yet. Please notify me if you find your language missing.
%%
\keyval{pages-name}{page name plural}\Default{pp.\cs*{@}\cs*{,}}
- \sinceversion{1.0}The ``name'' of the page label when there are more than
- one page. 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.
+ The ``name'' of the page label when there are more than one page. 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.
%%
\keybool{following-page}\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 \option{next-page}.
+ 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 \option{next-page}.
%%
\keybool{following-pages}\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
- \option{next-pages}.
+ 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 \option{next-pages}.
%%
+ \keybool{following-pages*}\Default{false}
+ \sinceversion{2.5}If set to \code{true} this sets both options
+ \keyis{following-page}{true} and \keyis{following-pages}{true}.
+ \code{false} sets \keyis{following-page}{false} and
+ \keyis{following-pages}{false}.
+ %%
\keyval{next-page}{text}\Default{\cs*{,}f.\cs*{@}}
- \sinceversion{1.0}Appended to a page number when \option{following-page}
- is set to \code{true} 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.
+ Appended to a page number when \option{following-page} is set to
+ \code{true} 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.
%%
\keyval{next-pages}{text}\Default{\cs*{,}ff.\cs*{@}}
- \sinceversion{1.0}Appended to a page number when \option{following-pages}
- is set to \code{true} and the range is more than 2 pages long. This is
- automatically translated to the active language. However, for the time
+ Appended to a page number when \option{following-pages} is set to
+ \code{true} 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.
%%
@@ -1304,7 +1336,7 @@
own. \emph{Be aware that per default \emph{all} \code{extra-table} styles
only use \code{l} columns. Since acronym descriptions can easily get
longer that a line you should probably define your own style if you want
- to use them.} See section~\vref{sec:more-list-cust} for details.
+ to use them.} See section~\vref{sec:lists} for details.
%%
\keychoice{list-heading}{chapter,chapter*,section,section*,subsection,%
subsection*,subsubsection,subsubsection*,addchap,addsec,none}%
@@ -1418,7 +1450,7 @@
in the preamble.
\section{About Page Ranges}
-If you enable the \option{page-ref} option \acro\ adds page numbers to the list
+If you enable the \option{page-style} option \acro\ adds page numbers to the list
of acronyms. In version~0.\versionstar{} it would add a page reference for an
acronym in the list of acronyms that used \cs*{pageref} to refer to the first
appearance of an acronym. This is retained using \keyis{pages}{first}.
@@ -1427,7 +1459,7 @@
pages are referenced using \cs*{hyperpage}.
There are some options that control how this list will be typeset, e.g.,
-\option{following-page}, \option{next-pages} or the option \option{page-ref}
+\option{following-page}, \option{next-pages} or the option \option{page-style}
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
@@ -1445,10 +1477,20 @@
of the document mark implicit barriers.
\end{commands}
\begin{options}
+ \keybool{use-barriers}\Default{false}
+ \sinceversion{2.5}If you want to use barriers and local lists you have to
+ activate the feature first. This should be set in the preamble in order
+ to work reliably. Make sure to watch out for log file messages asking you
+ to rerun.
+ \keybool{reset-at-barriers}\Default{false}
+ If this option is set to \code{true} \cs{acbarrier} implicitly calls
+ \cs{acresetall}.
\keybool{local-to-barriers}\Default{false}
- This option can be used as option to the \cs{printacronyms} command to
- create a list of only the acronyms of the current \enquote{barrier group}.
+ This option can \emph{only} be used as option to the \cs{printacronyms}
+ command. It then prints a list of only the acronyms of the current
+ \enquote{barrier group}.
\end{options}
+
\begin{example}
\acbarrier
\printacronyms[local-to-barriers]
@@ -1455,11 +1497,6 @@
\ac{ctan} and \ac{lppl}
\acbarrier
\end{example}
-\begin{options}
- \keybool{reset-at-barriers}\Default{false}
- If this option is set to \code{true} \cs{acbarrier} implicitly calls
- \cs{acresetall}.
-\end{options}
\section{Language Support}
\acro\ detects if packages \pkg{babel}~\cite{pkg:babel} or
@@ -1747,9 +1784,25 @@
\ProvideAcroEnding {possessive-plural} {s'} {s'}
\end{sourcecode}
-\section{More on List Customization}\label{sec:more-list-cust}
-\subsection{Own List Style}
+\section{More on Customization}\label{sec:more-custom}
+\subsection{Background Information}
+Several of \acro's objects are customized using templates. For each of these
+objects it is possible to define own templates\footnote{This requires some
+knowledge of \pkg{xtemplate} and expl3. Plans are to provide a documented
+interface for users of \acro{} in the future.}. Possibly more interesting: it
+is easily possible to define further instances of an object using a certain
+template. How this works is explained in the following sections. However, the
+basics are always the same. There is a command
+\begin{commands}
+ \command*{DeclareAcro\meta{object
+ type}Style}[\marg{name}\marg{template}\marg{options}]
+ which allows to define a new style (\ie, instance) for the object
+ \meta{object type} using the template \marg{template}.
+\end{commands}
+\subsection{Lists}\label{sec:lists}
+\subsubsection{Own List Style}
+
The different existing list styles are all built from four different
templates, \code{list}, \code{list-of}, \code{table} and \code{extra-table}.
Those templates are defined with the help of the \pkg{xtemplate}
@@ -1762,11 +1815,11 @@
Declares a new \acro\ list style \meta{name}. \meta{name} will be the
value which can be chosen in the option \option{list-style}.
\meta{template} is the name of the template to be used by the style.
- Available styles are listed in table~\ref{tab:list-templates}.
+ Available templates are listed in table~\ref{tab:list-templates}.
\meta{options} are the option settings for the corresponding template.
\end{commands}
-\begin{table}
+\begin{table}[hbp]
\centering
\caption{Available List Templates and Their Options}\label{tab:list-templates}
\begin{tabular}{*{4}{>{\ttfamily}l}}
@@ -1875,7 +1928,7 @@
\acsetup{list-style=mystyle,hyperref=false}
\printacronyms
-\subsection{Own List Heading Command}
+\subsubsection{Own List Heading Command}
With the option \option{list-heading} you can choose which command prints the
heading of the list. If you need a different choice than what's already
@@ -1891,17 +1944,167 @@
\DeclareAcroListHeading{section}{\section}
\end{sourcecode}
-\section{Configuration Files}
+\subsection{First Styles}
+The first styles define how an acronym is typeset when it is used for the
+first time. It is set with the option \option{first-style}. Legal values for
+this option are defined with the following command:
+\begin{commands}
+ \command{DeclareAcroFirstStyle}[\marg{name}\marg{template}\marg{options}]
+ Declares a new \acro\ first style \meta{name}. \meta{name} will be the
+ value which can be chosen in the option \option{first-style}.
+ \meta{template} is the name of the template to be used by the style.
+ Available templates are listed in table~\ref{tab:first-templates}.
+ \meta{options} are the option settings for the corresponding template.
+\end{commands}
+
+Here are two examples of the already available styles and how they are
+defined:
+\begin{sourcecode}
+ \DeclareAcroFirstStyle{short}{inline}{
+ only-short = true ,
+ brackets = false
+ }
+ \DeclareAcroFirstStyle{sidenote-reversed}{note}{
+ note-command = \sidenote{#1} ,
+ reversed = true
+ }
+\end{sourcecode}
+
+\begin{table}[hbp]
+ \centering
+ \caption{Available First Style Templates and Their Options}\label{tab:first-templates}
+ \begin{tabular}{*{4}{>{\ttfamily}l}}
+ \toprule
+ \normalfont\bfseries Template & \normalfont\bfseries Option &
+ \normalfont\bfseries Option Type & \normalfont\bfseries Default \\
+ \midrule
+ inline & brackets & boolean & true \\
+ & brackets-type & tokenlist & () \\
+ & only-short & boolean & false \\
+ & only-long & boolean & false \\
+ & reversed & boolean & false \\
+ & between & tokenlist \\
+ & foreign-sep & tokenlist & ,\textasciitilde \\
+ \midrule
+ note & use-note & boolean & true \\
+ & note-command & function & \cs*{footnote}\Marg{\#1} \\
+ & reversed & boolean & false \\
+ & foreign-sep & tokenlist & ,\textasciitilde \\
+ \bottomrule
+ \end{tabular}
+\end{table}
+
+\subsection{Extra Styles}
+The extra styles define how the extra information of an acronym is typeset in
+the list. It is set with the option \option{extra-style}. Legal values for
+this option are defined with the following command:
+\begin{commands}
+ \command{DeclareAcroExtraStyle}[\marg{name}\marg{template}\marg{options}]
+ Declares a new \acro\ extra style \meta{name}. \meta{name} will be the
+ value which can be chosen in the option \option{extra-style}.
+ \meta{template} is the name of the template to be used by the style.
+ Available templates are listed in table~\ref{tab:extra-templates}.
+ \meta{options} are the option settings for the corresponding template.
+\end{commands}
+
+Here are two examples of the already available styles and how they are
+defined:
+\begin{sourcecode}
+ \DeclareAcroExtraStyle{default}{inline}{
+ brackets = false ,
+ punct = true ,
+ punct-symbol = .
+ }
+ \DeclareAcroExtraStyle{paren}{inline}{
+ brackets = true ,
+ punct = true ,
+ punct-symbol =
+ }
+\end{sourcecode}
+
+\begin{table}
+ \centering
+ \caption{Available Extra Style Templates and Their Options}\label{tab:extra-templates}
+ \begin{tabular}{*{4}{>{\ttfamily}l}}
+ \toprule
+ \normalfont\bfseries Template & \normalfont\bfseries Option &
+ \normalfont\bfseries Option Type & \normalfont\bfseries Default \\
+ \midrule
+ inline & punct & boolean & true \\
+ & punct-symbol & tokenlist & , \\
+ & brackets & boolean & true \\
+ & brackets-type & tokenlist & () \\
+ \bottomrule
+ \end{tabular}
+\end{table}
+
+\subsection{Page Number Styles}
+The page number styles define how the page numbers where acronyms have been
+used are typeset in the list. It is set with the option \option{page-style}.
+Legal values for this option are defined with the following command:
+\begin{commands}
+ \command{DeclareAcroPageStyle}[\marg{name}\marg{template}\marg{options}]
+ Declares a new \acro\ extra style \meta{name}. \meta{name} will be the
+ value which can be chosen in the option \option{page-style}.
+ \meta{template} is the name of the template to be used by the style.
+ Available templates are listed in table~\ref{tab:page-templates}.
+ \meta{options} are the option settings for the corresponding template.
+\end{commands}
+
+Here are two examples of the already available styles and how they are
+defined:
+\begin{sourcecode}
+ \DeclareAcroPageStyle{default}{inline}{
+ punct = true ,
+ punct-symbol = .
+ }
+ \DeclareAcroPageStyle{paren}{inline}{
+ brackets=true ,
+ punct-symbol = ~
+ }
+\end{sourcecode}
+
+\begin{table}[hbp]
+ \centering
+ \caption{Available Page Number Style Templates and Their
+ Options}\label{tab:page-templates}
+ \begin{tabular}{*{3}{>{\ttfamily}l}>{\ttfamily}p{.25\linewidth}}
+ \toprule
+ \normalfont\bfseries Template & \normalfont\bfseries Option &
+ \normalfont\bfseries Option Type & \normalfont\bfseries Default \\
+ \midrule
+ inline & display & boolean & true \\
+ & punct & boolean & false \\
+ & punct-symbol & tokenlist & , \\
+ & brackets & boolean & false \\
+ & brackets-type & tokenlist & () \\
+ & space & skip & .333333em plus .166666em minus
+ .111111em \\
+ \bottomrule
+ \end{tabular}
+\end{table}
+
+\subsection{Configuration Files}
If\sinceversion{2.2} you repeatedly have the same setup and definitions for
-\acro\ in your preamble you might want to place those in a configuration file.
-If \acro\ finds a file named \code{acro.cfg} present it inputs it at the end
-of the package. The only thing to be aware of is that this file is input like
-a package which means that \code{@} is treated as a letter (category code~11).
+\acro\ in your preamble\footnote{For example defining new endings, \acro{}
+ commands, list styles, \ldots} you might want to place those in a
+configuration file. If \acro\ finds a file named \code{acro.cfg} present it
+inputs it at the end of the package. The only thing to be aware of is that
+this file is input like a package which means that \code{@} is treated as a
+letter (category code~11).
\appendix
-\section{All Acronyms Used in this Documentation}\label{sec:documentation_acronyms}
-\printacronyms[name=All Acronyms,heading=none]
+\acsetup{
+ list-style = description ,
+ list-heading = section ,
+ list-name = All Acronyms Used in this Documentation ,
+ page-style = comma ,
+ following-pages* = true ,
+ extra-style = comma
+}
+\printacronyms
+
\end{document}
Modified: trunk/Master/texmf-dist/tex/latex/acro/acro.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/acro/acro.sty 2016-06-11 23:20:06 UTC (rev 41385)
+++ trunk/Master/texmf-dist/tex/latex/acro/acro.sty 2016-06-11 23:20:16 UTC (rev 41386)
@@ -31,8 +31,8 @@
\RequirePackage{expl3,l3sort,xparse,l3keys2e,xtemplate,etoolbox}
\ProvidesExplPackage
{acro}
- {2016/05/03}
- {2.4b}
+ {2016/05/30}
+ {2.5b}
{Typeset Acronyms}
% --------------------------------------------------------------------------
@@ -39,61 +39,177 @@
% warning and error messages:
\msg_new:nnn {acro} {undefined}
{
- You've~requested~acronym~`#1'~\msg_line_context: \c_space_tl but~you~
- apparently~haven't~defined~it,~yet!~Maybe~you've~misspelled~it?
+ You've~ requested~ acronym~ `#1'~ \msg_line_context: \ but~ you~
+ apparently~ haven't~ defined~ it,~ yet! \\
+ Maybe~ you've~ misspelled~ `#1'?
}
\msg_new:nnn {acro} {macro}
{
- A~macro~with~the~csname~`#1'~already~exists.~Unless~you~set~acro's~option~
- `strict'~I~won't~redefine~it~\msg_line_context: .
+ A~ macro~ with~ the~ csname~ `#1'~ already~ exists! \\
+ Unless~ you~ set~ acro's~ option~ `strict'~ I~ won't~ redefine~ it~
+ \msg_line_context: .
}
\msg_new:nnn {acro} {replaced}
{
- 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.
+ The~ #1~ `#2' ~you ~used~ \msg_line_context: \ is~ deprecated~ and~ has~
+ been~ replaced~ by~ `#3'. ~Since~ I~ will~ not~ guarantee~ that~ #1~ `#2'~
+ will~ be~ kept~ forever~ I~ strongly~ encourage~ you~ to~ switch!
}
\msg_new:nnn {acro} {deprecated}
{
- 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.
+ The~ #1~ `#2'~ you~ used~ \msg_line_context: \ is~ deprecated~and~ there~
+ is~ no~ replacement.~ Since~ I~ will~ not~ guarantee~ that~ #1~ `#2'~
+ will~ be~ kept~ forever~ I~ strongly~ encourage~ you~ to~ remove~ it~
+ from~ your~ document.
}
\msg_new:nnn {acro} {substitute-short}
{
- No~ short~ form~ set~ for~ acronym~ `#1'.~ Setting~ the~ short~ form~
- equal~ to~ the~ ID~ `#1'.~ If~ that~ is~ not~ what~ you~ want~ add~ an~
- explicit~ short~ form.
+ There~ is~ no~ short~ form~ set~ for~ acronym~ `#1'! \\
+ I~ am~ setting~ the~ short~ form~ equal~ to~ the~ ID~ `#1'. \\
+ If~ that~ is~ not~ what~ you~ want~ make~ sure~ to~ add~ an~ explicit~
+ short~ form.
}
\msg_new:nnn {acro} {ending-exists}
{
- An~ ending~ with~ the~ name~ `#1'~ already~ exists.~ I'm~ overwriting~
- the~ defaults.
+ An~ ending~ with~ the~ name~ `#1'~ already~ exists! \\ \\
+ I~ am~ overwriting~ the~ defaults.
}
\msg_new:nnn {acro} {ending-before-acronyms}
{
- You~ are~ using~ \token_to_str:N \ProvideAcroEnding \c_space_tl after~
- you've~ declared~ at~ least~ one~ acronym.~ This~ will~ lead~ to~
- trouble!~ Define~ endings~ before~ any~ acronym~ declarations!
+ You~ are~ using~ \token_to_str:N \ProvideAcroEnding \ after~ you've~
+ declared~ at~ least~ one~ acronym.~ This~ will~ lead~ to~ trouble! \\
+ Make~ sure~ to~ define~ endings~ before~ *any*~ acronym~ declarations!
}
\msg_new:nnn {acro} {no-alternative}
{
- There~ is~ no~ alternative~ form~ for~ acronym~ `#1'.~ Using~ the~ short~
- form~ instead.
+ There~ is~ no~ alternative~ form~ for~ acronym~ `#1'! \\ \\
+ I~ am~ using~ the~ short~ form~ instead.
}
-\msg_new:nnn {acro} {unknown-list-style}
+\msg_new:nnn {acro} {unknown}
{
- You're~ trying~ to~ use~ the~ list~ style~ `#1'~ which~ isn't~ defined.~
- Using~ `#2'~ instead.
+ You're~ trying~ to~ use~ the~ #1~ `#2'~ \msg_line_context: . \\
+ However,~ I~ do~ not~ know~ #1~ `#2'! \\
+ If~ this~ is~ no~ typo~ please~ contact~ the~ package~ author. \\ \\
+ I~ am~ going~ to~ use~ the~ #1~ `#3'~ instead.
}
+% --------------------------------------------------------------------------
+% logging:
+\cs_new:Npn \acro_if_log:T #1 { \use:n {#1} }
+
+\bool_new:N \l__acro_log_acronyms_bool
+\bool_new:N \l__acro_log_acronyms_verbose_bool
+
+\keys_define:nn {acro}
+ {
+ log .choice: ,
+ log / true .code:n =
+ \bool_set_true:N \l__acro_log_acronyms_bool
+ \bool_set_false:N \l__acro_log_acronyms_verbose_bool ,
+ log / silent .meta:n = { log = true } ,
+ log / verbose .code:n =
+ \bool_set_true:N \l__acro_log_acronyms_bool
+ \bool_set_true:N \l__acro_log_acronyms_verbose_bool ,
+ log / false .code:n =
+ \bool_set_false:N \l__acro_log_acronyms_bool
+ \bool_set_false:N \l__acro_log_acronyms_verbose_bool ,
+ log .default:n = true ,
+ log .initial:n = false
+ }
+
+\cs_new:Npn \__acro_write_log:nn #1#2 { \ \ \ #1 ~ = ~ {#2} }
+\cs_new:Npn \__acro_write_log_property:nnn #1#2#3
+ { \__acro_write_log:nn {#2} { \acro_get_property:nn {#3} {#1} } }
+
+\cs_new:Npn \__acro_ending_log_entry:nn #1#2
+ {
+ | \\
+ | \__acro_write_log_property:nnn {#1} {short-#2} {short_#2} \\
+ | \__acro_write_log_property:nnn {#1} {short-#2-form} {short_#2_form} \\
+ | \__acro_write_log_property:nnn {#1} {long-#2} {long_#2} \\
+ | \__acro_write_log_property:nnn {#1} {long-#2-form} {long_#2_form} \\
+ | \__acro_write_log_property:nnn {#1} {alt-#2} {alt_#2} \\
+ | \__acro_write_log_property:nnn {#1} {alt-#2-form} {alt_#2_form} \\
+ }
+
+\msg_new:nnn {acro} {log-acronym-verbose}
+ {
+ ================================================= \\
+ | ~ \msg_info_text:n {acro}~ --~ defining~ new~ acronym: \\
+ | \__acro_write_log:nn {ID} {#1} \\
+ | \__acro_write_log_property:nnn {#1} {short} {short} \\
+ | \__acro_write_log_property:nnn {#1}{long} {long} \\
+ | \__acro_write_log_property:nnn {#1}{alt} {alt} \\
+ | \__acro_write_log_property:nnn {#1}{sort} {sort} \\
+ | \__acro_write_log_property:nnn {#1}{class} {class} \\
+ | \__acro_write_log_property:nnn {#1} {list} {list} \\
+ | \__acro_write_log_property:nnn {#1} {extra} {extra} \\
+ | \__acro_write_log_property:nnn {#1} {foreign} {foreign} \\
+ | \__acro_write_log_property:nnn {#1} {single} {single} \\
+ | \__acro_write_log_property:nnn {#1} {pdfstring} {pdfstring} \\
+ | \__acro_write_log_property:nnn {#1} {accsupp} {accsupp} \\
+ | \__acro_write_log_property:nnn {#1} {tooltip} {tooltip} \\
+ | \\
+ | \__acro_write_log_property:nnn {#1} {short-indefinite} {short_indefinite} \\
+ | \__acro_write_log_property:nnn {#1} {long-indefinite} {long_indefinite} \\
+ | \__acro_write_log_property:nnn {#1} {alt-indefinite} {alt_indefinite} \\
+ \seq_map_function:NN \l__acro_endings_seq \__acro_ending_log_entry:n
+ | \\
+ | \__acro_write_log_property:nnn {#1} {short-format} {short_format} \\
+ | \__acro_write_log_property:nnn {#1} {long-format} {long_format} \\
+ | \__acro_write_log_property:nnn {#1} {first-long-format} {first_long_format} \\
+ | \__acro_write_log_property:nnn {#1} {single-format} {single_format} \\
+ | \__acro_write_log_property:nnn {#1} {foreign-lang} {foreign_lang} \\
+ | \\
+ | \__acro_write_log_property:nnn {#1} {cite} {citation} \\
+ | \__acro_write_log_property:nnn {#1} {index} {index} \\
+ | \__acro_write_log_property:nnn {#1} {index-sort} {index_sort} \\
+ | \\
+ | \__acro_write_log_property:nnn {#1} {long-pre} {long_pre} \\
+ | \__acro_write_log_property:nnn {#1} {long-post} {long_post} \\
+ | \__acro_write_log_property:nnn {#1} {index-cmd} {index_cmd} \\
+ | \__acro_write_log_property:nnn {#1} {first-style} {first_style} \\
+ =================================================
+ }
+
+\msg_new:nnn {acro} {log-acronym-silent}
+ {
+ ================================================= \\
+ | ~ \msg_info_text:n {acro}~ --~ defining~ new~ acronym: \\
+ | \__acro_write_log:nn {ID} {#1} \\
+ | \__acro_write_log_property:nnn {#1} {short} {short} \\
+ | \__acro_write_log_property:nnn {#1} {long} {long} \\
+ | \__acro_write_log_property:nnn {#1} {alt} {alt} \\
+ | \__acro_write_log_property:nnn {#1} {sort} {sort} \\
+ | \__acro_write_log_property:nnn {#1} {class} {class} \\
+ | \__acro_write_log_property:nnn {#1} {list} {list} \\
+ | \__acro_write_log_property:nnn {#1} {extra} {extra} \\
+ | \__acro_write_log_property:nnn {#1} {foreign} {foreign} \\
+ | \__acro_write_log_property:nnn {#1} {pdfstring} {pdfstring} \\
+ | \__acro_write_log_property:nnn {#1} {cite} {citation} \\
+ =================================================
+ }
+
+\cs_new_protected:Npn \__acro_log_acronym:n #1
+ {
+ \bool_if:NT \l__acro_log_acronyms_bool
+ {
+ \cs_set:Npn \__acro_ending_log_entry:n ##1
+ { \__acro_ending_log_entry:nn {#1} {##1} }
+ \bool_if:NTF \l__acro_log_acronyms_verbose_bool
+ { \msg_log:nnn {acro} {log-acronym-verbose} {#1} }
+ { \msg_log:nnn {acro} {log-acronym-silent} {#1} }
+ }
+ }
+
+% --------------------------------------------------------------------------
% message macros:
\cs_new:Npn \__acro_remove_backslash:N #1
{ \exp_after:wN \use_none:n \token_to_str:N #1 }
@@ -203,8 +319,6 @@
\bool_new:N \l__acro_inside_tooltip_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_is_excluded_bool
\bool_new:N \l__acro_is_included_bool
@@ -216,6 +330,7 @@
\bool_new:N \l__acro_first_only_short_bool
\bool_new:N \l__acro_first_only_long_bool
\bool_new:N \l__acro_first_reversed_bool
+\bool_new:N \l__acro_first_switched_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
@@ -265,7 +380,7 @@
\tl_new:N \l__acro_list_type_tl
\tl_new:N \l__acro_list_tl
\tl_new:N \l__acro_list_heading_cmd_tl
-\tl_set:Nn \l__acro_list_heading_cmd_tl {section*}
+\tl_set:Nn \l__acro_list_heading_cmd_tl {section*}
\tl_new:N \l__acro_list_name_tl
\tl_set:Nn \l__acro_list_name_tl {Acronyms}
\tl_new:N \l__acro_list_before_tl
@@ -298,12 +413,16 @@
\tl_new:N \l__acro_single_form_tl
\tl_set:Nn \l__acro_single_form_tl {long}
-\dim_new:N \l__acro_page_space_dim
+\skip_new:N \l__acro_page_space_skip
\dim_new:N \l__acro_short_width_dim
\dim_set:Nn \l__acro_short_width_dim {3em}
\prop_new:N \l__acro_list_styles_prop
+\prop_new:N \l__acro_list_headings_prop
+\prop_new:N \l__acro_first_styles_prop
+\prop_new:N \l__acro_extra_styles_prop
+\prop_new:N \l__acro_page_styles_prop
% --------------------------------------------------------------------------
% small commands for use at various places
@@ -323,7 +442,6 @@
% options:
\keys_define:nn {acro}
{
- version .code:n = \acro_option_deprecated:n {version} ,
messages .choice: ,
messages / silent .code:n =
\bool_set_true:N \l__acro_silence_bool ,
@@ -371,9 +489,9 @@
single .bool_set:N = \l__acro_use_single_bool ,
single-form .tl_set:N = \l__acro_single_form_tl ,
single-form .value_required:n = true ,
- first-style .tl_set:N = \l__acro_first_instance_tl ,
+ first-style .code:n = \acro_set_first_style:n {#1} ,
first-style .value_required:n = true ,
- extra-style .tl_set:N = \l__acro_extra_instance_tl ,
+ extra-style .code:n = \acro_set_extra_style:n {#1} ,
extra-style .value_required:n = true ,
label .bool_set:N = \l__acro_place_label_bool ,
label-prefix .tl_set:N = \l__acro_label_prefix_tl ,
@@ -385,19 +503,20 @@
\bool_set_true:N \l__acro_place_label_bool
\bool_set_false:N \l__acro_list_all_pages_bool ,
pages .value_required:n = true ,
- page-ref .tl_set:N = \l__acro_page_instance_tl ,
- page-ref .value_required:n = true ,
+ page-ref .code:n =
+ \acro_option_deprecated:nn {page-ref} {page-style}
+ \acro_set_page_style:n {#1} ,
+ page-style .code:n = \acro_set_page_style:n {#1} ,
+ page-style .value_required:n = true ,
page-name .tl_set:N = \l__acro_page_name_tl ,
page-name .value_required:n = true ,
pages-name .tl_set:N = \l__acro_pages_name_tl ,
pages-name .value_required:n = true ,
- 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:n {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:n {record-pages} ,
+ following-pages* .meta:n =
+ { following-page = #1 , following-pages = #1 } ,
+ following-pages* .default:n = true ,
next-page .tl_set:N = \l__acro_next_page_tl ,
next-page .value_required:n = true ,
next-pages .tl_set:N = \l__acro_next_pages_tl ,
@@ -404,16 +523,10 @@
next-pages .value_required:n = true ,
list-style .code:n = \acro_set_list_style:n {#1} ,
list-style .value_required:n = true ,
- list-type .code:n = \acro_option_deprecated:n {list-type} ,
- list-header .code:n =
- \acro_option_deprecated:nn {list-header} {list-heading}
- \tl_set:Nn \l__acro_list_heading_cmd_tl {#1} ,
- list-heading .tl_set:N = \l__acro_list_heading_cmd_tl ,
+ list-heading .code:n = \acro_set_list_heading:n {#1} ,
list-heading .value_required:n = true ,
list-name .tl_set:N = \l__acro_list_name_tl ,
list-name .value_required:n = true ,
- list-table-width .code:n =
- \acro_option_deprecated:n {list-table-width} ,
hyperref .bool_set:N = \l__acro_use_hyperref_bool ,
only-used .bool_set:N = \l__acro_print_only_used_bool ,
mark-as-used .choice: ,
@@ -444,8 +557,6 @@
cite-connect .tl_set:N = \l__acro_citation_connect_tl ,
cite-connect .initial:n = \nobreakspace ,
cite-connect .value_required:n = true ,
- cite-space .code:n =
- \acro_option_deprecated:nn {cite-space} {cite-connect} ,
group-cite-connect .tl_set:N = \l__acro_between_group_connect_citation_tl ,
group-cite-connect .initial:n = {,\nobreakspace} ,
group-cite-connect .value_required:n = true ,
@@ -468,8 +579,6 @@
\cs_new_eq:NN \acro_xspace: \xspace
}
{ \cs_new:Npn \acro_xspace: {} }
- \bool_if:NF \l__acro_record_pages_bool
- { \cs_set_eq:NN \acro_record_page_number:n \use_none:n }
}
% --------------------------------------------------------------------------
@@ -500,13 +609,12 @@
{ \UseInstance {acro-list} {#1} {#2} {#3} }
\cs_generate_variant:Nn \acro_list_instance:nnn {VVV}
-% objects with three arguments:
-\cs_new_protected:Npn \acro_first_instance:nnnn #1#2#3#4
+\cs_new_protected:Npn \acro_first_instance:nnn #1#2#3
{
\acro_if_defined:nT {#2}
- { \UseInstance {acro-first} {#1} {#2} {#3} {#4} }
+ { \UseInstance {acro-first} {#1} {#2} {#3} }
}
-\cs_generate_variant:Nn \acro_first_instance:nnnn {VnV,VnVV}
+\cs_generate_variant:Nn \acro_first_instance:nnn {Vn,VnV}
% --------------------------------------------------------------------------
% hyperref support
@@ -568,15 +676,145 @@
% --------------------------------------------------------------------------
% output style of the first time an acronym is used
-\cs_new:Npn \__acro_note_command:n #1 {#1}
-% #1: id
-% #2: short
+% helper macros for the styles
+% #1: short|long
+% #2: id
% #3: long
-\DeclareObjectType {acro-first} {3}
+\cs_new_protected:Npn \__acro_print_form_and_indefinite:nnn #1#2#3
+ {
+ \group_begin:
+ \acro_for_all_trailing_tokens_do:n
+ { \acro_deactivate_trailing_action:n {##1} }
+ \str_case:nn {#1}
+ {
+ {long} {
+ \bool_if:nT
+ {
+ \l__acro_first_only_long_bool ||
+ !\l__acro_first_only_short_bool
+ }
+ {
+ \acro_write_indefinite:nn {#2} {long}
+ \acro_write_expanded:nnn {#2} {first-long} {#3}
+ }
+ }
+ {short} {
+ \bool_if:nT
+ {
+ !\l__acro_first_only_long_bool ||
+ \l__acro_first_only_short_bool
+ }
+ {
+ \acro_write_indefinite:nn {#2} {short}
+ \acro_write_compact:nn {#2} {short}
+ }
+ }
+ }
+ \group_end:
+ }
+\cs_new_protected:Npn \__acro_open_bracket:
+ {
+ \bool_if:nT
+ {
+ !\l__acro_first_only_long_bool &&
+ !\l__acro_first_only_short_bool
+ }
+ {
+ \acro_space:
+ \tl_if_blank:VF \l__acro_first_between_tl
+ {
+ \tl_use:N \l__acro_first_between_tl
+ \acro_space:
+ }
+ \bool_if:NT \l__acro_first_use_brackets_bool
+ { \tl_head:N \l__acro_first_brackets_tl }
+ }
+ }
+
+\cs_new_protected:Npn \__acro_close_bracket:
+ {
+ \bool_if:nT
+ {
+ \l__acro_first_use_brackets_bool &&
+ !\l__acro_first_only_short_bool &&
+ !\l__acro_first_only_long_bool
+ }
+ { \tl_tail:N \l__acro_first_brackets_tl }
+ }
+
+% #1: short|long
+% #2: id
+% #3: long
+\cs_new_protected:Npn \__acro_print_form:nnn #1#2#3
+ {
+ \str_case:nn {#1}
+ {
+ {long} {
+ \bool_if:nT
+ {
+ \l__acro_first_only_long_bool ||
+ !\l__acro_first_only_short_bool
+ }
+ { \acro_write_expanded:nnn {#2} {first-long} {#3} }
+ }
+ {short} {
+ \bool_if:nT
+ {
+ !\l__acro_first_only_long_bool ||
+ \l__acro_first_only_short_bool
+ }
+ { \acro_write_compact:nn {#2} {short} }
+ }
+ }
+ }
+
+% #1: id
+\cs_new_protected:Npn \__acro_foreign_sep:n #1
+ {
+ \bool_if:nT
+ {
+ \l__acro_foreign_bool &&
+ !\l__acro_first_only_short_bool &&
+ !\l__acro_first_only_long_bool
+ }
+ { \acro_if_foreign:nT {#1} { \tl_use:N \l__acro_foreign_sep_tl } }
+ }
+
+% #1: id
+\cs_new_protected:Npn \__acro_print_foreign:n #1
+ {
+ \bool_if:nT
+ {
+ \l__acro_foreign_bool &&
+ !\l__acro_first_only_short_bool &&
+ !\l__acro_first_only_long_bool
+ }
+ { \acro_write_foreign:n {#1} }
+ }
+
+\cs_new_protected:Npn \__acro_print_citation:n #1
+ {
+ \bool_if:NT \l__acro_group_citation_bool
+ { \acro_group_cite:n {#1} }
+ }
+
+\cs_new_protected:Npn \__acro_finalize_first:n #1
+ {
+ \bool_if:NF \l__acro_group_citation_bool
+ { \acro_cite_if:nn { \l__acro_citation_first_bool } {#1} }
+ \acro_index_if:nn { \l__acro_addto_index_bool } {#1}
+ }
+
+% --------------------------------------------------------------------------
+% the `acro-first' object, templates, instances:
+% #1: id
+% #2: long
+\DeclareObjectType {acro-first} {2}
+
% template for inline appearance:
-\DeclareTemplateInterface {acro-first} {inline} {3}
+\DeclareTemplateInterface {acro-first} {inline} {2}
{
brackets : boolean = true ,
brackets-type : tokenlist = () ,
@@ -584,9 +822,9 @@
only-long : boolean = false ,
reversed : boolean = false ,
between : tokenlist ,
- foreign-sep : tokenlist = { , ~ }
+ foreign-sep : tokenlist = {,~}
}
-\DeclareTemplateCode {acro-first} {inline} {3}
+\DeclareTemplateCode {acro-first} {inline} {2}
{
brackets = \l__acro_first_use_brackets_bool ,
brackets-type = \l__acro_first_brackets_tl ,
@@ -600,218 +838,169 @@
\AssignTemplateKeys
\bool_if:NTF \l__acro_first_reversed_bool
{ % zuerst kurze Form, dann lange Form:
- \bool_if:NF \l__acro_first_only_long_bool
- {
- \acro_write_indefinite:nn {#1} {short}
- \group_begin:
- \acro_for_all_trailing_tokens_do:n
- { \acro_deactivate_trailing_action:n {##1} }
- \acro_write_compact:nn {#1} {short}
- \group_end:
- \bool_if:NF \l__acro_first_only_short_bool
- {
- \acro_space:
- \tl_if_blank:VF \l__acro_first_between_tl
- {
- \tl_use:N \l__acro_first_between_tl
- \acro_space:
- }
- }
- }
- % öffnende Klammer:
- \bool_if:nT
- {
- \l__acro_first_use_brackets_bool &&
- !\l__acro_first_only_short_bool &&
- !\l__acro_first_only_long_bool
- }
- { \tl_head:N \l__acro_first_brackets_tl }
- % fremdsprachige Form:
- \bool_if:nT
- {
- \l__acro_foreign_bool &&
- !\l__acro_first_only_short_bool &&
- !\l__acro_first_only_long_bool
- }
- {
- \acro_write_foreign:n {#1}
- \acro_if_foreign:nT {#1} { \tl_use:N \l__acro_foreign_sep_tl }
- }
- % Artikel der Langform und Langform:
- \bool_if:NF \l__acro_first_only_short_bool
- {
- \acro_write_indefinite:nn {#1} {long}
- \acro_write_expanded:nnn {#1} {first-long} {#3}
- }
- % Zitat:
- \bool_if:NT \l__acro_group_citation_bool
- { \acro_group_cite:n {#1} }
- % schließende Klammer:
- \bool_if:nT
- {
- \l__acro_first_use_brackets_bool &&
- !\l__acro_first_only_short_bool &&
- !\l__acro_first_only_long_bool
- }
- { \tl_tail:N \l__acro_first_brackets_tl }
+ \__acro_print_form_and_indefinite:nnn {short} {#1} {#2}
+ \__acro_open_bracket:
+ \__acro_print_foreign:n {#1}
+ \__acro_foreign_sep:n {#1}
+ \__acro_print_form:nnn {long} {#1} {#2}
+ \__acro_print_citation:n {#1}
+ \__acro_close_bracket:
+ \__acro_finalize_first:n {#1}
}
{ % zuerst lange Form, dann kurze Form:
- % Artikel + lange Form:
- \bool_if:NF \l__acro_first_only_short_bool
- {
- \acro_write_indefinite:nn {#1} {long}
- \acro_write_expanded:nnn {#1} {first-long} {#3}
- \bool_if:NF \l__acro_first_only_long_bool
- {
- \acro_space:
- \tl_if_blank:VF \l__acro_first_between_tl
- {
- \tl_use:N \l__acro_first_between_tl
- \acro_space:
- }
- }
- }
- % öffnende Klammer:
- \bool_if:nT
- {
- \l__acro_first_use_brackets_bool &&
- !\l__acro_first_only_short_bool &&
- !\l__acro_first_only_long_bool
- }
- { \tl_head:N \l__acro_first_brackets_tl }
- % fremdsprachige Form:
- \bool_if:nT
- {
- \l__acro_foreign_bool &&
- !\l__acro_first_only_short_bool &&
- !\l__acro_first_only_long_bool
- }
- {
- \acro_write_foreign:n {#1}
- \acro_if_foreign:nT {#1} { \tl_use:N \l__acro_foreign_sep_tl }
- }
- % Artikel der Kurzform und Kurzform:
- \bool_if:NF \l__acro_first_only_long_bool
- {
- \acro_write_indefinite:nn {#1} {short}
- \group_begin:
- \acro_for_all_trailing_tokens_do:n
- { \acro_deactivate_trailing_action:n {##1} }
- \acro_write_compact:nn {#1} {short}
- \group_end:
- }
- % Zitat:
- \bool_if:NT \l__acro_group_citation_bool
- { \acro_group_cite:n {#1} }
- % schließende Klammer:
- \bool_if:nT
- {
- \l__acro_first_use_brackets_bool &&
- !\l__acro_first_only_short_bool &&
- !\l__acro_first_only_long_bool
- }
- { \tl_tail:N \l__acro_first_brackets_tl }
+ \__acro_print_form_and_indefinite:nnn {long} {#1} {#2}
+ \__acro_open_bracket:
+ \__acro_print_foreign:n {#1}
+ \__acro_foreign_sep:n {#1}
+ \__acro_print_form:nnn {short} {#1} {#2}
+ \__acro_print_citation:n {#1}
+ \__acro_close_bracket:
+ \__acro_finalize_first:n {#1}
}
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- \bool_if:NF \l__acro_group_citation_bool
- { \acro_cite_if:nn { \l__acro_citation_first_bool } {#1} }
- \acro_index_if:nn { \l__acro_addto_index_bool } {#1}
}
% template for footnotes, sidenotes, ...
-\DeclareTemplateInterface {acro-first} {note} {3}
+\cs_new:Npn \__acro_note_command:n #1 {#1}
+\DeclareTemplateInterface {acro-first} {note} {2}
{
use-note : boolean = true ,
note-command : function 1 = \footnote {#1} ,
- foreign-sep : tokenlist = ~
+ foreign-sep : tokenlist = {,~} ,
+ reversed : boolean = false ,
}
-\DeclareTemplateCode {acro-first} {note} {3}
+\DeclareTemplateCode {acro-first} {note} {2}
{
- use-note = \l__acro_use_note_bool ,
- note-command = \__acro_note_command:n ,
- foreign-sep = \l__acro_foreign_sep_tl
+ use-note = \l__acro_use_note_bool ,
+ note-command = \__acro_note_command:n ,
+ foreign-sep = \l__acro_foreign_sep_tl ,
+ reversed = \l__acro_first_reversed_bool
}
{
\AssignTemplateKeys
- \acro_write_indefinite:nn {#1} {short}
- \acro_acc_supp:nn {#1} { \acro_write_short:nn {#1} {#2} }
- \bool_if:NT \l__acro_use_note_bool
- {
- \__acro_note_command:n
+ \bool_if:NTF \l__acro_first_reversed_bool
+ { % long in text and short in note
+ \__acro_print_form_and_indefinite:nnn {long} {#1} {#2}
+ \bool_if:NT \l__acro_use_note_bool
{
- \acro_write_long:Vo \l__acro_first_long_format_tl {#3}
- \acro_if_foreign:nT {#1}
+ \__acro_note_command:n
{
- \tl_use:N \l__acro_foreign_sep_tl
- \acroenparen { \acro_write_foreign:n {#1} }
+ \__acro_print_foreign:n {#1}
+ \__acro_foreign_sep:n {#1}
+ \__acro_print_form:nnn {short} {#1} {#2}
+ \__acro_print_citation:n {#1}
+ \__acro_finalize_first:n {#1}
}
- \acro_cite_if:nn { \l__acro_citation_first_bool } {#1}
- \acro_index_if:nn { \l__acro_addto_index_bool } {#1}
}
}
+ { % short in text and long in note
+ \__acro_print_form_and_indefinite:nnn {short} {#1} {#2}
+ \bool_if:NT \l__acro_use_note_bool
+ {
+ \__acro_note_command:n
+ {
+ \__acro_print_foreign:n {#1}
+ \__acro_foreign_sep:n {#1}
+ \__acro_print_form:nnn {long} {#1} {#2}
+ \__acro_print_citation:n {#1}
+ \__acro_finalize_first:n {#1}
+ }
+ }
+ }
}
+% --------------------------------------------------------------------------
+% declare new first styles:
+\cs_new_protected:Npn \acro_declare_first_style:nnn #1#2#3
+ {
+ \DeclareInstance {acro-first} {#1} {#2} {#3}
+ \prop_put:Nnn \l__acro_first_styles_prop {#1} {#2}
+ }
+
+% #1: name
+% #2: template
+% #3: settings
+\NewDocumentCommand \DeclareAcroFirstStyle {mmm}
+ { \acro_declare_first_style:nnn {#1} {#2} {#3} }
+
+% set a list style
+\cs_new_protected:Npn \acro_set_first_style:n #1
+ {
+ \prop_if_in:NnTF \l__acro_first_styles_prop {#1}
+ { \__acro_set_first_style:n {#1} }
+ {
+ \msg_warning:nnnnn {acro} {unknown}
+ {first~ style}
+ {#1}
+ {default}
+ \__acro_set_first_style:n {default}
+ }
+ }
+
+\cs_new_protected:Npn \__acro_set_first_style:n #1
+ {
+ \tl_set:Nn \l__acro_first_instance_tl {#1}
+ \prop_get:NnN \l__acro_first_styles_prop {#1} \l__acro_tmpa_tl
+ }
+
% the different styles:
-\DeclareInstance {acro-first}
- { default }
- { inline }
+\DeclareAcroFirstStyle {default} {inline}
{ }
-\DeclareInstance {acro-first}
- { square }
- { inline }
+
+\DeclareAcroFirstStyle {reversed} {inline}
+ { reversed = true }
+
+\DeclareAcroFirstStyle {short} {inline}
+ {
+ only-short = true ,
+ brackets = false
+ }
+
+\DeclareAcroFirstStyle {long} {inline}
+ {
+ only-long = true ,
+ brackets = false
+ }
+
+\DeclareAcroFirstStyle {square} {inline}
{ brackets-type = [] }
-\DeclareInstance {acro-first}
- { plain }
- { inline }
+
+\DeclareAcroFirstStyle {plain} {inline}
{
brackets = false ,
between = --
}
-\DeclareInstance {acro-first}
- { plain-reversed }
- { inline }
+
+\DeclareAcroFirstStyle {plain-reversed} {inline}
{
brackets = false ,
between = -- ,
reversed = true
}
-\DeclareInstance {acro-first}
- { footnote }
- { note }
+
+\DeclareAcroFirstStyle {footnote} {note}
{ }
-\DeclareInstance {acro-first}
- { sidenote }
- { note }
+
+\DeclareAcroFirstStyle {footnote-reversed} {note}
+ { reversed = true }
+
+\DeclareAcroFirstStyle {sidenote} {note}
{ note-command = \sidenote {#1} }
-\DeclareInstance {acro-first}
- { empty }
- { note }
- { use-note = false }
-\DeclareInstance {acro-first}
- { short }
- { inline }
+
+\DeclareAcroFirstStyle {sidenote-reversed} {note}
{
- only-short = true ,
- brackets = false
+ note-command = \sidenote {#1} ,
+ reversed = true
}
-\DeclareInstance {acro-first}
- { long }
- { inline }
- {
- only-long = true ,
- brackets = false
- }
-\DeclareInstance {acro-first}
- { reversed }
- { inline }
- { reversed = true }
+\DeclareAcroFirstStyle {empty} {note}
+ { use-note = false }
+
% --------------------------------------------------------------------------
% formatting the extras information:
\DeclareObjectType {acro-extra} {1}
-\DeclareTemplateInterface {acro-extra} {default} {1}
+\DeclareTemplateInterface {acro-extra} {inline} {1}
{
punct : boolean = false ,
punct-symbol : tokenlist = {,} ,
@@ -819,7 +1008,7 @@
brackets-type : tokenlist = ()
}
-\DeclareTemplateCode {acro-extra} {default} {1}
+\DeclareTemplateCode {acro-extra} {inline} {1}
{
punct = \l__acro_extra_punct_bool ,
punct-symbol = \l__acro_extra_punct_tl ,
@@ -837,23 +1026,87 @@
{ \tl_tail:N \l__acro_extra_brackets_tl }
}
+% declare new extra styles:
+\cs_new_protected:Npn \acro_declare_etxra_style:nnn #1#2#3
+ {
+ \DeclareInstance {acro-etxra} {#1} {#2} {#3}
+ \prop_put:Nnn \l__acro_etxra_styles_prop {#1} {#2}
+ }
+
+% #1: name
+% #2: template
+% #3: settings
+\NewDocumentCommand \DeclareAcroExtraStyle {mmm}
+ { \acro_declare_extra_style:nnn {#1} {#2} {#3} }
+
+% set an extra style
+\cs_new_protected:Npn \acro_set_extra_style:n #1
+ {
+ \prop_if_in:NnTF \l__acro_extra_styles_prop {#1}
+ { \__acro_set_extra_style:n {#1} }
+ {
+ \msg_warning:nnnnn {acro} {unknown}
+ {extra~ style}
+ {#1}
+ {default}
+ \__acro_set_extra_style:n {default}
+ }
+ }
+
+\cs_new_protected:Npn \__acro_set_extra_style:n #1
+ {
+ \tl_set:Nn \l__acro_extra_instance_tl {#1}
+ \prop_get:NnN \l__acro_extra_styles_prop {#1} \l__acro_tmpa_tl
+ }
+
+\cs_new_protected:Npn \acro_declare_extra_style:nnn #1#2#3
+ {
+ \DeclareInstance {acro-extra} {#1} {#2} {#3}
+ \prop_put:Nnn \l__acro_extra_styles_prop {#1} {#2}
+ }
+
% the different styles:
-\DeclareInstance {acro-extra} {default} {default}
- { brackets = false , punct = true , punct-symbol = . }
-\DeclareInstance {acro-extra} {plain} {default}
- { brackets = false , punct = true , punct-symbol = }
-\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 }
+\DeclareAcroExtraStyle {default} {inline}
+ {
+ brackets = false ,
+ punct = true ,
+ punct-symbol = .
+ }
+\DeclareAcroExtraStyle {plain} {inline}
+ {
+ brackets = false ,
+ punct = true ,
+ punct-symbol =
+ }
+
+\DeclareAcroExtraStyle {paren} {inline}
+ {
+ brackets = true ,
+ punct = true ,
+ punct-symbol =
+ }
+
+\DeclareAcroExtraStyle {bracket} {inline}
+ {
+ brackets = true ,
+ punct = true ,
+ punct-symbol = ,
+ brackets-type = []
+ }
+
+\DeclareAcroExtraStyle {comma} {inline}
+ {
+ punct = true,
+ punct-symbol = {,} ,
+ brackets = false
+ }
+
% --------------------------------------------------------------------------
% outputting the page numbers:
\RequirePackage {zref-abspage}
-\cs_new_protected:Npn \acro_create_page_records:n #1
+\cs_new_protected:Npn \__acro_create_page_records:n #1
{
\seq_new:c { g__acro_#1_pages_seq }
\tl_new:c { g__acro_#1_recorded_pages_tl }
@@ -1019,7 +1272,7 @@
% --------------------------------------------------------------------------
\DeclareObjectType {acro-page-number} {1}
-\DeclareTemplateInterface {acro-page-number} {default} {1}
+\DeclareTemplateInterface {acro-page-number} {inline} {1}
{
display : boolean = true ,
punct : boolean = false ,
@@ -1026,10 +1279,10 @@
punct-symbol : tokenlist = {,} ,
brackets : boolean = false ,
brackets-type : tokenlist = () ,
- space : length = .333em
+ space : skip = .333333em plus .166666em minus .111111em
}
-\DeclareTemplateCode {acro-page-number} {default} {1}
+\DeclareTemplateCode {acro-page-number} {inline} {1}
{
display = \l__acro_page_display_bool ,
punct = \l__acro_page_punct_bool ,
@@ -1036,7 +1289,7 @@
punct-symbol = \l__acro_page_punct_tl ,
brackets = \l__acro_page_brackets_bool ,
brackets-type = \l__acro_page_brackets_tl ,
- space = \l__acro_page_space_dim
+ space = \l__acro_page_space_skip
}
{
\AssignTemplateKeys
@@ -1045,8 +1298,8 @@
\bool_if:NT \l__acro_page_punct_bool
{ \tl_use:N \l__acro_page_punct_tl }
% \tl_use:N \c_space_tl
- \dim_compare:nNnF { \l__acro_page_space_dim } = { 0pt }
- { \skip_horizontal:N \l__acro_page_space_dim }
+ \dim_compare:nNnF { \l__acro_page_space_skip } = { 0pt }
+ { \skip_horizontal:N \l__acro_page_space_skip }
\bool_if:NT \l__acro_page_brackets_bool
{ \tl_head:N \l__acro_page_brackets_tl }
\acro_print_page_numbers:n {#1}
@@ -1055,16 +1308,59 @@
}
}
+% declare new page styles:
+\cs_new_protected:Npn \acro_declare_page_style:nnn #1#2#3
+ {
+ \DeclareInstance {acro-page-number} {#1} {#2} {#3}
+ \prop_put:Nnn \l__acro_page_styles_prop {#1} {#2}
+ }
+
+% #1: name
+% #2: template
+% #3: settings
+\NewDocumentCommand \DeclareAcroPageStyle {mmm}
+ { \acro_declare_page_style:nnn {#1} {#2} {#3} }
+
+% set a page style
+\cs_new_protected:Npn \acro_set_page_style:n #1
+ {
+ \prop_if_in:NnTF \l__acro_page_styles_prop {#1}
+ { \__acro_set_page_style:n {#1} }
+ {
+ \msg_warning:nnnnn {acro} {unknown}
+ {page~ style}
+ {#1}
+ {none}
+ \__acro_set_page_style:n {none}
+ }
+ }
+
+\cs_new_protected:Npn \__acro_set_page_style:n #1
+ {
+ \tl_set:Nn \l__acro_page_instance_tl {#1}
+ \prop_get:NnN \l__acro_page_styles_prop {#1} \l__acro_tmpa_tl
+ }
+
% the different styles:
-\DeclareInstance {acro-page-number} {default} {default}
- { punct = true , punct-symbol = . }
-\DeclareInstance {acro-page-number} {plain} {default}
+\DeclareAcroPageStyle {default} {inline}
+ {
+ punct = true ,
+ punct-symbol = .
+ }
+
+\DeclareAcroPageStyle {plain} {inline}
{ punct = false }
-\DeclareInstance {acro-page-number} {comma} {default}
+
+\DeclareAcroPageStyle {comma} {inline}
{ punct = true }
-\DeclareInstance {acro-page-number} {paren} {default}
- { brackets=true , punct-symbol = ~ }
-\DeclareInstance {acro-page-number} {none} {default}
+
+\DeclareAcroPageStyle {paren} {inline}
+ {
+ brackets=true ,
+ punct-symbol = ~
+ }
+
+\DeclareAcroPageStyle {none} {inline}
{ display = false }
% --------------------------------------------------------------------------
@@ -1083,8 +1379,31 @@
\acro_list_title_format:n {#1}
}
+% set a list heading:
+\cs_new_protected:Npn \acro_set_list_heading:n #1
+ {
+ \prop_if_in:NnTF \l__acro_list_headings_prop {#1}
+ { \__acro_set_list_heading:n {#1} }
+ {
+ \msg_warning:nnnnn {acro} {unknown}
+ {list~ heading}
+ {#1}
+ {section*}
+ \__acro_set_list_heading:n {section*}
+ }
+ }
+
+\cs_new_protected:Npn \__acro_set_list_heading:n #1
+ {
+ \tl_set:Nn \l__acro_list_heading_cmd_tl {#1}
+ % \prop_get:NnN \l__acro_list_headings_prop
+ % {#1}
+ % \l__acro_list_heading_cmd_tl
+ }
+
\cs_new_protected:Npn \acro_declare_list_heading:nn #1#2
{
+ \prop_put:Nnn \l__acro_list_headings_prop {#1} {#2}
\DeclareInstance {acro-title} {#1} {sectioning}
{ name-format = #2 {##1} }
}
@@ -1093,19 +1412,19 @@
{ \acro_declare_list_heading:nn {#1} {#2} }
% the different styles:
-\acro_declare_list_heading:nn {part} {\part}
-\acro_declare_list_heading:nn {part*} {\part*}
-\acro_declare_list_heading:nn {chapter} {\chapter}
-\acro_declare_list_heading:nn {chapter*} {\chapter*}
-\acro_declare_list_heading:nn {addchap} {\addchap}
-\acro_declare_list_heading:nn {section} {\section}
-\acro_declare_list_heading:nn {section*} {\section*}
-\acro_declare_list_heading:nn {addsec} {\addsec}
-\acro_declare_list_heading:nn {subsection} {\subsection}
-\acro_declare_list_heading:nn {subsection*} {\subsection*}
-\acro_declare_list_heading:nn {subsubsection} {\subsubsection}
-\acro_declare_list_heading:nn {subsubsection*} {\subsubsection*}
-\acro_declare_list_heading:nn {none} {\use_none:n}
+\DeclareAcroListHeading {part} {\part}
+\DeclareAcroListHeading {part*} {\part*}
+\DeclareAcroListHeading {chapter} {\chapter}
+\DeclareAcroListHeading {chapter*} {\chapter*}
+\DeclareAcroListHeading {addchap} {\addchap}
+\DeclareAcroListHeading {section} {\section}
+\DeclareAcroListHeading {section*} {\section*}
+\DeclareAcroListHeading {addsec} {\addsec}
+\DeclareAcroListHeading {subsection} {\subsection}
+\DeclareAcroListHeading {subsection*} {\subsection*}
+\DeclareAcroListHeading {subsubsection} {\subsubsection}
+\DeclareAcroListHeading {subsubsection*} {\subsubsection*}
+\DeclareAcroListHeading {none} {\use_none:n}
% --------------------------------------------------------------------------
% typesetting the acronym list
@@ -1155,19 +1474,9 @@
{ \prg_return_true: }
{ \prg_return_false: }
}
-
-% build the list: default functions, may be redefined in the template code
-\cs_new_protected:Npn \acro_print_list_short:nn #1#2
- { \acro_list_short_entry:nn {#1} {#2} }
-\cs_new_protected:Npn \acro_print_list_long:n #1
- { \acro_list_long_entry:n {#1} }
-\cs_new_protected:Npn \acro_print_list_extra:n #1
- { \acro_list_extra_entry:n {#1} }
-\cs_new_protected:Npn \acro_print_list_page:n #1
- { \acro_list_page_entry:n {#1} }
-% macros for standard retrieval of items in the list:
-\cs_new_protected:Npn \acro_list_short_entry:nn #1#2
+% #1: id
+\cs_new_protected:Npn \__acro_list_entry_short:n #1
{
\acro_hyper_target:nn
{#1}
@@ -1174,11 +1483,18 @@
{
\acro_acc_supp:nn
{#1}
- { \acro_write_short:nn {#1} { \l__acro_list_short_format_tl {#2} } }
+ {
+ \acro_write_short:nn {#1}
+ {
+ \l__acro_list_short_format_tl
+ { \acro_get_property:nn {short} {#1} }
+ }
+ }
}
}
-\cs_set_protected:Npn \acro_list_long_entry:n #1
+% #1: id
+\cs_new_protected:Npn \__acro_list_entry_long:n #1
{
\group_begin:
\bool_if:NT \l__acro_capitalize_list_bool
@@ -1186,8 +1502,8 @@
\acro_write_long:Vf \l__acro_list_long_format_tl
{
\prop_if_in:NnTF \l__acro_list_prop {#1}
- { \prop_item:Nn \l__acro_list_prop {#1} }
- { \prop_item:Nn \l__acro_long_prop {#1} }
+ { \acro_get_property:nn {list} {#1} }
+ { \acro_get_property:nn {long} {#1} }
}
\group_end:
\bool_if:NT \l__acro_foreign_bool
@@ -1195,7 +1511,8 @@
\acro_cite_if:nn { \l__acro_citation_all_bool } {#1}
}
-\cs_set_protected:Npn \acro_list_extra_entry:n #1
+% #1: id
+\cs_new_protected:Npn \__acro_list_entry_extra:n #1
{
\prop_get:NnNT \l__acro_extra_prop {#1} \l__acro_tmpa_tl
{
@@ -1205,7 +1522,8 @@
}
}
-\cs_set_protected:Npn \acro_list_page_entry:n #1
+% #1: id
+\cs_new_protected:Npn \__acro_list_entry_page:n #1
{
\bool_if:nT { \cs_if_exist_p:c { acro@#1 at once } }
{
@@ -1214,8 +1532,28 @@
{#1}
}
}
+
+% macro for retrieval of items in the list:
+% #1: property
+% #2: id
+\cs_new_protected:Npn \acro_list_entry:nn #1#2
+ {
+ \str_case:nnF {#1}
+ {
+ {short} { \__acro_list_entry_short:n {#2} }
+ {long} { \__acro_list_entry_long:n {#2} }
+ {extra} { \__acro_list_entry_extra:n {#2} }
+ {page} { \__acro_list_entry_page:n {#2} }
+ }
+ { \acro_get_property:nn {#1} {#2} }
+ }
-% this macro may be redefined in templates:
+% #1: property
+% #2: id
+\cs_new:Npn \acro_get_property:nn #1#2
+ { \prop_item:cn {l__acro_#1_prop} {#2} }
+
+% this macro may/should be redefined in templates:
% #1: short
% #2: long
% #3: extra
@@ -1225,10 +1563,54 @@
\cs_new_protected:Npn \acro_for_all_acronyms_do:n #1
{ \prop_map_inline:Nn \l__acro_short_prop {#1} }
-
+
% test, if acronyms should be printed or not; needs testing for in/excluded
% classes and options `only-used' and `single' -- this macro should be used in
% the template code for retrieving the list
+
+% #1: id
+% #2: included classes
+% #3: excluded classes
+\prg_new_protected_conditional:Npnn \acro_if_entry:nnn #1#2#3 {T,F,TF}
+ {
+ \bool_if:nTF
+ {
+ \bool_if_p:c { g__acro_#1_in_list_bool } &&
+ (
+ ( \l__acro_use_single_bool && \cs_if_exist_p:c { acro@#1 at twice } )
+ ||
+ (
+ !\l__acro_use_single_bool &&
+ \cs_if_exist_p:c { acro@#1 at once } &&
+ \l__acro_print_only_used_bool
+ )
+ )
+ ||
+ ( !\l__acro_use_single_bool && !\l__acro_print_only_used_bool )
+ }
+ {
+ \acro_if_is_excluded:nnTF {#1} {#3}
+ { \prg_return_false: }
+ {
+ \acro_if_is_included:nnTF {#1} {#2}
+ {
+ \bool_if:nTF
+ { \g__acro_use_barriers_bool && \l__acro_use_barrier_bool }
+ {
+ \acro_if_in_barrier:nxTF {#1}
+ { \int_use:N \g__acro_barrier_int }
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ { \prg_return_true: }
+ }
+ { \prg_return_false: }
+ }
+ }
+ { \prg_return_false: }
+ }
+
+% this macro is used in templates for fetching all items to be printed:
%
% #1: included classes
% #2: excluded classes
@@ -1235,53 +1617,19 @@
\cs_new_protected:Npn \acro_list_items:nn #1#2
{
\acro_for_all_acronyms_do:n
- {
+ {% ##1: id; ##2: short form
\acro_get:n {##1}
- \bool_if:nT
+ \acro_if_entry:nnnT {##1} {#1} {#2}
{
- \bool_if_p:c { g__acro_##1_in_list_bool } &&
- (
- ( \l__acro_use_single_bool && \cs_if_exist_p:c { acro@##1 at twice } )
- ||
- (
- !\l__acro_use_single_bool &&
- \cs_if_exist_p:c { acro@##1 at once } &&
- \l__acro_print_only_used_bool
- )
- )
- ||
- ( !\l__acro_use_single_bool && !\l__acro_print_only_used_bool )
+ \acro_print_list_entry:nnnn
+ { \acro_list_entry:nn {short} {##1} }
+ { \acro_list_entry:nn {long} {##1} }
+ { \acro_list_entry:nn {extra} {##1} }
+ { \acro_list_entry:nn {page} {##1} }
}
- {
- \acro_if_is_excluded:nnF {##1} {#2}
- {
- \acro_if_is_included:nnT {##1} {#1}
- { % TODO: avoid code duplication
- \bool_if:NTF \l__acro_use_barrier_bool
- {
- \acro_if_in_barrier:nxT {##1}
- { \int_use:N \g__acro_barrier_int }
- {
- \acro_print_list_entry:nnnn
- { \acro_print_list_short:nn {##1} {##2} }
- { \acro_print_list_long:n {##1} }
- { \acro_print_list_extra:n {##1} }
- { \acro_print_list_page:n {##1} }
- }
- }
- {
- \acro_print_list_entry:nnnn
- { \acro_print_list_short:nn {##1} {##2} }
- { \acro_print_list_long:n {##1} }
- { \acro_print_list_extra:n {##1} }
- { \acro_print_list_page:n {##1} }
- }
- }
- }
- }
}
}
-
+
% --------------------------------------------------------------------------
% declare templates for the list:
% `list' template:
@@ -1520,7 +1868,10 @@
\prop_if_in:NnTF \l__acro_list_styles_prop {#1}
{ \__acro_set_list_style:n {#1} }
{
- \msg_warning:nnnn {acro} {unknown-list-style} {#1} {description}
+ \msg_warning:nnnnn {acro} {unknown}
+ {list~ style}
+ {#1}
+ {description}
\__acro_set_list_style:n {description}
}
}
@@ -1593,14 +1944,12 @@
\l__acro_first_instance_tl
\l__acro_first_style_tl
}
- \acro_first_instance:VnVV
+ \acro_first_instance:VnV
\l__acro_first_instance_tl
{#1}
- \l__acro_short_tl
\l__acro_long_tl
}
}
- \acro_record_barrier:n {#1}
}
% single appearances:
@@ -1646,10 +1995,9 @@
}
\tl_if_blank:VT \l__acro_single_tl
{ \tl_set_eq:NN \l__acro_single_tl \l__acro_long_tl }
- \acro_first_instance:VnVV
+ \acro_first_instance:VnV
\l__acro_first_instance_tl
{#1}
- \l__acro_short_tl
\l__acro_single_tl
}
}
@@ -1765,14 +2113,19 @@
\bool_new:N \l__acro_use_ending_form_bool
+% this does nothing if a non-existent ending (#1) or non-existent form (#3) is
+% input
% #1: ending
% #2: id
% #3: short|alt|long
\cs_new_protected:Npn \__acro_set_ending_for:nnn #1#2#3
{
- \bool_if:nTF { \prop_item:cn {l__acro_#3_#1_form_prop} {#2} }
- { \prop_get:cnc {l__acro_#3_#1_prop} {#2} {l__acro_#3_tl} }
- { \prop_get:cnc {l__acro_#3_#1_prop} {#2} {l__acro_#3_#1_tl} }
+ \acro_if_ending_form_exist:nnT {#1} {#3}
+ {
+ \bool_if:nTF { \prop_item:cn {l__acro_#3_#1_form_prop} {#2} }
+ { \prop_get:cnc {l__acro_#3_#1_prop} {#2} {l__acro_#3_tl} }
+ { \prop_get:cnc {l__acro_#3_#1_prop} {#2} {l__acro_#3_#1_tl} }
+ }
}
\cs_new_protected:Npn \__acro_set_endings:n #1
@@ -1781,20 +2134,27 @@
{ \__acro_set_ending:nn {##1} {#1} }
}
+% #1: id
+% #2: short|alt|…
\cs_new_protected:Npn \acro_get_ending_form:nn #1#2
{
\acro_for_endings_do:n
{
- \bool_if:nT
+ \acro_if_ending_form_exist:nnT {##1} {#2}
{
- \prop_item:cn {l__acro_#2_##1_form_prop} {#1}
- &&
- \use:c {l__acro_##1_bool}
+ \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} {} }
}
- { \prop_get:cncF {l__acro_#2_##1_prop} {#1} {l__acro_#2_tl} {} }
}
}
+% #1: id
+% #2: short|alt|…
\cs_new_protected:Npn \acro_endings:nn #1#2
{
\group_begin:
@@ -1822,6 +2182,15 @@
{ \prg_return_true: }
{ \prg_return_false: }
}
+
+% #1: ending
+% #2: short|alt|…
+\prg_new_conditional:Npnn \acro_if_ending_form_exist:nn #1#2 {p,T,F,TF}
+ {
+ \cs_if_exist:cTF {l__acro_#2_#1_prop}
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
% #1: name
% #2: default short
@@ -1857,7 +2226,7 @@
{ \bool_set_true:c {l__acro_#1_bool} }
% acronym properties:
% short-<ending>:
- \acro_declare_key:nnn {short_#1} {short-#1}
+ \__acro_declare_property:nnn {short_#1} {short-#1}
{
\prop_put:cnn {l__acro_short_#1_form_prop} {##1} { \c_false_bool }
\prop_put:cnx {l__acro_pdfstring_short_#1_prop}
@@ -1864,15 +2233,15 @@
{##1} { \prop_item:Nn \l__acro_short_prop {##1} \exp_not:n {##2} }
}
% short-<ending>-form:
- \acro_declare_key_generic:nnn {short_#1_form} {short-#1-form}
+ \__acro_declare_property_generic:nnn {short_#1_form} {short-#1-form}
{
- \__acro_key_check:nn {##1} {short-#1-form}
+ \__acro_property_check:nn {##1} {short-#1-form}
\prop_put:cnn {l__acro_short_#1_form_prop} {##1} { \c_true_bool }
\prop_put:cnn {l__acro_short_#1_prop} {##1} {##2}
\prop_put:cnn {l__acro_pdfstring_short_#1_prop} {##1} {##2}
}
% alt-<ending>:
- \acro_declare_key:nnn {alt_#1} {alt-#1}
+ \__acro_declare_property:nnn {alt_#1} {alt-#1}
{
\prop_put:cnn {l__acro_alt_#1_form_prop} {##1} { \c_false_bool }
\prop_put:cnx {l__acro_pdfstring_alt_#1_prop}
@@ -1879,20 +2248,20 @@
{##1} { \prop_item:Nn \l__acro_alt_prop {##1} \exp_not:n {##2} }
}
% alt-<ending>-form:
- \acro_declare_key_generic:nnn {alt_#1_form} {alt-#1-form}
+ \__acro_declare_property_generic:nnn {alt_#1_form} {alt-#1-form}
{
- \__acro_key_check:nn {##1} {alt-#1-form}
+ \__acro_property_check:nn {##1} {alt-#1-form}
\prop_put:cnn {l__acro_alt_#1_form_prop} {##1} { \c_true_bool }
\prop_put:cnn {l__acro_alt_#1_prop} {##1} {##2}
\prop_put:cnn {l__acro_pdfstring_alt_#1_prop} {##1} {##2}
}
% long-<ending>:
- \acro_declare_key:nnn {long_#1} {long-#1}
+ \__acro_declare_property:nnn {long_#1} {long-#1}
{ \prop_put:cnn {l__acro_long_#1_form_prop} {##1} { \c_false_bool } }
% long-<ending>-form:
- \acro_declare_key_generic:nnn {long_#1_form} {long-#1-form}
+ \__acro_declare_property_generic:nnn {long_#1_form} {long-#1-form}
{
- \__acro_key_check:nn {##1} {long-#1-form}
+ \__acro_property_check:nn {##1} {long-#1-form}
\prop_put:cnn {l__acro_long_#1_form_prop} {##1} { \c_true_bool }
\prop_put:cnn {l__acro_long_#1_prop} {##1} {##2}
}
@@ -1903,11 +2272,22 @@
% <ending>-ending
\keys_define:nn {acro}
{
- short-#1-ending .tl_set:c = {l__acro_default_short_#1_tl} ,
- alt-#1-ending .tl_set:c = {l__acro_default_alt_#1_tl} ,
- long-#1-ending .tl_set:c = {l__acro_default_long_#1_tl} ,
+ short-#1-ending .code:n =
+ \bool_if:NT \g__acro_first_acronym_declared_bool
+ { \acro_serious_message:n {ending-before-acronyms} }
+ \tl_set:cn {l__acro_default_short_#1_tl} {##1} ,
+ alt-#1-ending .code:n =
+ \bool_if:NT \g__acro_first_acronym_declared_bool
+ { \acro_serious_message:n {ending-before-acronyms} }
+ \tl_set:cn {l__acro_default_alt_#1_tl} {##1} ,
+ long-#1-ending .code:n =
+ \bool_if:NT \g__acro_first_acronym_declared_bool
+ { \acro_serious_message:n {ending-before-acronyms} }
+ \tl_set:cn {l__acro_default_long_#1_tl} {##1},
#1-ending .code:n =
- { \__acro_read_ending_settings:nww {#1} ##1// \acro_stop: }
+ \bool_if:NT \g__acro_first_acronym_declared_bool
+ { \acro_serious_message:n {ending-before-acronyms} }
+ \__acro_read_ending_settings:nww {#1} ##1// \acro_stop:
}
% pdfstrings:
\prop_new:c {l__acro_pdfstring_short_#1_prop}
@@ -1974,6 +2354,7 @@
% style for that:
\prg_new_protected_conditional:Npnn \acro_is_used:n #1 { T,F,TF }
{
+ \acro_record_barrier:n {#1}
\bool_if:nTF
{
\bool_if_p:c { g__acro_#1_used_bool } &&
@@ -1989,19 +2370,19 @@
{
\bool_if:NTF \l__acro_mark_as_used_bool
{
- \__acro_aux_file:Nnnnn \acro at used@twice
+ \__acro_aux_file:Nxxxx \acro at used@twice
{#1}
{ \thepage }
{ \arabic {page} }
{ \arabic {abspage} }
}
- { \__acro_aux_file:Nnnnn \acro at used@twice {#1} {} {} {} }
+ { \__acro_aux_file:Nxxxx \acro at used@twice {#1} {} {} {} }
\prg_return_true:
}
{
\bool_if:NTF \l__acro_mark_as_used_bool
{
- \__acro_aux_file:Nnnnn \acro at used@once
+ \__acro_aux_file:Nxxxx \acro at used@once
{#1}
{ \thepage }
{ \arabic {page} }
@@ -2017,7 +2398,7 @@
}
\bool_gset_true:c { g__acro_#1_used_bool }
}
- { \__acro_aux_file:Nnnnn \acro at used@once {#1} {} {} {} }
+ { \__acro_aux_file:Nxxxx \acro at used@once {#1} {} {} {} }
\prg_return_false:
}
}
@@ -2026,16 +2407,13 @@
{ \acro_is_used:nTF {#1} { } { } }
\cs_new_protected:Npn \__acro_aux_file:Nnnnn #1#2#3#4#5
- {
- % \if at filesw
- \iow_shipout_x:Nn \@auxout
- { \token_to_str:N #1 {#2} {#3} {#4} {#5} }
- % \fi
- }
+ { \iow_shipout:Nn \@auxout { #1 {#2} {#3} {#4} {#5} } }
+\cs_generate_variant:Nn \__acro_aux_file:Nnnnn { Nxxxx }
+
+\cs_new_protected:Npn \__acro_aux_file_now:n #1
+ { \iow_now:Nn \@auxout {#1} }
+\cs_generate_variant:Nn \__acro_aux_file_now:n { x }
-\cs_new_protected:Npn \__acro_aux_file:n #1
- { \iow_shipout_x:Nn \@auxout {#1} }
-
% --------------------------------------------------------------------------
% the commands for the auxiliary file:
\cs_new_protected:Npn \acro at used@once #1#2#3#4
@@ -2085,19 +2463,17 @@
{
\seq_if_empty:cF {g__acro_#1_pages_seq}
{
- \if at filesw
- \__acro_aux_file:n
- {
- \token_to_str:N \acro at pages {#1}
- { \seq_use:cn {g__acro_#1_pages_seq} {|} } ^^J
- \token_to_str:N \acro at barriers {#1}
- { \seq_use:cn {g__acro_#1_barriers_seq} {,} }
- }
- \fi
+ \__acro_aux_file_now:x
+ {
+ \token_to_str:N \acro at pages {#1}
+ { \seq_use:cn {g__acro_#1_pages_seq} {|} } ^^J
+ \token_to_str:N \acro at barriers {#1}
+ { \seq_use:cn {g__acro_#1_barriers_seq} {,} }
+ }
}
\acro_check_barriers:n {#1}
}
- \__acro_aux_file:n { \acro at rerun@check }
+ \__acro_aux_file_now:n { \acro at rerun@check }
}
% if `acro' is deactivated prevent unnecessary errors from aux file:
@@ -2104,14 +2480,14 @@
\if at filesw
\AtBeginDocument
{
- \__acro_aux_file:n
+ \__acro_aux_file_now:n
{
- \token_to_str:N \providecommand \token_to_str:N \acro at used@once [4] {} ^^J
- \token_to_str:N \providecommand \token_to_str:N \acro at used@twice [4] {} ^^J
- \token_to_str:N \providecommand \token_to_str:N \acro at pages [2] {} ^^J
- \token_to_str:N \providecommand \token_to_str:N \acro at rerun@check {} ^^J
- \token_to_str:N \providecommand \token_to_str:N \acro at print@list {} ^^J
- \token_to_str:N \providecommand \token_to_str:N \acro at barriers [2] {}
+ \providecommand \acro at used@once [4] {} ^^J
+ \providecommand \acro at used@twice [4] {} ^^J
+ \providecommand \acro at pages [2] {} ^^J
+ \providecommand \acro at rerun@check {} ^^J
+ \providecommand \acro at print@list {} ^^J
+ \providecommand \acro at barriers [2] {}
}
}
\fi
@@ -2259,7 +2635,8 @@
\l__acro_long_tl
}
}
-
+
+% TODO: get rid of argument #3?
% #1: ID
% #2: long|first-long|list-long|extra
% #3: long form
@@ -2367,10 +2744,9 @@
\l__acro_first_instance_tl
\l__acro_first_style_tl
}
- \acro_first_instance:VnVV
+ \acro_first_instance:VnV
\l__acro_first_instance_tl
{#1}
- \l__acro_short_tl
\l__acro_long_tl
}
@@ -2384,10 +2760,9 @@
\acro_is_used:n {#1}
\acro_if_is_single:nT {#1}
{ \cs_set_eq:NN \acro_hyper_link:nn \use_ii:nn }
- \acro_first_instance:VnVn
+ \acro_first_instance:Vnn
\l__acro_first_instance_tl
{#1}
- \l__acro_short_tl
{#2}
}
@@ -2788,10 +3163,8 @@
\bool_gset_true:c { g__acro_#1_first_use_bool }
\bool_gset_true:c { g__acro_#1_in_list_bool }
\if at filesw
- \__acro_aux_file:n
- { \token_to_str:N \acro at used@once {#1} {} {} {} }
- \__acro_aux_file:n
- { \token_to_str:N \acro at used@twice {#1} {} {} {} }
+ \__acro_aux_file_now:n { \acro at used@once {#1} {} {} {} }
+ \__acro_aux_file_now:n { \acro at used@twice {#1} {} {} {} }
\fi
}
@@ -2831,13 +3204,17 @@
% acronym barriers: allow local lists of only those acronyms used between two
% barriers
-\int_new:N \g__acro_barrier_int
+\int_new:N \g__acro_barrier_int
+\bool_new:N \g__acro_use_barriers_bool
\bool_new:N \g__acro_reset_at_barrier_bool
\bool_new:N \l__acro_use_barrier_bool
\keys_define:nn {acro}
{
- reset-at-barriers .bool_gset:N = \g__acro_reset_at_barrier_bool
+ use-barriers .bool_gset:N = \g__acro_use_barriers_bool ,
+ use-barriers .initial:n = false ,
+ reset-at-barriers .bool_gset:N = \g__acro_reset_at_barrier_bool ,
+ reset-at-barriers .initial:n = false
}
\cs_new_protected:Npn \acro_barrier:
@@ -2852,36 +3229,42 @@
\cs_new_protected:Npn \acro_check_barriers:n #1
{
- \tl_set:Nx \l__acro_tmpa_tl
- { \seq_use:cn {g__acro_#1_barriers_seq} {} }
- \tl_set:Nx \l__acro_tmpb_tl
- { \seq_use:cn {g__acro_#1_recorded_barriers_seq} {} }
- \tl_if_eq:NNF \l__acro_tmpa_tl \l__acro_tmpb_tl
+ \bool_if:NT \g__acro_use_barriers_bool
{
- \@latex at warning@no at line
- {Rerun~to~get~barriers~of~acronym~#1~right}
+ \tl_set:Nx \l__acro_tmpa_tl
+ { \seq_use:cn {g__acro_#1_barriers_seq} {} }
+ \tl_set:Nx \l__acro_tmpb_tl
+ { \seq_use:cn {g__acro_#1_recorded_barriers_seq} {} }
+ \tl_if_eq:NNF \l__acro_tmpa_tl \l__acro_tmpb_tl
+ {
+ \@latex at warning@no at line
+ {Rerun~to~get~barriers~of~acronym~#1~right}
+ }
}
}
\cs_new_protected:Npn \acro_record_barrier:n #1
{
- \seq_if_in:cxF {g__acro_#1_barriers_seq}
- { \int_use:N \g__acro_barrier_int }
+ \bool_if:NT \g__acro_use_barriers_bool
{
- \seq_gput_right:cx {g__acro_#1_barriers_seq}
+ \seq_if_in:cxF {g__acro_#1_barriers_seq}
{ \int_use:N \g__acro_barrier_int }
+ {
+ \seq_gput_right:cx {g__acro_#1_barriers_seq}
+ { \int_use:N \g__acro_barrier_int }
+ }
}
}
% #1: id
% #2: barrier number
-\prg_new_conditional:Npnn \acro_if_in_barrier:nn #1#2 {T,F,TF}
+\prg_new_protected_conditional:Npnn \acro_if_in_barrier:nn #1#2 {T,F,TF}
{
\seq_if_in:cnTF {g__acro_#1_recorded_barriers_seq} {#2}
{ \prg_return_true: }
{ \prg_return_false: }
}
-\cs_generate_variant:Nn \acro_if_in_barrier:nnT {nx}
+\cs_generate_variant:Nn \acro_if_in_barrier:nnTF {nx}
\cs_new:Npn \acro at barriers #1#2
{ \seq_gset_split:cnn {g__acro_#1_recorded_barriers_seq} {,} {#2} }
@@ -2911,6 +3294,7 @@
{
\bool_set_false:N \l__acro_indefinite_bool
\bool_set_false:N \l__acro_first_upper_bool
+ \bool_set_false:N \l__acro_upper_indefinite_bool
% \bool_set_false:N \l__acro_citation_all_bool
% \bool_set_false:N \l__acro_citation_first_bool
\bool_set_false:N \l__acro_addto_index_bool
@@ -3287,33 +3671,36 @@
% --------------------------------------------------------------------------
% additional variables:
-\tl_new:N \l__acro_current_key_tl
+\tl_new:N \l__acro_current_property_tl
% --------------------------------------------------------------------------
% key and order checking
\msg_new:nnn {acro} {no-id}
- { Something~has~gone~wrong,~you've~probably~forgotten~to~set~the~acronym~ID. }
+ {
+ Something~ has~ gone~ wrong,~ you've~ probably~ forgotten~ to~ set~ the~
+ acronym~ ID.
+ }
\msg_new:nnn {acro} {before-short}
{
- You've~set~The~key~`#2'~before~the~`short'~key~for~acronym~`#1'~but~
- needs~to~be~set~after~it.
+ You've~ set~ the~ property~ `#2'~ before~ the~ `short'~ property~ for~
+ acronym~ `#1'~ but~ it~ needs~ to~ be~ set~ after~ it.
}
\msg_new:nnn {acro} {missing}
- { The~`#2'~key~for~acronym~`#1'~is~missing. }
+ { The~ `#2'~ property~ for~ acronym~ `#1'~ is~ missing. }
-\msg_new:nnn {acro} {doubled-key}
+\msg_new:nnn {acro} {doubled-property}
{
- It~ seems~ to~ me~ you~ have~ used~ the~ `#2'~ key~ twice~ in~ the~
+ It~ seems~ to~ me~ you~ have~ used~ the~ `#2'~ property~ twice~ in~ the~
declaration~ of~ acronym~ `#1'.~ If~ you~ haven't~ there's~
something~ different~ wrong~ and~ I'm~ lost.~ You~'re~ on~ your~ own~
then.
}
-\cs_new_protected:Npn \__acro_key_check:nn #1#2
+\cs_new_protected:Npn \__acro_property_check:nn #1#2
{
- \tl_if_blank:VT \l__acro_current_key_tl
+ \tl_if_blank:VT \l__acro_current_property_tl
{ \acro_serious_message:n {no-id} }
\bool_if:cF { l__acro_#1_short_set_bool }
{
@@ -3324,12 +3711,12 @@
\bool_set_true:c { l__acro_#1_#2_set_bool }
}
-\cs_new_protected:Npn \__acro_first_key_check:nn #1#2
+\cs_new_protected:Npn \__acro_first_property_check:nn #1#2
{
\cs_if_exist:cTF { l__acro_#1_short_set_bool }
{
\bool_if:cT { l__acro_#1_short_set_bool }
- { \acro_serious_message:nnn {doubled-key} {#1} {#2} }
+ { \acro_serious_message:nnn {doubled-property} {#1} {#2} }
}
{
\bool_new:c { l__acro_#1_short_set_bool }
@@ -3338,12 +3725,12 @@
}
% --------------------------------------------------------------------------
-% the internal key selection functions for \DeclareAcronym:
+% the internal property selection functions for \DeclareAcronym:
% #1: name in associated cs
-% #2: key name
+% #2: property name
% #3: action
-\cs_new_protected:Npn \acro_declare_key_generic:nnn #1#2#3
+\cs_new_protected:Npn \__acro_declare_property_generic:nnn #1#2#3
{
\prop_clear_new:c { l__acro_#1_prop }
\cs_new_protected:cpn { __acro_declare_#1:nn } ##1##2 {#3}
@@ -3351,18 +3738,18 @@
\keys_define:nn { acro / declare-acronym }
{
#2 .code:n =
- \use:c {__acro_declare_#1:Vn} \l__acro_current_key_tl {##1}
+ \use:c {__acro_declare_#1:Vn} \l__acro_current_property_tl {##1}
}
}
% #1: name in associated cs
-% #2: key name
+% #2: property name
% #3: action
-\cs_new_protected:Npn \acro_declare_key:nnn #1#2#3
+\cs_new_protected:Npn \__acro_declare_property:nnn #1#2#3
{
- \acro_declare_key_generic:nnn {#1} {#2}
+ \__acro_declare_property_generic:nnn {#1} {#2}
{
- \__acro_key_check:nn {##1} {#2}
+ \__acro_property_check:nn {##1} {#2}
\prop_put:cnn { l__acro_#1_prop } {##1} {##2}
#3
}
@@ -3369,21 +3756,21 @@
}
% #1: name in associated cs
-% #2: key name
-\cs_new_protected:Npn \acro_declare_key:nn #1#2
- { \acro_declare_key:nnn {#1} {#2} {} }
-\cs_generate_variant:Nn \acro_declare_key:nn { V }
+% #2: property name
+\cs_new_protected:Npn \__acro_declare_property:nn #1#2
+ { \__acro_declare_property:nnn {#1} {#2} {} }
+\cs_generate_variant:Nn \__acro_declare_property:nn { V }
-\cs_new_protected:Npn \acro_declare_simple_key:n #1
+\cs_new_protected:Npn \__acro_declare_simple_property:n #1
{
\tl_set:Nn \l__acro_tmpa_tl {#1}
\tl_replace_all:Nnn \l__acro_tmpa_tl {-} {_}
- \acro_declare_key:Vn \l__acro_tmpa_tl {#1}
+ \__acro_declare_property:Vn \l__acro_tmpa_tl {#1}
}
-% #1: new alias key
-% #2: old key
-\cs_new_protected:Npn \acro_declare_key_alias:nn #1#2
+% #1: new alias property
+% #2: old property
+\cs_new_protected:Npn \__acro_declare_property_alias:nn #1#2
{
\keys_define:nn { acro / declare-acronym }
{ #1 .meta:n = { #2 = {##1} } }
@@ -3390,11 +3777,11 @@
}
% --------------------------------------------------------------------------
-% declare the keys for \DeclareAcronym:
+% declare the properties for \DeclareAcronym:
% short:
-\acro_declare_key_generic:nnn {short} {short}
+\__acro_declare_property_generic:nnn {short} {short}
{
- \__acro_first_key_check:nn {#1} {short}
+ \__acro_first_property_check:nn {#1} {short}
\prop_put:Nnn \l__acro_short_prop {#1} {#2}
\prop_put:Nnn \l__acro_sort_prop {#1} {#1}
\prop_put:Nnn \l__acro_index_sort_prop {#1} {#1}
@@ -3421,7 +3808,7 @@
}
% long:
-\acro_declare_key:nnn {long} {long}
+\__acro_declare_property:nnn {long} {long}
{
\acro_for_endings_do:n
{ \prop_put:cnn {l__acro_long_##1_form_prop} {#1} { \c_false_bool } }
@@ -3435,10 +3822,10 @@
}
}
-\acro_declare_simple_key:n{first-style}
+\__acro_declare_simple_property:n {first-style}
% list:
-\acro_declare_simple_key:n {list}
+\__acro_declare_simple_property:n {list}
% defines `short-plural', `long-plural' and `long-plural-form' as well as the
% options `plural-ending', `short-plural-ending' and `long-plural-ending':
@@ -3445,19 +3832,19 @@
\ProvideAcroEnding {plural} {s} {s}
% short indefinite article:
-\acro_declare_simple_key:n {short-indefinite}
+\__acro_declare_simple_property:n {short-indefinite}
% long indefinite article:
-\acro_declare_simple_key:n {long-indefinite}
+\__acro_declare_simple_property:n {long-indefinite}
% pre long:
-\acro_declare_simple_key:n {long-pre}
+\__acro_declare_simple_property:n {long-pre}
% post long:
-\acro_declare_simple_key:n {long-post}
+\__acro_declare_simple_property:n {long-post}
% sort:
-\acro_declare_key:nnn {sort} {sort}
+\__acro_declare_property:nnn {sort} {sort}
{
\bool_if:cF { l__acro_#1_index-sort_set_bool }
{ \prop_put:Nnn \l__acro_index_sort_prop {#1} {#2} }
@@ -3464,7 +3851,7 @@
}
% alternative:
-\acro_declare_key:nnn {alt} {alt}
+\__acro_declare_property:nnn {alt} {alt}
{
\prop_put:Nnn \l__acro_pdfstring_alt_prop {#1} {#2}
\prop_put:NnV \l__acro_alt_indefinite_prop
@@ -3478,31 +3865,31 @@
}
% alt. indefinite article:
-\acro_declare_simple_key:n {alt-indefinite}
+\__acro_declare_simple_property:n {alt-indefinite}
% foreign:
-\acro_declare_simple_key:n {foreign}
+\__acro_declare_simple_property:n {foreign}
% foreign:
-\acro_declare_simple_key:n {foreign-lang}
+\__acro_declare_simple_property:n {foreign-lang}
% format:
-\acro_declare_simple_key:n {format}
+\__acro_declare_simple_property:n {format}
% short format:
-\acro_declare_key_alias:nn {short-format} {format}
+\__acro_declare_property_alias:nn {short-format} {format}
% long format:
-\acro_declare_simple_key:n {long-format}
+\__acro_declare_simple_property:n {long-format}
% first long format:
-\acro_declare_simple_key:n {first-long-format}
+\__acro_declare_simple_property:n {first-long-format}
-% pdfstring:
+% pdfstring -- currently needs to be done `by hand':
\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_property_check:nn {#1} {pdfstring}
\prop_put:Nnx \l__acro_pdfstring_short_prop {#1} {#2}
\acro_for_endings_do:n
{
@@ -3521,13 +3908,13 @@
\keys_define:nn { acro / declare-acronym }
{
pdfstring .code:n =
- \__acro_declare_pdfstring:Vw \l__acro_current_key_tl #1 // \acro_stop: ,
+ \__acro_declare_pdfstring:Vw \l__acro_current_property_tl #1 // \acro_stop: ,
}
\prop_new:N \l__acro_pdfstring_alt_prop
\cs_new_protected:Npn \__acro_declare_pdfstring_alt:nw #1#2/#3/#4 \acro_stop:
{
- \__acro_key_check:nn {#1} { pdfstring-alt }
+ \__acro_property_check:nn {#1} { pdfstring-alt }
\prop_put:Nnn \l__acro_pdfstring_alt_prop {#1} {#2}
\acro_for_endings_do:n
{
@@ -3543,36 +3930,36 @@
\keys_define:nn { acro / declare-acronym }
{
pdfstring-alt .code:n =
- \__acro_declare_pdfstring_alt:Vw \l__acro_current_key_tl #1 // \acro_stop: ,
+ \__acro_declare_pdfstring_alt:Vw \l__acro_current_property_tl #1 // \acro_stop: ,
}
% class:
-\acro_declare_simple_key:n {class}
+\__acro_declare_simple_property:n {class}
% extra information:
-\acro_declare_simple_key:n {extra}
+\__acro_declare_simple_property:n {extra}
% single appearances:
-\acro_declare_simple_key:n {single}
+\__acro_declare_simple_property:n {single}
% single format:
-\acro_declare_simple_key:n {single-format}
+\__acro_declare_simple_property:n {single-format}
% acc supp:
-\acro_declare_key:nn {acc_supp} {accsupp}
+\__acro_declare_property:nn {acc_supp} {accsupp}
% tooltip:
-\acro_declare_simple_key:n {tooltip}
+\__acro_declare_simple_property:n {tooltip}
-% citation:
+% citation -- currently needs to be done `by hand':
\prop_new:N \l__acro_citation_prop
\prop_new:N \l__acro_citation_pre_prop
\prop_new:N \l__acro_citation_post_prop
\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
- % 2 options: #1: ID: #6: key, #3: first option, #5: second option
+ % no options: #1: ID, #2: property, #3 is blank
+ % 1 option: #1: ID, #4: property, #3: option, #5 is blank
+ % 2 options: #1: ID: #6: property, #3: first option, #5: second option
\tl_if_blank:nF { #2#4#6 }
{
\tl_if_empty:nTF { #3 }
@@ -3590,12 +3977,12 @@
{
cite .code:n =
\__acro_declare_citation:Vw
- \l__acro_current_key_tl #1 [][] \scan_stop: \acro_stop:
+ \l__acro_current_property_tl #1 [][] \scan_stop: \acro_stop:
}
\cs_new_protected:Npn \__acro_declare_citation_aux:nnnn #1#2#3#4
{
- \__acro_key_check:nn {#1} { cite }
+ \__acro_property_check:nn {#1} {cite}
\prop_put:Nnn \l__acro_citation_prop {#1} { #4 }
\tl_if_empty:nF {#2}
{ \prop_put:Nnn \l__acro_citation_pre_prop {#1} {#2} }
@@ -3612,21 +3999,21 @@
% - \index{}
% - \index[]{}
% question is, though, if it should be the same one for all acronyms?
-% I go for yes but would also add a `post' key that allows to add arbitrary
+% I go for yes but would also add a `post' property that allows to add arbitrary
% TeX code after an acronym is typeset
% index:
-\acro_declare_simple_key:n {index}
+\__acro_declare_simple_property:n {index}
% index-sort:
-\acro_declare_simple_key:n {index-sort}
+\__acro_declare_simple_property:n {index-sort}
% index-cmd:
-\acro_declare_simple_key:n {index-cmd}
+\__acro_declare_simple_property:n {index-cmd}
% --------------------------------------------------------------------------
% acronym macros:
-\cs_new_protected: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
{
@@ -3646,7 +4033,7 @@
{
\seq_gput_right:Nn \g__acro_declared_acronyms_seq {#1}
\bool_gset_true:N \g__acro_first_acronym_declared_bool
- \tl_set:Nn \l__acro_current_key_tl {#1}
+ \tl_set:Nn \l__acro_current_property_tl {#1}
\keys_set:nn { acro / declare-acronym } {#2}
\bool_new:c {g__acro_#1_first_use_bool}
\bool_new:c {g__acro_#1_used_bool}
@@ -3656,13 +4043,14 @@
\seq_new:c {g__acro_#1_recorded_barriers_seq}
\bool_if:NF \l__acro_print_only_used_bool
{ \bool_gset_true:c {g__acro_#1_in_list_bool} }
- \acro_create_page_records:n {#1}
- \acro_define_acronym_macro:n {#1}
- \tl_clear:N \l__acro_current_key_tl
+ \__acro_create_page_records:n {#1}
+ \__acro_define_acronym_macro:n {#1}
+ \tl_clear:N \l__acro_current_property_tl
\bool_if:cF {l__acro_#1_short_set_bool}
{ \acro_serious_message:nnn {missing} {#1} {short} }
\bool_if:cF {l__acro_#1_long_set_bool}
{ \acro_serious_message:nnn {missing} {#1} {long} }
+ \__acro_log_acronym:n {#1}
}
% --------------------------------------------------------------------------
@@ -3682,10 +4070,7 @@
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_heading_cmd_tl {#1} ,
- heading .tl_set:N = \l__acro_list_heading_cmd_tl ,
+ heading .code:n = \__acro_set_list_heading:n {#1} ,
sort .bool_set:N = \l__acro_sort_bool ,
local-to-barriers .bool_set:N = \l__acro_use_barrier_bool
}
@@ -3700,7 +4085,7 @@
\tl_clear:N \l__acro_included_classes_tl
\tl_clear:N \l__acro_excluded_classes_tl
\keys_set:nn { acro / print-acronyms } {#1}
- \__acro_aux_file:n { \token_to_str:N \acro at print@list }
+ \__acro_aux_file_now:n { \acro at print@list }
\bool_if:NT \l__acro_sort_bool
{ \acro_sort_prop:N \l__acro_short_prop }
\acro_title_instance:VV
@@ -3723,42 +4108,92 @@
% --------------------------------------------------------------------------
% language support
\RequirePackage {translations}
+
+\cs_new_protected:Npn \__acro_declare_translation:www #1 \q_mark #2=#3 \q_stop
+ {
+ \tl_set:Nx \l__acro_tmpa_tl { \tl_trim_spaces:n {#1} }
+ \tl_set:Nx \l__acro_tmpb_tl { \tl_trim_spaces:n {#2} }
+ \tl_if_in:nnT {#3} {=}
+ {} % TODO: misplaced equal sign
+ \tl_set:Nx \l__acro_tmpc_tl { \tl_trim_spaces:n {#3} }
+ \__acro_declare_translation:VVV
+ \l__acro_tmpb_tl
+ \l__acro_tmpa_tl
+ \l__acro_tmpc_tl
+ }
+
+% #1: key
+% #2: lang
+% #3: translation
+\cs_new_protected:Npn \__acro_declare_translation:nnn #1#2#3
+ { \DeclareTranslation {#1} {#2} {#3} }
+\cs_generate_variant:Nn \__acro_declare_translation:nnn {VVV}
+
+% #1: key
+% #2: csv list: { <lang1> = <translation1> , <lang2> = <translation2> }
+\cs_new_protected:Npn \acro_declare_translation:nn #1#2
+ {
+ \clist_map_inline:nn {#2}
+ {
+ \tl_if_blank:nTF {##1}
+ { }% TODO: empty translation -- skip?
+ { \__acro_declare_translation:www #1 \q_mark ##1 \q_stop }
+ }
+ }
+
+\NewDocumentCommand \DeclareAcroTranslation {mm}
+ { \acro_declare_translation:nn {#1} {#2} }
+\@onlypreamble \DeclareAcroTranslation
+
% list name
-\DeclareTranslationFallback {acronym-list-name} {Acronyms}
-\DeclareTranslation {English} {acronym-list-name} {Acronyms}
-\DeclareTranslation {American} {acronym-list-name} {Acronyms}
-\DeclareTranslation {British} {acronym-list-name} {Acronyms}
-\DeclareTranslation {French} {acronym-list-name} {Acronymes}
-\DeclareTranslation {German} {acronym-list-name} {Abk\"urzungen}
-\DeclareTranslation {Italian} {acronym-list-name} {Acronimi}
-\DeclareTranslation {Portuguese} {acronym-list-name} {Acr\'onimos}
-\DeclareTranslation {Spanish} {acronym-list-name} {Siglas}
-\DeclareTranslation {Catalan} {acronym-list-name} {Sigles}
-\DeclareTranslation {Turkish} {acronym-list-name} {K\i saltmalar}
+\DeclareAcroTranslation {acronym-list-name}
+ {
+ Fallback = Acronyms ,
+ English = Acronyms ,
+ French = Acronymes ,
+ German = Abk\"urzungen ,
+ Italian = Acronimi ,
+ Portuguese = Acr\'onimos ,
+ Spanish = Siglas ,
+ Catalan = Sigles ,
+ Turkish = K\i saltmalar
+ }
% page name
-\DeclareTranslationFallback {acronym-page-name} {p.}
-\DeclareTranslation {English} {acronym-page-name} {p.}
-\DeclareTranslation {German} {acronym-page-name} {S.}
-\DeclareTranslation {Portuguese} {acronym-page-name} {p.}
+\DeclareAcroTranslation {acronym-page-name}
+ {
+ Fallback = p. ,
+ English = p. ,
+ German = S. ,
+ Portuguese = p.
+ }
% pages name
-\DeclareTranslationFallback {acronym-pages-name} {pp.}
-\DeclareTranslation {English} {acronym-pages-name} {pp.}
-\DeclareTranslation {German} {acronym-pages-name} {S.}
-\DeclareTranslation {Portuguese} {acronym-pages-name} {pp.}
+\DeclareAcroTranslation {acronym-pages-name}
+ {
+ Fallback = pp. ,
+ English = pp. ,
+ German = S. ,
+ Portuguese = pp.
+ }
% following page
-\DeclareTranslationFallback {acronym-next-page} {f.}
-\DeclareTranslation {English} {acronym-next-page} {f.}
-\DeclareTranslation {German} {acronym-next-page} {f.}
-\DeclareTranslation {Portuguese} {acronym-next-page} {s.}
+\DeclareAcroTranslation {acronym-next-page}
+ {
+ Fallback = f. ,
+ English = f. ,
+ German = f. ,
+ Portuguese = s.
+ }
% following pages
-\DeclareTranslationFallback {acronym-next-pages} {ff.}
-\DeclareTranslation {English} {acronym-next-pages} {ff.}
-\DeclareTranslation {German} {acronym-next-pages} {ff.}
-\DeclareTranslation {Portuguese} {acronym-next-pages} {ss.}
+\DeclareAcroTranslation {acronym-next-pages}
+ {
+ Fallback = ff. ,
+ English = ff. ,
+ German = ff. ,
+ Portuguese = ss.
+ }
% tokenlists using the translations:
\tl_set:Nn \l__acro_list_name_tl { \GetTranslation {acronym-list-name} }
@@ -3958,13 +4393,29 @@
<val1> and long endings to <val2>
- a single appearance should be treated like a first
appearance as far as citations are concerned
+2016/05/25 v2.5 - some of the entries added to the aux file need to be
+ written \immediate in order to avoid this trap:
+ http://tex.stackexchange.com/q/116001/
+ - cleaner interface for first-style template definitions
+ - new `acro-first' instances `footnote-reversed' and
+ `sidenote-reversed'
+ - new commands \DeclareAcroFirstStyle, \DeclareAcroExtraStyle
+ and \DeclareAcroPageStyle
+ - add warning `ending-before-acronyms' to options setting the
+ defaults of an ending; this should avoid confusion
+ - property declaration for acronyms should be handled by
+ internal functions
+ - improvements in the list template code
+ - logging info when an acronym is declared
+ - remove deprecated options
+ - new option `use-barriers'
+ - new option `following-pages*'
+ - option `page-ref' replaced by option `page-style'
+2016/05/26 v2.5a - bug fix: remove erroneous group in `<ending>-ending' option
+2016/05/30 v2.5b - fix issue #72
% --------------------------------------------------------------------------
% TODO:
- extend option `macros' to also define uppercase macros, possibly as a choice
-- Option `totoc'!?
-- 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
- add \ACF, \ACFP, \ACL and \ACLP that will print all words of the long form
capitalized
More information about the tex-live-commits
mailing list