diff options
Diffstat (limited to 'macros/latex/contrib')
24 files changed, 2266 insertions, 1471 deletions
diff --git a/macros/latex/contrib/acro/README b/macros/latex/contrib/acro/README index 5bfe1ce016..17088db3c0 100644 --- a/macros/latex/contrib/acro/README +++ b/macros/latex/contrib/acro/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the ACRO package v2.10d 2019/12/30 +the ACRO package v2.11 2020/01/11 Typeset Acronyms @@ -8,7 +8,7 @@ Clemens Niederberger Web: https://bitbucket.org/cgnieder/acro E-Mail: contact@mychemistry.eu -------------------------------------------------------------------------- -Copyright 2012--2019 Clemens Niederberger +Copyright 2012--2020 Clemens Niederberger This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 @@ -23,7 +23,9 @@ This work has the LPPL maintenance status `maintained'. The Current Maintainer of this work is Clemens Niederberger. -------------------------------------------------------------------------- The acro package consists of the files - - acro.sty, acro_en.tex, acro_en.pdf, README, acro.history +- acro.sty, acro.definitions.tex, acro.cfg +- acro-manual.tex, acro-manual.pdf, acro-manual.cls +- acro.history, README -------------------------------------------------------------------------- If you have any ideas, questions, suggestions or bugs to report, please feel free to contact me. diff --git a/macros/latex/contrib/acro/acro-manual.cls b/macros/latex/contrib/acro/acro-manual.cls new file mode 100644 index 0000000000..e65b3a635b --- /dev/null +++ b/macros/latex/contrib/acro/acro-manual.cls @@ -0,0 +1,389 @@ +% -------------------------------------------------------------------------- +% the ACRO package +% +% Typeset Acronyms +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://bitbucket.org/cgnieder/acro/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2011--2020 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% The acro package consists of the files +% - acro.sty, acro.definitions.tex, acro.cfg +% - acro-manual.tex, acro-manual.pdf, acro-manual.cls +% - acro.history, README +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +\ProvidesClass{acro-manual}[2020/01/11] + +\LoadClass[load-preamble,add-index]{cnltx-doc} +\RequirePackage{imakeidx} +\RequirePackage[utf8]{inputenc} + +\usepackage{acro} +\acsetup{ + single = true , + accsupp = true , + index = true , + use-barriers = true , + hyperref = true , + log = true +} + +\setcnltx{ + package = {acro} , + info = {Typeset Acronyms and other Abbreviations} , + authors = Clemens Niederberger , + email = contact@mychemistry.eu , + url = https://bitbucket.org/cgnieder/acro/ , + abstract = {% + \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}.\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, + acfp, Acfp, acfplike, aciftrailing, acl, Acl, aclp, Aclp, acp, Acp, + acpsingle, Acpsingle, AcroRegisterTrailing, acs, Acs, acsingle, + Acsingle, acsp, Acsp, acspace, acreset, acresetall, acsetup, + DeclareAcroCommand, DeclareAcronym, DeclareAcroExtraStyle, + DeclareAcroFirstStyle, DeclareAcroListHeading, + DeclareAcroListStyle, DeclareAcroPageStyle, DeclarePseudoAcroCommand, + iac, Iac, iaca, Iaca, iacs, Iacs, iacl, Iacl, iacf, Iacf, iacflike, + Iacflike, + NewAcroCommand, NewPseudoAcroCommand, + printacronyms, + ProvideAcroCommand, ProvideAcroEnding, ProvidePseudoAcroCommand, + RenewAcroCommand, RenewPseudoAcroCommand + } , + add-silent-cmds = { + addcolon, DeclareInstance, babelhyphen, ExplSyntaxOff, ExplSyntaxOn, nato, + NewDocumentCommand, newlist, ny, setlist + } , + index-setup = { level = \section , headers={\indexname}{\indexname} } +} + +\colorlet{property}{blue} +\newidxcmd\property{\code{\textcolor{property}{#1}}}[ (property)] +\newrobustcmd*\prop{\@ifstar{\cnltx@prop@star}{\cnltx@prop@nostar}} + +\newrobustcmd*\cnltx@prop@star{% + \cnltx@ifdash + {\cnltx@prop@aux*\meta} + {\cnltx@prop@aux*\marg}% +} +\newrobustcmd*\cnltx@prop@nostar{% + \cnltx@ifdash + {\cnltx@prop@aux{}\meta} + {\cnltx@prop@aux{}\marg}% +} +\newcommand*\cnltx@prop@aux[4]{% + \code{\property#1{#3}\cnltx@isvalue#2{#4}}% +} + +\newrobustcmd*\propis{% + \@ifstar + {\cnltx@propis*} + {\cnltx@propis{}}% +} +\newrobustcmd*\cnltx@propis[1]{% + \cnltx@ifdash + {\cnltx@prop@aux{#1}\@firstofone} + {\cnltx@prop@aux{#1}\Marg}% +} +\newrobustcmd*\choiceprop{% + \@ifstar + {\cnltx@choiceprop@star} + {\cnltx@choiceprop@nostar}% +} +\def\cnltx@choiceprop@star#1#2{% + \code{\property*{#1}\cnltx@isvalue\choices{#2}}} +\def\cnltx@choiceprop@nostar#1#2{% + \code{\property{#1}\cnltx@isvalue\choices{#2}}} +\newcommand*\boolprop{% + \@ifstar + {\cnltx@boolprop@star} + {\cnltx@boolprop@nostar}% +} +\def\cnltx@boolprop@star#1{\choiceprop*{#1}{\default{true},false}} +\def\cnltx@boolprop@nostar#1{\choiceprop{#1}{\default{true},false}} + +\newenvironment{properties} + {% + \def\propert{\@cnltx@option@item\property}% + \def\propval{\@cnltx@option@item\prop}% + \def\proplit{\@cnltx@option@item\propis}% + \def\propchoice{\@cnltx@option@item\choiceprop}% + \def\propbool{\@cnltx@option@item\boolprop}% + \cnltxlist + } + {\endcnltxlist} + +\protected\def\@versionstar{\raisebox{-.25em}{*}} +\newcommand\versionstar{\texorpdfstring{\@versionstar}{*}} + +\newcommand*\TF{\textcolor{red}{\uline{\code{\textcolor{cs}{\textit{TF}}}}}} + +\RequirePackage{fontawesome} +\RequirePackage{datetime2} +\DTMsetup{useregional=numeric,datesep=/} +\newrobustcmd*\acro@add@version[2]{% + \csdef{ac@ver@#2}{% + \DTMdate{#1}% + \csgdef{ac@ver@#2used}{}% + \csdef{ac@ver@#2}{\DTMdate{#1}}% + }% +} + +\newrobustcmd*\ac@date[1]{\ifcsdef{ac@ver@#1used}{}{ (\csuse{ac@ver@#1})}} +\newrobustcmd*\ac@ifnew[1]{\ifcsstring{c_acro_version_tl}{#1}} +\newrobustcmd*\ac@NEW{\faStarO\ New} + +\renewrobustcmd*\sinceversion[1]{% + \ac@ifnew{#1}% + {\cnltx@version@note{\textcolor{red}{\ac@NEW}}}% + {\cnltx@version@note{\GetTranslation{cnltx-introduced}~#1\ac@date{#1}}}% +} +\renewrobustcmd*\changedversion[1]{% + \cnltx@version@note{\GetTranslation{cnltx-changed}~#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}{}% +} + +\RenewDocumentEnvironment{commands}{} + {% + \cnltx@set@catcode_{12}% + \let\command\cnltx@command + \cnltxlist + } + {\endcnltxlist} + +\RequirePackage{tcolorbox,xsimverb} +\tcbuselibrary{skins,breakable} +\tcbset{enhanced,enhanced jigsaw} + +\newtcolorbox{bewareofthedog}{ + colback = white , + colframe = red , + underlay={% + \path[draw=none] + (interior.south west) + rectangle node[red]{\Huge\bfseries !} + ([xshift=-4mm]interior.north west); + }% +} + +\newtcolorbox{cnltxcode}[1][]{ + boxrule = 1pt , + colback = cnltxbg , + colframe = cnltx , + arc = 5pt , + beforeafter skip = .5\baselineskip ,% + #1% +} + +\newcommand*\acroman@readoptions[1]{% + \catcode`\^^M=13 + \acroman@read@options{#1}% +} + +\begingroup +\catcode`\^^M=13 +\gdef\acroman@read@options#1#2^^M{% + \ifblank{#2}{}{\acroman@read@options@#2}% + #1% + \XSIMfilewritestart*{\jobname.tmp}% +}% +\endgroup +\def\acroman@read@options@[#1]{\pgfqkeys{/cnltx}{#1}} + +\RenewDocumentEnvironment{sourcecode}{} + {% + \begingroup + \acroman@readoptions{% + \endgroup + \setlength\cnltx@sidebysidewidth + {\dimexpr .45\columnwidth -\lst@xleftmargin -\lst@xrightmargin\relax}% + \expanded{% + \noexpand\lstset{ + style=cnltx, + \ifboolexpe{ bool {cnltx@sidebyside} and not bool {cnltx@codeonly} } + {linewidth=\cnltx@sidebysidewidth,}{}% + \expandonce\cnltx@local@listings@options + }% + }% + \XSIMgobblechars{2}% + }% + } + {% + \XSIMfilewritestop + \cnltxcode[breakable]% + \lstinputlisting[style=cnltx]{\jobname.tmp}% + \endcnltxcode + } + +\RenewDocumentEnvironment{example}{} + {% + \begingroup + \acroman@readoptions{% + \endgroup + \setlength\cnltx@sidebysidewidth + {\dimexpr .45\columnwidth -\lst@xleftmargin -\lst@xrightmargin\relax}% + \expanded{% + \noexpand\lstset{ + style=cnltx, + \ifboolexpe{ bool {cnltx@sidebyside} and not bool {cnltx@codeonly} } + {linewidth=\cnltx@sidebysidewidth,}{}% + \expandonce\cnltx@local@listings@options + }% + }% + \XSIMgobblechars{2}% + }% + } + {% + \XSIMfilewritestop + \ifbool{cnltx@sidebyside} + {% + \cnltxcode + \noindent + \minipage[c]{\cnltx@sidebysidewidth}% + \cnltx@pre@source@hook + \lstinputlisting[style=cnltx] {\jobname.tmp}% + \cnltx@after@source@hook + \endminipage\hfill + \minipage[c]{\cnltx@sidebysidewidth}% + \cnltx@pre@example@hook + \input {\jobname.tmp}% + \cnltx@after@example@hook + \endminipage + } + {% + \cnltxcode[breakable]% + \cnltx@pre@source@hook + \lstinputlisting{\jobname.tmp}% + \cnltx@after@source@hook + \tcblower + \cnltx@pre@example@hook + \input {\jobname.tmp}% + \cnltx@after@example@hook + }% + \endcnltxcode + } + +\RequirePackage[ + backend=biber, + style=cnltx, + sortlocale=en_US, + indexing=cite]{biblatex} +\RequirePackage{csquotes,varioref} +\defbibheading{bibliography}{\section{References}} + +\RequirePackage[biblatex]{embrac}[2012/06/29] +\ChangeEmph{[}[,.02em]{]}[.055em,-.08em] +\ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em] + +% additional packages: +\RequirePackage{longtable,array,booktabs,enumitem,amssymb} + +\newcommand*\h[1]{\textcolor{cnltx}{\textbf{#1}}} +\newcommand*\mailto[1]{\texttt{\href{mailto:#1}{#1}}} + +\ProvideAcroEnding {possessive} {'s} {'s} + +\acro@add@version{2012-06-22}{0.1} +\acro@add@version{2012-06-23}{0.1a} +\acro@add@version{2012-06-24}{0.1b} +\acro@add@version{2012-06-24}{0.1c} +\acro@add@version{2012-06-24}{0.2} +\acro@add@version{2012-06-25}{0.2a} +\acro@add@version{2012-06-25}{0.3} +\acro@add@version{2012-06-27}{0.3a} +\acro@add@version{2012-06-29}{0.3b} +\acro@add@version{2012-07-16}{0.3c} +\acro@add@version{2012-07-23}{0.3d} +\acro@add@version{2012-07-24}{0.3e} +\acro@add@version{2012-09-28}{0.4} +\acro@add@version{2012-10-07}{0.4a} +\acro@add@version{2012-11-30}{0.5} +\acro@add@version{2012-12-14}{0.6} +\acro@add@version{2013-01-02}{0.6a} +\acro@add@version{2013-01-16}{1.0} +\acro@add@version{2013-01-26}{1.1} +\acro@add@version{2013-01-29}{1.1a} +\acro@add@version{2013-02-09}{1.2} +\acro@add@version{2013-04-04}{1.2a} +\acro@add@version{2013-05-06}{1.3} +\acro@add@version{2013-05-09}{1.3a} +\acro@add@version{2013-05-30}{1.3b} +\acro@add@version{2013-06-16}{1.3c} +\acro@add@version{2013-07-08}{1.3d} +\acro@add@version{2013-08-07}{1.3e} +\acro@add@version{2013-08-27}{1.4} +\acro@add@version{2013-09-02}{1.4a} +\acro@add@version{2013-09-24}{1.4b} +\acro@add@version{2013-11-04}{1.4c} +\acro@add@version{2013-11-22}{1.4d} +\acro@add@version{2013-12-18}{1.5} +\acro@add@version{2015-02-26}{1.6} +\acro@add@version{2015-04-08}{1.6a} +\acro@add@version{2015-05-10}{1.6b} +\acro@add@version{2015-08-16}{2.0} +\acro@add@version{2015-08-25}{2.0a} +\acro@add@version{2015-08-29}{2.0b} +\acro@add@version{2015-09-05}{2.1} +\acro@add@version{2015-10-03}{2.2} +\acro@add@version{2016-01-07}{2.2a} +\acro@add@version{2016-01-21}{2.2b} +\acro@add@version{2016-02-02}{2.2c} +\acro@add@version{2016-03-14}{2.3} +\acro@add@version{2016-03-25}{2.4} +\acro@add@version{2016-04-14}{2.4a} +\acro@add@version{2016-05-03}{2.4b} +\acro@add@version{2016-05-25}{2.5} +\acro@add@version{2016-05-26}{2.5a} +\acro@add@version{2016-05-30}{2.5b} +\acro@add@version{2016-07-20}{2.6} +\acro@add@version{2016-08-13}{2.6a} +\acro@add@version{2016-08-13}{2.6b} +\acro@add@version{2016-08-16}{2.6c} +\acro@add@version{2016-08-30}{2.6d} +\acro@add@version{2016-09-04}{2.6e} +\acro@add@version{2017-01-22}{2.7} +\acro@add@version{2017-02-09}{2.7a} +\acro@add@version{2017-06-21}{2.7b} +\acro@add@version{2017-08-28}{2.7c} +\acro@add@version{2018-01-30}{2.8} +\acro@add@version{2019-02-17}{2.9} +\acro@add@version{2019-09-23}{2.10} +\acro@add@version{2019-10-02}{2.10a} +\acro@add@version{2019-10-06}{2.10b} +\acro@add@version{2019-10-12}{2.10c} +\acro@add@version{2019-12-30}{2.10d} +\acro@add@version{2020-01-11}{2.11} + +\endinput diff --git a/macros/latex/contrib/acro/acro-manual.pdf b/macros/latex/contrib/acro/acro-manual.pdf Binary files differnew file mode 100644 index 0000000000..8d5fded23e --- /dev/null +++ b/macros/latex/contrib/acro/acro-manual.pdf diff --git a/macros/latex/contrib/acro/acro_en.tex b/macros/latex/contrib/acro/acro-manual.tex index 9aaea47d3c..43462b6bac 100644 --- a/macros/latex/contrib/acro/acro_en.tex +++ b/macros/latex/contrib/acro/acro-manual.tex @@ -1,8 +1,8 @@ +% !arara: pdflatex: { interaction: nonstopmode } +% !arara: biber % arara: pdflatex: { interaction: nonstopmode } -% arara: biber % arara: pdflatex: { interaction: nonstopmode } % arara: pdflatex: { interaction: nonstopmode } -% !arara: pdflatex: { interaction: nonstopmode } % -------------------------------------------------------------------------- % the ACRO package % @@ -10,10 +10,10 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: http://www.mychemsitry.eu/forums/forum/acro/ +% Web: https://bitbucket.org/cgnieder/acro/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2011--2019 Clemens Niederberger +% Copyright 2011--2020 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -28,73 +28,17 @@ % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- % The acro package consists of the files -% - acro.sty, acro_en.tex, acro_en.pdf, README +% - acro.sty, acro.definitions.tex, acro.cfg +% - acro-manual.tex, acro-manual.pdf, acro-manual.cls +% - acro.history, README % -------------------------------------------------------------------------- % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -\documentclass[load-preamble+]{cnltx-doc} - -\usepackage[utf8]{inputenc} -\usepackage[single,macros,accsupp,index]{acro} -\setcnltx{ - package = {acro} , - info = {Typeset Acronyms and other Abbreviations} , - authors = Clemens Niederberger , - email = contact@mychemistry.eu , - url = https://bitbucket.org/cgnieder/acro/ , - abstract = {% - \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}.\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, - acfp, Acfp, acfplike, aciftrailing, acl, Acl, aclp, Aclp, acp, Acp, - AcroRegisterTrailing, acs, Acs, acsingle, Acsingle, acsp, Acsp, acspace, - acreset, acresetall, acsetup, - DeclareAcroCommand, DeclareAcronym, DeclareAcroExtraStyle, - DeclareAcroFirstStyle, DeclareAcroListHeading, - DeclareAcroListStyle, DeclareAcroPageStyle, DeclarePseudoAcroCommand, - iac, Iac, iaca, Iaca, iacs, Iacs, iacl, Iacl, iacf, Iacf, iacflike, - Iacflike, - NewAcroCommand, NewPseudoAcroCommand, - printacronyms, - ProvideAcroCommand, ProvideAcroEnding, ProvidePseudoAcroCommand, - RenewAcroCommand, RenewPseudoAcroCommand - } , - add-silent-cmds = { - addcolon, DeclareInstance, babelhyphen, ExplSyntaxOff, ExplSyntaxOn, nato, - NewDocumentCommand, newlist, ny, setlist - } , - index-setup = { level = \section , headers={\indexname}{\indexname} } -} - -\acsetup{ - use-barriers = true , - hyperref = true , - log -} - -\usepackage{varioref} - -\defbibheading{bibliography}{\section{References}} - -\usepackage{csquotes} - -\usepackage[biblatex]{embrac}[2012/06/29] -\ChangeEmph{[}[,.02em]{]}[.055em,-.08em] -\ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em] - -\usepackage{filecontents} +\documentclass{acro-manual} \addbibresource{\jobname.bib} +\addbibresource{cnltx.bib} \begin{filecontents}{\jobname.bib} @online{wikipedia, author = {Wikipedia}, @@ -120,15 +64,6 @@ } \end{filecontents} -% additional packages: -\usepackage{longtable,array,booktabs,enumitem,amssymb} - -\newcommand*\wikipedia{%\libertineGlyph{W.alt}\kern-.055em -\textsc{Wikipedia}} -\newcommand*\h[1]{\textcolor{cnltx}{\textbf{#1}}} - -\ProvideAcroEnding {possessive} {'s} {'s} - % declare acronyms \DeclareAcronym{cd} { @@ -136,7 +71,6 @@ long = Compact Disc , short-format = \scshape } -\let\ctan\relax \DeclareAcronym{ctan} { short = ctan , @@ -145,7 +79,6 @@ pdfstring = CTAN , accsupp = CTAN } -\def\ctan{\acs{ctan}} \DeclareAcronym{ecu} { short = ECU , @@ -174,7 +107,6 @@ long-plural = , class = city } -\let\lppl\relax \DeclareAcronym{lppl} { short = lppl , @@ -184,7 +116,6 @@ accsupp = LPPL , index-cmd = \csname @gobble\endcsname } -\def\lppl{\acs{lppl}} \DeclareAcronym{MP} { short = MP , @@ -244,26 +175,11 @@ long-indefinite = an } +% because the mannual does not activate the `macros' option: +\newcommand*\nato{\ac{nato}} +\newcommand*\ny{\ac{ny}} -\makeatletter -\protected\def\@versionstar{\raisebox{-.25em}{*}} -\newcommand\versionstar{\texorpdfstring{\@versionstar}{*}} -\makeatother - -\newcommand*\latin{\textit} - -\makeatletter -\newcommand*\TF{\textcolor{red}{\uline{\code{\textcolor{cs}{\textit{TF}}}}}} -\renewenvironment{commands} - {% - \cnltx@set@catcode_{12}% - \let\command\cnltx@command - \cnltxlist - } - {\endcnltxlist} -\makeatother - -\newcommand*\mailto[1]{\texttt{\href{mailto:#1}{#1}}} +\newcommand*\latin[1]{\textit{#1}} \begin{document} \section{Licence and Requirements} @@ -275,95 +191,98 @@ \pkg{zref-abspage}\footnote{\CTANurl{oberdiek}} and \needpackage{translations}~\cite{pkg:translations}. - - \section{Basics} \subsection{Creating New Acronyms} 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. + The basic command for declaring an acronym where \meta{id} is a unique + string identifying the acronym. Per default behaviour this is case + sensitive which means \code{id} is different from \code{ID}, for example. + There is an option \option{case-sensitive}\sinceversion{2.11} to change + this. \end{commands} This command understands a number of keys which are listed below. Some of them are not described immediately but at appropriate places in the documentation. -\begin{options} +\begin{properties} %% short - \keyval{short}{text}\Default! - 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 - sets it accordingly. A warning will be written to the log then. + \propval{short}{text}\Default! + The short form of the acronym. \emph{This property is required}: an + acronym must have a short form. If this is set it \emph{must} be set as + first option! If another property is set first and notices the + \property{short} property missing it assumes that the \acs{id} should be + used as short version and 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 - have a description. + \propval{long}{text}\Default! + The long form of the acronym. \emph{This property is required}: an + acronym must have a description. %% short-plural - \keyval{short-plural}{text}\Default{s} + \propval{short-plural}{text}\Default{s} The plural ending appended to the short form. %% short-plural-form - \keyval{short-plural-form}{text} + \propval{short-plural-form}{text} 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} + \propval{long-plural}{text}\Default{s} The plural ending appended to the long form. %% long-plural-form - \keyval{long-plural-form}{text} + \propval{long-plural-form}{text} 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} + \propval{alt-plural}{text}\Default{s} The\sinceversion{2.0} plural ending appended to the alternative form. %% alt-plural-form - \keyval{alt-plural-form}{text} + \propval{alt-plural-form}{text} The\sinceversion{2.0} plural alternative form of the acronym; replaces the alternative form when used instead of appending the plural ending. %% foreign-plural - \keyval{foreign-plural}{text}\Default{s} + \propval{foreign-plural}{text}\Default{s} The\sinceversion{2.9} plural ending appended to the foreign form. %% foreign-plural-form - \keyval{foreign-plural-form}{text} - Plural\sinceversion{2.9} lforeign form of the acronym; replaces the + \propval{foreign-plural-form}{text} + Plural\sinceversion{2.9} foreign form of the acronym; replaces the foreign form when used instead of appending the plural ending. %% list - \keyval{list}{text} + \propval{list}{text} If specified this will be written in the list as description instead of the long form. %% short-indefinite - \keyval{short-indefinite}{text}\Default{a} + \propval{short-indefinite}{text}\Default{a} Indefinite article for the short form. %% long-indefinite - \keyval{long-indefinite}{text}\Default{a} + \propval{long-indefinite}{text}\Default{a} Indefinite article for the long form. %% long-pre - \keyval{long-pre}{text} + \propval{long-pre}{text} \meta{text} is prepended to the long form in the text but not in the list of acronyms. %% long-post - \keyval{long-post}{text} + \propval{long-post}{text} \meta{text} is appended to the long form in the text but not in the list of acronyms. %% long-post - \keyval{post}{text} + \propval{post}{text} \meta{text}\sinceversion{2.8} is appended to the acronym in the text but not in the list of acronyms. %% alt - \keyval{alt}{text} + \propval{alt}{text} Alternative short form. %% alt-indefinite - \keyval{alt-indefinite}{text}\Default{a} + \propval{alt-indefinite}{text}\Default{a} Indefinite article for the alternative form. %% extra - \keyval{extra}{text} + \propval{extra}{text} Extra information to be added in the list of acronyms. %% foreign - \keyval{foreign}{original long form} + \propval{foreign}{original long form} Can be useful when dealing with acronyms in foreign languages, see section~\vref{ssec:foreign} for details. %% foreign-lang - \keyval{foreign-lang}{language} + \propval{foreign-lang}{language} \sinceversion{2.3}The \pkg{babel}~\cite{pkg:babel} or \pkg{polyglossia}~\cite{pkg:polyglossia} language of the foreign form. This language is used to wrap the entry with @@ -371,80 +290,92 @@ documentation. \pkg{polyglossia} is loaded. You'll need to take care that the corresponding language is loaded by \pkg{babel} or \pkg{polyglossia}. %% single - \keyval{single}{text} + \propval{single}{text} \sinceversion{2.3}If provided \meta{text} will be used instead of the long form if the acronym is only used a single time \emph{and} the option \keyis{single}{true} is active. %% sort - \keyval{sort}{text} + \propval{sort}{text} If used the acronym will be sorted according to this key instead of its \acs{id}. %% class - \keyval{class}{csv list} + \propval{class}{csv list} The\changedversion{2.4} class(es) the acronym belongs to. %% cite - \keylit{cite}{\oarg{prenote}\oarg{postnote}\marg{citation keys}} + \proplit-{cite}{\oarg{prenote}\oarg{postnote}\marg{citation keys}} A citation that is printed to the acronym according to an option explained later. + %% before-citation + \propval{before-citation}{code} + \meta{code}\sinceversion{2.11} is inserted directly before \property{cite} + and \emph{ony when} \property{cite} is used. + %% after-citation + \propval{after-citation}{code} + \meta{code}\sinceversion{2.11} is inserted directly after \property{cite} + and \emph{ony when} \property{cite} is used. %% short-format - \keyval{short-format}{\TeX{} code} + \propval{short-format}{\TeX{} code} The format used for the short form of the acronym. %% long-format - \keyval{long-format}{\TeX{} code} + \propval{long-format}{\TeX{} code} The format used for the long form of the acronym. %% short-format - \keyval{alt-format}{\TeX{} code} + \propval{alt-format}{\TeX{} code} The\sinceversion{2.10} format used for the alternative form of the acronym. If this is not given the short format will be used. %% first-long-format - \keyval{first-long-format}{\TeX{} code} + \propval{first-long-format}{\TeX{} code} The format used for the first long form of the acronym as set with \cs{ac}, \cs{acf} or \cs{acflike} and their uppercase, plural and indefinite forms. %% single-format - \keyval{single-format}{\TeX{} code} + \propval{single-format}{\TeX{} code} \sinceversion{2.3}The format used for the acronym if the acronym is only used a single time. %% first-style - \keychoice{first-style}{default,empty,square,short,long,reversed,footnote,sidenote,% + \propchoice{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}} + \proplit-{pdfstring}{\Marg{\meta{pdfstring}/\meta{plural ending}}} \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} + \propval{accsupp}{text} Sets the \code{ActualText} key as presented by the \pkg{accsupp} package for the acronym. %% tooltip - \keyval{tooltip}{text} + \propval{tooltip}{text} \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} + \propval{index-sort}{text} 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. + the value of the \property{sort} property. This key allows to set an + individual sorting option for the index. See section~\vref{ssec:index} + for details. %% index - \keyval{index}{text} + \propval{index}{text} 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} + \propval{index-cmd}{control sequence} 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} +\end{properties} + +\begin{bewareofthedog} + In its simplest form an acronym needs a short and a long form. Please note + that both keys \emph{must} be set and that the \property{short} property + \emph{must} always be the \emph{first} property that is set. +\end{bewareofthedog} -In its simplest form an acronym needs a short and a long form. Please note -that both keys \emph{must} be set and that the \option{short} key \emph{must} -always be the \emph{first} key that is set. \begin{sourcecode} % preamble: \DeclareAcronym{test}{ @@ -455,8 +386,8 @@ always be the \emph{first} key that is set. This creates the acronym ``\acs{test}'' with the \acs{id} ``test'' and the long form ``\acl{test}.'' -The \option{format} key allows you to choose a specific format for the short -form of an acronym: +The \property{short-format} key allows you to choose a specific format for the +short form of an acronym: \begin{sourcecode} % preamble: \DeclareAcronym{ot}{ @@ -467,7 +398,7 @@ form of an acronym: \end{sourcecode} The short form now looks like this: \acs{ot}. -The \option{cite} key needs a bit explaining. It expects arguments like the +The \property{cite} key needs a bit explaining. It expects arguments like the standard \cs*{cite} command, \latin{i.e.}, two optional arguments setting the \meta{prenote} and \meta{postnote} and one mandatory argument setting the citation key. @@ -545,7 +476,7 @@ Acronyms are used with one of the following commands: same as \cs{acl} but capitalizes first letter. %% \command{aca}[\sarg\marg{id}] - \h{a}lternative short form as specified in the \option{alt} key of + \h{a}lternative short form as specified in the \property{alt} property of \cs{DeclareAcronym}; if it hasn't been specified this is identical to \cs{acs}. \command{Aca}[\sarg\marg{id}] @@ -619,17 +550,17 @@ may be formed differently. And third, other languages can have other plural endings. For these reasons \cs{DeclareAcronym} can get the following keys: -\begin{options} - \keyval{short-plural}{text}\Default{s} +\begin{properties} + \propval{short-plural}{text}\Default{s} The plural ending of the short form. - \keyval{long-plural}{text}\Default{s} + \propval{long-plural}{text}\Default{s} The plural ending of the long form. - \keyval{long-plural-form}{text} + \propval{long-plural-form}{text} An alternative plural form for the long form. -\end{options} +\end{properties} These keys are optional. If they're not used, the default setting is -\code{s}. If you use \option{long-plural-form} the long form will be replaced -by the specified plural form when necessary. +\code{s}. If you use \property{long-plural-form} the long form will be +replaced by the specified plural form when necessary. Suppose we define the following acronyms: \begin{sourcecode} @@ -677,10 +608,10 @@ For a more general view on endings please read section \subsection{Alternative Short Forms} For some acronyms it might be useful to have alternative forms. For this \cs{DeclareAcronym} has another key: -\begin{options} - \keyval{alt}{text} - Alternative short form. -\end{options} +\begin{properties} + \propval{alt}{text} + Alternative short form. +\end{properties} \begin{example} % preamble: % \DeclareAcronym{jpg}{ @@ -699,10 +630,10 @@ is formatted in the same way. Of course you can print a list of acronyms where their meaning is explained. Sometimes it can be useful to add additional information there. This is done with another key to \cs{DeclareAcronym}: -\begin{options} - \keyval{extra}{text} +\begin{properties} + \propval{extra}{text} Additional information for the list of acronyms. -\end{options} +\end{properties} These information will only be displayed in the list. See section~\vref{sec:print_lists} for the impact of the following example. @@ -730,16 +661,16 @@ the acronyms stem from another language than the document language, \ac{ecu} \end{example} That's why I decided to add the following properties: -\begin{options} - \keyval{foreign}{original long form} +\begin{properties} + \propval{foreign}{original long form} A description for an acronym originating in another language than the document language. - \keyval{foreign-lang}{language} + \propval{foreign-lang}{language} \sinceversion{2.3}The \pkg{babel}~\cite{pkg:babel} or \pkg{polyglossia}~\cite{pkg:polyglossia} language of the foreign form. This language is used to wrap the entry with \cs*{foreignlanguage}\marg{language}. -\end{options} +\end{properties} Here is the definition of the above mentioned \ac{ecu} acronym: \begin{sourcecode} @@ -750,10 +681,10 @@ Here is the definition of the above mentioned \ac{ecu} acronym: foreign-lang = english } \end{sourcecode} -As you have seen this adds the \option{foreign} entry to the first appearance -of an acronym. It is also added in parentheses to the list of acronyms after -the \option{long} entry. Actually the entry there is the argument to the -following command: +As you have seen this adds the \property{foreign} entry to the first +appearance of an acronym. It is also added in parentheses to the list of +acronyms after the \property{long} entry. Actually the entry there is the +argument to the following command: \begin{commands} \command{acroenparen}[\marg{argument}] Places \meta{argument} in parentheses: \cs{acroenparen}\Marg{example}: @@ -769,11 +700,18 @@ Unlike many other languages\footnote{Let's better say: unlike the other article is not determined by the grammatical case, gender or number but by the pronounciation of the following word. This means that the short and the long form of an acronym can have different indefinite articles. For these cases -\acro\ offers the keys \option{short-indefinite}, \option{alt-indefinite} and -\option{long-indefinite} whose default is \code{a}. For every lowercase -singular command two alternatives exist, preceded by \code{i} and \code{I}, -respectively, which output the lowercase and uppercase version of the -corresponding indefinite article. +\acro\ offers the following keys: +\begin{properties} + \propval{short-indefinite}{article}\Default{a} + Indefinite article for the short form. + \propval{alt-indefinite}{article}\Default{a} + Indefinite article for the alternative form. + \propval{long-indefinite}{article}\Default{a} + Indefinite article for the long form. +\end{properties} +For every lowercase singular command two alternatives exist, preceded by +\code{i} and \code{I}, respectively, which output the lowercase and uppercase +version of the corresponding indefinite article. \begin{example} % preamble: @@ -810,8 +748,9 @@ The following options control the behaviour of the uppercasing commands: \subsection{Simulating the First Appearance}\label{sec:simul-first-appe} 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. +\option{first-style} option (or \property{first-style} property) 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 @@ -839,6 +778,10 @@ option is active. Write acronym as if it were used only a single time. \command{Acsingle}[\sarg\marg{id}] Uppercase form of \cs{acsingle}. + \command{acpsingle}[\sarg\marg{id}] + Plural\sinceversion{2.11} form of \cs{acsingle}. + \command{Acsingle}[\sarg\marg{id}] + Plural\sinceversion{2.11} form of \cs{Acsingle}. \end{commands} \begin{example}[side-by-side] @@ -850,10 +793,10 @@ 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}{csv list} +\begin{properties} + \propval{class}{csv list} Associated\changedversion{2.4} class(es) for an acronym. -\end{options} +\end{properties} 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 @@ -948,11 +891,11 @@ bookmarks. \command{acpdfstringplural}[\marg{id}] Access the plural form of the text string used in \acs{pdf} bookmarks. \end{commands} -\begin{options} - \keylit{pdfstring}{\Marg{\meta{pdfstring}/\meta{plural ending}}} +\begin{properties} + \proplit-{pdfstring}{\Marg{\meta{pdfstring}/\meta{plural ending}}} Key for \cs{DeclareAcronym} to declare a custom text string for \acs{pdf} bookmarks. The plural ending can be set optionally. -\end{options} +\end{properties} For example the \acs{pdf} acronym used in the title for this section is defined as follows: @@ -968,7 +911,7 @@ as follows: \subsubsection{Accessibility Support} -The last example also demonstrates the \option{accsupp} key. The idea is to +The last example also demonstrates the \property{accsupp} key. The idea is to have something different visible in the \acs{pdf} file compared to what you get when you select and copy the corresponding string. In the example visible string is a lowercase \code{pdf} in small caps while the string copied is an @@ -976,17 +919,21 @@ uppercase \code{PDF}. For this to work you need to use the \emph{package option} \option{accsupp}, too, which will load the package \pkg{accsupp} if it isn't loaded by the user -already. Then the key \option{accsupp} will set the \code{ActualText} +already. Then the key \property{accsupp} will set the \code{ActualText} property of \cs*{BeginAccSupp}. Please refer to \pkg{accsupp}'s documentation for details. To see its effect copy \ac{pdf} and paste it into a text file. You should get uppercase letters instead of lowercase ones. -\begin{options} - \keyval{accsupp}{text} +\begin{properties} + \propval{accsupp}{text} 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{properties} +\begin{options} + \keybool{accsupp}\Default{false} + Activate \acro's accessibility support. \end{options} \subsubsection{Tooltips} @@ -1008,10 +955,10 @@ macro. the \acs{pdf}, the second being the tooltip description text. \end{options} -For using this with acronyms they have a property \option{tooltip} which can +For using this with acronyms they have a property \property{tooltip} which can be used inside \cs{DeclareAcronym} for specifying the description text of the tooltip. If the \option{tooltip} package option is used but the property is -not set for an acronym then the \option{long} property is used instead. +not set for an acronym then the \property{long} property is used instead. If an acronym is used inside of another acronym then the tooltips of the ``inner'' acronyms are disabled. @@ -1020,11 +967,11 @@ If an acronym is used inside of another acronym then the tooltips of the \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 -acronym. The short versions appearing there are formatted according to the -chosen format of the corresponding acronym, of course. +\code{\meta{sort}@\meta{short}} if the \property{sort} property has been set, +\code{\meta{index-sort}@\meta{short}} if the property \property{index-sort} +has been set, or \meta{index} if the property \property{index} has been set +for the specific acronym. The short versions appearing there are formatted +according to the chosen format of the corresponding acronym, of course. This document demonstrates the feature. You can find every acronym that has been declared in the index. In order to allow flexibility the indexing @@ -1085,22 +1032,38 @@ that, this fact shouldn't cause too much inconvenience. \section{Options and Customization}\label{sec:customization} \subsection{General Options} There are a few options which change the general behaviour of \acro. -\default{Underlined} values are used if no value is given. +\default{Underlined} values are used if no value is given. \acro's package +options are best set onyl via the setup command: +\begin{commands} + \command{acsetup}[\marg{options}] + Set up \acro. +\end{commands} +\begin{bewareofthedog} + They \emph{might} work as package options to \cs*{usepackage} as well but + \emph{I do not recommend it} and will likely remove this in a future + version~3 of \acro. +\end{bewareofthedog} + \begin{options} - %% - % \keychoice{version}{0,1}\Default{1} - % Provide backwards compatibility for documents set with \acro\ in a version - % prior to v1.0. - %% \keychoice{messages}{silent,loud}\Default{loud} 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 printed in the list. %% + \keybool{case-sensitive}\Default{true} + If\sinceversion{2.11} set to \code{true} the \meta{id} as used in + \cs{DeclareAcronym} or \cs{ac} is read \emph{case sensitive}, + \latin{i.e.}, \code{id} would differ from \code{ID}. This is \acro's + default behaviour. + + If set to \code{true} \code{id} would be the same as \code{ID}. This can + be useful when acronyms are used in page headings for example. + %% \keychoice{single-form}{long,short,alt,first}\Default{long} \sinceversion{2.0}Determines how a single appearance of an acronym is printed if \keyis{single}{true} has been chosen. @@ -1153,12 +1116,12 @@ There are a few options which change the general behaviour of \acro. declaration. %% \keybool{display-foreign}\Default{true} - When set to \code{false} any \option{foreign} option is ignored and + When set to \code{false} any \property{foreign} property is ignored and foreign forms are not displayed. %% \keychoice{cite}{\default{all},first,none}\Default{first} \changedversion{2.4b}This option decides whether citations that are added - via \option{cite} are added to each first, every or no appearance of an + via \property{cite} are added to each first, every or no appearance of an acronym. If \code{first} is chosen, the option \keyis{single}{true} is active and an acronym appears only once it still will get the citation. %% @@ -1219,17 +1182,9 @@ There are a few options which change the general behaviour of \acro. If\sinceversion{2.10} set to \code{true} commands like \cs{Ac} or \cs{Acp} will uppercase the first letter of the short version. \end{options} - -All options of this and the following sections can be set via the setup command: -\begin{commands} - \command{acsetup}[\marg{options}] - Set up \acro\ anywhere in the document. Or separate package loading from - setup. -\end{commands} -They might work as package options as well but \emph{I do not recommend it}. \begin{example} - % with \acsetup{macros} + % with \acsetup{macros} activated: we could have used these before: \nato, \ny \end{example} @@ -1247,7 +1202,7 @@ possible output forms of the acronyms. The same for the long forms. %% \keyval{foreign-format}{format}\Default - The format for the \option{foreign} entry when it appears as part of the + The format for the \property{foreign} entry when it appears as part of the first appearance of an acronym. %% \keyval{single-format}{format}\Default @@ -1274,7 +1229,7 @@ possible output forms of the acronyms. \option{long-format} after this one will overwrite it again. %% \keyval{list-foreign-format}{format}\Default{\cs{acroenparen}} - \label{key:list-foreign-format}The format for the \option{foreign} entry + \label{key:list-foreign-format}The format for the \property{foreign} entry as it appears in the list. This may be code that ends with a macro that takes a mandatory argument. %% @@ -1312,9 +1267,7 @@ possible output forms of the acronyms. long: \acf{ny} \\ \acsetup{first-style=reversed} reversed: \acf{ny} \\ - \acsetup{ - first-style = footnote-reversed - } + \acsetup{first-style = footnote-reversed} footnote-reversed: \acf{ny} \end{example} @@ -1714,19 +1667,19 @@ commands\footnote{Which is why you need to use them inside an expl3 The \cs*{acro_get:n} command is called the first macro that is called by \cs*{acro_use:n} which for example enables conditionals to test for certain acronym properties. - \command*{acro_get_property:nn}[\TF\ \marg{id} \marg{property} \marg{true} + \command*{acro_property_get:nn}[\TF\ \marg{id} \marg{property} \marg{true} \marg{false}] - Fetches\sinceversion{2.7} the property \meta{property} of the acronym + Fetches\changedversion{2.11} the property \meta{property} of the acronym \meta{id} and stores it in a tokenlist variable \cs*{l__acro_\meta{property}_tl} where all dashes in the property names are replaced with underscores. \meta{true} is placed in the input stream if the property had been set, \meta{false} otherwise. - \command*{acro_get_property:nn}[\marg{id} \marg{property}] - Like\sinceversion{2.7} \cs*{acro_get_property:nn}\TF, but without the + \command*{acro_property_get:nn}[\marg{id} \marg{property}] + Like\changedversion{2.11} \cs*{acro_property_get:nn}\TF, but without the \meta{true} and \meta{false} arguments. - \command*{acro_if_property:nn}[\TF\ \marg{id} \marg{property} \marg{true} + \command*{acro_property_if_set:nn}[\TF\ \marg{id} \marg{property} \marg{true} \marg{false}] - Checks\sinceversion{2.7} if the property \meta{property} of the acronym + Checks\changedversion{2.11} if the property \meta{property} of the acronym \meta{id} is set and places \meta{true} is in the input stream if yes and \meta{false} otherwise. \end{commands} @@ -1803,14 +1756,14 @@ The command's syntax and what it does is as follows: \end{itemize} It also defines the acronym properties \begin{itemize} - \item \option*{short-\meta{name}}, - \item \option*{short-\meta{name}-form}, - \item \option*{alt-\meta{name}}, - \item \option*{alt-\meta{name}-form}, - \item \option*{long-\meta{name}}, - \item \option*{long-\meta{name}-form}, - \item \option*{foreign-\meta{name}} and - \item \option*{foreign-\meta{name}-form}. + \item \property*{short-\meta{name}}, + \item \property*{short-\meta{name}-form}, + \item \property*{alt-\meta{name}}, + \item \property*{alt-\meta{name}-form}, + \item \property*{long-\meta{name}}, + \item \property*{long-\meta{name}-form}, + \item \property*{foreign-\meta{name}} and + \item \property*{foreign-\meta{name}-form}. \end{itemize} Additionally it defines a setup macro as described in section~\vref{sec:defining-own-acronym}, @@ -1895,7 +1848,7 @@ styles now are defined via the following macro: \meta{options} are the option settings for the corresponding template. \end{commands} -\begin{table}[hbp] +\begin{table} \centering \caption{Available List Templates and Their Options}\label{tab:list-templates} \begin{tabular}{*{4}{>{\ttfamily}l}} @@ -2046,7 +1999,7 @@ defined: } \end{sourcecode} -\begin{table}[hbp] +\begin{table}[!h] \centering \caption{Available First Style Templates and Their Options}\label{tab:first-templates} \begin{tabular}{*{4}{>{\ttfamily}l}} @@ -2140,7 +2093,7 @@ defined: } \end{sourcecode} -\begin{table}[hbp] +\begin{table} \centering \caption{Available Page Number Style Templates and Their Options}\label{tab:page-templates} @@ -2182,4 +2135,6 @@ letter (category code~11). \printacronyms +\printbibliography + \end{document} diff --git a/macros/latex/contrib/acro/acro.definitions.tex b/macros/latex/contrib/acro/acro.definitions.tex new file mode 100644 index 0000000000..61c781a269 --- /dev/null +++ b/macros/latex/contrib/acro/acro.definitions.tex @@ -0,0 +1,574 @@ +% -------------------------------------------------------------------------- +% the ACRO package +% +% Typeset Acronyms +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://bitbucket.org/cgnieder/acro/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2011--2020 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% The acro package consists of the files +% - acro.sty, acro.definitions.tex, acro.cfg +% - acro-manual.tex, acro-manual.pdf, acro-manual.cls +% - acro.history, README +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +\ExplSyntaxOn + +% document commands: +\NewDocumentCommand \DeclareAcronym {mm} + { \acro_declare_acronym:nn {#1} {#2} } + +\NewDocumentCommand \acsetup { m } + { + \tl_if_blank:nF {#1} + { \keys_set:nn {acro} {#1} } + \ignorespaces + } + +\NewDocumentCommand \ProvideAcroEnding {mmm} + { \acro_provide_ending:nnn {#1} {#2} {#3} } + +\NewDocumentCommand \AcroRegisterTrailing {mm} + { \acro_register_trailing_token:Nn #1 {#2} } + +\NewDocumentCommand \DeclareAcroTranslation {mm} + { \acro_declare_translation:nn {#1} {#2} } + +\DeclareExpandableDocumentCommand \acifused { m } + { \acro_if_acronym_used:nTF {#1} } + +\NewDocumentCommand \acresetall {} + { \acro_reset_all: } + +\NewDocumentCommand \acuseall {} + { \acro_mark_all_as_used: } + +\NewDocumentCommand \acreset { > { \SplitList {,} } m } + { \ProcessList {#1} { \acro_reset:n } \ignorespaces } + +\NewDocumentCommand \acuse { > { \SplitList {,} } m } + { \ProcessList {#1} { \acro_mark_as_used:n } \ignorespaces } + +\NewDocumentCommand \acfirstupper {m} + { \acro_first_upper_case:n {#1} } + +\NewExpandableDocumentCommand \aciffirst {+m+m} + { \bool_if:NTF \l__acro_first_instance_bool {#1} {#2} } + +\NewDocumentCommand \acdot {} { \acro_dot: } +\NewDocumentCommand \acspace {} { \acro_space: } + +\NewDocumentCommand \acbarrier {} + { \acro_barrier: } + +\NewDocumentCommand \acswitchoff {} + { \acro_switch_off: } + +\NewDocumentCommand \acswitchon {} + { \acro_switch_on: } + +\NewDocumentCommand \printacronyms { O{} } + { \acro_print_acronyms:n {#1} } + +% -------------------------------------------------------------------------- +% styles +% #1: name +% #2: template +% #3: settings +\NewDocumentCommand \DeclareAcroFirstStyle {mmm} + { \acro_declare_first_style:nnn {#1} {#2} {#3} } + +\NewDocumentCommand \DeclareAcroExtraStyle {mmm} + { \acro_declare_extra_style:nnn {#1} {#2} {#3} } + +\NewDocumentCommand \DeclareAcroPageStyle {mmm} + { \acro_declare_page_style:nnn {#1} {#2} {#3} } + +\NewDocumentCommand \DeclareAcroListHeading {mm} + { \acro_declare_list_heading:nn {#1} {#2} } + +\NewDocumentCommand \DeclareAcroListStyle {mmm} + { \acro_declare_list_style:nnn {#1} {#2} {#3} } + +% -------------------------------------------------------------------------- +% endings: +\ProvideAcroEnding {plural} {s} {s} + +% -------------------------------------------------------------------------- +% use acronyms: +% automatic: +\NewAcroCommand \ac + { \acro_use:n {#1} } + +\NewAcroCommand \Ac + { + \acro_first_upper: + \acro_use:n {#1} + } + +\NewAcroCommand \iac + { + \acro_indefinite: + \acro_use:n {#1} + } + +\NewAcroCommand \Iac + { + \acro_first_upper: + \acro_indefinite: + \acro_use:n {#1} + } + +\NewAcroCommand \acp + { + \acro_plural: + \acro_use:n {#1} + } + +\NewAcroCommand \Acp + { + \acro_plural: + \acro_first_upper: + \acro_use:n {#1} + } + +\NewAcroCommand \acsingle + { + \acro_get:n {#1} + \acro_single:n {#1} + } + +\NewAcroCommand \acpsingle + { + \acro_get:n {#1} + \acro_plural: + \acro_single:n {#1} + } + +\NewAcroCommand \Acsingle + { + \acro_get:n {#1} + \acro_first_upper: + \acro_single:n {#1} + } + +\NewAcroCommand \Acpsingle + { + \acro_get:n {#1} + \acro_first_upper: + \acro_plural: + \acro_single:n {#1} + } + +% short: +\NewAcroCommand \acs + { \acro_short:n {#1} } + +\NewAcroCommand \Acs + { + \acro_first_upper: + \acro_short:n {#1} + } + +\NewAcroCommand \iacs + { + \acro_indefinite: + \acro_short:n {#1} + } + +\NewAcroCommand \Iacs + { + \acro_first_upper: + \acro_indefinite: + \acro_short:n {#1} + } + +\NewAcroCommand \acsp + { + \acro_plural: + \acro_short:n {#1} + } + +\NewAcroCommand \Acsp + { + \acro_first_upper: + \acro_plural: + \acro_short:n {#1} + } + +% alt: +\NewAcroCommand \aca + { \acro_alt:n {#1} } + +\NewAcroCommand \Aca + { + \acro_first_upper: + \acro_alt:n {#1} + } + +\NewAcroCommand \iaca + { + \acro_indefinite: + \acro_alt:n {#1} + } + +\NewAcroCommand \Iaca + { + \acro_first_upper: + \acro_indefinite: + \acro_alt:n {#1} + } + +\NewAcroCommand \acap + { + \acro_plural: + \acro_alt:n {#1} + } + +\NewAcroCommand \Acap + { + \acro_first_upper: + \acro_plural: + \acro_alt:n {#1} + } + +% long: +\NewAcroCommand \acl + { \acro_long:n {#1} } + +\NewAcroCommand \Acl + { + \acro_first_upper: + \acro_long:n {#1} + } + +\NewAcroCommand \iacl + { + \acro_indefinite: + \acro_long:n {#1} + } + +\NewAcroCommand \Iacl + { + \acro_first_upper: + \acro_indefinite: + \acro_long:n {#1} + } + +\NewAcroCommand \aclp + { + \acro_plural: + \acro_long:n {#1} + } + +\NewAcroCommand \Aclp + { + \acro_plural: + \acro_first_upper: + \acro_long:n {#1} + } + +% first: +\NewAcroCommand \acf + { \acro_first:n {#1} } + +\NewAcroCommand \Acf + { + \acro_first_upper: + \acro_first:n {#1} + } + +\NewAcroCommand \iacf + { + \acro_indefinite: + \acro_first:n {#1} + } + +\NewAcroCommand \Iacf + { + \acro_first_upper: + \acro_indefinite: + \acro_first:n {#1} + } + +\NewAcroCommand \acfp + { + \acro_plural: + \acro_first:n {#1} + } + +\NewAcroCommand \Acfp + { + \acro_plural: + \acro_first_upper: + \acro_first:n {#1} + } + +% first-like: +\NewPseudoAcroCommand \acflike + { \acro_first_like:nn {#1} {#2} } + +\NewPseudoAcroCommand \iacflike + { + \acro_indefinite: + \acro_first_like:nn {#1} {#2} + } + +\NewPseudoAcroCommand \Iacflike + { + \acro_first_upper: + \acro_indefinite: + \acro_first_like:nn {#1} {#2} + } + +\NewPseudoAcroCommand \acfplike + { + \acro_plural: + \acro_first_like:nn {#1} {#2} + } + +% -------------------------------------------------------------------------- +% first appearance styles: +\DeclareAcroFirstStyle {default} {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 = [] } + +\DeclareAcroFirstStyle {plain} {inline} + { + brackets = false , + between = -- + } + +\DeclareAcroFirstStyle {plain-reversed} {inline} + { + brackets = false , + between = -- , + reversed = true + } + +\DeclareAcroFirstStyle {footnote} {note} + { } + +\DeclareAcroFirstStyle {footnote-reversed} {note} + { reversed = true } + +\DeclareAcroFirstStyle {sidenote} {note} + { note-command = \sidenote {#1} } + +\DeclareAcroFirstStyle {sidenote-reversed} {note} + { + note-command = \sidenote {#1} , + reversed = true + } + +\DeclareAcroFirstStyle {empty} {note} + { use-note = false } + +% -------------------------------------------------------------------------- +% extra info appearance styles: +\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 + } + +% -------------------------------------------------------------------------- +% page number appearance styles: +\DeclareAcroPageStyle {default} {inline} + { + punct = true , + punct-symbol = . + } + +\DeclareAcroPageStyle {plain} {inline} + { punct = false } + +\DeclareAcroPageStyle {comma} {inline} + { punct = true } + +\DeclareAcroPageStyle {paren} {inline} + { + brackets=true , + punct-symbol = ~ + } + +\DeclareAcroPageStyle {none} {inline} + { display = false } + +% -------------------------------------------------------------------------- +% list heading styles: +\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} + +% -------------------------------------------------------------------------- +% list styles: +\DeclareAcroListStyle {description} {list} + { } + +\DeclareAcroListStyle {toc} {list-of} + { } + +\DeclareAcroListStyle {lof} {list-of} + { style = lof } + +\DeclareAcroListStyle {tabular} {table} + { table = tabular } + +\DeclareAcroListStyle {longtable} {table} + { table = longtable } + +\DeclareAcroListStyle {extra-tabular} {extra-table} + { table = tabular } + +\DeclareAcroListStyle {extra-longtable} {extra-table} + { table = longtable } + +\DeclareAcroListStyle {extra-tabular-rev} {extra-table} + { + table = tabular , + reverse = true + } + +\DeclareAcroListStyle {extra-longtable-rev} {extra-table} + { + table = longtable , + reverse = true + } + +% -------------------------------------------------------------------------- +% register some tokens to be checked for: +\AcroRegisterTrailing . {dot} +\AcroRegisterTrailing - {dash} +\AcroRegisterTrailing \babelhyphen {babel-hyphen} + +\acsetup { activate-trailing-tokens = dot } + +% -------------------------------------------------------------------------- +% translations: +% list name +\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 +\DeclareAcroTranslation {acronym-page-name} + { + Fallback = p. , + English = p. , + German = S. , + Portuguese = p. + } + +% pages name +\DeclareAcroTranslation {acronym-pages-name} + { + Fallback = pp. , + English = pp. , + German = S. , + Portuguese = pp. + } + +% following page +\DeclareAcroTranslation {acronym-next-page} + { + Fallback = f. , + English = f. , + German = f. , + Portuguese = s. + } + +% following pages +\DeclareAcroTranslation {acronym-next-pages} + { + Fallback = ff. , + English = ff. , + German = ff. , + Portuguese = ss. + } + +\file_input_stop: diff --git a/macros/latex/contrib/acro/acro.history b/macros/latex/contrib/acro/acro.history index b20f53427a..d6aa883d6d 100644 --- a/macros/latex/contrib/acro/acro.history +++ b/macros/latex/contrib/acro/acro.history @@ -1,33 +1,35 @@ -% -------------------------------------------------------------------------- -% the ACRO package -% -% Typeset Acronyms -% -% -------------------------------------------------------------------------- -% Clemens Niederberger -% Web: https://bitbucket.org/cgnieder/acro/ -% E-Mail: contact@mychemistry.eu -% -------------------------------------------------------------------------- -% Copyright 2011--2019 Clemens Niederberger -% -% This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3 -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This work has the LPPL maintenance status `maintained'. -% -% The Current Maintainer of this work is Clemens Niederberger. -% -------------------------------------------------------------------------- -% The acro package consists of the files -% - acro.sty, acro_en.tex, acro_en.pdf, README -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- +-------------------------------------------------------------------------- +the ACRO package + + Typeset Acronyms + +-------------------------------------------------------------------------- +Clemens Niederberger +Web: https://bitbucket.org/cgnieder/acro/ +E-Mail: contact@mychemistry.eu +-------------------------------------------------------------------------- +Copyright 2011--2020 Clemens Niederberger + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3 +of this license or (at your option) any later version. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is Clemens Niederberger. +-------------------------------------------------------------------------- +The acro package consists of the files +- acro.sty, acro.definitions.tex, acro.cfg +- acro-manual.tex, acro-manual.pdf, acro-manual.cls +- acro.history, README +-------------------------------------------------------------------------- +If you have any ideas, questions, suggestions or bugs to report, please +feel free to contact me. +-------------------------------------------------------------------------- 2012/06/22 v0.1 - first public release 2012/06/23 v0.1a - bug fix, added `strict' and `macros' option and creation of shortcut macros @@ -270,3 +272,11 @@ 2019/12/30 v2.10d - fix issue #76 - fix issue #141 - fix issue #143 +2020/01/11 v2.11 - new commands \acpsingle and \Acpsingle + - fix issues with optional arguments of the `cite' property + - new properties `before-citation' and `after-citation' + - new options `config-file-name' and `config-file-extension' + - new option `case-sensitive' + - rename the manual file and use a dedicated class for the + manual + - prefer lazy boolean evaluation when possible diff --git a/macros/latex/contrib/acro/acro.sty b/macros/latex/contrib/acro/acro.sty index 03d0121d5f..98425268c1 100644 --- a/macros/latex/contrib/acro/acro.sty +++ b/macros/latex/contrib/acro/acro.sty @@ -8,7 +8,7 @@ % Web: https://bitbucket.org/cgnieder/acro/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2011--2019 Clemens Niederberger +% Copyright 2011--2020 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -23,17 +23,39 @@ % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- % The acro package consists of the files -% - acro.sty, acro_en.tex, acro_en.pdf, acro.history, README +% - acro.sty, acro.definitions.tex, acro.cfg +% - acro-manual.tex, acro-manual.pdf, acro-manual.cls +% - acro.history, README % -------------------------------------------------------------------------- % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -\RequirePackage{expl3,xparse,l3keys2e,xtemplate,etoolbox} +\RequirePackage{expl3,xparse,xtemplate,l3keys2e} +\RequirePackage{etoolbox} % for the document hooks + +\ExplSyntaxOn + +\tl_const:Nn \c_acro_date_tl {2020/01/11} +\tl_const:Nn \c_acro_version_major_number_tl {2} +\tl_const:Nn \c_acro_version_minor_number_tl {11} +\tl_const:Nn \c_acro_version_subrelease_tl {} +\tl_const:Nx \c_acro_version_number_tl + { + \c_acro_version_major_number_tl . + \c_acro_version_minor_number_tl + } +\tl_const:Nx \c_acro_version_tl + { + \c_acro_version_number_tl + \c_acro_version_subrelease_tl + } +\tl_const:Nn \c_acro_info_tl {Typeset~ Acronyms} + \ProvidesExplPackage {acro} - {2019/12/30} - {2.10d} - {Typeset Acronyms} + {\c_acro_date_tl} + {\c_acro_version_tl} + {\c_acro_info_tl} % -------------------------------------------------------------------------- % warning and error messages: @@ -108,6 +130,195 @@ } % -------------------------------------------------------------------------- +% temporary variables +\tl_new:N \l__acro_tmpa_tl +\tl_new:N \l__acro_tmpb_tl +\tl_new:N \l__acro_tmpc_tl +\prop_new:N \l__acro_tmpa_prop +\prop_new:N \l__acro_tmpb_prop +\seq_new:N \l__acro_tmpa_seq +\seq_new:N \l__acro_tmpb_seq +\int_new:N \l__acro_tmpa_int +\int_new:N \l__acro_tmpb_int +\int_new:N \l__acro_tmpc_int +\int_new:N \l__acro_tmpd_int + +% -------------------------------------------------------------------------- +% variants of kernel commands +\cs_generate_variant:Nn \quark_if_no_value:nTF {V} +\cs_generate_variant:Nn \tl_put_right:Nn {NV,Nv} +\cs_generate_variant:Nn \tl_if_eq:nnT {V} +\cs_generate_variant:Nn \tl_if_eq:nnF {V} +\cs_generate_variant:Nn \seq_use:Nnnn {c} +\cs_generate_variant:Nn \seq_gset_split:Nnn {c} +\cs_generate_variant:Nn \seq_set_split:Nnn {NnV} +\cs_generate_variant:Nn \seq_if_in:NnT {NV} +\cs_generate_variant:Nn \seq_if_in:NnTF {Ne} +\cs_generate_variant:Nn \prop_put:Nnn {NnV,cnx,cnv} +\cs_generate_variant:Nn \prop_get:NnNTF {cnc} +\cs_generate_variant:Nn \prop_get:NnNF {cn,cnc} +\cs_generate_variant:Nn \prop_get:NnN {cnc} +\cs_generate_variant:Nn \cs_generate_variant:Nn {c} +\cs_generate_variant:Nn \str_case:nn {V} + +% -------------------------------------------------------------------------- +% variables: +\bool_new:N \l__acro_acc_supp_bool +\bool_new:N \l__acro_addto_index_bool +\bool_new:N \l__acro_capitalize_list_bool +\bool_new:N \g__acro_case_sensitive_bool +\bool_new:N \l__acro_citation_all_bool +\bool_new:N \l__acro_citation_first_bool +\bool_set_true:N \l__acro_citation_first_bool +\bool_new:N \l__acro_create_macros_bool +\bool_new:N \l__acro_custom_alt_format_bool +\bool_new:N \l__acro_custom_long_format_bool +\bool_new:N \l__acro_custom_short_format_bool +\bool_new:N \l__acro_extra_punct_bool +\bool_new:N \l__acro_extra_use_brackets_bool +\bool_new:N \g__acro_first_acronym_declared_bool +\bool_new:N \l__acro_first_instance_bool +\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_first_use_brackets_bool +\bool_new:N \l__acro_first_upper_bool +\bool_new:N \l__acro_following_page_bool +\bool_new:N \l__acro_following_pages_bool +\bool_new:N \l__acro_foreign_bool +\bool_set_true:N \l__acro_foreign_bool +\bool_new:N \l__acro_group_citation_bool +\bool_new:N \l__acro_hyperref_loaded_bool +\bool_new:N \l__acro_hyperref_use_bool +\bool_new:N \l__acro_include_endings_format_bool +\bool_new:N \l__acro_indefinite_bool +\bool_new:N \l__acro_in_list_bool +\bool_new:N \l__acro_is_included_bool +\bool_new:N \l__acro_is_excluded_bool +\bool_new:N \l__acro_list_all_pages_bool +\bool_set_true:N \l__acro_list_all_pages_bool +\bool_new:N \l__acro_list_reverse_long_extra_bool +\bool_new:N \l__acro_log_acronyms_bool +\bool_new:N \l__acro_log_acronyms_verbose_bool +\bool_new:N \l__acro_mark_as_used_bool +\bool_new:N \g__acro_mark_first_as_used_bool +\bool_new:N \l__acro_override_list_format_bool +\bool_new:N \l__acro_page_brackets_bool +\bool_new:N \l__acro_page_display_bool +\bool_new:N \l__acro_page_punct_bool +\bool_new:N \l__acro_place_label_bool +\bool_new:N \l__acro_print_only_used_bool +\bool_set_true:N \l__acro_print_only_used_bool +\bool_new:N \g__acro_rerun_bool +\bool_new:N \g__acro_reset_at_barrier_bool +\bool_new:N \l__acro_silence_bool +\bool_new:N \l__acro_single_use_bool +\bool_new:N \l__acro_sort_bool +\bool_set_true:N \l__acro_sort_bool +\bool_new:N \l__acro_strict_bool +\bool_new:N \l__acro_trailing_tokens_bool +\bool_new:N \l__acro_tooltip_bool +\bool_new:N \l__acro_tooltip_inside_bool +\bool_new:N \l__acro_upper_indefinite_bool +\bool_new:N \l__acro_upper_short_bool +\bool_new:N \l__acro_use_acronyms_bool +\bool_set_true:N \l__acro_use_acronyms_bool +\bool_new:N \l__acro_use_barrier_bool +\bool_new:N \g__acro_use_barriers_bool +\bool_new:N \l__acro_use_ending_form_bool +\bool_new:N \l__acro_use_note_bool +\bool_new:N \l__acro_xspace_bool + +\str_new:N \l__acro_current_id_str + +\tl_new:N \l__acro_list_entries_tl +\tl_new:N \l__acro_endings_tl +\tl_new:N \l__acro_trailing_tokens_tl +\tl_new:N \l__acro_included_classes_tl +\tl_new:N \l__acro_excluded_classes_tl +\tl_new:N \l__acro_ignore_tl +\tl_new:N \l__acro_default_indefinite_tl +\tl_set:Nn \l__acro_default_indefinite_tl {a} +\tl_new:N \l__acro_foreign_sep_tl +\tl_new:N \l__acro_extra_instance_tl +\tl_set:Nn \l__acro_extra_instance_tl {default} +\tl_new:N \l__acro_page_instance_tl +\tl_set:Nn \l__acro_page_instance_tl {none} +\tl_new:N \l__acro_page_name_tl +\tl_new:N \l__acro_pages_name_tl +\tl_new:N \l__acro_next_page_tl +\tl_new:N \l__acro_next_pages_tl +\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_heading_cmd_tl +\tl_set:Nn \l__acro_list_heading_cmd_tl {section*} +\tl_new:N \l__acro_list_name_tl +\tl_new:N \l__acro_list_before_tl +\tl_new:N \l__acro_list_after_tl +\tl_new:N \l__acro_custom_short_format_tl +\tl_new:N \l__acro_first_between_tl +\tl_new:N \l__acro_citation_connect_tl +\tl_new:N \l__acro_between_group_connect_citation_tl +\tl_new:N \l__acro_extra_brackets_tl +\tl_new:N \l__acro_extra_punct_tl +\tl_new:N \l__acro_first_brackets_tl +\tl_new:N \l__acro_page_punct_tl +\tl_new:N \l__acro_page_brackets_tl +\tl_new:N \l__acro_last_page_tl +\tl_new:N \l__acro_current_page_tl +\tl_new:N \l__acro_list_table_tl +\tl_new:N \l__acro_list_table_spec_tl +\tl_new:N \l__acro_acc_supp_tl +\tl_new:N \l__acro_acc_supp_options_tl +\tl_new:N \l__acro_label_prefix_tl +\tl_set:Nn \l__acro_label_prefix_tl {ac:} +\tl_new:N \l__acro_index_short_tl +\tl_new:N \l__acro_first_instance_tl +\tl_set:Nn \l__acro_first_instance_tl {default} +\tl_new:N \l__acro_short_tl +\tl_new:N \l__acro_short_format_tl +\tl_new:N \l__acro_list_short_format_tl +\tl_new:N \l__acro_alt_tl +\tl_new:N \l__acro_alt_format_tl +\tl_new:N \l__acro_long_tl +\tl_new:N \l__acro_long_format_tl +\tl_new:N \l__acro_list_long_format_tl +\tl_new:N \l__acro_single_form_tl +\tl_set:Nn \l__acro_single_form_tl {long} +\tl_new:N \l__acro_extra_format_tl +\tl_new:N \l__acro_foreign_format_tl +\tl_new:N \l__acro_foreign_list_format_tl +\tl_set:Nn \l__acro_foreign_list_format_tl { \acroenparen } +\tl_new:N \l__acro_index_format_tl + +\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} + +\int_new:N \g__acro_barrier_int + +\seq_new:N \l__acro_endings_seq +\seq_new:N \l__acro_actions_seq +\seq_new:N \g__acro_declared_acronyms_seq + +\prop_new:N \l__acro_citation_prop +\prop_new:N \l__acro_citation_pre_prop +\prop_new:N \l__acro_citation_post_prop +\prop_new:N \l__acro_pdfstring_alt_prop +\prop_new:N \l__acro_pdfstring_short_prop +\prop_new:N \g__acro_properties_prop +\prop_new:N \l__acro_trailing_tokens_prop +\prop_new:N \l__acro_trailing_actions_prop +\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 + +% -------------------------------------------------------------------------- % logging: \prg_new_conditional:Npnn \acro_if_log: {p,T,F,TF} { @@ -116,9 +327,6 @@ { \prg_return_false: } } -\bool_new:N \l__acro_log_acronyms_bool -\bool_new:N \l__acro_log_acronyms_verbose_bool - \keys_define:nn {acro} { log .choice: , @@ -138,7 +346,7 @@ \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} } } + { \__acro_write_log:nn {#2} { \__acro_property_get:nn {#3} {#1} } } \cs_new:Npn \__acro_ending_log_entry:nn #1#2 { @@ -159,10 +367,10 @@ | ~ \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} {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} \\ @@ -183,6 +391,8 @@ | \__acro_write_log_property:nnn {#1} {foreign-lang} {foreign_lang} \\ | \\ | \__acro_write_log_property:nnn {#1} {cite} {citation} \\ + | \__acro_write_log_property:nnn {#1} {before-citation} {before_citation} \\ + | \__acro_write_log_property:nnn {#1} {after-citation} {after_citation} \\ | \__acro_write_log_property:nnn {#1} {index} {index} \\ | \__acro_write_log_property:nnn {#1} {index-sort} {index_sort} \\ | \\ @@ -207,7 +417,6 @@ | \__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} \\ ================================================= } @@ -274,172 +483,6 @@ } % -------------------------------------------------------------------------- -% temporary variables -\tl_new:N \l__acro_tmpa_tl -\tl_new:N \l__acro_tmpb_tl -\tl_new:N \l__acro_tmpc_tl -\prop_new:N \l__acro_tmpa_prop -\prop_new:N \l__acro_tmpb_prop -\seq_new:N \l__acro_tmpa_seq -\seq_new:N \l__acro_tmpb_seq -\int_new:N \l__acro_tmpa_int -\int_new:N \l__acro_tmpb_int -\int_new:N \l__acro_tmpc_int -\int_new:N \l__acro_tmpd_int - -% -------------------------------------------------------------------------- -% variants of kernel commands -\cs_generate_variant:Nn \quark_if_no_value:nTF { V } -\cs_generate_variant:Nn \tl_put_right:Nn { NV, Nv } -\cs_generate_variant:Nn \tl_if_eq:nnT { V } -\cs_generate_variant:Nn \tl_if_eq:nnF { V } -\cs_generate_variant:Nn \seq_use:Nnnn { c } -\cs_generate_variant:Nn \seq_gset_split:Nnn { c } -\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:NnNTF { cnc } -\cs_generate_variant:Nn \prop_get:NnNF { cn, cnc } -\cs_generate_variant:Nn \prop_get:NnN { cnc } -\cs_generate_variant:Nn \cs_generate_variant:Nn { c } -\cs_generate_variant:Nn \str_case:nn { V } - -% -------------------------------------------------------------------------- -% variables: -\bool_new:N \l__acro_silence_bool -\bool_new:N \l__acro_mark_as_used_bool -\bool_new:N \g__acro_mark_first_as_used_bool -\bool_new:N \l__acro_use_single_bool -\bool_new:N \l__acro_print_only_used_bool -\bool_set_true:N \l__acro_print_only_used_bool -\bool_new:N \l__acro_hyperref_loaded_bool -\bool_new:N \l__acro_use_hyperref_bool -\bool_new:N \l__acro_xspace_bool -\bool_new:N \l__acro_custom_short_format_bool -\bool_new:N \l__acro_custom_alt_format_bool -\bool_new:N \l__acro_custom_long_format_bool -\bool_new:N \l__acro_override_list_format_bool -\bool_new:N \l__acro_strict_bool -\bool_new:N \l__acro_create_macros_bool -\bool_new:N \l__acro_first_upper_bool -\bool_new:N \l__acro_upper_short_bool -\bool_new:N \l__acro_indefinite_bool -\bool_new:N \l__acro_upper_indefinite_bool -\bool_new:N \l__acro_foreign_bool -\bool_set_true:N \l__acro_foreign_bool -\bool_new:N \l__acro_sort_bool -\bool_set_true:N \l__acro_sort_bool -\bool_new:N \l__acro_capitalize_list_bool -\bool_new:N \l__acro_citation_all_bool -\bool_new:N \l__acro_citation_first_bool -\bool_set_true:N \l__acro_citation_first_bool -\bool_new:N \l__acro_group_citation_bool -\bool_new:N \l__acro_acc_supp_bool -\bool_new:N \l__acro_tooltip_bool -\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_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 -\bool_new:N \l__acro_new_page_numbering_bool -\bool_new:N \l__acro_first_use_brackets_bool -\bool_new:N \l__acro_first_only_short_bool -\bool_new:N \l__acro_first_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 -\bool_new:N \l__acro_in_list_bool -\bool_new:N \l__acro_place_label_bool -\bool_new:N \l__acro_list_all_pages_bool -\bool_set_true:N \l__acro_list_all_pages_bool -\bool_new:N \g__acro_first_acronym_declared_bool -\bool_new:N \l__acro_include_endings_format_bool -\bool_new:N \l__acro_list_reverse_long_extra_bool -\bool_new:N \l__acro_use_acronyms_bool -\bool_set_true:N \l__acro_use_acronyms_bool - -\tl_new:N \l__acro_ignore_tl -\tl_new:N \l__acro_default_indefinite_tl -\tl_set:Nn \l__acro_default_indefinite_tl {a} -\tl_new:N \l__acro_foreign_sep_tl -\tl_new:N \l__acro_extra_instance_tl -\tl_set:Nn \l__acro_extra_instance_tl {default} -\tl_new:N \l__acro_page_instance_tl -\tl_set:Nn \l__acro_page_instance_tl {none} -\tl_new:N \l__acro_page_name_tl -\tl_new:N \l__acro_pages_name_tl -\tl_new:N \l__acro_next_page_tl -\tl_new:N \l__acro_next_pages_tl -\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_heading_cmd_tl -\tl_set:Nn \l__acro_list_heading_cmd_tl {section*} -\tl_new:N \l__acro_list_name_tl -\tl_new:N \l__acro_list_before_tl -\tl_new:N \l__acro_list_after_tl -\tl_new:N \l__acro_custom_short_format_tl -\tl_new:N \l__acro_first_between_tl -\tl_new:N \l__acro_citation_connect_tl -\tl_new:N \l__acro_between_group_connect_citation_tl -\tl_new:N \l__acro_extra_brackets_tl -\tl_new:N \l__acro_extra_punct_tl -\tl_new:N \l__acro_first_brackets_tl -\tl_new:N \l__acro_page_punct_tl -\tl_new:N \l__acro_page_brackets_tl -\tl_new:N \l__acro_last_page_tl -\tl_new:N \l__acro_current_page_tl -\tl_new:N \l__acro_list_table_tl -\tl_new:N \l__acro_list_table_spec_tl -\tl_new:N \l__acro_acc_supp_tl -\tl_new:N \l__acro_acc_supp_options_tl -\tl_new:N \l__acro_label_prefix_tl -\tl_set:Nn \l__acro_label_prefix_tl { ac: } -\tl_new:N \l__acro_index_short_tl -\tl_new:N \l__acro_first_instance_tl -\tl_set:Nn \l__acro_first_instance_tl {default} - -\tl_new:N \l__acro_short_tl -\tl_new:N \l__acro_short_format_tl -\tl_new:N \l__acro_list_short_format_tl - -\tl_new:N \l__acro_alt_tl -\tl_new:N \l__acro_alt_format_tl - -\tl_new:N \l__acro_long_tl -\tl_new:N \l__acro_list_long_format_tl - -\tl_new:N \l__acro_single_form_tl -\tl_set:Nn \l__acro_single_form_tl {long} - -\tl_new:N \l__acro_extra_format_tl - -\tl_new:N \l__acro_foreign_format_tl -\tl_new:N \l__acro_foreign_list_format_tl -\tl_set:Nn \l__acro_foreign_list_format_tl { \acroenparen } - -\tl_new:N \l__acro_index_format_tl - - -\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 \cs_new:Npn \acro_no_break: { \tex_penalty:D 10000 \scan_stop: } @@ -450,10 +493,13 @@ \cs_new_eq:NN \acro_first_upper_case:n \__acro_first_upper_case:n -\NewDocumentCommand \acfirstupper {m} - { \acro_first_upper_case:n {#1} } - % -------------------------------------------------------------------------- +\tl_new:N \l_acro_config_file_name_tl +\tl_new:N \l_acro_config_file_extension_tl + +\tl_set:Nn \l_acro_config_file_name_tl {acro} +\tl_set:Nn \l_acro_config_file_extension_tl {cfg} + % options: \keys_define:nn {acro} { @@ -463,6 +509,10 @@ messages / loud .code:n = \bool_set_false:N \l__acro_silence_bool , messages .value_required:n = true , + config-file-name .tl_set:N = \l_acro_config_file_name_tl , + config-file-name .initial:n = acro , + config-file-extension .tl_set:N = \l_acro_config_file_extension_tl , + config-file-extension .initial:n = cfg , accsupp .bool_set:N = \l__acro_acc_supp_bool , accsupp-options .tl_set:N = \l__acro_acc_supp_options_tl , tooltip .bool_set:N = \l__acro_tooltip_bool , @@ -472,6 +522,8 @@ xspace .bool_set:N = \l__acro_xspace_bool , % xspace .code:n = \acro_option_deprecated:nn {xspace} {} , strict .bool_set:N = \l__acro_strict_bool , + case-sensitive .bool_set:N = \g__acro_case_sensitive_bool , + case-sensitive .initial:n = true , sort .bool_set:N = \l__acro_sort_bool , short-format .code:n = \tl_set:Nn \l__acro_short_format_tl {#1} @@ -506,7 +558,7 @@ override-list-format .initial:n = true , extra-format .tl_set:N = \l__acro_extra_format_tl , extra-format .value_required:n = true , - single .bool_set:N = \l__acro_use_single_bool , + single .bool_set:N = \l__acro_single_use_bool , single-form .tl_set:N = \l__acro_single_form_tl , single-form .value_required:n = true , first-style .code:n = \acro_set_first_style:n {#1} , @@ -547,7 +599,7 @@ list-heading .value_required:n = true , list-name .tl_set:N = \l__acro_list_name_tl , list-name .value_required:n = true , - hyperref .bool_set:N = \l__acro_use_hyperref_bool , + hyperref .bool_set:N = \l__acro_hyperref_use_bool , only-used .bool_set:N = \l__acro_print_only_used_bool , mark-as-used .choice: , mark-as-used / first .code:n = @@ -604,11 +656,6 @@ } % -------------------------------------------------------------------------- -% setup command: -\NewDocumentCommand \acsetup { m } - { \keys_set:nn {acro} {#1} \ignorespaces } - -% -------------------------------------------------------------------------- % we use xtemplate for different object types and with a different number of % arguments; let's declare functions for usage later so we don't have to % bother @@ -633,7 +680,7 @@ \cs_new_protected:Npn \acro_first_instance:nn #1#2 { - \acro_if_property:nnTF {#1} {first-style} + \acro_property_if_set:nnTF {#1} {first-style} { \tl_set_eq:NN \l__acro_tmpa_tl @@ -663,7 +710,9 @@ \cs_new_protected:Npn \acro_activate_hyperref_support: { - \bool_if:nT { \l__acro_hyperref_loaded_bool && \l__acro_use_hyperref_bool } + \bool_lazy_and:nnT + { \l__acro_hyperref_loaded_bool } + { \l__acro_hyperref_use_bool } { \sys_if_engine_xetex:TF { @@ -680,8 +729,9 @@ % #2: text \cs_new_protected:Npn \__acro_make_link:nn #1#2 { - \bool_if:nTF - { \l__acro_use_hyperref_bool && \l__acro_hyperref_loaded_bool } + \bool_lazy_and:nnTF + { \l__acro_hyperref_use_bool } + { \l__acro_hyperref_loaded_bool } { \acro_hyper_link:nn {#1} { \phantom {#2} } \acro_if_is_single:nTF {#1} @@ -690,7 +740,6 @@ } {#2} } -\cs_generate_variant:Nn \__acro_make_link:Nnn {NnV} \cs_new:Npn \acro_color_link:n #1 { @@ -730,22 +779,18 @@ \str_case:nn {#1} { {long} { - \bool_if:nT - { - \l__acro_first_only_long_bool || - !\l__acro_first_only_short_bool - } + \bool_lazy_or:nnT + { \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 - } + \bool_lazy_or:nnT + { !\l__acro_first_only_long_bool } + { \l__acro_first_only_short_bool } { \acro_soft_upper: \acro_write_indefinite:nn {#2} {short} @@ -758,11 +803,9 @@ \cs_new_protected:Npn \__acro_open_bracket: { - \bool_if:nT - { - !\l__acro_first_only_long_bool && - !\l__acro_first_only_short_bool - } + \bool_lazy_and:nnT + { !\l__acro_first_only_long_bool } + { !\l__acro_first_only_short_bool } { \acro_space: \tl_if_blank:VF \l__acro_first_between_tl @@ -777,11 +820,11 @@ \cs_new_protected:Npn \__acro_close_bracket: { - \bool_if:nT + \bool_lazy_all:nT { - \l__acro_first_use_brackets_bool && - !\l__acro_first_only_short_bool && - !\l__acro_first_only_long_bool + { \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 } } @@ -794,11 +837,9 @@ \str_case:nn {#1} { {long} { - \bool_if:nT - { - \l__acro_first_only_long_bool || - !\l__acro_first_only_short_bool - } + \bool_lazy_or:nnT + { \l__acro_first_only_long_bool } + { !\l__acro_first_only_short_bool } { \group_begin: \bool_set_false:N \l__acro_first_upper_bool @@ -807,11 +848,9 @@ } } {short} { - \bool_if:nT - { - !\l__acro_first_only_long_bool || - \l__acro_first_only_short_bool - } + \bool_lazy_or:nnT + { !\l__acro_first_only_long_bool } + { \l__acro_first_only_short_bool } { \group_begin: \bool_set_false:N \l__acro_first_upper_bool @@ -825,11 +864,11 @@ % #1: id \cs_new_protected:Npn \__acro_foreign_sep:n #1 { - \bool_if:nT + \bool_lazy_all:nT { - \l__acro_foreign_bool && - !\l__acro_first_only_short_bool && - !\l__acro_first_only_long_bool + { \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 } } } @@ -839,11 +878,11 @@ { \acro_if_foreign:nT {#1} { - \bool_if:nT + \bool_lazy_all:nT { - \l__acro_foreign_bool && - !\l__acro_first_only_short_bool && - !\l__acro_first_only_long_bool + { \l__acro_foreign_bool } + { !\l__acro_first_only_short_bool } + { !\l__acro_first_only_long_bool } } { \acro_write_foreign:n {#1} @@ -861,9 +900,9 @@ \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} - \acro_get_property:nnT {#1} {post} + { \acro_cite_if:Nn \l__acro_citation_first_bool {#1} } + \acro_index_if:Nn \l__acro_addto_index_bool {#1} + \acro_property_get:nnT {#1} {post} { \tl_use:N \l__acro_post_tl } } @@ -919,11 +958,6 @@ \__acro_finalize_first:n {#1} } } - -\bool_new:N \l__acro_first_instance_bool - -\NewExpandableDocumentCommand \aciffirst {+m+m} - { \bool_if:NTF \l__acro_first_instance_bool {#1} {#2} } % template for footnotes, sidenotes, ... \cs_new:Npn \__acro_note_command:n #1 {#1} @@ -983,12 +1017,6 @@ \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 { @@ -1046,12 +1074,6 @@ \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 { @@ -1191,13 +1213,14 @@ { \acro_get_abspage_from:N \l__acro_last_page_tl } \int_set:Nn \l__acro_tmpd_int { \acro_get_page_number_from:N \l__acro_last_page_tl } - \bool_if:nTF + \bool_lazy_and:nnTF { \int_compare_p:nNn { \l__acro_tmpa_int - \l__acro_tmpc_int } = { \l__acro_tmpb_int - \l__acro_tmpd_int } - && + } + { \int_compare_p:nNn { \l__acro_tmpb_int - \l__acro_tmpd_int } = {1} } @@ -1243,7 +1266,7 @@ \seq_put_right:Nn #1 {#3} } } -\cs_generate_variant:Nn \acro_determine_page_ranges:NNn { NNV } +\cs_generate_variant:Nn \acro_determine_page_ranges:NNn {NNV} % -------------------------------------------------------------------------- \DeclareObjectType {acro-page-number} {1} @@ -1291,12 +1314,6 @@ \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 { @@ -1348,12 +1365,7 @@ } \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 - } + { \tl_set:Nn \l__acro_list_heading_cmd_tl {#1} } \cs_new_protected:Npn \acro_declare_list_heading:nn #1#2 { @@ -1362,9 +1374,6 @@ { name-format = #2 {##1} } } -\NewDocumentCommand \DeclareAcroListHeading {mm} - { \acro_declare_list_heading:nn {#1} {#2} } - % -------------------------------------------------------------------------- % typesetting the acronym list \DeclareObjectType {acro-list} {2} @@ -1376,11 +1385,11 @@ \bool_set_false:N \l__acro_is_excluded_bool \tl_if_blank:nF {#2} { - \clist_map_inline:nn {#2} + \acro_property_get:nnT {#1} {class} { - \prop_get:NnNT \l__acro_class_prop {#1} \l__acro_tmpa_tl + \seq_set_split:NnV \l__acro_tmpa_seq {,} \l__acro_class_tl + \clist_map_inline:nn {#2} { - \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 } } @@ -1399,11 +1408,11 @@ \tl_if_blank:nTF {#2} { \bool_set_true:N \l__acro_is_included_bool } { - \clist_map_inline:nn {#2} + \acro_property_get:nnT {#1} {class} { - \prop_get:NnNT \l__acro_class_prop {#1} \l__acro_tmpa_tl + \seq_set_split:NnV \l__acro_tmpa_seq {,} \l__acro_class_tl + \clist_map_inline:nn {#2} { - \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_included_bool } } @@ -1425,14 +1434,12 @@ \acro_acc_supp:nn {#1} { - \bool_if:nTF - { - \l__acro_custom_short_format_bool && - \l__acro_override_list_format_bool - } + \bool_lazy_and:nnTF + { \l__acro_custom_short_format_bool } + { \l__acro_override_list_format_bool } { \l__acro_custom_short_format_tl } { \l__acro_list_short_format_tl } - { \__acro_get_property:nn {short} {#1} } + { \__acro_property_get:nn {short} {#1} } } } \group_end: @@ -1447,30 +1454,30 @@ \acro_write_long:Vf \l__acro_list_long_format_tl { \prop_if_in:NnTF \l__acro_list_prop {#1} - { \__acro_get_property:nn {list} {#1} } - { \__acro_get_property:nn {long} {#1} } + { \__acro_property_get:nn {list} {#1} } + { \__acro_property_get:nn {long} {#1} } } \group_end: \bool_if:NT \l__acro_foreign_bool { \acro_get_foreign:n {#1} } - \acro_cite_if:nn { \l__acro_citation_all_bool } {#1} + \acro_cite_if:Nn \l__acro_citation_all_bool {#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 + \acro_property_get:nnT {#1} {extra} { \acro_extra_instance:VV \l__acro_extra_instance_tl - \l__acro_tmpa_tl + \l__acro_extra_tl } } % #1: id \cs_new_protected:Npn \__acro_list_entry_page:n #1 { - \bool_if:nT { \cs_if_exist_p:c { acro@#1@once } } + \cs_if_exist:cT {acro@#1@once} { \acro_page_number_instance:Vn \l__acro_page_instance_tl @@ -1490,7 +1497,7 @@ {extra} { \__acro_list_entry_extra:n {#2} } {page} { \__acro_list_entry_page:n {#2} } } - { \__acro_get_property:nn {#1} {#2} } + { \__acro_property_get:nn {#1} {#2} } } % this macro may/should be redefined in templates: @@ -1513,20 +1520,31 @@ % #3: excluded classes \prg_new_protected_conditional:Npnn \acro_if_entry:nnn #1#2#3 {T,F,TF} { - \bool_if:nTF + \bool_lazy_or:nnTF + { + \bool_lazy_and_p:nn + { !\l__acro_single_use_bool } + { !\l__acro_print_only_used_bool } + } { - \bool_if_p:c { g__acro_#1_in_list_bool } && - ( - ( \l__acro_use_single_bool && \cs_if_exist_p:c { acro@#1@twice } ) - || - ( - !\l__acro_use_single_bool && - \cs_if_exist_p:c { acro@#1@once } && - \l__acro_print_only_used_bool - ) - ) - || - ( !\l__acro_use_single_bool && !\l__acro_print_only_used_bool ) + \bool_lazy_and_p:nn + { \bool_if_p:c {g__acro_#1_in_list_bool} } + { + \bool_lazy_or_p:nn + { + \bool_lazy_and_p:nn + { \l__acro_single_use_bool } + { \cs_if_exist_p:c {acro@#1@twice} } + } + { + \bool_lazy_all_p:n + { + { !\l__acro_single_use_bool } + { \cs_if_exist_p:c {acro@#1@once} } + { \l__acro_print_only_used_bool } + } + } + } } { \acro_if_is_excluded:nnTF {#1} {#3} @@ -1534,8 +1552,9 @@ { \acro_if_is_included:nnTF {#1} {#2} { - \bool_if:nTF - { \g__acro_use_barriers_bool && \l__acro_use_barrier_bool } + \bool_lazy_and:nnTF + { \g__acro_use_barriers_bool } + { \l__acro_use_barrier_bool } { \acro_if_in_barrier:nxTF {#1} { \int_use:N \g__acro_barrier_int } @@ -1550,8 +1569,6 @@ { \prg_return_false: } } -\tl_new:N \l__acro_list_entries_tl - % this macro is used in templates for fetching all items to be printed; it % collects all entries in a tl which then is used where needed % @@ -1815,12 +1832,6 @@ \prop_put:Nnn \l__acro_list_styles_prop {#1} {#2} } -% #1: name -% #2: template -% #3: settings -\NewDocumentCommand \DeclareAcroListStyle {mmm} - { \acro_declare_list_style:nnn {#1} {#2} {#3} } - % set a list style \cs_new_protected:Npn \acro_set_list_style:n #1 { @@ -1842,6 +1853,28 @@ } % -------------------------------------------------------------------------- +% case insensitivity of the ID: +\cs_new:Npn \acro_case_insensitive:n #1 + { + \bool_if:NTF \g__acro_case_sensitive_bool + { \tl_to_str:n {#1} } + { \str_lower_case:n {#1} } + } + +\cs_new_protected:Npn \acro_protected_case_insensitive:n #1 + { \acro_case_insensitive:n {#1} } + +\cs_new:Npn \acro_case_insensitive:Nn #1#2 + { \exp_args:Ne #1 { \acro_case_insensitive:n {#2} } } + +\cs_new:Npn \acro_case_insensitive:Nnn #1#2#3 + { \exp_args:Ne #1 { \acro_case_insensitive:n {#2} } {#3} } + +\cs_new_protected:Npn \acro_case_insensitive_command:Nnnn #1#2#3#4 + { \exp_args:Nnnx #1 {#2} {#3} { \acro_case_insensitive:n {#4} } } +\cs_generate_variant:Nn \acro_case_insensitive_command:Nnnn {c} + +% -------------------------------------------------------------------------- % automatic typesetting, the internals of \ac: % #1: id @@ -1879,7 +1912,7 @@ \acro_single_form:nV {#1} \l__acro_single_form_tl \acro_after:n {#1} } - + % #1: ID % #2: long|first|<other> \cs_new_protected:Npn \acro_single_form:nn #1#2 @@ -1935,8 +1968,9 @@ \prg_new_conditional:Npnn \acro_if_is_single:n #1 { p,T,TF } { - \bool_if:nTF - { !\l__acro_use_single_bool || \cs_if_exist_p:c { acro@#1@twice } } + \bool_lazy_or:nnTF + { !\l__acro_single_use_bool } + { \cs_if_exist_p:c {acro@#1@twice} } { \prg_return_false: } { \prg_return_true: } } @@ -1946,11 +1980,10 @@ % -------------------------------------------------------------------------- % some helpers we'll need more often: -\seq_new:N \g__acro_declared_acronyms_seq - \prg_new_conditional:Npnn \acro_if_defined:n #1 {p,T,F,TF} { - \seq_if_in:NnTF \g__acro_declared_acronyms_seq {#1} + \seq_if_in:NeTF \g__acro_declared_acronyms_seq + { \acro_case_insensitive:n {#1} } { \prg_return_true: } { \prg_return_false: } } @@ -1965,14 +1998,14 @@ % name is needed % #1: property % #2: id -\cs_new:Npn \__acro_get_property:nn #1#2 +\cs_new:Npn \__acro_property_get:nn #1#2 { \prop_item:cn {l__acro_#1_prop} {#2} } % #1: id % #2: property % #3: set case % #4: not set case -\prg_new_protected_conditional:Npnn \acro_get_property:nn #1#2 {T,F,TF} +\prg_new_protected_conditional:Npnn \acro_property_get:nn #1#2 {T,F,TF} { \tl_set:Nn \l__acro_tmpa_tl {#2} \tl_replace_all:Nnn \l__acro_tmpa_tl {-} {_} @@ -1984,32 +2017,14 @@ { \prg_return_false: } } -\cs_new_protected:Npn \acro_get_property:nn #1#2 - { \acro_get_property:nnTF {#1} {#2} {} {} } -\cs_generate_variant:Nn \acro_get_property:nn {V} - -% #1: id -% #2: property -% #3: set case -% #4: not set case -\prg_new_protected_conditional:Npnn \acro_if_property:nn #1#2 {T,F,TF} - { - \tl_set:Nn \l__acro_tmpa_tl {#2} - \tl_replace_all:Nnn \l__acro_tmpa_tl {-} {_} - \prop_if_in:cnTF - {l__acro_ \l__acro_tmpa_tl _prop} - {#1} - { \prg_return_true: } - { \prg_return_false: } - } - -\seq_new:N \l__acro_actions_seq +\cs_new_protected:Npn \acro_property_get:nn #1#2 + { \acro_property_get:nnTF {#1} {#2} {} {} } +\cs_generate_variant:Nn \acro_property_get:nn {V} % within this command one can refer to the current id with `#1' \cs_new_protected:Npn \acro_add_action:n #1 { \seq_put_right:Nn \l__acro_actions_seq {#1} } -\tl_new:N \l_acro_current_id_tl \cs_new_protected:Npn \__acro_get_actions:n #1 { \seq_map_inline:Nn \l__acro_actions_seq @@ -2024,52 +2039,57 @@ \bool_if:NF \l__acro_in_list_bool { \leavevmode } \acro_activate_hyperref_support: % short: - \prop_get:NnNF \l__acro_short_prop {#1} \l__acro_short_tl {} - % \__acro_make_link:NnV \l__acro_short_tl {#1} \l__acro_tmpa_tl + \acro_property_get:nn {#1} {short} % alt: - \prop_get:NnNF \l__acro_alt_prop {#1} \l__acro_alt_tl - % { \__acro_make_link:NnV \l__acro_alt_tl {#1} \l__acro_tmpa_tl } + \acro_property_get:nnF {#1} {alt} { \tl_set_eq:NN \l__acro_alt_tl \l__acro_short_tl } % long: - \acro_get_property:nn {#1} {long} + \acro_property_get:nn {#1} {long} % foreign: - \acro_get_property:nn {#1} {foreign} + \acro_property_get:nn {#1} {foreign} % foreign-lang: - \acro_get_property:nn {#1} {foreign-lang} + \acro_property_get:nn {#1} {foreign-lang} % extra: - \acro_get_property:nn {#1} {extra} + \acro_property_get:nn {#1} {extra} % single: - \acro_get_property:nn {#1} {single} + \acro_property_get:nn {#1} {single} % first-style: - \acro_get_property:nn {#1} {first-style} + \acro_property_get:nn {#1} {first-style} % formatting - \prop_get:NnNTF \l__acro_long_format_prop {#1} - \l__acro_custom_long_format_tl - { \bool_set_true:N \l__acro_custom_long_format_bool } + \acro_property_get:nnTF {#1} {long-format} + { + \tl_set_eq:NN \l__acro_custom_long_format_tl \l__acro_long_format_tl + \bool_set_true:N \l__acro_custom_long_format_bool + } { \bool_set_false:N \l__acro_custom_long_format_bool } - \acro_get_property:nn {#1} {first-long-format} - \prop_get:NnNTF \l__acro_format_prop {#1} \l__acro_custom_short_format_tl - { \bool_set_true:N \l__acro_custom_short_format_bool } + \acro_property_get:nn {#1} {first-long-format} + \acro_property_get:nnTF {#1} {format} + { + \tl_set_eq:NN \l__acro_custom_short_format_tl \l__acro_format_tl + \bool_set_true:N \l__acro_custom_short_format_bool + } { \bool_set_false:N \l__acro_custom_short_format_bool } - \prop_get:NnNTF \l__acro_alt_format_prop {#1} \l__acro_custom_alt_format_tl - { \bool_set_true:N \l__acro_custom_alt_format_bool } + \acro_property_get:nnTF {#1} {alt-format} + { + \tl_set_eq:NN \l__acro_custom_alt_format_tl \l__acro_alt_format_tl + \bool_set_true:N \l__acro_custom_alt_format_bool + } { \bool_set_false:N \l__acro_custom_alt_format_bool } - \acro_get_property:nn {#1} {single-format} + \acro_property_get:nn {#1} {single-format} \acro_for_endings_do:n { \bool_if:cT {l__acro_##1_bool} { \__acro_set_ending_for:nnn {##1} {#1} {long} } } - \acro_get_property:nnF {#1} {long-post} + \acro_property_get:nnF {#1} {long-post} { \tl_clear:N \l__acro_long_post_tl } - \acro_get_property:nnT {#1} {long-pre} + \acro_property_get:nnT {#1} {long-pre} { \tl_put_left:NV \l__acro_long_tl \l__acro_long_pre_tl } \__acro_get_actions:n {#1} } % -------------------------------------------------------------------------- % plural endings and similar concepts: -\seq_new:N \l__acro_endings_seq \cs_new_protected:Npn \acro_for_endings_do:n #1 { \seq_map_inline:Nn \l__acro_endings_seq {#1} } @@ -2087,10 +2107,6 @@ } } -\tl_new:N \l__acro_endings_tl - -\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 @@ -2121,12 +2137,9 @@ { \acro_if_ending_form_exist:nnT {##1} {#2} { - \bool_if:nT - { - \use:c { c_ \prop_item:cn {l__acro_#2_##1_form_prop} {#1} _bool } - && - \use:c {l__acro_##1_bool} - } + \bool_lazy_and:nnT + { \use:c {l__acro_##1_bool} } + { \use:c { c_ \prop_item:cn {l__acro_#2_##1_form_prop} {#1} _bool } } { \prop_get:cncF {l__acro_#2_##1_prop} {#1} {l__acro_#2_tl} {} } } } @@ -2389,26 +2402,22 @@ } } -\NewDocumentCommand \ProvideAcroEnding {mmm} - { \acro_provide_ending:nnn {#1} {#2} {#3} } - % -------------------------------------------------------------------------- % enable us to know if the acronym is used only once and provide a different % 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_lazy_and:nnTF + { \bool_if_p:c {g__acro_#1_used_bool} } { - \bool_if_p:c { g__acro_#1_used_bool } && - ( - ( - \bool_if_p:c { g__acro_#1_first_use_bool } && - \g__acro_mark_first_as_used_bool - ) - || - ! \g__acro_mark_first_as_used_bool - ) + \bool_lazy_or_p:nn + { + \bool_lazy_and_p:nn + { \bool_if_p:c {g__acro_#1_first_use_bool} } + { \g__acro_mark_first_as_used_bool } + } + { !\g__acro_mark_first_as_used_bool } } { \bool_if:NTF \l__acro_mark_as_used_bool @@ -2430,11 +2439,9 @@ { \thepage } { \arabic {page} } { \arabic {abspage} } - \bool_if:nT - { - !\bool_if_p:c { g__acro_#1_label_bool } && - \l__acro_place_label_bool - } + \bool_lazy_and:nnT + { !\bool_if_p:c {g__acro_#1_label_bool} } + { \l__acro_place_label_bool } { \bool_gset_true:c { g__acro_#1_label_bool } \label{\l__acro_label_prefix_tl #1} @@ -2454,11 +2461,11 @@ \cs_new_protected:Npn \__acro_aux_file:Nnnnn #1#2#3#4#5 { \iow_shipout:Nn \@auxout { #1 {#2} {#3} {#4} {#5} } } -\cs_generate_variant:Nn \__acro_aux_file:Nnnnn { Nxxxx } +\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_generate_variant:Nn \__acro_aux_file_now:n {x} % -------------------------------------------------------------------------- % the commands for the auxiliary file: @@ -2482,8 +2489,6 @@ \cs_new_protected:Npn \acro@pages #1#2 { \tl_gset:cn {g__acro_#1_recorded_pages_tl} {#2} } -\bool_new:N \g__acro_rerun_bool - \cs_new_protected:Npn \acro@rerun@check { \bool_if:NT \g__acro_rerun_bool @@ -2567,14 +2572,13 @@ { \__acro_typeset:nn {short} { - \bool_if:nTF - { \l__acro_first_upper_bool } + \bool_if:NTF \l__acro_first_upper_bool { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } } { \exp_not:n {#2} } } } } -\cs_generate_variant:Nn \acro_write_short:nn { nV , nv } +\cs_generate_variant:Nn \acro_write_short:nn {nV,nv} % typeset the alternative form: % #1: ID @@ -2585,14 +2589,15 @@ { \__acro_typeset:nn {alt} { - \bool_if:nTF - { \l__acro_first_upper_bool && \l__acro_upper_short_bool } + \bool_lazy_and:nnTF + { \l__acro_first_upper_bool } + { \l__acro_upper_short_bool } { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } } { \exp_not:n {#2} } } } } -\cs_generate_variant:Nn \acro_write_alt:nn { nV , nv } +\cs_generate_variant:Nn \acro_write_alt:nn {nV,nv} % typeset a long form: % TODO: rethink the formatting mechanism @@ -2612,16 +2617,13 @@ } } } -\cs_generate_variant:Nn \acro_write_long:nn { VV,Vo,Vf,V,v,vv } +\cs_generate_variant:Nn \acro_write_long:nn {VV,Vo,Vf,V,v,vv} \prg_new_conditional:Npnn \acro_if_foreign:n #1 {T,F,TF} { - \bool_if:nTF - { - \l__acro_foreign_bool - && - \prop_if_in_p:Nn \l__acro_foreign_prop {#1} - } + \bool_lazy_and:nnTF + { \l__acro_foreign_bool } + { \prop_if_in_p:Nn \l__acro_foreign_prop {#1} } { \prg_return_true: } { \prg_return_false: } } @@ -2648,7 +2650,7 @@ { \acro_if_foreign:nT {#1} { - \prop_get:NnNT \l__acro_foreign_prop {#1} \l__acro_foreign_tl + \acro_property_get:nnT {#1} {foreign} { \group_begin: \tl_use:N \l__acro_foreign_format_tl @@ -2666,10 +2668,9 @@ \cs_new_protected:Npn \acro_get_foreign:n #1 { - \prop_if_in:NnT \l__acro_foreign_prop {#1} + \acro_property_get:nnT {#1} {foreign} { \tl_use:N \l__acro_foreign_sep_tl - \prop_get:NnN \l__acro_foreign_prop {#1} \l__acro_foreign_tl \group_begin: \tl_use:N \l__acro_foreign_list_format_tl { @@ -2713,7 +2714,7 @@ \tl_if_in:nnT {#2} {long} { \l__acro_long_post_tl } } -\cs_generate_variant:Nn \acro_write_expanded:nnn { nnV } +\cs_generate_variant:Nn \acro_write_expanded:nnn {nnV} % #1: ID % #2: long|first-long|list-long|extra @@ -2732,9 +2733,9 @@ % #1: id \cs_new_protected:Npn \acro_after:n #1 { - \acro_cite_if:nn { \l__acro_citation_all_bool } {#1} - \acro_index_if:nn { \l__acro_addto_index_bool } {#1} - \acro_get_property:nnT {#1} {post} + \acro_cite_if:Nn \l__acro_citation_all_bool {#1} + \acro_index_if:Nn \l__acro_addto_index_bool {#1} + \acro_property_get:nnT {#1} {post} { \tl_use:N \l__acro_post_tl } } @@ -2833,8 +2834,8 @@ % ---------------------------------------------------------------------------- % citations: -\cs_new:Npn \__acro_citation_cmd:w { \cite } %{} -\cs_new:Npn \__acro_group_citation_cmd:w { \cite } %{} +\cs_new:Npn \__acro_citation_cmd:w { \cite } +\cs_new:Npn \__acro_group_citation_cmd:w { \cite } % #1 pre % #2 post @@ -2845,14 +2846,16 @@ { \__acro_citation_cmd:w {#3} } { \quark_if_no_value:nTF {#2} - { \__acro_citation_cmd:w [ #1 ] {#3} } - { \__acro_citation_cmd:w [ #1 ] [ #2 ] {#3} } + { \__acro_citation_cmd:w [#1] {#3} } + { \__acro_citation_cmd:w [#1] [#2] {#3} } } } -\cs_generate_variant:Nn \__acro_cite:nnn { VVV } +\cs_generate_variant:Nn \__acro_cite:nnn {VVV} \cs_new_protected:Npn \acro_cite:n #1 { + \acro_property_get:nnT {#1} {before-citation} + { \acro_no_break: \l__acro_before_citation_tl } \prop_get:NnNT \l__acro_citation_prop {#1} \l__acro_tmpa_tl { \prop_get:NnN \l__acro_citation_pre_prop {#1} \l__acro_tmpb_tl @@ -2864,6 +2867,8 @@ \l__acro_tmpc_tl \l__acro_tmpa_tl } + \acro_property_get:nnT {#1} {after-citation} + { \acro_no_break: \l__acro_after_citation_tl } } \cs_new_protected:Npn \acro_group_cite:n #1 @@ -2873,18 +2878,18 @@ \tl_set_eq:NN \l__acro_citation_connect_tl \l__acro_between_group_connect_citation_tl - \acro_cite_if:nn { \l__acro_citation_first_bool } {#1} + \acro_cite_if:Nn \l__acro_citation_first_bool {#1} \group_end: } -\cs_new_protected:Npn \acro_cite_if:nn #1#2 - { \bool_if:nT {#1} { \acro_cite:n {#2} } } +\cs_new_protected:Npn \acro_cite_if:Nn #1#2 + { \bool_if:NT #1 { \acro_cite:n {#2} } } % ---------------------------------------------------------------------------- % indexing: -\cs_new_protected:Npn \acro_index_if:nn #1#2 +\cs_new_protected:Npn \acro_index_if:Nn #1#2 { - \bool_if:nT { (#1) && \l__acro_mark_as_used_bool } + \bool_lazy_and:nnT {#1} { \l__acro_mark_as_used_bool } { \prop_get:NnN \l__acro_index_cmd_prop {#2} \l__acro_tmpa_tl \prop_get:NnN \l__acro_index_sort_prop {#2} \l__acro_tmpb_tl @@ -2920,7 +2925,7 @@ } { \__acro_index_cmd:n {#4} } } -\cs_generate_variant:Nn \__acro_index:nnnn { VnVV } +\cs_generate_variant:Nn \__acro_index:nnnn {VnVV} % ---------------------------------------------------------------------------- % accessability support @@ -2951,7 +2956,7 @@ #3 \EndAccSupp { } } -\cs_generate_variant:Nn \acro_do_acc_supp:nnn { VV } +\cs_generate_variant:Nn \acro_do_acc_supp:nnn {VV} \AtEndPreamble { @@ -2976,20 +2981,20 @@ % #3: tool tip text \cs_new_protected:Npn \acro_write_tooltip:nnn #1#2#3 { - \prop_get:NnNTF \l__acro_tooltip_prop {#1} \l__acro_tmpa_tl - { \__acro_check_tooltip:nV {#2} \l__acro_tmpa_tl } + \acro_property_get:nnTF {#1} {tooltip} + { \__acro_check_tooltip:nV {#2} \l__acro_tooltip_tl } { \__acro_check_tooltip:nn {#2} {#3} } } -\cs_generate_variant:Nn \acro_write_tooltip:nnn { nnV } +\cs_generate_variant:Nn \acro_write_tooltip:nnn {nnV} % #1: printed text % #2: tool tip text \cs_new_protected:Npn \__acro_check_tooltip:nn #1#2 { - \bool_if:NTF \l__acro_inside_tooltip_bool + \bool_if:NTF \l__acro_tooltip_inside_bool {#1} { - \bool_set_true:N \l__acro_inside_tooltip_bool + \bool_set_true:N \l__acro_tooltip_inside_bool \__acro_tooltip_cmd:nn {#1} {#2} } } @@ -3109,10 +3114,6 @@ % -------------------------------------------------------------------------- % trailing tokens and what to do when present -\prop_new:N \l__acro_trailing_tokens_prop -\prop_new:N \l__acro_trailing_actions_prop -\bool_new:N \l__acro_trailing_tokens_bool -\tl_new:N \l__acro_trailing_tokens_tl \cs_new_protected:Npn \acro_new_trailing_token:n #1 { \bool_new:c {l__acro_trailing_#1_bool} } @@ -3131,9 +3132,6 @@ { \acro_activate_trailing_action:n {#2} } \acro_new_trailing_token:n {#2} } - -\NewDocumentCommand \AcroRegisterTrailing {mm} - { \acro_register_trailing_token:Nn #1 {#2} } \cs_new_protected:Npn \acro_for_all_trailing_tokens_do:n #1 { \prop_map_inline:Nn \l__acro_trailing_tokens_prop {#1} } @@ -3203,9 +3201,6 @@ \cs_new_protected:Npn \acro_space: { \acro_if_trailing_tokens:nF {dash,babel-hyphen} { \c_space_tl } } - -\NewDocumentCommand \acdot {} { \acro_dot: } -\NewDocumentCommand \acspace {} { \acro_space: } % --------------------------------------------------------------------------- % reset outputs, they'll behave like the first time again (!not like the _only_ @@ -3237,41 +3232,19 @@ \cs_new_protected:Npn \acro_mark_all_as_used: { \acro_for_all_acronyms_do:n { \acro_mark_as_used:n {##1} } } -\DeclareExpandableDocumentCommand \acifused { m } - { \acro_if_acronym_used:nTF {#1} } - \prg_new_conditional:Npnn \acro_if_acronym_used:n #1 { p,T,F,TF } { - \bool_if:nTF - { - \bool_if_p:c { g__acro_#1_used_bool } && - ( !\acro_if_is_single_p:n {#1} ) - } + \bool_lazy_and:nnTF + { \bool_if_p:c {g__acro_#1_used_bool} } + { !\acro_if_is_single_p:n {#1} } { \prg_return_true: } { \prg_return_false: } } -\NewDocumentCommand \acresetall {} - { \acro_reset_all: } - -\NewDocumentCommand \acuseall {} - { \acro_mark_all_as_used: } - -\NewDocumentCommand \acreset { > { \SplitList { , } } m } - { \ProcessList {#1} { \acro_reset:n } \ignorespaces } - -\NewDocumentCommand \acuse { > { \SplitList { , } } m } - { \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_use_barriers_bool -\bool_new:N \g__acro_reset_at_barrier_bool -\bool_new:N \l__acro_use_barrier_bool - \keys_define:nn {acro} { use-barriers .bool_gset:N = \g__acro_use_barriers_bool , @@ -3287,9 +3260,6 @@ { \acro_reset_all: } } -\NewDocumentCommand \acbarrier {} - { \acro_barrier: } - \cs_new_protected:Npn \acro_check_barriers:n #1 { \bool_if:NT \g__acro_use_barriers_bool @@ -3358,9 +3328,6 @@ \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 \acro_for_endings_do:n { \bool_set_false:c {l__acro_##1_bool} } } @@ -3376,8 +3343,7 @@ % #2: ID \cs_new_protected:Npn \acro_check_and_mark_if:nn #1#2 { - \bool_if:nTF - { (#1) || !\l__acro_use_acronyms_bool } + \bool_lazy_or:nnTF {#1} { !\l__acro_use_acronyms_bool } { \acro_check_acronym:nn {#2} {false} } { \acro_check_acronym:nn {#2} {true} } } @@ -3388,12 +3354,6 @@ \cs_new_protected:Npn \acro_switch_on: { \bool_set_true:N \l__acro_use_acronyms_bool } -\NewDocumentCommand \acswitchoff {} - { \acro_switch_off: } - -\NewDocumentCommand \acswitchon {} - { \acro_switch_on: } - % commands for (re)defining \ac-like macros: \cs_new_protected:Npn \acro_define_new_acro_command:NN #1#2 { @@ -3401,19 +3361,29 @@ % #2: definition where `#1' refers to the ID \cs_new_protected:Npn #1 ##1##2 { - \cs_set:Npn \__acro_tmp_command:n ####1 {##2} - \exp_args:NNnx #2 ##1 {sO{}m} + \cs_set:Npn \__acro_tmp:n ####1 {##2} + \cs_new_protected:cpx + {acro_ \__acro_remove_backslash:N ##1 :nnn} ####1####2####3 { \acro_begin: \acro_reset_specials: - \keys_set:nn {acro} {########2} - \acro_check_and_mark_if:nn {########1} {########3} - \exp_not:o { \__acro_tmp_command:n {####3} } + \exp_not:N \tl_if_blank:nF {####2} { \keys_set:nn {acro} {####2} } + \acro_check_and_mark_if:nn {####1} {####3} + \__acro_tmp:n {####3} \acro_end: } + #2 ##1 {sO{}m} + { + \acro_case_insensitive_command:cnnn + {acro_ \__acro_remove_backslash:N ##1 :nnn} + {####1} + {####2} + {####3} + } } } \cs_generate_variant:Nn \acro_define_new_acro_command:NN {cc} +\cs_generate_variant:Nn \acro_check_and_mark_if:nn {nx} % commands for (re)defining \acflike-like macros: \cs_new_protected:Npn \acro_define_new_acro_pseudo_command:NN #1#2 @@ -3422,15 +3392,24 @@ % #2: definition where `#1' refers to the ID and `#2' to the pseudo long form \cs_new_protected:Npn #1 ##1##2 { - \cs_set:Npn \__acro_tmp_command:nn ####1####2 {##2} - \exp_args:NNnx #2 ##1 {smm} + \cs_set:Npn \__acro_tmp:nn ####1####2 {##2} + \cs_new_protected:cpx + {acro_ \__acro_remove_backslash:N ##1 :nnn} ####1####2####3 { \acro_begin: \acro_reset_specials: - \acro_check_and_mark_if:nn {########1} {########2} - \exp_not:o { \__acro_tmp_command:nn {####2} {####3} } + \acro_check_and_mark_if:nn {####1} {####3} + \__acro_tmp:nn {####3} {####2} \acro_end: } + #2 ##1 {smm} + { + \acro_case_insensitive_command:cnnn + {acro_ \__acro_remove_backslash:N ##1 :nnn} + {####1} + {####3} + {####2} + } } } \cs_generate_variant:Nn \acro_define_new_acro_pseudo_command:NN {cc} @@ -3595,10 +3574,6 @@ } % -------------------------------------------------------------------------- -% additional variables: -\tl_new:N \l__acro_current_property_tl - -% -------------------------------------------------------------------------- % key and order checking \msg_new:nnn {acro} {no-id} { @@ -3627,36 +3602,47 @@ % #2: property \cs_new_protected:Npn \__acro_property_check:nn #1#2 { - \tl_if_blank:VT \l__acro_current_property_tl + \str_if_empty:NT \l__acro_current_id_str { \acro_serious_message:n {no-id} } \str_if_eq:nnF {#2} {short} { - \bool_if:cF { l__acro_#1_short_set_bool } + \acro_property_if_set:nnF {#1} {short} { - \keys_set:nn { acro / declare-acronym } { short = {#1} } + \keys_set:nn {acro/declare-acronym} { short = {#1} } \acro_harmless_message:nn {substitute-short} {#1} } } - % \bool_new:c { l__acro_#1_#2_set_bool } - \bool_set_true:c { l__acro_#1_#2_set_bool } + \acro_property_mark_set:nn {#1} {#2} } \cs_new_protected:Npn \__acro_first_property_check:nn #1#2 { - \cs_if_exist:cTF { l__acro_#1_short_set_bool } + \cs_if_exist:cTF {l__acro_#1_short_set_bool} { - \bool_if:cT { l__acro_#1_short_set_bool } + \acro_property_if_set:nnT {#1} {short} { \acro_serious_message:nnn {doubled-property} {#1} {#2} } } - { - \bool_new:c { l__acro_#1_short_set_bool } - \bool_set_true:c { l__acro_#1_short_set_bool } - } + { \bool_new:c {l__acro_#1_short_set_bool} } + \acro_property_mark_set:nn {#1} {short} } +% #1: ID +% #2: property +\prg_new_conditional:Npnn \acro_property_if_set:nn #1#2 {T,F,TF} + { + \bool_if:cTF {l__acro_#1_#2_set_bool} + { \prg_return_true: } + { \prg_return_false: } + } + +% #1: ID +% #2: property +\cs_new_protected:Npn \acro_property_mark_set:nn #1#2 + { \bool_set_true:c { l__acro_#1_#2_set_bool } } +\cs_generate_variant:Nn \acro_property_mark_set:nn {V} + % -------------------------------------------------------------------------- % the internal property selection functions for \DeclareAcronym: -\prop_new:N \g__acro_properties_prop \cs_new_protected:Npn \acro_for_properties_do:n { \prop_map_inline:Nn \g__acro_properties_prop } @@ -3667,14 +3653,14 @@ \cs_new_protected:Npn \acro_declare_property_generic:nnn #1#2#3 { \prop_clear_new:c {l__acro_#1_prop} + \tl_clear_new:c {l__acro_#1_tl} \cs_new_protected:cpn {__acro_declare_#1:nn} ##1##2 {#3} \cs_generate_variant:cn {__acro_declare_#1:nn} {V} - % \bool_new:c {l__acro_ \l__acro_current_property_tl _#1_set_bool} \keys_define:nn {acro/declare-acronym} { #2 .code:n = - \use:c {__acro_declare_#1:Vn} \l__acro_current_property_tl {##1} - \bool_set_true:c {l__acro_ \l__acro_current_property_tl _#2_set_bool} + \use:c {__acro_declare_#1:Vn} \l__acro_current_id_str {##1} + \acro_property_mark_set:Vn \l__acro_current_id_str {#2} } \prop_gput:Nnn \g__acro_properties_prop {#2} {#1} } @@ -3696,13 +3682,12 @@ % #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_generate_variant:Nn \acro_declare_property:nn {V} -\cs_new_protected:Npn \acro_declare_simple_property:n #1 +\cs_new_protected:Npn \acro_declare_property_simple:n #1 { \tl_set:Nn \l__acro_tmpa_tl {#1} \tl_replace_all:Nnn \l__acro_tmpa_tl {-} {_} - \tl_clear_new:c {l__acro_ \l__acro_tmpa_tl _tl} \acro_declare_property:Vn \l__acro_tmpa_tl {#1} } @@ -3754,42 +3739,42 @@ \acro_for_endings_do:n { \prop_put:cnn {l__acro_long_##1_form_prop} {#1} {false} - \bool_if:cF {l__acro_#1_long-##1_set_bool} + \acro_property_if_set:nnF {#1} {long-##1} { \prop_put:cnv {l__acro_long_##1_prop} {#1} {l__acro_default_long_##1_tl} } \prop_put:cnn {l__acro_foreign_##1_form_prop} {#1} {false} - \bool_if:cF {l__acro_#1_foreign-##1_set_bool} + \acro_property_if_set:nnF {#1} {foreign-##1} { \prop_put:cnv {l__acro_foreign_##1_prop} {#1} {l__acro_default_foreign_##1_tl} } } } -\acro_declare_simple_property:n {first-style} +\acro_declare_property_simple:n {first-style} % list: -\acro_declare_simple_property:n {list} +\acro_declare_property_simple: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': % \ProvideAcroEnding {plural} {s} {s} % short indefinite article: -\acro_declare_simple_property:n {short-indefinite} +\acro_declare_property_simple:n {short-indefinite} % long indefinite article: -\acro_declare_simple_property:n {long-indefinite} +\acro_declare_property_simple:n {long-indefinite} % pre long: -\acro_declare_simple_property:n {long-pre} +\acro_declare_property_simple:n {long-pre} % post long: -\acro_declare_simple_property:n {long-post} +\acro_declare_property_simple:n {long-post} % post: -\acro_declare_simple_property:n {post} +\acro_declare_property_simple:n {post} % sort: \acro_declare_property:nnn {sort} {sort} { - \bool_if:cF { l__acro_#1_index-sort_set_bool } + \acro_property_if_set:nnF {#1} {index-sort} { \prop_put:Nnn \l__acro_index_sort_prop {#1} {#2} } } @@ -3803,36 +3788,35 @@ \cs_set_protected:Npn \acro_alt_error:n #1 { - \bool_if:cF {l__acro_#1_alt_set_bool} + \acro_property_if_set:nnF {#1} {alt} { \acro_harmless_message:nn {no-alternative} {#1} } } % alt. indefinite article: -\acro_declare_simple_property:n {alt-indefinite} +\acro_declare_property_simple:n {alt-indefinite} % foreign: -\acro_declare_simple_property:n {foreign} +\acro_declare_property_simple:n {foreign} % foreign-lang: -\acro_declare_simple_property:n {foreign-lang} +\acro_declare_property_simple:n {foreign-lang} % format: -\acro_declare_simple_property:n {format} +\acro_declare_property_simple:n {format} % short format: \acro_declare_property_alias:nn {short-format} {format} % alt format: -\acro_declare_simple_property:n {alt-format} +\acro_declare_property_simple:n {alt-format} % long format: -\acro_declare_simple_property:n {long-format} +\acro_declare_property_simple:n {long-format} % first long format: -\acro_declare_simple_property:n {first-long-format} +\acro_declare_property_simple:n {first-long-format} % 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_property_check:nn {#1} {pdfstring} @@ -3850,17 +3834,17 @@ } } } -\cs_generate_variant:Nn \__acro_declare_pdfstring:nw { V } -\keys_define:nn { acro / declare-acronym } +\cs_generate_variant:Nn \__acro_declare_pdfstring:nw {V} + +\keys_define:nn {acro/declare-acronym} { pdfstring .code:n = - \__acro_declare_pdfstring:Vw \l__acro_current_property_tl #1 // \acro_stop: , + \__acro_declare_pdfstring:Vw \l__acro_current_id_str #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_property_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 { @@ -3872,70 +3856,87 @@ { \prop_put:cnn {l__acro_pdfstring_alt_##1_prop} {#1} {#2#3} } } } -\cs_generate_variant:Nn \__acro_declare_pdfstring_alt:nw { V } -\keys_define:nn { acro / declare-acronym } +\cs_generate_variant:Nn \__acro_declare_pdfstring_alt:nw {V} + +\keys_define:nn {acro/declare-acronym} { pdfstring-alt .code:n = - \__acro_declare_pdfstring_alt:Vw \l__acro_current_property_tl #1 // \acro_stop: , + \__acro_declare_pdfstring_alt:Vw \l__acro_current_id_str #1 // \acro_stop: } % class: -\acro_declare_simple_property:n {class} +\acro_declare_property_simple:n {class} % extra information: -\acro_declare_simple_property:n {extra} +\acro_declare_property_simple:n {extra} % single appearances: -\acro_declare_simple_property:n {single} +\acro_declare_property_simple:n {single} % single format: -\acro_declare_simple_property:n {single-format} +\acro_declare_property_simple:n {single-format} % acc supp: \acro_declare_property:nn {acc_supp} {accsupp} % tooltip: -\acro_declare_simple_property:n {tooltip} +\acro_declare_property_simple:n {tooltip} -% 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 +% before-citation: +\acro_declare_property_simple:n {before-citation} + +% after-citation: +\acro_declare_property_simple:n {after-citation} + +% citation -- this needs a bit more work: \cs_new_protected:Npn \__acro_declare_citation:nw #1#2[#3]#4[#5]#6#7 \acro_stop: { - % no options: #1: ID, #2: property, #3 is blank - % 1 option: #1: ID, #4: property, #3: option, #5 is blank + % no options: #1: ID, #2: property, #7 is blank + % 1 option: #1: ID, #4: property, #3: option, #5: \q_no_value % 2 options: #1: ID: #6: property, #3: first option, #5: second option - \tl_if_blank:nF { #2#4#6 } + \tl_if_blank:nTF {#7} { - \tl_if_empty:nTF {#3} - { \__acro_declare_citation_aux:nnnn {#1} { } { } {#2} } + \__acro_declare_citation_aux:nnnn {#1} + { \q_no_value } + { \q_no_value } + {#2} + } + { + \quark_if_no_value:nTF {#5} { - \tl_if_empty:nTF {#5} - { \__acro_declare_citation_aux:nnnn {#1} {#3} { } {#4} } - { \__acro_declare_citation_aux:nnnn {#1} {#3} {#5} {#6} } + \__acro_declare_citation_aux:nnnx {#1} + { \q_no_value } + {#3} + { \tl_head:n {#4} } } + { \__acro_declare_citation_aux:nnnn {#1} {#3} {#5} {#6} } } } -\cs_generate_variant:Nn \__acro_declare_citation:nw { V } +\cs_generate_variant:Nn \__acro_declare_citation:nw {V} -\keys_define:nn { acro / declare-acronym } +\keys_define:nn {acro/declare-acronym} { cite .code:n = \__acro_declare_citation:Vw - \l__acro_current_property_tl #1 [][] \scan_stop: \acro_stop: + \l__acro_current_id_str #1 [\q_no_value][\q_no_value] \scan_stop: \acro_stop: } - +\prop_gput:Nnn \g__acro_properties_prop {cite} {cite} + +% #1: ID +% #2: pre +% #3: post +% #4: citation key \cs_new_protected:Npn \__acro_declare_citation_aux:nnnn #1#2#3#4 { \__acro_property_check:nn {#1} {cite} \prop_put:Nnn \l__acro_citation_prop {#1} {#4} - \tl_if_empty:nF {#2} + \quark_if_no_value:nF {#2} { \prop_put:Nnn \l__acro_citation_pre_prop {#1} {#2} } - \tl_if_empty:nF {#3} + \quark_if_no_value:nF {#3} { \prop_put:Nnn \l__acro_citation_post_prop {#1} {#3} } } - +\cs_generate_variant:Nn \__acro_declare_citation_aux:nnnn {nnnx} + % TODO: % add index entries, by default \index{<sort>@<short>} % index: overwrite default <sort>@<short> entry completely @@ -3949,13 +3950,13 @@ % TeX code after an acronym is typeset % index: -\acro_declare_simple_property:n {index} +\acro_declare_property_simple:n {index} % index-sort: -\acro_declare_simple_property:n {index-sort} +\acro_declare_property_simple:n {index-sort} % index-cmd: -\acro_declare_simple_property:n {index-cmd} +\acro_declare_property_simple:n {index-cmd} % -------------------------------------------------------------------------- % acronym macros: @@ -3976,13 +3977,16 @@ % -------------------------------------------------------------------------- % internal acronym declaring function: \cs_new_protected:Npn \acro_declare_acronym:nn #1#2 + { \acro_case_insensitive:Nnn \__acro_declare_acronym:nn {#1} {#2} } + +\cs_new_protected:Npn \__acro_declare_acronym:nn #1#2 { \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_property_tl {#1} + \str_set:Nn \l__acro_current_id_str {#1} \acro_for_properties_do:n - { \bool_new:c {l__acro_#1_##1_set_bool} } - \keys_set:nn { acro / declare-acronym } {#2} + { \bool_new:c {l__acro_ \l__acro_current_id_str _##1_set_bool} } + \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} @@ -3993,27 +3997,20 @@ { \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_property_tl - \bool_if:cF {l__acro_#1_short_set_bool} + \str_clear:N \l__acro_current_id_str + \acro_property_if_set:nnF {#1} {short} { \acro_serious_message:nnn {missing} {#1} {short} } - \bool_if:cF {l__acro_#1_long_set_bool} + \acro_property_if_set:nnF {#1} {long} { \acro_serious_message:nnn {missing} {#1} {long} } \__acro_log_acronym:n {#1} } -% -------------------------------------------------------------------------- -% the user command: -\NewDocumentCommand \DeclareAcronym {mm} - { \acro_declare_acronym:nn {#1} {#2} } - + % -------------------------------------------------------------------------- % print the list: % #1: list of classes % #2: list of excluded classes -\tl_new:N \l__acro_included_classes_tl -\tl_new:N \l__acro_excluded_classes_tl - -\keys_define:nn { acro / print-acronyms } +\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 , @@ -4032,7 +4029,8 @@ \cs_set:Npn \@noitemerr {} \tl_clear:N \l__acro_included_classes_tl \tl_clear:N \l__acro_excluded_classes_tl - \keys_set:nn { acro / print-acronyms } {#1} + \tl_if_blank:nF {#1} + { \keys_set:nn {acro/print-acronyms} {#1} } \__acro_aux_file_now:n { \acro@print@list } \bool_if:NT \l__acro_sort_bool { \acro_sort_prop:NN \l__acro_short_prop \l__acro_sort_prop } @@ -4050,9 +4048,6 @@ \group_end: } -\NewDocumentCommand \printacronyms { O{} } - { \acro_print_acronyms:n {#1} } - % -------------------------------------------------------------------------- % language support \RequirePackage {translations} @@ -4088,10 +4083,6 @@ } } -\NewDocumentCommand \DeclareAcroTranslation {mm} - { \acro_declare_translation:nn {#1} {#2} } -\@onlypreamble \DeclareAcroTranslation - % tokenlists using the translations: \tl_set:Nn \l__acro_list_name_tl { \GetTranslation {acronym-list-name} } \tl_set:Nn \l__acro_page_name_tl { \GetTranslation {acronym-page-name}\@\, } @@ -4101,478 +4092,27 @@ % -------------------------------------------------------------------------- % definition file: -% \tl_const:Nn \c_acro_definition_file_name_tl {acro} -% \tl_const:Nn \c_acro_definition_file_extension_tl {def} - -% \file_if_exist:nTF -% { \c_acro_definition_file_name_tl .\c_acro_definition_file_extension_tl } -% { -% \@onefilewithoptions -% {\c_acro_definition_file_name_tl} [] [] -% \c_acro_definition_file_extension_tl -% } -% { \acro_serious_message:n {definitions-missing} } - - -% -------------------------------------------------------------------------- -% first appearance styles: -\DeclareAcroFirstStyle {default} {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 = [] } - -\DeclareAcroFirstStyle {plain} {inline} - { - brackets = false , - between = -- - } - -\DeclareAcroFirstStyle {plain-reversed} {inline} - { - brackets = false , - between = -- , - reversed = true - } - -\DeclareAcroFirstStyle {footnote} {note} - { } - -\DeclareAcroFirstStyle {footnote-reversed} {note} - { reversed = true } - -\DeclareAcroFirstStyle {sidenote} {note} - { note-command = \sidenote {#1} } - -\DeclareAcroFirstStyle {sidenote-reversed} {note} - { - note-command = \sidenote {#1} , - reversed = true - } - -\DeclareAcroFirstStyle {empty} {note} - { use-note = false } +\tl_const:Nn \c_acro_definition_file_name_tl {acro.definitions} +\tl_const:Nn \c_acro_definition_file_extension_tl {tex} -% -------------------------------------------------------------------------- -% extra info appearance styles: -\DeclareAcroExtraStyle {default} {inline} +\file_if_exist:nTF + { \c_acro_definition_file_name_tl .\c_acro_definition_file_extension_tl } { - 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 - } - -% -------------------------------------------------------------------------- -% page number appearance styles: -\DeclareAcroPageStyle {default} {inline} - { - punct = true , - punct-symbol = . - } - -\DeclareAcroPageStyle {plain} {inline} - { punct = false } - -\DeclareAcroPageStyle {comma} {inline} - { punct = true } - -\DeclareAcroPageStyle {paren} {inline} - { - brackets=true , - punct-symbol = ~ - } - -\DeclareAcroPageStyle {none} {inline} - { display = false } - -% -------------------------------------------------------------------------- -% list heading styles: -\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} - -% -------------------------------------------------------------------------- -% list styles: -\DeclareAcroListStyle {description} {list} - { } - -\DeclareAcroListStyle {toc} {list-of} - { } - -\DeclareAcroListStyle {lof} {list-of} - { style = lof } - -\DeclareAcroListStyle {tabular} {table} - { table = tabular } - -\DeclareAcroListStyle {longtable} {table} - { table = longtable } - -\DeclareAcroListStyle {extra-tabular} {extra-table} - { table = tabular } - -\DeclareAcroListStyle {extra-longtable} {extra-table} - { table = longtable } - -\DeclareAcroListStyle {extra-tabular-rev} {extra-table} - { - table = tabular , - reverse = true - } - -\DeclareAcroListStyle {extra-longtable-rev} {extra-table} - { - table = longtable , - reverse = true - } - -% -------------------------------------------------------------------------- -% register some tokens to be checked for: -\AcroRegisterTrailing . {dot} -\AcroRegisterTrailing - {dash} -\AcroRegisterTrailing \babelhyphen {babel-hyphen} - -\keys_set:nn {acro} { activate-trailing-tokens = dot } - -% -------------------------------------------------------------------------- -% the user commands -% automatic: -\NewAcroCommand \ac - { \acro_use:n {#1} } - -\NewAcroCommand \Ac - { - \acro_first_upper: - \acro_use:n {#1} - } - -\NewAcroCommand \iac - { - \acro_indefinite: - \acro_use:n {#1} - } - -\NewAcroCommand \Iac - { - \acro_first_upper: - \acro_indefinite: - \acro_use:n {#1} - } - -\NewAcroCommand \acp - { - \acro_plural: - \acro_use:n {#1} - } - -\NewAcroCommand \Acp - { - \acro_plural: - \acro_first_upper: - \acro_use:n {#1} - } - -\NewAcroCommand \acsingle - { - \acro_get:n {#1} - \acro_single:n {#1} - } - -\NewAcroCommand \Acsingle - { - \acro_get:n {#1} - \acro_first_upper: - \acro_single:n {#1} - } - -% short: -\NewAcroCommand \acs - { \acro_short:n {#1} } - -\NewAcroCommand \Acs - { - \acro_first_upper: - \acro_short:n {#1} - } - -\NewAcroCommand \iacs - { - \acro_indefinite: - \acro_short:n {#1} - } - -\NewAcroCommand \Iacs - { - \acro_first_upper: - \acro_indefinite: - \acro_short:n {#1} - } - -\NewAcroCommand \acsp - { - \acro_plural: - \acro_short:n {#1} - } - -\NewAcroCommand \Acsp - { - \acro_first_upper: - \acro_plural: - \acro_short:n {#1} - } - -% alt: -\NewAcroCommand \aca - { \acro_alt:n {#1} } - -\NewAcroCommand \Aca - { - \acro_first_upper: - \acro_alt:n {#1} - } - -\NewAcroCommand \iaca - { - \acro_indefinite: - \acro_alt:n {#1} - } - -\NewAcroCommand \Iaca - { - \acro_first_upper: - \acro_indefinite: - \acro_alt:n {#1} - } - -\NewAcroCommand \acap - { - \acro_plural: - \acro_alt:n {#1} - } - -\NewAcroCommand \Acap - { - \acro_first_upper: - \acro_plural: - \acro_alt:n {#1} - } - -% long: -\NewAcroCommand \acl - { \acro_long:n {#1} } - -\NewAcroCommand \Acl - { - \acro_first_upper: - \acro_long:n {#1} - } - -\NewAcroCommand \iacl - { - \acro_indefinite: - \acro_long:n {#1} - } - -\NewAcroCommand \Iacl - { - \acro_first_upper: - \acro_indefinite: - \acro_long:n {#1} - } - -\NewAcroCommand \aclp - { - \acro_plural: - \acro_long:n {#1} - } - -\NewAcroCommand \Aclp - { - \acro_plural: - \acro_first_upper: - \acro_long:n {#1} - } - -% first: -\NewAcroCommand \acf - { \acro_first:n {#1} } - -\NewAcroCommand \Acf - { - \acro_first_upper: - \acro_first:n {#1} - } - -\NewAcroCommand \iacf - { - \acro_indefinite: - \acro_first:n {#1} - } - -\NewAcroCommand \Iacf - { - \acro_first_upper: - \acro_indefinite: - \acro_first:n {#1} - } - -\NewAcroCommand \acfp - { - \acro_plural: - \acro_first:n {#1} - } - -\NewAcroCommand \Acfp - { - \acro_plural: - \acro_first_upper: - \acro_first:n {#1} - } - -% first-like: -\NewPseudoAcroCommand \acflike - { \acro_first_like:nn {#1} {#2} } - -\NewPseudoAcroCommand \iacflike - { - \acro_indefinite: - \acro_first_like:nn {#1} {#2} - } - -\NewPseudoAcroCommand \Iacflike - { - \acro_first_upper: - \acro_indefinite: - \acro_first_like:nn {#1} {#2} - } - -\NewPseudoAcroCommand \acfplike - { - \acro_plural: - \acro_first_like:nn {#1} {#2} - } - -% -------------------------------------------------------------------------- -% endings: -\ProvideAcroEnding {plural} {s} {s} - -% -------------------------------------------------------------------------- -% translations: -% list name -\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 -\DeclareAcroTranslation {acronym-page-name} - { - Fallback = p. , - English = p. , - German = S. , - Portuguese = p. - } - -% pages name -\DeclareAcroTranslation {acronym-pages-name} - { - Fallback = pp. , - English = pp. , - German = S. , - Portuguese = pp. - } - -% following page -\DeclareAcroTranslation {acronym-next-page} - { - Fallback = f. , - English = f. , - German = f. , - Portuguese = s. - } - -% following pages -\DeclareAcroTranslation {acronym-next-pages} - { - Fallback = ff. , - English = ff. , - German = ff. , - Portuguese = ss. + \@onefilewithoptions + {\c_acro_definition_file_name_tl} [] [] + \c_acro_definition_file_extension_tl } + { \acro_serious_message:n {definitions-missing} } % -------------------------------------------------------------------------- % allow for a configuration file: -\tl_const:Nn \c_acro_config_file_name_tl {acro} -\tl_const:Nn \c_acro_config_file_extension_tl {cfg} \file_if_exist:nT - { \c_acro_config_file_name_tl .\c_acro_config_file_extension_tl } + { \l_acro_config_file_name_tl . \l_acro_config_file_extension_tl } { \@onefilewithoptions - {\c_acro_config_file_name_tl} [] [] - \c_acro_config_file_extension_tl + {\l_acro_config_file_name_tl} [] [] + \l_acro_config_file_extension_tl } \file_input_stop: diff --git a/macros/latex/contrib/acro/acro_en.pdf b/macros/latex/contrib/acro/acro_en.pdf Binary files differdeleted file mode 100644 index eee6eaed49..0000000000 --- a/macros/latex/contrib/acro/acro_en.pdf +++ /dev/null diff --git a/macros/latex/contrib/acro/example_one.tex b/macros/latex/contrib/acro/example_one.tex index 40b3d5fce4..3af86f5c33 100644 --- a/macros/latex/contrib/acro/example_one.tex +++ b/macros/latex/contrib/acro/example_one.tex @@ -2,7 +2,6 @@ % arara: pdflatex \documentclass{scrartcl} \usepackage[T1]{fontenc} -\usepackage[utf8]{inputenc} \usepackage[ngerman]{babel} \usepackage{acro} \acsetup{ @@ -80,7 +79,7 @@ zweites Mal: \ac{ecm} \ac{F} -% alle außer der Klasse 'physics' auflisten: +% % alle außer der Klasse 'physics' auflisten: \printacronyms[exclude-classes=physics, name=Abkürzungsverzeichnis] % nur die Klasse 'physics' auflisten: diff --git a/macros/latex/contrib/acro/example_two.tex b/macros/latex/contrib/acro/example_two.tex index f99d853a5f..7b188dc324 100644 --- a/macros/latex/contrib/acro/example_two.tex +++ b/macros/latex/contrib/acro/example_two.tex @@ -1,10 +1,9 @@ % arara: pdflatex % arara: pdflatex -% this file is an adapted version of acrotest.tex shipped out with the `acronym' -% package +% this file is an adapted version of acrotest.tex shipped out +% with the `acronym' package \documentclass{article} \usepackage[T1]{fontenc} -\usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage[colorlinks]{hyperref} \usepackage{acro} diff --git a/macros/latex/contrib/exframe/README.txt b/macros/latex/contrib/exframe/README.txt index cea7a5c270..86c71316ab 100644 --- a/macros/latex/contrib/exframe/README.txt +++ b/macros/latex/contrib/exframe/README.txt @@ -1,5 +1,5 @@ -exframe v3.3 -Copyright 2011-2019 Niklas Beisert +exframe v3.31 +Copyright 2011-2020 Niklas Beisert exframe is a LaTeX2e package which provides a general purpose framework to describe and typeset exercises and exam questions diff --git a/macros/latex/contrib/exframe/exframe.dtx b/macros/latex/contrib/exframe/exframe.dtx index dd8e26e393..b760696ca9 100644 --- a/macros/latex/contrib/exframe/exframe.dtx +++ b/macros/latex/contrib/exframe/exframe.dtx @@ -1,6 +1,6 @@ % \iffalse % -% exframe.dtx Copyright (C) 2011-2019 Niklas Beisert +% exframe.dtx Copyright (C) 2011-2020 Niklas Beisert % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -20,11 +20,11 @@ % exfserpe.tex, exfserpf.tex, exfsermk.sh, exfsermk.mak. % %<package|samplesingle|samplemultimain>\NeedsTeXFormat{LaTeX2e}[1996/12/01] -%<package>\ProvidesPackage{exframe}[2019/06/15 v3.3 Framework for Exercise Problems] -%<samplesingle>\ProvidesFile{exfsamp.tex}[2019/06/15 v3.3 standalone sample for exframe] -%<samplemultimain>\ProvidesFile{exfserm.tex}[2019/06/15 v3.3 multipart sample for exframe] +%<package>\ProvidesPackage{exframe}[2020/01/11 v3.31 Framework for Exercise Problems] +%<samplesingle>\ProvidesFile{exfsamp.tex}[2020/01/11 v3.31 standalone sample for exframe] +%<samplemultimain>\ProvidesFile{exfserm.tex}[2020/01/11 v3.31 multipart sample for exframe] %<*driver> -\def\thedate#1{2019/06/15}\def\theversion#1{v3.3} +\def\thedate#1{2020/01/11}\def\theversion#1{v3.31} \ProvidesFile{exframe.dtx}[\thedate{} \theversion{} exframe reference manual file] \PassOptionsToClass{10pt,a4paper}{article} \documentclass{ltxdoc} @@ -37,9 +37,10 @@ \hypersetup{colorlinks=true} \hypersetup{pdfstartview=FitH} \hypersetup{pdfpagemode=UseNone} +\hypersetup{keeppdfinfo=true} \hypersetup{pdfsource={}} \hypersetup{pdflang={en-UK}} -\hypersetup{pdfcopyright={Copyright 2010-2019 Niklas Beisert. +\hypersetup{pdfcopyright={Copyright 2010-2020 Niklas Beisert. This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license or (at your option) any later version.}} @@ -157,9 +158,8 @@ categories can be added. The package can use alternative counters for equations within solutions (and problems). This is to ensure a consistent numbering independently of whether solutions are output or not. -\end{itemize} - +\end{itemize} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -284,6 +284,7 @@ see \secref{sec:options} for further information. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DescribeMacro{\ifsolutions} +\DescribeMacro{onlysolutions} The display of solutions is reflected by the conditional |\ifsolutions|. As the hiding of solutions is performed automatically, the conditional would typically be used to change some details, @@ -293,6 +294,30 @@ e.g.\ for adjusting titles: |\ifsolutions Solutions\||else Exercises\||fi| \end{center} % +Alternatively, content to be processed only in solutions mode +can be enclosed in an |onlysolutions| block: +% +\begin{center} +\begin{tabular}{l} +|\begin{onlysolutions}|\\ +|...|\\ +|\end{onlysolutions}| +\end{tabular} +\end{center} +% +This structure can be useful to hide auxiliary text or material +if all solution content is to be stripped from a source file, +e.g.\ by an automated \textsf{sed} filter rule +(doubling of backslashes required for \textsf{sed} +as well as for shell script strings): +% +\begin{center} +\begin{tabular}{l} +|sed "/\\\\begin{solution}/,/\\\\end{solution}/d;"\|\\ +|"/\\\\begin{onlysolutions}/,/\\\\end{onlysolutions}/d"| +\end{tabular} +\end{center} +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DescribeMacro{solutionequation} @@ -1483,7 +1508,6 @@ enable/disable buffering for |problem| environments in order to control their display. \end{itemize} -% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1492,7 +1516,7 @@ in order to control their display. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Copyright} -Copyright \copyright{} 2011--2019 Niklas Beisert +Copyright \copyright{} 2011--2020 Niklas Beisert This work may be distributed and/or modified under the conditions of the \LaTeX{} Project Public License, either version 1.3 @@ -1666,6 +1690,45 @@ The package offers most of the functionality of the above packages, but (presently) misses out on some more advanced features, see \secref{sec:suggestions}. +\iffalse +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\subsection{Suggested Customisations} +\label{sec:customisations} + +\textbf{philosophy:} +this is fundamental, relies on few other basic packages. +can improve by combining with other packages which provide solutions +for particular applications. some suggestions: + +\textbf{Optional Starred} + +\textbf{Till's Boxen} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Realize background color for solutions with tcolorbox: +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\RequirePackage{tcolorbox} +%\tcbuselibrary{breakable} +%\exercisestyle{solutionsep} +%\exerciseconfig{insertsolutionsbefore}{% +% \begin{tcolorbox}[breakable,boxrule=0.2pt,sharp corners=all]} +%\exerciseconfig{insertsolutionsafter}{% +% \end{tcolorbox}} +%% cannot use marginpar inside tcolorbox (nested floats), use marginnote instead: +%\exercisestyle{solutionpointsat=margin} +%\RequirePackage{marginnote} +%\exerciseconfig{insertpointsmargin}[1]{\marginnote{\footnotesize #1}} +%% Don't indent solutions: +%\exerciseconfig{skipsolutionitemsub}{0ex} +%% remove initial "Solution:" because the colorbox is highlight enough: +%\exerciseconfig{composetitlesolutionsingle}[2]{} + +\textbf{Collections} + +\textbf{keep list of tags per sheet. code to loop through list. Manuel Benz} + +\fi + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Feature Suggestions} \label{sec:suggestions} @@ -1692,6 +1755,28 @@ Define structures for multiple-choice questions. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Revision History} +\iffalse +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\paragraph{v3.3+:} 2020/01/12 + +\begin{itemize} +\item +section on extensions +\item +\ldots +\end{itemize} +\fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\paragraph{v3.31:} 2020/01/11 + +\begin{itemize} +\item +|onlysolutions| environment for solution mode content +\item +sample multipart setup streamlined +\end{itemize} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph{v3.3:} 2019/06/15 @@ -2533,12 +2618,11 @@ xu:=1cm; \getexercisedata{author}. \copyrightmessage{} \licensemessage}} \ifdefined\sourceurl\hypersetup{pdflicenseurl={\sourceurl}}\else \ifdefined\licenseurl\hypersetup{pdflicenseurl={\licenseurl}}\fi\fi -\ifdefined\XMPLangAlt +\hypersetup{keeppdfinfo=true} \hypersetup{pdfsource={}} \XMPLangAlt{en}{pdfcopyright={Copyright \getexercisedata{date} \getexercisedata{author}. \copyrightmessage{} \licensemessage}} \fi -\fi % \end{macrocode} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -2908,6 +2992,20 @@ label(btex \figure etex, center(paths[1])); #!/bin/bash % \end{macrocode} +% Configure and declare variables with default values. +% |srcmain| defines the name of the main source file; +% |srcsec|\textit{nn} defines the name of the sheet source file; +% |trglist| defines the target file names; +% |trgsol| defines the target modes; +% |sheets| is a list of allowable sheet identifiers \textit{nn}: +% \begin{macrocode} +srcmain="exfserm" +srcsec="exfser" +trglist=(Problems Solutions) +trgsol=(n y) +secnum="01 02 03 aa" +% \end{macrocode} + % Display usage: % \begin{macrocode} if [ -z $1 ] @@ -2915,7 +3013,7 @@ then echo "Usage: $0 number [version] number: number of sheet, 0 for combined document - version: 1 for problems, 2 for solutions + version: 0 for problems, 1 for solutions $0 filename filename: target file to be compiled" exit 1 @@ -2926,28 +3024,18 @@ fi % Configure and declare variables with default values. % |num| takes the sheet number; % |ver| takes the compile mode; -% |main| defines the name of the main source file; -% |source|\textit{nn} defines the name of the sheet source file; -% |target1|[\textit{nn}] defines the target file name in mode 1; -% |target2|[\textit{nn}] defines the target file name in mode 2; -% |sheets| is a list of allowable sheet identifiers \textit{nn}: % \begin{macrocode} num="$1" ver="$2" -main="exfserm" -source="exfser" -target1="Problems" -target2="Solutions" -sheets="01 02 03 aa" nl=$'\n' -sheetokay="" +secokay="" make=".pdf" % \end{macrocode} %\iffalse$\fi % Check if the parameter matches any of the acceptable output file names: % \begin{macrocode} -for v in $target1 $target2 +for v in "${trglist[@]}" do if [[ $num =~ ^$v ]] then @@ -2958,6 +3046,7 @@ do fi done % \end{macrocode} +%\iffalse$\fi % Ensure that |num| is a two-digit number, prepend `0' otherwise: % \begin{macrocode} @@ -2967,16 +3056,16 @@ if [[ $num == "00" ]]; then num=""; fi % Check whether |num| is acceptable: % \begin{macrocode} -if [[ -z $num ]]; then sheetokay="okay"; fi -for v in $sheets +if [[ -z $num ]]; then secokay="okay"; fi +for v in $secnum do - if [[ "$num" == "$v" ]]; then sheetokay="okay"; fi + if [[ "$num" == "$v" ]]; then secokay="okay"; fi done % \end{macrocode} % Otherwise display error message and exit: % \begin{macrocode} -if [[ -z $sheetokay ]] +if [[ -z $secokay ]] then echo "error: unknown sheet" exit 1 @@ -2984,6 +3073,12 @@ fi % \end{macrocode} %\iffalse$\fi +% Disable newline character for command line tex code: +% \begin{macrocode} +if [[ "$make" == ".pdf" ]]; then nl=""; fi +% \end{macrocode} +%\iffalse$\fi + % Function to compile a component. % Set up \textsf{childdoc} mechanism according to desired component. % Compile two passes, first in |-draftmode|. @@ -2992,23 +3087,27 @@ fi % \begin{macrocode} function docompile { - if [[ -z $num ]]; then job=$main; else job=$source$num; fi - for par in -draftmode "" + if [[ -z $num ]] + then + job="$srcmain" + fwd="\\childdocforward{$srcmain}" + else + job="$srcsec$num" + fwd="\\childdocforward[$srcmain]{$srcsec$num}" + fi + body="\\def\\jobname{$job}$optdef\\input{childdoc.def}$fwd" + for pass in first main do - body="\\def\\jobname{$job}\\def\\draftver{n}\\def\\printsol{$sol}" - body="$body\\input{childdoc.def}" - if [[ -z $num ]] - then - body="$body\\childdocforward{$main}" - else - body="$body\\childdocforward[$main]{$source$num}" - fi + par=""; + if [[ "$pass" == "first" ]]; then par="-draftmode"; fi drop="This is|entering extended mode|\\write18" drop="$drop|Preloading the plain mem file|mpost\.mp|plain\.mp" pdflatex -shell-escape -interaction=batchmode $par \ - -jobname "$target$num" "$body" | grep -vE "$drop" + -jobname "$trg" "$body" | grep -vE "$drop" + if [[ "$pass" != "main" ]]; then continue; fi + if ! (grep -E -q "may have changed|rerunfilecheck Warning" "$trg.log"); then break; fi done - grep -E "Warning|Error|Undefined|Overfull|Underfull" "$target$num.log" + grep -E "^! |Warning|Error|Undefined|Overfull|Underfull" "$trg.log" } % \end{macrocode} %\iffalse$\fi @@ -3017,40 +3116,34 @@ function docompile % \begin{macrocode} function writesource { - body="\\def\\draftver{n}$nl\\def\\printsol{$sol}$nl" - body="$body\\input{childdoc.def}$nl" if [[ -z $num ]] then - body="$body\\childdocforward{$main}" + fwd="\\childdocforward{$srcmain}" else - body="$body\\childdocforwardprefix[$main]{$target}{$source}" + fwd="\\childdocforwardprefix[$srcmain]{$target}{$srcsec}" fi - echo "$body" > $target$num.tex -} -% \end{macrocode} - -% Configure variables and select appropriate function for intended task: -% \begin{macrocode} -function process -{ - target=$1 - sol=$2 - if [[ "$make" == ".pdf" ]]; then docompile; else writesource; fi + body="$optdef\\input{childdoc.def}$nl$fwd" + echo "$body" > $trg.tex } % \end{macrocode} %\iffalse$\fi -% Translate versions to parameter values: +% Translate versions to parameter values, +% configure variables and select appropriate function for intended task: % \begin{macrocode} -if [[ -z $ver || "$ver" == "$target1" || $ver = 1 ]] -then - process $target1 n -fi -if [[ -z $ver || "$ver" == "$target2" || $ver = 2 ]] -then - process $target2 y -fi +for i in "${!trglist[@]}" +do + if [[ -z $ver || "$ver" == "${trglist[$i]}" || $ver = $i ]] + then + target="${trglist[$i]}" + sol="${trgsol[$i]}" + trg="$target$num" + optdef="\\def\\draftver{n}$nl\\def\\printsol{$sol}$nl" + if [[ "$make" == ".pdf" ]]; then docompile; else writesource; fi + fi +done % \end{macrocode} +%\iffalse$\fi % Finish with blank line: % \begin{macrocode} @@ -3079,19 +3172,20 @@ echo % % Configuration definitions: % \begin{macrocode} -MAIN = exfserm -SOURCE = exfser -PROBLEM = exfserp +SRCMAIN = exfserm +SRCSEC = exfser +SRCPRB = exfserp SCRIPT = exfsermk.sh MAKEFILE = exfsermk.mak -TARGETLIST = Problems Solutions -SHEETNUM = 01 02 03 aa -PREREQS = $(MAIN).tex -SOURCES = $(SHEETNUM:%=$(SOURCE)%.tex) -SHEETS = $(foreach trg,$(TARGETLIST),$(trg).pdf $(SHEETNUM:%=$(trg)%.pdf)) -TARGETS = $(foreach trg,$(TARGETLIST),$(trg).pdf) -GENFILES = $(foreach trg,$(TARGETLIST),$(trg).tex $(SHEETNUM:%=$(trg)%.tex)) -BAKFILES = $(SOURCES) $(MAIN).tex $(MAKEFILE) $(SCRIPT) $(PROBLEM)* +TRGLIST = Problems Solutions +SECNUM = 01 02 03 aa +PREREQS = $(SRCMAIN).tex + +SRCSECFILES = $(SECNUM:%=$(SRCSEC)%.tex) +TRGMAINFILES = $(foreach trg,$(TRGLIST),$(trg).pdf) +TRGSECFILES = $(foreach trg,$(TRGLIST),$(trg).pdf $(SECNUM:%=$(trg)%.pdf)) +GENFILES = $(foreach trg,$(TRGLIST),$(trg).tex $(SECNUM:%=$(trg)%.tex)) +BAKFILES = $(PREREQS) $(SRCSECFILES) $(GENFILES) $(MAKEFILE) $(SCRIPT) $(SRCPRB)* % \end{macrocode} %\iffalse$\fi @@ -3099,9 +3193,9 @@ BAKFILES = $(SOURCES) $(MAIN).tex $(MAKEFILE) $(SCRIPT) $(PROBLEM)* % |default| is the default target when no parameters are given: % \begin{macrocode} default: sheets ; -sheets: $(SHEETS) ; -main: $(TARGETS) ; -sheet%: $(foreach trg,$(TARGETLIST),$(trg)%.pdf) ; +main: $(TRGMAINFILES) ; +sheets: $(TRGSECFILES) ; +sheet%: $(foreach trg,$(TRGLIST),$(trg)%.pdf) ; all: main sheets ; sources: $(GENFILES) ; % \end{macrocode} @@ -3111,11 +3205,11 @@ sources: $(GENFILES) ; % Note that command lines have to start with a tab character % (represented by 8 spaces here): % \begin{macrocode} -$(TARGETS): $(SOURCES) $(PREREQS) +$(TRGMAINFILES): $(SRCSECFILES) $(PREREQS) bash ./$(SCRIPT) $@ -$(word 1,$(TARGETLIST))%.pdf: $(SOURCE)%.tex $(PREREQS) +$(word 1,$(TRGLIST))%.pdf: $(SRCSEC)%.tex $(PREREQS) bash ./$(SCRIPT) $@ -$(word 2,$(TARGETLIST))%.pdf: $(SOURCE)%.tex $(PREREQS) +$(word 2,$(TRGLIST))%.pdf: $(SRCSEC)%.tex $(PREREQS) bash ./$(SCRIPT) $@ $(GENFILES): bash ./$(SCRIPT) $@ @@ -3125,20 +3219,19 @@ $(GENFILES): % Touch main file for recompile: % \begin{macrocode} touch: - touch $(MAIN).tex + touch $(SRCMAIN).tex % \end{macrocode} %\iffalse$\fi % Define |clean| target to remove all intermediate compilation files: % \begin{macrocode} clean: - rm -f $(SHEETNUM:%=$(SOURCE)%.aux) - rm -f $(SHEETNUM:%=$(SOURCE)%.log) - rm -f $(foreach trg,$(TARGETLIST),$(SHEETNUM:%=$(trg)%.log) $(trg).log) - rm -f $(patsubst %,$(MAIN)%,.aux .log .out .toc) - rm -f $(patsubst %,$(MAIN)%,.mp .mpx -*.mps -tmp.log -tmp.mp -tmp.mpx) + rm -f $(foreach ext,.aux .log,$(SECNUM:%=$(SRCSEC)%$(ext))) + rm -f $(foreach trg,$(TRGLIST),$(SECNUM:%=$(trg)%.log) $(trg).log) + rm -f $(foreach ext,.aux .log .out .toc,$(SRCMAIN)$(ext)) + rm -f $(foreach ext,.mp .mpx -*.mps -tmp.log -tmp.mp -tmp.mpx,$(SRCMAIN)$(ext)) rm -f mpxerr.tex mpxerr.log mpxerr.dvi texput.log - rm -f $(patsubst %,$(PROBLEM)*%,.aux .log .mp .mpx -*.mps) - rm -f $(patsubst %,$(PROBLEM)*%,-tmp.log -tmp.mp -tmp.mpx) + rm -f $(patsubst %,$(SRCPRB)*%,.aux .log .mp .mpx -*.mps) + rm -f $(patsubst %,$(SRCPRB)*%,-tmp.log -tmp.mp -tmp.mpx) % \end{macrocode} %\iffalse$\fi % Define |clean-bak| target to remove all backup files @@ -3151,10 +3244,9 @@ clean-bak: % for a clean source directory: % \begin{macrocode} clean-all: clean - rm -f $(SHEETS) $(TARGETS) - rm -f $(SHEETNUM:%=$(SOURCE)%.pdf) $(MAIN).pdf - rm -f $(foreach trg,$(TARGETLIST),$(SHEETNUM:%=$(trg)%.tex) $(trg).tex) - rm -f $(PROBLEM)*.pdf + rm -f $(TRGSECFILES) $(TRGMAINFILES) $(GENFILES) + rm -f $(SECNUM:%=$(SRCSEC)%.pdf) $(SRCMAIN).pdf + rm -f $(SRCPRB)*.pdf % \end{macrocode} %\iffalse$\fi % \catcode9=9 @@ -3378,6 +3470,19 @@ clean-all: clean \newcommand{\exercisesetup}[1]{\exf@expsetkeys{exf@setup}{#1}} % \end{macrocode} +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \paragraph{Solutions Only Processing.} +% +% \macro{onlysolutions} +% Process block only in solutions mode: +% \begin{macrocode} +\newenvironment{onlysolutions}% + {\ifsolutions\else% + \let\endonlysolutions\endcomment% + \expandafter\comment\fi}% + {} +% \end{macrocode} + % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \subsection{Configuration} % \label{sec:imp-config} @@ -4456,33 +4561,17 @@ clean-all: clean % \paragraph{Write Metadata to PDF Files.} % % \macro{\exf@writemetadata} -% Write Metadata to PDF Files in case \textsf{hyperref} is available, -% choose between global and sheet version, pass through unfilled values: +% Write Metadata to PDF Files in case \textsf{hyperref} is available: % \begin{macrocode} -\newcommand{\exf@writemetadata}[1]{% +\newcommand{\exf@writemetadata}{% \ifdefined\hypersetup% - \def\exf@tmp{#1}\ifx\exf@tmp\exf@empty% -% \end{macrocode} -% Write global author and title: -% \begin{macrocode} - \ifx\exf@data@author\exf@empty\else% - \hypersetup{pdfauthor={\exf@data@author}}\fi% - \ifx\exf@data@title\exf@empty\else% - \hypersetup{pdftitle={\exf@data@title}}\fi% - \else% -% \end{macrocode} -% Write sheet author (if available) and compose sheet title: -% \begin{macrocode} - \ifx\exf@data@sheet@author\exf@empty% - \ifx\exf@data@author\exf@empty\else% - \hypersetup{pdfauthor={\exf@data@author}}\fi% - \else\hypersetup{pdfauthor={\exf@data@sheet@author}}\fi% - \hypersetup{pdftitle={\exf@config@composemetasheet% - {\csname the\exf@sheetcounter\endcsname}{\exf@data@sheet@rawtitle}}}% - \fi% % \end{macrocode} -% Write subject and keywords: +% Write author, title, subject and keywords: % \begin{macrocode} + \ifx\exf@data@author\exf@empty\else% + \hypersetup{pdfauthor={\exf@data@author}}\fi% + \ifx\exf@data@title\exf@empty\else% + \hypersetup{pdftitle={\exf@data@title}}\fi% \ifx\exf@data@subject\exf@empty\else% \hypersetup{pdfsubject={\exf@data@subject}}\fi% \ifx\exf@data@keyword\exf@empty\else% @@ -4496,14 +4585,14 @@ clean-all: clean % Automatic writing at |\begin{document}|: % \begin{macrocode} -\AtBeginDocument{\exf@ifis\exf@metadata{auto}{\exf@writemetadata{}}} +\AtBeginDocument{\exf@ifis\exf@metadata{auto}{\exf@writemetadata}} % \end{macrocode} % \macro{\writeexercisedata} % Write metadata manually: % \begin{macrocode} \newcommand{\writeexercisedata}{% - \exf@ifis\exf@metadata{manual}{\exf@writemetadata{}}} + \exf@ifis\exf@metadata{manual}{\exf@writemetadata}} % \end{macrocode} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -5131,7 +5220,12 @@ clean-all: clean % \end{macrocode} % Process metadata: % \begin{macrocode} - \exf@ifis\exf@metadata{sheet}{\exf@writemetadata{sheet}}% + \exf@ifis\exf@metadata{sheet}{{% + \ifx\exf@data@sheet@author\exf@empty\else% + \let\exf@data@author\exf@data@sheet@author\fi% + \def\exf@data@title{\exf@config@composemetasheet% + {\csname the\exf@sheetcounter\endcsname}{\exf@data@sheet@rawtitle}}% + \exf@writemetadata}}% % \end{macrocode} % Insert hook code: % \begin{macrocode} diff --git a/macros/latex/contrib/exframe/exframe.ins b/macros/latex/contrib/exframe/exframe.ins index 621d7e434d..3e3845b443 100644 --- a/macros/latex/contrib/exframe/exframe.ins +++ b/macros/latex/contrib/exframe/exframe.ins @@ -4,7 +4,7 @@ \keepsilent \preamble -Copyright (C) 2011-2019 Niklas Beisert +Copyright (C) 2011-2020 Niklas Beisert This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/exframe/exframe.pdf b/macros/latex/contrib/exframe/exframe.pdf Binary files differindex 84e39f432b..e9886cb930 100644 --- a/macros/latex/contrib/exframe/exframe.pdf +++ b/macros/latex/contrib/exframe/exframe.pdf diff --git a/macros/latex/contrib/simplebnf/LICENSE b/macros/latex/contrib/simplebnf/LICENSE new file mode 100644 index 0000000000..3a0de6d06f --- /dev/null +++ b/macros/latex/contrib/simplebnf/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright © 2019-2020 Jay Lee <jaeho.lee@snu.ac.kr> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/macros/latex/contrib/simplebnf/README.md b/macros/latex/contrib/simplebnf/README.md new file mode 100644 index 0000000000..240e26de0b --- /dev/null +++ b/macros/latex/contrib/simplebnf/README.md @@ -0,0 +1,11 @@ +# simplebnf +simplebnf is a simple package to format Backus-Naur form. The package provides a simple way to format Backus-Naur form (BNF). It parses BNF expressions, possibly with annotations. + +## Documentation +See the [simplebnf-doc.pdf](https://github.com/Zeta611/simplebnf/blob/master/simplebnf-doc.pdf) file. + +## Authors +- Jay Lee <jaeho.lee@snu.ac.kr> + +## License +simplebnf is available under the MIT license. See the [LICENSE](https://github.com/Zeta611/simplebnf/blob/master/LICENSE) file for more info. diff --git a/macros/latex/contrib/simplebnf/simplebnf-doc.pdf b/macros/latex/contrib/simplebnf/simplebnf-doc.pdf Binary files differnew file mode 100644 index 0000000000..02434f6b7f --- /dev/null +++ b/macros/latex/contrib/simplebnf/simplebnf-doc.pdf diff --git a/macros/latex/contrib/simplebnf/simplebnf-doc.tex b/macros/latex/contrib/simplebnf/simplebnf-doc.tex new file mode 100644 index 0000000000..e30c524e85 --- /dev/null +++ b/macros/latex/contrib/simplebnf/simplebnf-doc.tex @@ -0,0 +1,82 @@ +\documentclass[a4paper]{article} + +\usepackage{fontspec} +\setmainfont{Linux Libertine} +\setsansfont{Libertinus Sans} +\setmonofont{Inconsolata} + +\usepackage{hyperref} + +\usepackage{tcolorbox} +\tcbuselibrary{listings,breakable} +\tcbset{listing engine=listings,colframe=black,colback=white,size=small} +\NewDocumentEnvironment {exampleside} {} + { \tcblisting{listing side text,righthand width=.4\textwidth} } + { \endtcblisting } + +\NewDocumentEnvironment { presentcommand } { b } + {% + \vspace*{0.5\baselineskip}\noindent\fbox{% + \begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule} + #1 + \end{minipage}}\vspace*{0.5\baselineskip} + } + { } + +\NewDocumentCommand \cmd { m } { \texttt{\textbackslash#1} } +\NewDocumentCommand \env { m m } + { + \texttt{% + \textbackslash begin\{#1\} \textrm{#2} % + \textbackslash end\{#1\}% + }% + } + +\usepackage{simplebnf} + +\title{% + \textsf{simplebnf} --- A simple package to format Backus-Naur form% + \footnote{This file describes v0.1.0.}} +\author{Jay Lee\footnote{E-mail: % + \href{mailto:jaeho.lee@snu.ac.kr}{\texttt{jaeho.lee@snu.ac.kr}}}} +\date{2019/12/23} + +\begin{document} +\maketitle + +\begin{presentcommand} + \cmd{bnfexpr} \cmd{bnfannot} +\end{presentcommand} +The \cmd{bnfexpr} and the \cmd{bnfannot} commands are simply wrappers around +\cmd{texttt} and \cmd{textit}, respectively. + +\begin{presentcommand} + \env{bnfgrammar}{text} +\end{presentcommand} +The \textit{term} argument of the \texttt{bnfgrammar} environment is the term +to define a grammar. +The text inside the environment should be formatted as: +\begin{equation*} + \bnfexpr{term} \Coloneqq \langle\textit{keypairs}\rangle +\end{equation*} +where each pair of \textit{keypairs} represents an alternative syntactic form +of the \textit{term} and its annotation, delimited with a colon(\verb/:/). +If you don't need annotations, simply omit the colons and annotations +altogether. + +A sample code and the result is shown below: +\begin{exampleside} +\begin{bnfgrammar} + v ::= n | $\lambda$x.e +\end{bnfgrammar} + +\begin{bnfgrammar} + C ::= + []: hole + | C\,e: application 1 + | v\,C: application 2 + | C\,+\,e: addition 1 + | v\,+\,C: addition 2 +\end{bnfgrammar} +\end{exampleside} +\end{document} diff --git a/macros/latex/contrib/simplebnf/simplebnf.sty b/macros/latex/contrib/simplebnf/simplebnf.sty new file mode 100644 index 0000000000..511a01c7d3 --- /dev/null +++ b/macros/latex/contrib/simplebnf/simplebnf.sty @@ -0,0 +1,113 @@ +%% +%% This is file `simplebnf.sty'. +%% +%% --------------------------------------------------------------------------- +%% The simplebnf package --- A simple package to format Backus-Naur form +%% Maintained by Jay Lee +%% E-mail: jaeho.lee@snu.ac.kr +%% Released under the MIT License. +%% --------------------------------------------------------------------------- +%% +\RequirePackage{expl3,xparse} +% mathtools is needed for the \Coloneqq simbol +\RequirePackage{mathtools} +\ProvidesExplPackage + {simplebnf} + {2019/12/23} + {0.1.0} + {A simple package to format Backus–Naur form} + + +\cs_generate_variant:Nn \seq_set_split:Nnn {NVn} + +\tl_new:N \g__simplebnf_defeq_tl +\tl_gset:Nn \g__simplebnf_defeq_tl { \ensuremath{\Coloneqq} } + +\tl_new:N \g__simplebnf_defor_tl +\tl_gset:Nn \g__simplebnf_defor_tl { \ensuremath{|} } + +\seq_new:N \l__input_seq +\tl_new:N \l__term_tl +\tl_new:N \l__body_tl +\tl_new:N \l__keypairs_tl +\seq_new:N \l__keypairs_seq + +\NewDocumentCommand \bnfexpr { m } { \texttt { #1 } } +\NewDocumentCommand \bnfannot { m } { \textit{ #1 } } + +\NewDocumentEnvironment { bnfgrammar } { +b } + { + % Store the term to define grammar in \l__term_tl and the + % (alternative form: annotion) keypairs in \l__keypairs_tl + \regex_split:nnN { ::= } { #1 } \l__input_seq + \seq_pop_left:NN \l__input_seq \l__term_tl + \seq_pop_left:NN \l__input_seq \l__keypairs_tl + + % Store keypairs + \seq_set_split:NnV \l__keypairs_seq { | } \l__keypairs_tl + + \begin{center} + \tl_set:Nn \l__table_tl + { + \begin{tabular}{lcll} + \bnfexpr { \l__term_tl } & \g__simplebnf_defeq_tl & + } + + \bool_set_false:N \l_tmpa_bool + + \seq_map_inline:Nn \l__keypairs_seq + { + \bool_if:NTF \l_tmpa_bool + { \tl_put_right:Nn \l__table_tl { \\ & \g__simplebnf_defor_tl & } } + { \bool_set_true:N \l_tmpa_bool } + + \regex_split:nnNTF { : } { ##1 } \l_tmpa_seq + { + \seq_pop_left:NNT \l_tmpa_seq \l_tmpa_tl + { + \tl_set:Nx \l_tmpa_tl { \bnfexpr { \l_tmpa_tl } } + \tl_put_right:NV \l__table_tl \l_tmpa_tl + } + + \tl_put_right:Nn \l__table_tl { & } + + \seq_pop_left:NNT \l_tmpa_seq \l_tmpb_tl + { + \tl_set:Nx \l_tmpb_tl { \bnfannot { \l_tmpb_tl } } + \tl_put_right:NV \l__table_tl \l_tmpb_tl + } + } + { + \tl_put_right:Nn \l__table_tl { \bnfexpr { ##1 } & } + } + } + + \tl_put_right:Nn \l__table_tl { \end{tabular} } + \tl_use:N \l__table_tl + \end{center} + } + { } + +%% The MIT License (MIT) +%% +%% Copyright © 2019-2020 Jay Lee <jaeho.lee@snu.ac.kr> +%% +%% Permission is hereby granted, free of charge, to any person obtaining +%% a copy of this software and associated documentation files (the "Software"), +%% to deal in the Software without restriction, including without limitation +%% the rights to use, copy, modify, merge, publish, distribute, sublicense, +%% and/or sell copies of the Software, and to permit persons to whom the +%% Software is furnished to do so, subject to the following conditions: +%% +%% The above copyright notice and this permission notice shall be included +%% in all copies or substantial portions of the Software. +%% +%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +%% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +%% OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +%% IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +%% DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +%% TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +%% OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +%% +%% End of file `simplebnf.sty'. diff --git a/macros/latex/contrib/tasks/README b/macros/latex/contrib/tasks/README index c0cd02c7f8..aa177739fa 100644 --- a/macros/latex/contrib/tasks/README +++ b/macros/latex/contrib/tasks/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the TASKS package v1.1 2019/11/03 +the TASKS package v1.1a 2020/01/11 horizontally columned lists @@ -8,7 +8,7 @@ Clemens Niederberger Web: https://github.com/cgnieder/tasks/ E-Mail: contact@mychemistry.eu -------------------------------------------------------------------------- -Copyright 2013--2019 Clemens Niederberger +Copyright 2013--2020 Clemens Niederberger This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tasks/tasks.cfg b/macros/latex/contrib/tasks/tasks.cfg index d76ad264cd..127d78f273 100644 --- a/macros/latex/contrib/tasks/tasks.cfg +++ b/macros/latex/contrib/tasks/tasks.cfg @@ -8,7 +8,7 @@ % Web: https://github.com/cgnieder/tasks/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2013--2019 Clemens Niederberger +% Copyright 2013--2020 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tasks/tasks.sty b/macros/latex/contrib/tasks/tasks.sty index ed0bc10610..e9332a378c 100644 --- a/macros/latex/contrib/tasks/tasks.sty +++ b/macros/latex/contrib/tasks/tasks.sty @@ -8,7 +8,7 @@ % Web: https://github.com/cgnieder/tasks/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2013--2019 Clemens Niederberger +% Copyright 2013--2020 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -28,10 +28,10 @@ \RequirePackage {expl3,xparse,xtemplate} \ExplSyntaxOn -\tl_const:Nn \c_tasks_date_tl {2019/11/03} +\tl_const:Nn \c_tasks_date_tl {2020/01/11} \tl_const:Nn \c_tasks_version_major_number_tl {1} \tl_const:Nn \c_tasks_version_minor_number_tl {1} -\tl_const:Nn \c_tasks_version_subrelease_tl {} +\tl_const:Nn \c_tasks_version_subrelease_tl {a} \tl_const:Nx \c_tasks_version_number_tl { \c_tasks_version_major_number_tl . @@ -63,13 +63,13 @@ \msg_new:nnn {tasks} {width-too-small} { The~ width~ of~ `#1'~ is~ too~ small~ \msg_line_context: .~ - Please~ set~ it~ at~ least~ to~ #2. + Please~ set~ it~ at~ least~ to~ #2 pt. } \msg_new:nnn {tasks} {no-item} { You've~ placed~ `#1'~ before~ the~ first~ #2~ \msg_line_context: .~ - I~ will~ through~ it~ away~ and~ ignore~ it~ for~ the~ rest~ of~ the~ + I~ will~ throw~ it~ away~ and~ ignore~ it~ for~ the~ rest~ of~ the~ list. } @@ -530,7 +530,7 @@ { \__tasks_read_item:www ##1 \q_stop \refstepcounter {task} - \tl_set:NV \l__tasks_label_tl \l__tasks_tmpa_tl + \tl_set:Nx \l__tasks_label_tl { { \exp_not:V \l__tasks_tmpa_tl } } \bool_if:NTF \l__tasks_custom_label_format_bool { \tl_put_left:NV \l__tasks_label_tl \l__tasks_custom_label_format_tl } { \tl_put_left:NV \l__tasks_label_tl \l__tasks_label_format_tl } @@ -602,9 +602,12 @@ \cs_new_protected:Npn \__tasks_read_item_aux_ii:ww [#1]#2 \q_stop { - \tl_set:Nn \l__tasks_tmp_label_tl {#1} - \tl_if_eq:nnF {#1} { $tasks$default$label$ } - { \tl_put_left:NV \l__tasks_tmp_label_tl \l__tasks_label_format_tl } + \tl_if_eq:nnTF {#1} {$tasks$default$label$} + { \tl_set:Nn \l__tasks_tmp_label_tl {#1} } + { + \tl_set:Nn \l__tasks_tmp_label_tl {{#1}} + \tl_put_left:NV \l__tasks_tmp_label_tl \l__tasks_label_format_tl + } \tl_set:Nx \l__tasks_item_tl { \tl_trim_spaces:n {#2} } } @@ -825,3 +828,5 @@ 2019/11/03 v1.1 - fix typo - make \settasks' argument long - new option `start' +2020/01/11 v1.2 - allow `label-format' to end with command that needs an + argument diff --git a/macros/latex/contrib/tasks/tasks_en.pdf b/macros/latex/contrib/tasks/tasks_en.pdf Binary files differindex d39fa59b12..27389741a3 100644 --- a/macros/latex/contrib/tasks/tasks_en.pdf +++ b/macros/latex/contrib/tasks/tasks_en.pdf diff --git a/macros/latex/contrib/tasks/tasks_en.tex b/macros/latex/contrib/tasks/tasks_en.tex index b9f3a4f350..8821283a82 100644 --- a/macros/latex/contrib/tasks/tasks_en.tex +++ b/macros/latex/contrib/tasks/tasks_en.tex @@ -8,7 +8,7 @@ % Web: https://github.com/cgnieder/tasks/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2013--2019 Clemens Niederberger +% Copyright 2013--2020 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -270,8 +270,9 @@ following ones that can be set using a setup command: Choose the instance to be used. Read more on this in section~\ref{sec:tasks}. \keyval{label-format}{code}\Default - \changedversion{0.9}Can be used to apply a formatting like, \eg, - \cs*{bfseries} to the labels. + \changedversion{1.1a}Can be used to apply a formatting like, \eg, + \cs*{bfseries} to the labels. This may be code accepting the item as + mandatory argument. \keyval{label}{code}\Default{\cs*{alph}\code{*)}} \changedversion{1.0}Sets a custom label. The \code{*} is replaced by \Marg{task}. This is heavily inspired by @@ -283,7 +284,7 @@ following ones that can be set using a setup command: item. \keyval{item-format}{code}\Default \sinceversion{0.11}Can be used to apply a formatting like, \eg, - \cs*{bfseries} to the items. This may be a macro accepting the item as + \cs*{bfseries} to the items. This may be code accepting the item as mandatory argument. \keyval{item-indent}{dim}\Default{2.5em} \sinceversion{0.9a}The indent of an item, \ie, the horizontal space @@ -341,7 +342,7 @@ following ones that can be set using a setup command: \draw[<->] (0,-.5) --node[below]{item indent} (2,-.5) ; \draw[<->] (2,-.5) --node[below]{item width} (10,-.5) ; \draw[<->] (labeledge1) ++(0,1) --node[above]{label width} ++(-1,0) ; - \draw[<->] (labeledge1) --node[above]{item offset} ++(.5,0) ; + \draw[<->] (labeledge1) --node[above]{label offset} ++(.5,0) ; \end{tikzpicture} \caption{A visual representation of the used lengths.} \label{fig:lengths} |