diff --git a/HISTORY b/HISTORY index 68fd13c..b342b94 100644 --- a/HISTORY +++ b/HISTORY @@ -299,12 +299,14 @@ The Current Maintainer of this work is Clemens Niederberger. - \acroifboolean(TF) - add missing code in some of the list templates - improve examples code -2020/05/?? v3.2 - fix units example +2020/05/10 v3.2 - fix units example - prevent to early expansion of formatting instructions - fix error in \AcroNeedPackage - - fix wrong usage of `longtabu` in the `longtable` template - - add supertabular template + - fix wrong usage of `longtabu' in the `longtable' template + - add `supertabular' template + - new: `display properties', this adds + `list/foreign/display' - add further examples - - new: `display properties' - adds `list/foreign/display' - + - \SetupAcroTemplate, \SetupNextAcroTemplate + - properly define and document \AcroTemplateName and + \AcroTemplateType diff --git a/README b/README index 9b6b9df..1cfc035 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the ACRO package v3.1 2020/05/03 +the ACRO package v3.2 2020/05/10 Typeset Acronyms @@ -22,9 +22,10 @@ This work has the LPPL maintenance status `maintained'. The Current Maintainer of this work is Clemens Niederberger. -------------------------------------------------------------------------- -The acro package consists of the code file: +The acro package consists of code files: acro.sty + acro2.sty The acro package consists of documentation files: @@ -46,5 +47,8 @@ folder examples/ in the same folder as acro-manual.pdf: acro.example.issue-154.pdf, acro.example.issue-154.tex acro.example.texsx-505891.pdf, acro.example.texsx-505891.tex acro.example.texsx-507726.pdf, acro.example.texsx-507726.tex - + acro.example.texsx-513623.pdf, acro.example.texsx-513623.tex + acro.example.texsx-515295.pdf, acro.example.texsx-515295.tex + acro.example.texsx-542461.pdf, acro.example.texsx-542461.tex + -------------------------------------------------------------------------- diff --git a/code/acro.interface.code.tex b/code/acro.interface.code.tex index 2f9ec6c..24958cb 100644 --- a/code/acro.interface.code.tex +++ b/code/acro.interface.code.tex @@ -104,6 +104,12 @@ \NewDocumentCommand \RenewAcroTemplate {O{acronym}m+m} { \use:c {acro_#1_template_renew:nn} {#2} {#3} } +\NewDocumentCommand \SetupAcroTemplate {O{acronym}m+m} + { \acro_template_setup:nnn {#1} {#2} {#3} } + +\NewDocumentCommand \SetupNextAcroTemplate {O{acronym}m+m} + { \acro_next_template_setup:nnn {#1} {#2} {#3} } + \NewDocumentCommand \DeclareAcronym {m+m} { \acro_declare_acronym:nn {#1} {#2} } diff --git a/code/acro.start.code.tex b/code/acro.start.code.tex index e550a29..8a7ff70 100644 --- a/code/acro.start.code.tex +++ b/code/acro.start.code.tex @@ -27,9 +27,9 @@ % setup package: \tl_const:Nn \c_acro_package_name_tl {acro} -\tl_const:Nn \c_acro_date_tl {2020/05/04} +\tl_const:Nn \c_acro_date_tl {2020/05/10} \tl_const:Nn \c_acro_version_major_number_tl {3} -\tl_const:Nn \c_acro_version_minor_number_tl {1} +\tl_const:Nn \c_acro_version_minor_number_tl {2} \tl_const:Nn \c_acro_version_subrelease_tl {} \tl_const:Nx \c_acro_version_number_tl { diff --git a/code/acro.sty b/code/acro.sty index b0b1e10..d272acd 100644 --- a/code/acro.sty +++ b/code/acro.sty @@ -27,9 +27,9 @@ % setup package: \tl_const:Nn \c_acro_package_name_tl {acro} -\tl_const:Nn \c_acro_date_tl {2020/05/04} +\tl_const:Nn \c_acro_date_tl {2020/05/10} \tl_const:Nn \c_acro_version_major_number_tl {3} -\tl_const:Nn \c_acro_version_minor_number_tl {1} +\tl_const:Nn \c_acro_version_minor_number_tl {2} \tl_const:Nn \c_acro_version_subrelease_tl {} \tl_const:Nx \c_acro_version_number_tl { @@ -735,6 +735,12 @@ \NewDocumentCommand \RenewAcroTemplate {O{acronym}m+m} { \use:c {acro_#1_template_renew:nn} {#2} {#3} } +\NewDocumentCommand \SetupAcroTemplate {O{acronym}m+m} + { \acro_template_setup:nnn {#1} {#2} {#3} } + +\NewDocumentCommand \SetupNextAcroTemplate {O{acronym}m+m} + { \acro_next_template_setup:nnn {#1} {#2} {#3} } + \NewDocumentCommand \DeclareAcronym {m+m} { \acro_declare_acronym:nn {#1} {#2} } @@ -2608,10 +2614,10 @@ \cs_new_protected:Npn \acro_footnote:n #1 { - \tl_set:Ne \l__acro_fnpct_check_tl { \l__acro_fnpct_check_tl } + \tl_set:Ne \l__acro_tmpa_tl { \l__acro_fnpct_check_tl } \exp_last_unbraced:Nno \footnote {#1} - \l__acro_fnpct_check_tl + \l__acro_tmpa_tl } % options for activating actions: @@ -3179,6 +3185,7 @@ \cs_new_protected:Npn \__acro_template_add:nnn #1#2#3 { \tl_new:c {l__acro_template_#1_#2_setup_tl} + \tl_new:c {l__acro_next_template_#1_#2_setup_tl} \acro_attribute_set:nnn {template::#1} {#2} {#3} } @@ -3221,28 +3228,33 @@ % #3: setup code \cs_new_protected:Npn \acro_template_setup:nnn #1#2#3 { \tl_set:cn {l__acro_template_#1_#2_setup_tl} {#3} } -\cs_generate_variant:Nn \acro_template_setup:nnn {nnV,nVn} + +\cs_new_protected:Npn \acro_next template_setup:nnn #1#2#3 + { \tl_set:cn {l__acro_next_template_#1_#2_setup_tl} {#3} } % #1: template type % #2: template name -\cs_new_protected:Npn \__acro_template_setup:nn #1#2 - { \tl_use:c {l__acro_template_#1_#2_setup_tl} } +\cs_new_protected:Npn \__acro_template_do_setup:nn #1#2 + { + \tl_use:c {l__acro_template_#1_#2_setup_tl} + \tl_use:c {l__acro_next_template_#1_#2_setup_tl} + } % #1: template type % #2: template name \cs_new_protected:Npn \__acro_clear_template_setup:nn #1#2 - { \tl_clear:c {l__acro_template_#1_#2_setup_tl} } + { \tl_clear:c {l__acro_next_template_#1_#2_setup_tl} } % #1: template type % #2: template name \cs_new_protected:Npn \__acro_template_start:nn #1#2 { \group_begin: - \__acro_template_setup:nn {#1} {#2} - \tl_clear_new:N \TemplateType - \tl_set:Nn \TemplateType {#1} - \tl_clear_new:N \TemplateName - \tl_set:Nn \TemplateName {#2} + \__acro_template_do_setup:nn {#1} {#2} + \tl_clear_new:N \AcroTemplateType + \tl_set:Nn \AcroTemplateType {#1} + \tl_clear_new:N \AcroTemplateName + \tl_set:Nn \AcroTemplateName {#2} } % #1: template type @@ -5046,7 +5058,7 @@ \acropages { \acrotranslate {page} \nobreakspace } { \acrotranslate {pages} \nobreakspace } - \tabularnewline + \strut \tabularnewline } } { \AcroRerun } @@ -5058,6 +5070,38 @@ \end {longtabu} } +\NewAcroTemplate[list] {supertabular} + { + \AcroNeedPackage {array,supertabular} + \acronymsmapF + { + \AcroAddRow + { + \acrowrite {short} + \acroifT {alt} { / } \acrowrite {alt} + & + \acrowrite {list} + \acroifanyT {foreign,extra} {~(} + \acrowrite {foreign} + \acroifallT {foreign,extra} {,~} + \acrowrite {extra} + \acroifanyT {foreign,extra} {)} + \acropagefill + \acropages + { \acrotranslate {page} \nobreakspace } + { \acrotranslate {pages} \nobreakspace } + \tabularnewline + } + } + { \AcroRerun } + \acroheading + \acropreamble + \par \noindent + \begin {supertabular} {>{\bfseries}lp{.7\linewidth}} + \AcronymTable + \end {supertabular} + } + \NewAcroTemplate [list] {lof} { \acroheading diff --git a/code/acro.templates.code.tex b/code/acro.templates.code.tex index b51c509..d0c483a 100644 --- a/code/acro.templates.code.tex +++ b/code/acro.templates.code.tex @@ -35,6 +35,7 @@ \cs_new_protected:Npn \__acro_template_add:nnn #1#2#3 { \tl_new:c {l__acro_template_#1_#2_setup_tl} + \tl_new:c {l__acro_next_template_#1_#2_setup_tl} \acro_attribute_set:nnn {template::#1} {#2} {#3} } @@ -77,28 +78,33 @@ % #3: setup code \cs_new_protected:Npn \acro_template_setup:nnn #1#2#3 { \tl_set:cn {l__acro_template_#1_#2_setup_tl} {#3} } -\cs_generate_variant:Nn \acro_template_setup:nnn {nnV,nVn} + +\cs_new_protected:Npn \acro_next template_setup:nnn #1#2#3 + { \tl_set:cn {l__acro_next_template_#1_#2_setup_tl} {#3} } % #1: template type % #2: template name -\cs_new_protected:Npn \__acro_template_setup:nn #1#2 - { \tl_use:c {l__acro_template_#1_#2_setup_tl} } +\cs_new_protected:Npn \__acro_template_do_setup:nn #1#2 + { + \tl_use:c {l__acro_template_#1_#2_setup_tl} + \tl_use:c {l__acro_next_template_#1_#2_setup_tl} + } % #1: template type % #2: template name \cs_new_protected:Npn \__acro_clear_template_setup:nn #1#2 - { \tl_clear:c {l__acro_template_#1_#2_setup_tl} } + { \tl_clear:c {l__acro_next_template_#1_#2_setup_tl} } % #1: template type % #2: template name \cs_new_protected:Npn \__acro_template_start:nn #1#2 { \group_begin: - \__acro_template_setup:nn {#1} {#2} - \tl_clear_new:N \TemplateType - \tl_set:Nn \TemplateType {#1} - \tl_clear_new:N \TemplateName - \tl_set:Nn \TemplateName {#2} + \__acro_template_do_setup:nn {#1} {#2} + \tl_clear_new:N \AcroTemplateType + \tl_set:Nn \AcroTemplateType {#1} + \tl_clear_new:N \AcroTemplateName + \tl_set:Nn \AcroTemplateName {#2} } % #1: template type diff --git a/code/acro.tools.code.tex b/code/acro.tools.code.tex index a2443f0..652cb02 100644 --- a/code/acro.tools.code.tex +++ b/code/acro.tools.code.tex @@ -426,10 +426,10 @@ \cs_new_protected:Npn \acro_footnote:n #1 { - \tl_set:Ne \l__acro_fnpct_check_tl { \l__acro_fnpct_check_tl } + \tl_set:Ne \l__acro_tmpa_tl { \l__acro_fnpct_check_tl } \exp_last_unbraced:Nno \footnote {#1} - \l__acro_fnpct_check_tl + \l__acro_tmpa_tl } % options for activating actions: diff --git a/doc/acro-manual.cls b/doc/acro-manual.cls index e4f61e8..a6109da 100644 --- a/doc/acro-manual.cls +++ b/doc/acro-manual.cls @@ -94,8 +94,10 @@ babelhyphen, parencite, BeginAccSupp, EndAccSupp, if@filesw, acro@list, + iupac, enquote, NewDocumentCommand, - newabbreviation, printabbreviations + newabbreviation, printabbreviations, + newspecies } , index-setup = { level = \section , headers={\indexname}{\indexname} , noclearpage , @@ -107,9 +109,7 @@ \DeclareTranslation{English}{cnltx-toc}{Table of contents} -\newcommand*\barg{\textcolor{argument}{\code{!}}} -\newcommand*\qarg{\textcolor{argument}{\code{?}}} -\newcommand*\uarg{\textcolor{argument}{\code{|}}} +\renewcommand*\arg[1]{\textcolor{argument}{\code{#1}}} \newidxcmd\sym{\code{#1}}[ (symbol)] @@ -233,15 +233,15 @@ \renewrobustcmd*\sinceversion[1]{% \ac@ifnew{#1}% {\cnltx@version@note{\textcolor{red}{\ac@NEW}}}% - {\cnltx@version@note{\GetTranslation{cnltx-introduced}~#1\ac@date{#1}}}% + {\cnltx@version@note{\GetTranslation{cnltx-introduced}~v#1\ac@date{#1}}}% } \renewrobustcmd*\changedversion[1]{% - \cnltx@version@note{\GetTranslation{cnltx-changed}~#1\ac@date{#1}}% + \cnltx@version@note{\GetTranslation{cnltx-changed}~v#1\ac@date{#1}}% } \newnote*\sincechanged[2]{% \GetTranslation{cnltx-introduced}~#1\ac@date{#1}, - changed with version~#2\ac@date{#2}\ac@ifnew{#2}{ \ac@NEW}{}% + changed with ~v#2\ac@date{#2}\ac@ifnew{#2}{ \ac@NEW}{}% } \RenewDocumentEnvironment{commands}{} @@ -652,7 +652,8 @@ \acro@add@version{2020-01-24}{2.11b} \acro@add@version{2020-02-03}{2.11c} % 2020: v3 -\acro@add@version{2020-04-29}{v3.0} -\acro@add@version{2020-05-03}{v3.1} +\acro@add@version{2020-04-29}{3.0} +\acro@add@version{2020-05-03}{3.1} +\acro@add@version{2020-05-10}{3.2} \endinput diff --git a/doc/acro-manual.pdf b/doc/acro-manual.pdf index 5c2310f..90a739e 100644 Binary files a/doc/acro-manual.pdf and b/doc/acro-manual.pdf differ diff --git a/doc/acro-manual.tex b/doc/acro-manual.tex index d6cb641..1d21678 100644 --- a/doc/acro-manual.tex +++ b/doc/acro-manual.tex @@ -1123,7 +1123,7 @@ \subsection{Indefinite forms}\label{sec:indefinite-forms} an \ac{ufo} \end{example} And what good would it be to use a package like \acro\ if you have to keep -track of of and second uses, anyway? This is why \acs{ufo} should be defined +track of first and second uses, anyway? This is why \acs{ufo} should be defined like we did on page~\pageref{ufo}. We then can just use the dedicated commands and let them decide for us: \begin{example}[side-by-side] @@ -1179,6 +1179,9 @@ \section{Foreign language acronyms}\label{sec:fore-lang-acronyms} \begin{options} \keybool{display}\Module{foreign}\Default{true} Determine wether to hide or display the foreign form. + \keybool{display}\Module{list,foreign}\Default{true} + \sinceversion{3.2}Determine wether to hide or display the foreign form in + the list of acronyms. \keybool{display}\Module{locale}\Default{false} This options determines wether the language of the foreign form is printed or not when the full form of the acronym is printed. @@ -1250,6 +1253,8 @@ \section{Uppercasing}\label{sec:uppercasing} } \end{sourcecode} +\pagebreak + There are a number of options to control the uppercasing behavior: \begin{options} \opt{first}\Module{uppercase} @@ -1374,7 +1379,7 @@ \subsection{Indexing}\label{sec:indexing} \end{properties} This manual is an example for the indexing feature. Each acronym from section~\vref{sec:acronyms} that has been used in this manual is also listed -in the manual. +in the index. \section{Barriers}\label{sec:barriers} The main purpose of the concept of barriers is to be able to have \emph{local} @@ -1401,10 +1406,10 @@ \section{Barriers}\label{sec:barriers} \begin{commands} \command{acbarrier} For this command to have any effect you must set - \module{barriers}\code{/}\option{single} to \code{true}! + \module{barriers}\code{/}\option{use} to \code{true}! \end{commands} \begin{bewareofthedog} - It takes usually two or even three \LaTeX\ runs until acronym usages + It usually takes two or even three \LaTeX\ runs until acronym usages between barriers are properly counted. \end{bewareofthedog} @@ -1415,7 +1420,7 @@ \subsection{What is it about?} tokens: the \enquote{\code{dot}} (\sym{.}), the \enquote{\code{dash}} (\sym{-}) and the \enquote{\code{babel-hyphen}} (\cs*{babelhyphen}). -Yeu have seen an example for this already: +You have seen an example for this already: \begin{sourcecode} \DeclareAcronym{etc}{ short = etc\acdot , @@ -1502,8 +1507,7 @@ \subsection{How does it work?} \code{babel-hyphen} follows. \expandable\command{abbrdot} Inserts \sym{.}\cs*{@} \end{commands} -The definitions are equivalent\footnote{Not \emph{quite}: \acro's definitions - are engine protected.} to the following code: +The definitions are equivalent to the following code: \begin{sourcecode} \newcommand*\acdot{\aciftrailing{dot}{}{\abbrdot}} \newcommand*\acspace{\aciftrailing{dash,babel-hyphen}{}{\space}} @@ -1802,7 +1806,13 @@ \subsubsection{List templates} A style that uses a \env*{longtabu} environment for building the list. This needs the \pkg{longtable} package and the \pkg{tabu} package~\cite{pkg:tabu} loaded\footnote{Please note that this package - currently is un-maintained and has a number of open bugs.}. + currently is un-maintained and has a number of open bugs. For further + information refer to + \url{https://github.com/tabu-issues-for-future-maintainer/tabu}}. + \tmpl{supertabular} + A\sinceversion{3.2} style that uses a \env*{supertabular} environment for + building the list. This needs the \pkg{supertabular} + package~\cite{pkg:supertabular} loaded. \tmpl{tabular} A style that uses a \env*{tabular} environment for building the list. Since a \env*{tabular} cannot break across pages this is only suited for @@ -1828,7 +1838,7 @@ \subsubsection{Header templates} \tmpl{section} Uses \cs*{section} for the heading. \tmpl{section*} - Uses \cs*{section}\sarg* for the heading. + Uses \cs*{section}\sarg\ for the heading. \end{templates} \subsection{Defining new templates}\label{sec:defin-new-templ} @@ -1842,6 +1852,19 @@ \subsection{Defining new templates}\label{sec:defin-new-templ} This re-defines a template of type \meta{type} woth the name \meta{name} which inserts \meta{code} when used. A template of type \meta{type} with name \meta{name} must exist. The default type is \code{acronym}. + \command{SetupAcroTemplate}[\oarg{type}\marg{name}\marg{code}] + Adds\sinceversion{3.2} \meta{code} to the beginning of the template + \meta{name} of type \meta{type}. The default type is \code{acronym}. + \command{SetupNextAcroTemplate}[\oarg{type}\marg{name}\marg{code}] + Adds\sinceversion{3.2} \meta{code} to the beginning of \emph{the next use} + of the template \meta{name} of type \meta{type}. The default type is + \code{acronym}. + \expandable\command{AcroTemplateType} + Within a template this expands to the \meta{type} of the current + template. + \expandable\command{AcroTemplateName} + Within a template this expands to the \meta{name} of the current + template. \end{commands} How to use these commands is best explained by examples of how the existing @@ -1868,7 +1891,7 @@ \subsection{Commands to be used in template definitions} \subsubsection{Commands for common uses} \begin{commands} \expandable\command{acrolistname} - Expnads to whatever is currently set with + Expands to whatever is currently set with \module{list}\code{/}\option{name}. \command{acrowrite}[\marg{property}] Prints the property \meta{property} of the current acronym. Depending on @@ -2138,7 +2161,7 @@ \section{Articles}\label{sec:articles} \begin{commands} \command{DeclareAcroArticle}[\marg{name}\marg{default}] This command can be used to define properties and options analoguous to - the indefnite article which have been defined this way: + the indefinite article which have been defined this way: \end{commands} \begin{sourcecode} \DeclareAcroArticle{indefinite}{a} @@ -2164,7 +2187,7 @@ \section{Articles}\label{sec:articles} This command tells the template that the article \meta{foo} should be used. \end{commands} -Section~\vref{sec:own-acronym-commands} has an example of how this can be used +Section~\vref{sec:own-acronym-commands} has examples of how this can be used to define definite articles and commands that make use of them like this: \begin{example} \dacs{hadopi} \par @@ -2209,13 +2232,13 @@ \section{Translations}\label{sec:translations} The existing keywords had been shown in table~\vref{tab:translations}. \section{Properties}\label{sec:new-properties} -As you know from section~\ref{sec:decl-acronyms-other} \acro\ comes with -quiute a number of predefined properties for the control of acronyms. -However, there are cases when additional properties would be nice to have and -to use. \acro\ provides this command: +As you know from section~\ref{sec:decl-acronyms-other} \acro\ comes with quite +a number of predefined properties which control various aspects of +acronyms. However, there are cases when additional properties would be nice to +have and to use. It can be done with the following command: \begin{commands} - \command{DeclareAcroProperty}[\sarg\qarg\barg\uarg\marg{name}] - This defines the new property \meta{name}. The command has four optional + \command{DeclareAcroProperty}[\sarg\arg{?}\arg{!}\arg{|}\arg{>}\marg{name}] + This defines the new property \meta{name}. The command has five optional arguments most of which you probably never need. \par The optional star \sym{*} ensures that each acronym gets a \emph{unique} value for the property. \par @@ -2224,11 +2247,18 @@ \section{Properties}\label{sec:new-properties} \code{false} and when it is used without value (not an empty value!) then \code{true} is assumed. \par The optional exclamation mark \sym{!} creates a \emph{mandatory} - property. An error if raised if an acronym does not set it. \par + property. An error is raised if an acronym does not set it. \par The optional pipe \sym{|} creates a \emph{static} property which means its value is written to an auxiliary file and read in again at begin - document. Once set the value is the same throughout the document - \command{DeclareAcroPropertyAlias}[\sarg\qarg\barg\uarg\marg{name1}\marg{name2}] + document. Once set the value is the same throughout the document. \par + The optional greater as symbol\sinceversion{3.2} \sym{>} creates a + \emph{display} property. This additionally defines the two boolean + options \meta{name}\code{/}\option{display} and + \module{list}\code{/}\meta{name}\code{/}\option{display}, both initially + set to true. If these options are set to false the acronym commands or + the list act as if the property \meta{name} has not been set. The + \property{foreign} property is an example. + \command{DeclareAcroPropertyAlias}[\sarg\arg{?}\arg{!}\arg{|}\arg{>}\marg{name1}\marg{name2}] This newly declares property \meta{name1} and makes it an alias of property \meta{name2}. This means that \meta{name1} gets the same value that \meta{name2} has unless it is set explicitly. Property \meta{name2}