summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-03-26 22:55:11 +0000
committerKarl Berry <karl@freefriends.org>2016-03-26 22:55:11 +0000
commit473c539aefe98fc932ea0ed651464b9f91482938 (patch)
tree892212ff8982b6c2bbc1725a48508172c3bfb88f /Master/texmf-dist
parent3b47cbe7d71ad346d91c4c320e9a0a2bd9c5a112 (diff)
acro (26mar16)
git-svn-id: svn://tug.org/texlive/trunk@40145 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/acro/README4
-rw-r--r--Master/texmf-dist/doc/latex/acro/acro_en.pdfbin544763 -> 550009 bytes
-rw-r--r--Master/texmf-dist/doc/latex/acro/acro_en.tex100
-rw-r--r--Master/texmf-dist/tex/latex/acro/acro.sty279
4 files changed, 264 insertions, 119 deletions
diff --git a/Master/texmf-dist/doc/latex/acro/README b/Master/texmf-dist/doc/latex/acro/README
index d20ee643b21..3bd7c774078 100644
--- a/Master/texmf-dist/doc/latex/acro/README
+++ b/Master/texmf-dist/doc/latex/acro/README
@@ -1,9 +1,9 @@
--------------------------------------------------------------------------
-the ACRO package v2.3
+the ACRO package v2.4
Typeset Acronyms
-2016/03/14
+2016/03/25
--------------------------------------------------------------------------
Clemens Niederberger
Web: http://www.mychemistry.eu/forums/forum/acro/
diff --git a/Master/texmf-dist/doc/latex/acro/acro_en.pdf b/Master/texmf-dist/doc/latex/acro/acro_en.pdf
index 5012ce361e9..c3d29648871 100644
--- a/Master/texmf-dist/doc/latex/acro/acro_en.pdf
+++ b/Master/texmf-dist/doc/latex/acro/acro_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/acro/acro_en.tex b/Master/texmf-dist/doc/latex/acro/acro_en.tex
index 102da540681..f9a0ac9cb5c 100644
--- a/Master/texmf-dist/doc/latex/acro/acro_en.tex
+++ b/Master/texmf-dist/doc/latex/acro/acro_en.tex
@@ -1,6 +1,6 @@
-% arara: pdflatex
-% arara: biber
-% arara: pdflatex
+% !arara: pdflatex
+% !arara: biber
+% !arara: pdflatex
% arara: pdflatex
% arara: pdflatex
% --------------------------------------------------------------------------
@@ -52,10 +52,10 @@
automatically sorts the list created by \cs{printacronyms}.%
} ,
add-cmds = {
- ac, Ac, aca, Aca, acap, Acap, acdot, acf, Acf, acflike, acg, acfp, Acfp,
- acfplike, aciftrailing, acl, Acl, aclp, Aclp, acp, Acp,
- AcroRegisterTrailing, acs, Acs, acsp, Acsp, acspace, acreset,
- acresetall, acsetup,
+ ac, Ac, aca, Aca, acap, Acap, acbarrier, acdot, acf, Acf, acflike, acg,
+ 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,
iac, Iac, iaca, Iaca, iacs, Iacs, iacl, Iacl, iacf, Iacf, iacflike,
@@ -299,6 +299,8 @@
{\endcnltxlist}
\makeatother
+\newcommand*\mailto[1]{\texttt{\href{mailto:#1}{#1}}}
+
\begin{document}
\section{Licence and Requirements}
\license
@@ -442,8 +444,8 @@ documentation.
if used the acronym will be sorted according to this key instead of its
\acs{id}.
%% class
- \keyval{class}{text}
- the class the acronym belongs to.
+ \keyval{class}{csv list}
+ 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
@@ -792,12 +794,11 @@ corresponding indefinite article.
accented letters.
\end{commands}
-\subsection{Simulating the First Appearance}
-\noindent\sinceversion{1.2}%
-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.
+\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.
\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
@@ -816,19 +817,35 @@ makes no sense to append it to the text that is inserted manually anyway.
Note that whatever text you're inserting might be gobbled depending on the
\option{first-style} you're using.
+\subsection{Fetching the Single Appearance}
+There\sinceversion{2.3} are macros that fetch the \emph{single} appearance of
+an acronym even if it has been used more than once and the \option{single}
+option is active.
+\begin{commands}
+ \command{acsingle}[\sarg\marg{id}]
+ Write acronym as if it were used only a single time.
+ \command{Acsingle}[\sarg\marg{id}]
+ Uppercase form of \cs{acsingle}.
+\end{commands}
+
+\begin{example}[side-by-side]
+ \acsingle{ny}
+\end{example}
+
\subsection{Using Classes}
The acronyms of \acro\ can be divided into different classes. This doesn't
change the output but allows different acronym lists, see
section~\vref{sec:print_lists}. For this \cs{DeclareAcronym} has an additional
key:
\begin{options}
- \keyval{class}{text}
- Associated class for an acronym.
+ \keyval{class}{csv list}
+ Associated\changedversion{2.4} class(es) for an acronym.
\end{options}
This might be useful if you can and want to divide your acronyms into
different types, technical and grammatical ones, say, that shall be listed in
-different lists.
+different lists. Since every acronym can get a list of associated classes
+those classes can effectively be used like tags for filtering acronyms.
\begin{example}[side-by-side]
% preamble:
@@ -1016,17 +1033,17 @@ The commands takes a few options, namely the following ones:
list. A special value is \code{none} which suppresses the heading.
\keybool{sort}\Default{true}
\sinceversion{1.3}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
+ section~\ref{sec:divid-your-docum}.
\end{options}
-\begin{sourcecode}
+\begin{example}
\acsetup{extra-style=comma}
\printacronyms[exclude-classes=city]
\printacronyms[include-classes=city,name={City Acronyms}]
-\end{sourcecode}
-\acsetup{extra-style=comma}
-\printacronyms[exclude-classes=city]
-
-\printacronyms[include-classes=city,name={City Acronyms}]
+\end{example}
You can see that the default layout is a \code{description} list with a
\cs*{section}\sarg\ title. Both can be changed, see
@@ -1454,6 +1471,33 @@ least two compilation runs until changes in the options or the actual page
numbers affect it. This is due to the fact that the updated sequence is first
written to the \code{aux} file and only read in during the next run.
+\section{Dividing Your Document Into Pieces -- Creating Local
+ Lists}\label{sec:divid-your-docum}
+
+\acro\sinceversion{2.4} introduces the concept of \emph{barriers} which can
+divide the document into parts. It is possible to create lists of only those
+acronyms used between two such barriers.
+\begin{commands}
+ \command{acbarrier}
+ Sets a barrier at the point of use in the document. The begin and the end
+ of the document mark implicit barriers.
+\end{commands}
+\begin{options}
+ \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}.
+\end{options}
+\begin{example}
+ \acbarrier
+ \printacronyms[local-to-barriers]
+ \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
@@ -1461,9 +1505,9 @@ written to the \code{aux} file and only read in during the next run.
strings to match the chosen language. However, due to my limited language
knowledge only a few translations are provided. I'll show how the English
translations are defined so you can add the translations to your preamble if
-needed. Even better would be you'd send me a short email at
-\href{mailto:contact@mychemistry.eu}{contact@mychemistry.eu} with the
-appropriate translations for your language and I'll add them to \acro.
+needed. Even better would be you'd send me a short email to
+\mailto{contact@mychemistry.eu} with the appropriate translations for your
+language and I'll add them to \acro.
\begin{sourcecode}
\DeclareTranslation{English}{acronym-list-name}{Acronyms}
@@ -1611,6 +1655,8 @@ commands\footnote{Which is why you need to use them inside an expl3
Loops over all acronyms known when the macro is used. Inside of
\meta{code} you can refer to the \acs{id} \meta{id} of an acronym with
\verbcode+#1+.
+ \command*{acro_barrier:}
+ The code-level version of \cs{acbarrier}.
\end{commands}
\paragraph{Examples}
diff --git a/Master/texmf-dist/tex/latex/acro/acro.sty b/Master/texmf-dist/tex/latex/acro/acro.sty
index a566c25a487..d646a937712 100644
--- a/Master/texmf-dist/tex/latex/acro/acro.sty
+++ b/Master/texmf-dist/tex/latex/acro/acro.sty
@@ -31,8 +31,8 @@
\RequirePackage{expl3,l3sort,xparse,l3keys2e,xtemplate,etoolbox}
\ProvidesExplPackage
{acro}
- {2016/03/14}
- {2.3}
+ {2016/03/25}
+ {2.4}
{Typeset Acronyms}
% --------------------------------------------------------------------------
@@ -163,6 +163,8 @@
\cs_generate_variant:Nn \tl_if_eq:nnF { V }
\cs_generate_variant:Nn \seq_use:Nnnn { c }
\cs_generate_variant:Nn \seq_gset_split:Nnn { c }
+\cs_generate_variant:Nn \seq_set_split:Nnn { NnV }
+\cs_generate_variant:Nn \seq_if_in:NnT { NV }
\cs_generate_variant:Nn \prop_put:Nnn { NnV, cnx, cnv }
\cs_generate_variant:Nn \prop_get:NnNF { cn, cnc }
\cs_generate_variant:Nn \prop_get:NnN { cnc }
@@ -204,6 +206,7 @@
\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
\bool_new:N \l__acro_page_punct_bool
\bool_new:N \l__acro_page_brackets_bool
\bool_new:N \l__acro_page_display_bool
@@ -231,7 +234,7 @@
\tl_new:N \l__acro_list_long_format_tl
\tl_new:N \l__acro_single_format_tl
\tl_new:N \l__acro_default_indefinite_tl
-\tl_set:Nn \l__acro_default_indefinite_tl { a }
+\tl_set:Nn \l__acro_default_indefinite_tl {a}
\tl_new:N \l__acro_extra_tl
\tl_new:N \l__acro_extra_format_tl
\tl_new:N \l__acro_foreign_tl
@@ -241,28 +244,28 @@
\tl_set:Nn \l__acro_foreign_list_format_tl { \acroenparen }
\tl_new:N \l__acro_foreign_lang_tl
\tl_new:N \l__acro_first_instance_tl
-\tl_set:Nn \l__acro_first_instance_tl { default }
+\tl_set:Nn \l__acro_first_instance_tl {default}
\tl_new:N \l__acro_first_style_tl
\tl_new:N \l__acro_extra_instance_tl
-\tl_set:Nn \l__acro_extra_instance_tl { default }
+\tl_set:Nn \l__acro_extra_instance_tl {default}
\tl_new:N \l__acro_page_instance_tl
-\tl_set:Nn \l__acro_page_instance_tl { none }
+\tl_set:Nn \l__acro_page_instance_tl {none}
\tl_new:N \l__acro_page_name_tl
-\tl_set:Nn \l__acro_page_name_tl { p.\@\, }
+\tl_set:Nn \l__acro_page_name_tl {p.\@\,}
\tl_new:N \l__acro_pages_name_tl
-\tl_set:Nn \l__acro_pages_name_tl { pp.\@\, }
+\tl_set:Nn \l__acro_pages_name_tl {pp.\@\,}
\tl_new:N \l__acro_next_page_tl
-\tl_set:Nn \l__acro_next_page_tl { \,f.\@ }
+\tl_set:Nn \l__acro_next_page_tl {\,f.\@}
\tl_new:N \l__acro_next_pages_tl
-\tl_set:Nn \l__acro_next_pages_tl { \,ff.\@ }
+\tl_set:Nn \l__acro_next_pages_tl {\,ff.\@}
\tl_new:N \l__acro_list_instance_tl
\tl_set:Nn \l__acro_list_instance_tl {description}
\tl_new:N \l__acro_list_type_tl
\tl_new:N \l__acro_list_tl
-\tl_new:N \l__acro_list_title_tl
-\tl_set:Nn \l__acro_list_title_tl { section* }
+\tl_new:N \l__acro_list_heading_cmd_tl
+\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_set:Nn \l__acro_list_name_tl {Acronyms}
\tl_new:N \l__acro_list_before_tl
\tl_new:N \l__acro_list_after_tl
\tl_new:N \l__acro_short_tl
@@ -402,8 +405,8 @@
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_title_tl {#1} ,
- list-heading .tl_set:N = \l__acro_list_title_tl ,
+ \tl_set:Nn \l__acro_list_heading_cmd_tl {#1} ,
+ list-heading .tl_set:N = \l__acro_list_heading_cmd_tl ,
list-heading .value_required:n = true ,
list-name .tl_set:N = \l__acro_list_name_tl ,
list-name .value_required:n = true ,
@@ -809,14 +812,14 @@
\cs_new_protected:Npn \acro_print_page_numbers:n #1
{
- \seq_if_empty:cF { g__acro_#1_pages_seq }
+ \seq_if_empty:cF {g__acro_#1_pages_seq}
{
\bool_if:NTF \l__acro_list_all_pages_bool
{
% have the numbers changed?
\tl_set:Nx \l__acro_tmpa_tl
- { \seq_use:cnnn { g__acro_#1_pages_seq } { | } { | } { | } }
- \tl_if_eq:cNF { g__acro_#1_recorded_pages_tl } \l__acro_tmpa_tl
+ { \seq_use:cn {g__acro_#1_pages_seq} {|} }
+ \tl_if_eq:cNF {g__acro_#1_recorded_pages_tl} \l__acro_tmpa_tl
{
\@latex@warning@no@line
{Rerun~to~get~page~numbers~of~acronym~#1~in~acronym~list~right}
@@ -1045,23 +1048,49 @@
% #1: id
% #2: excluded classes
-% #3: continue if not excluded
-\cs_new_protected:Npn \acro_is_excluded:nnF #1#2#3
+\prg_new_protected_conditional:Npnn \acro_if_is_excluded:nn #1#2 {T,F,TF}
{
\bool_set_false:N \l__acro_is_excluded_bool
- \tl_if_empty:nTF {#2}
- {#3}
+ \tl_if_blank:nF {#2}
{
\clist_map_inline:nn {#2}
{
- \prop_get:NnNF \l__acro_class_prop {#1} \l__acro_tmpa_tl {}
- \tl_if_eq:VnT \l__acro_tmpa_tl {##1}
- { \bool_set_true:N \l__acro_is_excluded_bool }
+ \prop_get:NnNT \l__acro_class_prop {#1} \l__acro_tmpa_tl
+ {
+ \seq_set_split:NnV \l__acro_tmpa_seq {,} \l__acro_tmpa_tl
+ \seq_if_in:NnT \l__acro_tmpa_seq {##1}
+ { \bool_set_true:N \l__acro_is_excluded_bool }
+ }
}
- \bool_if:NF \l__acro_is_excluded_bool {#3}
}
+ \bool_if:NTF \l__acro_is_excluded_bool
+ { \prg_return_true: }
+ { \prg_return_false: }
}
+% #1: id
+% #2: included classes
+\prg_new_protected_conditional:Npnn \acro_if_is_included:nn #1#2 {T,F,TF}
+ {
+ \bool_set_true:N \l__acro_is_included_bool
+ \tl_if_blank:nF {#2}
+ {
+ \clist_map_inline:nn {#2}
+ {
+ \prop_get:NnNTF \l__acro_class_prop {#1} \l__acro_tmpa_tl
+ {
+ \seq_set_split:NnV \l__acro_tmpa_seq {,} \l__acro_tmpa_tl
+ \seq_if_in:NnF \l__acro_tmpa_seq {##1}
+ { \bool_set_false:N \l__acro_is_included_bool }
+ }
+ { \bool_set_false:N \l__acro_is_included_bool }
+ }
+ }
+ \bool_if:NTF \l__acro_is_included_bool
+ { \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} }
@@ -1135,6 +1164,9 @@
% 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: included classes
+% #2: excluded classes
\cs_new_protected:Npn \acro_list_items:nn #1#2
{
\acro_for_all_acronyms_do:n
@@ -1156,34 +1188,29 @@
( !\l__acro_use_single_bool && !\l__acro_print_only_used_bool )
}
{
- \acro_is_excluded:nnF {##1} {#2}
+ \acro_if_is_excluded:nnF {##1} {#2}
{
- \tl_if_blank:nTF {#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} }
- }
- {
- \clist_map_inline:nn {#1}
+ \acro_if_is_included:nnT {##1} {#1}
+ { % TODO: avoid code duplication
+ \bool_if:NTF \l__acro_use_barrier_bool
{
- \prop_get:NnNT \l__acro_class_prop {##1} \l__acro_tmpa_tl
+ \acro_if_in_barrier:nxT {##1}
+ { \int_use:N \g__acro_barrier_int }
{
- \tl_set:Nn \l__acro_tmpb_tl {####1}
- \tl_trim_spaces:N \l__acro_tmpa_tl
- \tl_trim_spaces:N \l__acro_tmpb_tl
- \tl_if_eq:NNT \l__acro_tmpa_tl \l__acro_tmpb_tl
- {
- \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} }
}
}
+ {
+ \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} }
+ }
}
}
}
@@ -1508,6 +1535,7 @@
\l__acro_long_tl
}
}
+ \acro_record_barrier:n {#1}
}
% single appearances:
@@ -1851,8 +1879,8 @@
\__acro_aux_file:Nnnnn \acro@used@twice
{#1}
{ \thepage }
- { \arabic{page} }
- { \arabic{abspage} }
+ { \arabic {page} }
+ { \arabic {abspage} }
}
{ \__acro_aux_file:Nnnnn \acro@used@twice {#1} {} {} {} }
\prg_return_true:
@@ -1863,8 +1891,8 @@
\__acro_aux_file:Nnnnn \acro@used@once
{#1}
{ \thepage }
- { \arabic{page} }
- { \arabic{abspage} }
+ { \arabic {page} }
+ { \arabic {abspage} }
\bool_if:nT
{
!\bool_if_p:c { g__acro_#1_label_bool } &&
@@ -1892,25 +1920,27 @@
% \fi
}
+\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@used@once #1#2#3#4
{
- \cs_gset_nopar:cpn { acro@#1@once } {#1}
- \bool_gset_true:c { g__acro_#1_in_list_bool }
- \tl_if_empty:nF { #2#3#4 }
- { \seq_gput_right:cn { g__acro_#1_pages_seq } { {#2}{#3}{#4} } }
+ \cs_gset_nopar:cpn {acro@#1@once} {#1}
+ \bool_gset_true:c {g__acro_#1_in_list_bool}
+ \tl_if_empty:nF {#2#3#4}
+ { \seq_gput_right:cn {g__acro_#1_pages_seq} { {#2}{#3}{#4} } }
}
\cs_new_protected:Npn \acro@used@twice #1#2#3#4
{
- \cs_gset_nopar:cpn { acro@#1@twice } {#1}
- \tl_if_empty:nF { #2#3#4 }
- { \seq_gput_right:cn { g__acro_#1_pages_seq } { {#2}{#3}{#4} } }
+ \cs_gset_nopar:cpn {acro@#1@twice} {#1}
+ \tl_if_empty:nF {#2#3#4}
+ { \seq_gput_right:cn {g__acro_#1_pages_seq} { {#2}{#3}{#4} } }
}
\cs_new_protected:Npn \acro@pages #1#2
- { \tl_gset:cn { g__acro_#1_recorded_pages_tl } {#2} }
+ { \tl_gset:cn {g__acro_#1_recorded_pages_tl} {#2} }
\bool_new:N \g__acro_rerun_bool
@@ -1929,42 +1959,46 @@
\cs_gset_protected:Npn \acro@used@once #1#2#3#4
{
\tl_set:Nn \l__acro_tmpa_tl {#1}
- \tl_if_eq:cNF { acro@#1@once } \l__acro_tmpa_tl
+ \tl_if_eq:cNF {acro@#1@once} \l__acro_tmpa_tl
{ \bool_gset_true:N \g__acro_rerun_bool }
}
\cs_gset_protected:Npn \acro@used@twice #1#2#3#4
{
\tl_set:Nn \l__acro_tmpa_tl {#1}
- \tl_if_eq:cNF { acro@#1@twice } \l__acro_tmpa_tl
+ \tl_if_eq:cNF {acro@#1@twice} \l__acro_tmpa_tl
{ \bool_gset_true:N \g__acro_rerun_bool }
}
\acro_for_all_acronyms_do:n
{
- \seq_if_empty:cF { g__acro_#1_pages_seq }
+ \seq_if_empty:cF {g__acro_#1_pages_seq}
{
\if@filesw
- \iow_shipout_x:Nn \@auxout
+ \__acro_aux_file:n
{
\token_to_str:N \acro@pages {#1}
- { \seq_use:cnnn { g__acro_#1_pages_seq } { | } { | } { | } }
+ { \seq_use:cn {g__acro_#1_pages_seq} {|} } ^^J
+ \token_to_str:N \acro@barriers {#1}
+ { \seq_use:cn {g__acro_#1_barriers_seq} {,} }
}
\fi
}
+ \acro_check_barriers:n {#1}
}
- \iow_shipout_x:Nn \@auxout { \acro@rerun@check }
+ \__acro_aux_file:n { \acro@rerun@check }
}
% if `acro' is deactivated prevent unnecessary errors from aux file:
\if@filesw
\AtBeginDocument
{
- \iow_now:Nx \@auxout
+ \__acro_aux_file:n
{
\token_to_str:N \providecommand \token_to_str:N \acro@used@once [4] {} ^^J
\token_to_str:N \providecommand \token_to_str:N \acro@used@twice [4] {} ^^J
\token_to_str:N \providecommand \token_to_str:N \acro@pages [2] {} ^^J
\token_to_str:N \providecommand \token_to_str:N \acro@rerun@check {} ^^J
- \token_to_str:N \providecommand \token_to_str:N \acro@print@list {}
+ \token_to_str:N \providecommand \token_to_str:N \acro@print@list {} ^^J
+ \token_to_str:N \providecommand \token_to_str:N \acro@barriers [2] {}
}
}
\fi
@@ -2638,9 +2672,9 @@
\bool_gset_true:c { g__acro_#1_first_use_bool }
\bool_gset_true:c { g__acro_#1_in_list_bool }
\if@filesw
- \iow_shipout_x:Nn \@auxout
+ \__acro_aux_file:n
{ \token_to_str:N \acro@used@once {#1} {} {} {} }
- \iow_shipout_x:Nn \@auxout
+ \__acro_aux_file:n
{ \token_to_str:N \acro@used@twice {#1} {} {} {} }
\fi
}
@@ -2678,6 +2712,65 @@
{ \ProcessList {#1} { \acro_mark_as_used:n } \ignorespaces }
% --------------------------------------------------------------------------
+% acronym barriers: allow local lists of only those acronyms used between two
+% barriers
+
+\int_new:N \g__acro_barrier_int
+\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
+ }
+
+\cs_new_protected:Npn \acro_barrier:
+ {
+ \int_gincr:N \g__acro_barrier_int
+ \bool_if:NT \g__acro_reset_at_barrier_bool
+ { \acro_reset_all: }
+ }
+
+\NewDocumentCommand \acbarrier {}
+ { \acro_barrier: }
+
+\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
+ {
+ \@latex@warning@no@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 }
+ {
+ \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}
+ {
+ \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_new:Npn \acro@barriers #1#2
+ { \seq_gset_split:cnn {g__acro_#1_recorded_barriers_seq} {,} {#2} }
+
+% --------------------------------------------------------------------------
% the user commands -- preparation:
\cs_new_protected:Npn \acro_begin:
{
@@ -3438,24 +3531,26 @@
\bool_gset_true:N \g__acro_first_acronym_declared_bool
\tl_set:Nn \l__acro_current_key_tl {#1}
\keys_set:nn { acro / declare-acronym } {#2}
- \bool_new:c { g__acro_#1_first_use_bool }
- \bool_new:c { g__acro_#1_used_bool }
- \bool_new:c { g__acro_#1_label_bool }
- \bool_new:c { g__acro_#1_in_list_bool }
+ \bool_new:c {g__acro_#1_first_use_bool}
+ \bool_new:c {g__acro_#1_used_bool}
+ \bool_new:c {g__acro_#1_label_bool}
+ \bool_new:c {g__acro_#1_in_list_bool}
+ \seq_new:c {g__acro_#1_barriers_seq}
+ \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 } }
+ { \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
- \bool_if:cF { l__acro_#1_short_set_bool }
+ \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 }
+ \bool_if:cF {l__acro_#1_long_set_bool}
{ \acro_serious_message:nnn {missing} {#1} {long} }
}
% --------------------------------------------------------------------------
% the user command:
-\NewDocumentCommand \DeclareAcronym { mm }
+\NewDocumentCommand \DeclareAcronym {mm}
{ \acro_declare_acronym:nn {#1} {#2} }
% --------------------------------------------------------------------------
@@ -3467,14 +3562,15 @@
\keys_define:nn { acro / print-acronyms }
{
- include-classes .tl_set:N = \l__acro_included_classes_tl ,
- exclude-classes .tl_set:N = \l__acro_excluded_classes_tl ,
- name .tl_set:N = \l__acro_list_name_tl ,
- header .code:n =
+ include-classes .tl_set:N = \l__acro_included_classes_tl ,
+ exclude-classes .tl_set:N = \l__acro_excluded_classes_tl ,
+ name .tl_set:N = \l__acro_list_name_tl ,
+ header .code:n =
\acro_option_deprecated:nn {header} {heading}
- \tl_set:Nn \l__acro_list_title_tl {#1} ,
- heading .tl_set:N = \l__acro_list_title_tl ,
- sort .bool_set:N = \l__acro_sort_bool
+ \tl_set:Nn \l__acro_list_heading_cmd_tl {#1} ,
+ heading .tl_set:N = \l__acro_list_heading_cmd_tl ,
+ sort .bool_set:N = \l__acro_sort_bool ,
+ local-to-barriers .bool_set:N = \l__acro_use_barrier_bool
}
\cs_new_protected:Npn \acro_print_acronyms:n #1
@@ -3487,11 +3583,11 @@
\tl_clear:N \l__acro_included_classes_tl
\tl_clear:N \l__acro_excluded_classes_tl
\keys_set:nn { acro / print-acronyms } {#1}
- \iow_now:Nx \@auxout { \string \acro@print@list }
+ \__acro_aux_file:n { \token_to_str:N \acro@print@list }
\bool_if:NT \l__acro_sort_bool
{ \acro_sort_prop:N \l__acro_short_prop }
\acro_title_instance:VV
- \l__acro_list_title_tl
+ \l__acro_list_heading_cmd_tl
\l__acro_list_name_tl
\cs_if_exist:NTF \acro@printed@list
{
@@ -3723,10 +3819,13 @@
endings
- property `foreign-lang'
- fix issue #65
+2016/03/?? v2.4 - extend class mechanism: classes can be used like tags
+ - add idea of `barriers' and list local to those barriers
+ => new option `reset-at-barriers'
+ => new option `local-to-barriers' for \printacronyms
+ => new command \acbarrier
% --------------------------------------------------------------------------
-update => http://tex.stackexchange.com/questions/236362
-
% TODO:
- extend option `macros' to also define uppercase macros, possibly as a choice
- Option `totoc'!?