texlive[68512] Master: collargs (11oct23)
commits+karl at tug.org
commits+karl at tug.org
Wed Oct 11 22:25:43 CEST 2023
Revision: 68512
https://tug.org/svn/texlive?view=revision&revision=68512
Author: karl
Date: 2023-10-11 22:25:43 +0200 (Wed, 11 Oct 2023)
Log Message:
-----------
collargs (11oct23)
Modified Paths:
--------------
trunk/Master/tlpkg/bin/tlpkg-ctan-check
trunk/Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc
Added Paths:
-----------
trunk/Master/texmf-dist/doc/generic/collargs/
trunk/Master/texmf-dist/doc/generic/collargs/FILES
trunk/Master/texmf-dist/doc/generic/collargs/INSTALL.md
trunk/Master/texmf-dist/doc/generic/collargs/LICENCE
trunk/Master/texmf-dist/doc/generic/collargs/README.md
trunk/Master/texmf-dist/source/generic/collargs/
trunk/Master/texmf-dist/source/generic/collargs/Makefile
trunk/Master/texmf-dist/source/generic/collargs/collargs.edtx
trunk/Master/texmf-dist/source/generic/collargs/collargs.ins
trunk/Master/texmf-dist/tex/context/collargs/
trunk/Master/texmf-dist/tex/context/collargs/t-collargs.tex
trunk/Master/texmf-dist/tex/latex/collargs/
trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty
trunk/Master/texmf-dist/tex/plain/collargs/
trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex
trunk/Master/tlpkg/tlpsrc/collargs.tlpsrc
Added: trunk/Master/texmf-dist/doc/generic/collargs/FILES
===================================================================
--- trunk/Master/texmf-dist/doc/generic/collargs/FILES (rev 0)
+++ trunk/Master/texmf-dist/doc/generic/collargs/FILES 2023-10-11 20:25:43 UTC (rev 68512)
@@ -0,0 +1,10 @@
+doc/generic/collargs/LICENCE
+doc/generic/collargs/INSTALL.md
+doc/generic/collargs/FILES
+doc/generic/collargs/README.md
+tex/latex/collargs/collargs.sty
+tex/context/collargs/t-collargs.tex
+tex/plain/collargs/collargs.tex
+source/generic/collargs/collargs.edtx
+source/generic/collargs/Makefile
+source/generic/collargs/collargs.ins
Added: trunk/Master/texmf-dist/doc/generic/collargs/INSTALL.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/collargs/INSTALL.md (rev 0)
+++ trunk/Master/texmf-dist/doc/generic/collargs/INSTALL.md 2023-10-11 20:25:43 UTC (rev 68512)
@@ -0,0 +1,68 @@
+# Installation from the TDS archive
+
+If CollArgs is not (yet) offered by your TeX distribution, the easiest way to
+install it is by downloading the TDS archive `collargs.tds.zip` from
+[CollArgs's CTAN page](https://ctan.org/pkg/collargs), and unpacking it into
+your `texmf` directory.
+
+Read on only if you have an unstoppable urge to install from source and/or
+compile the manual or the documented source code.
+
+# Installation from the source
+
+## Getting the sources
+
+There are several options:
+
+* Download and unpack the zip archive of the package from [CollArgs's CTAN
+ page](https://ctan.org/pkg/collargs).
+
+* Download and unpack the TDS archive, or copy the files from your local
+ distribution. The sources reside in `<texmf>/source/generic/collargs`.
+
+* Clone the [GitHub repository of
+ Memoize](https://github.com/sasozivanovic/memoize).
+
+## Generating the runtime files
+
+The easiest way to generate the runtime files is by running `make`. The
+following command will generate runtime files for all supported formats
+(currently: LaTeX, plain TeX and ConTeXt).
+
+```
+make collargs.sty
+```
+
+Alternatively, you can generate these files manually. The source of this
+package was written using [EasyDTX](https://ctan.org/pkg/easydtx). Therefore,
+you first have to convert the `.edtx` file into a regular `.dtx`:
+
+```
+edtx2dtx collargs.edtx > collargs.dtx
+```
+
+The next step is standard. Produce the runtime files by compiling the
+installation file:
+
+```
+tex collargs.ins
+```
+
+Finally, if you require the ConTeXt runtime, replace all instances of
+`\expanded` and `\unexpanded` in `t-collargs.tex` by `\normalexpanded` and
+`\normalunexpanded`, respectively. One way to do this is:
+
+```
+sed -i -s -e 's/\\\(un\)\?expanded/\\normal\1expanded/g;' t-collargs.tex
+```
+
+## Installation
+
+It is recommended to install the files into a TDS-compliant `texmf` directory,
+as usual. Inspect file `FILES` or the TDS archive `collargs.tds.zip` to see
+what goes where.
+
+# Compiling the documentation
+
+The documentation of this package is integrated into the documentation of
+[Memoize](https://ctan.org/pkg/memoize), please continue there.
Property changes on: trunk/Master/texmf-dist/doc/generic/collargs/INSTALL.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/generic/collargs/LICENCE
===================================================================
--- trunk/Master/texmf-dist/doc/generic/collargs/LICENCE (rev 0)
+++ trunk/Master/texmf-dist/doc/generic/collargs/LICENCE 2023-10-11 20:25:43 UTC (rev 68512)
@@ -0,0 +1,416 @@
+The LaTeX Project Public License
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+LPPL Version 1.3c 2008-05-04
+
+Copyright 1999 2002-2008 LaTeX3 Project
+ Everyone is allowed to distribute verbatim copies of this
+ license document, but modification of it is not allowed.
+
+
+PREAMBLE
+========
+
+The LaTeX Project Public License (LPPL) is the primary license under
+which the LaTeX kernel and the base LaTeX packages are distributed.
+
+You may use this license for any work of which you hold the copyright
+and which you wish to distribute. This license may be particularly
+suitable if your work is TeX-related (such as a LaTeX package), but
+it is written in such a way that you can use it even if your work is
+unrelated to TeX.
+
+The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE',
+below, gives instructions, examples, and recommendations for authors
+who are considering distributing their works under this license.
+
+This license gives conditions under which a work may be distributed
+and modified, as well as conditions under which modified versions of
+that work may be distributed.
+
+We, the LaTeX3 Project, believe that the conditions below give you
+the freedom to make and distribute modified versions of your work
+that conform with whatever technical specifications you wish while
+maintaining the availability, integrity, and reliability of
+that work. If you do not see how to achieve your goal while
+meeting these conditions, then read the document `cfgguide.tex'
+and `modguide.tex' in the base LaTeX distribution for suggestions.
+
+
+DEFINITIONS
+===========
+
+In this license document the following terms are used:
+
+ `Work'
+ Any work being distributed under this License.
+
+ `Derived Work'
+ Any work that under any applicable law is derived from the Work.
+
+ `Modification'
+ Any procedure that produces a Derived Work under any applicable
+ law -- for example, the production of a file containing an
+ original file associated with the Work or a significant portion of
+ such a file, either verbatim or with modifications and/or
+ translated into another language.
+
+ `Modify'
+ To apply any procedure that produces a Derived Work under any
+ applicable law.
+
+ `Distribution'
+ Making copies of the Work available from one person to another, in
+ whole or in part. Distribution includes (but is not limited to)
+ making any electronic components of the Work accessible by
+ file transfer protocols such as FTP or HTTP or by shared file
+ systems such as Sun's Network File System (NFS).
+
+ `Compiled Work'
+ A version of the Work that has been processed into a form where it
+ is directly usable on a computer system. This processing may
+ include using installation facilities provided by the Work,
+ transformations of the Work, copying of components of the Work, or
+ other activities. Note that modification of any installation
+ facilities provided by the Work constitutes modification of the Work.
+
+ `Current Maintainer'
+ A person or persons nominated as such within the Work. If there is
+ no such explicit nomination then it is the `Copyright Holder' under
+ any applicable law.
+
+ `Base Interpreter'
+ A program or process that is normally needed for running or
+ interpreting a part or the whole of the Work.
+
+ A Base Interpreter may depend on external components but these
+ are not considered part of the Base Interpreter provided that each
+ external component clearly identifies itself whenever it is used
+ interactively. Unless explicitly specified when applying the
+ license to the Work, the only applicable Base Interpreter is a
+ `LaTeX-Format' or in the case of files belonging to the
+ `LaTeX-format' a program implementing the `TeX language'.
+
+
+
+CONDITIONS ON DISTRIBUTION AND MODIFICATION
+===========================================
+
+1. Activities other than distribution and/or modification of the Work
+are not covered by this license; they are outside its scope. In
+particular, the act of running the Work is not restricted and no
+requirements are made concerning any offers of support for the Work.
+
+2. You may distribute a complete, unmodified copy of the Work as you
+received it. Distribution of only part of the Work is considered
+modification of the Work, and no right to distribute such a Derived
+Work may be assumed under the terms of this clause.
+
+3. You may distribute a Compiled Work that has been generated from a
+complete, unmodified copy of the Work as distributed under Clause 2
+above, as long as that Compiled Work is distributed in such a way that
+the recipients may install the Compiled Work on their system exactly
+as it would have been installed if they generated a Compiled Work
+directly from the Work.
+
+4. If you are the Current Maintainer of the Work, you may, without
+restriction, modify the Work, thus creating a Derived Work. You may
+also distribute the Derived Work without restriction, including
+Compiled Works generated from the Derived Work. Derived Works
+distributed in this manner by the Current Maintainer are considered to
+be updated versions of the Work.
+
+5. If you are not the Current Maintainer of the Work, you may modify
+your copy of the Work, thus creating a Derived Work based on the Work,
+and compile this Derived Work, thus creating a Compiled Work based on
+the Derived Work.
+
+6. If you are not the Current Maintainer of the Work, you may
+distribute a Derived Work provided the following conditions are met
+for every component of the Work unless that component clearly states
+in the copyright notice that it is exempt from that condition. Only
+the Current Maintainer is allowed to add such statements of exemption
+to a component of the Work.
+
+ a. If a component of this Derived Work can be a direct replacement
+ for a component of the Work when that component is used with the
+ Base Interpreter, then, wherever this component of the Work
+ identifies itself to the user when used interactively with that
+ Base Interpreter, the replacement component of this Derived Work
+ clearly and unambiguously identifies itself as a modified version
+ of this component to the user when used interactively with that
+ Base Interpreter.
+
+ b. Every component of the Derived Work contains prominent notices
+ detailing the nature of the changes to that component, or a
+ prominent reference to another file that is distributed as part
+ of the Derived Work and that contains a complete and accurate log
+ of the changes.
+
+ c. No information in the Derived Work implies that any persons,
+ including (but not limited to) the authors of the original version
+ of the Work, provide any support, including (but not limited to)
+ the reporting and handling of errors, to recipients of the
+ Derived Work unless those persons have stated explicitly that
+ they do provide such support for the Derived Work.
+
+ d. You distribute at least one of the following with the Derived Work:
+
+ 1. A complete, unmodified copy of the Work;
+ if your distribution of a modified component is made by
+ offering access to copy the modified component from a
+ designated place, then offering equivalent access to copy
+ the Work from the same or some similar place meets this
+ condition, even though third parties are not compelled to
+ copy the Work along with the modified component;
+
+ 2. Information that is sufficient to obtain a complete,
+ unmodified copy of the Work.
+
+7. If you are not the Current Maintainer of the Work, you may
+distribute a Compiled Work generated from a Derived Work, as long as
+the Derived Work is distributed to all recipients of the Compiled
+Work, and as long as the conditions of Clause 6, above, are met with
+regard to the Derived Work.
+
+8. The conditions above are not intended to prohibit, and hence do not
+apply to, the modification, by any method, of any component so that it
+becomes identical to an updated version of that component of the Work as
+it is distributed by the Current Maintainer under Clause 4, above.
+
+9. Distribution of the Work or any Derived Work in an alternative
+format, where the Work or that Derived Work (in whole or in part) is
+then produced by applying some process to that format, does not relax or
+nullify any sections of this license as they pertain to the results of
+applying that process.
+
+10. a. A Derived Work may be distributed under a different license
+ provided that license itself honors the conditions listed in
+ Clause 6 above, in regard to the Work, though it does not have
+ to honor the rest of the conditions in this license.
+
+ b. If a Derived Work is distributed under a different license, that
+ Derived Work must provide sufficient documentation as part of
+ itself to allow each recipient of that Derived Work to honor the
+ restrictions in Clause 6 above, concerning changes from the Work.
+
+11. This license places no restrictions on works that are unrelated to
+the Work, nor does this license place any restrictions on aggregating
+such works with the Work by any means.
+
+12. Nothing in this license is intended to, or may be used to, prevent
+complete compliance by all parties with all applicable laws.
+
+
+NO WARRANTY
+===========
+
+There is no warranty for the Work. Except when otherwise stated in
+writing, the Copyright Holder provides the Work `as is', without
+warranty of any kind, either expressed or implied, including, but not
+limited to, the implied warranties of merchantability and fitness for a
+particular purpose. The entire risk as to the quality and performance
+of the Work is with you. Should the Work prove defective, you assume
+the cost of all necessary servicing, repair, or correction.
+
+In no event unless required by applicable law or agreed to in writing
+will The Copyright Holder, or any author named in the components of the
+Work, or any other party who may distribute and/or modify the Work as
+permitted above, be liable to you for damages, including any general,
+special, incidental or consequential damages arising out of any use of
+the Work or out of inability to use the Work (including, but not limited
+to, loss of data, data being rendered inaccurate, or losses sustained by
+anyone as a result of any failure of the Work to operate with any other
+programs), even if the Copyright Holder or said author or said other
+party has been advised of the possibility of such damages.
+
+
+MAINTENANCE OF THE WORK
+=======================
+
+The Work has the status `author-maintained' if the Copyright Holder
+explicitly and prominently states near the primary copyright notice in
+the Work that the Work can only be maintained by the Copyright Holder
+or simply that it is `author-maintained'.
+
+The Work has the status `maintained' if there is a Current Maintainer
+who has indicated in the Work that they are willing to receive error
+reports for the Work (for example, by supplying a valid e-mail
+address). It is not required for the Current Maintainer to acknowledge
+or act upon these error reports.
+
+The Work changes from status `maintained' to `unmaintained' if there
+is no Current Maintainer, or the person stated to be Current
+Maintainer of the work cannot be reached through the indicated means
+of communication for a period of six months, and there are no other
+significant signs of active maintenance.
+
+You can become the Current Maintainer of the Work by agreement with
+any existing Current Maintainer to take over this role.
+
+If the Work is unmaintained, you can become the Current Maintainer of
+the Work through the following steps:
+
+ 1. Make a reasonable attempt to trace the Current Maintainer (and
+ the Copyright Holder, if the two differ) through the means of
+ an Internet or similar search.
+
+ 2. If this search is successful, then enquire whether the Work
+ is still maintained.
+
+ a. If it is being maintained, then ask the Current Maintainer
+ to update their communication data within one month.
+
+ b. If the search is unsuccessful or no action to resume active
+ maintenance is taken by the Current Maintainer, then announce
+ within the pertinent community your intention to take over
+ maintenance. (If the Work is a LaTeX work, this could be
+ done, for example, by posting to comp.text.tex.)
+
+ 3a. If the Current Maintainer is reachable and agrees to pass
+ maintenance of the Work to you, then this takes effect
+ immediately upon announcement.
+
+ b. If the Current Maintainer is not reachable and the Copyright
+ Holder agrees that maintenance of the Work be passed to you,
+ then this takes effect immediately upon announcement.
+
+ 4. If you make an `intention announcement' as described in 2b. above
+ and after three months your intention is challenged neither by
+ the Current Maintainer nor by the Copyright Holder nor by other
+ people, then you may arrange for the Work to be changed so as
+ to name you as the (new) Current Maintainer.
+
+ 5. If the previously unreachable Current Maintainer becomes
+ reachable once more within three months of a change completed
+ under the terms of 3b) or 4), then that Current Maintainer must
+ become or remain the Current Maintainer upon request provided
+ they then update their communication data within one month.
+
+A change in the Current Maintainer does not, of itself, alter the fact
+that the Work is distributed under the LPPL license.
+
+If you become the Current Maintainer of the Work, you should
+immediately provide, within the Work, a prominent and unambiguous
+statement of your status as Current Maintainer. You should also
+announce your new status to the same pertinent community as
+in 2b) above.
+
+
+WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE
+======================================================
+
+This section contains important instructions, examples, and
+recommendations for authors who are considering distributing their
+works under this license. These authors are addressed as `you' in
+this section.
+
+Choosing This License or Another License
+----------------------------------------
+
+If for any part of your work you want or need to use *distribution*
+conditions that differ significantly from those in this license, then
+do not refer to this license anywhere in your work but, instead,
+distribute your work under a different license. You may use the text
+of this license as a model for your own license, but your license
+should not refer to the LPPL or otherwise give the impression that
+your work is distributed under the LPPL.
+
+The document `modguide.tex' in the base LaTeX distribution explains
+the motivation behind the conditions of this license. It explains,
+for example, why distributing LaTeX under the GNU General Public
+License (GPL) was considered inappropriate. Even if your work is
+unrelated to LaTeX, the discussion in `modguide.tex' may still be
+relevant, and authors intending to distribute their works under any
+license are encouraged to read it.
+
+A Recommendation on Modification Without Distribution
+-----------------------------------------------------
+
+It is wise never to modify a component of the Work, even for your own
+personal use, without also meeting the above conditions for
+distributing the modified component. While you might intend that such
+modifications will never be distributed, often this will happen by
+accident -- you may forget that you have modified that component; or
+it may not occur to you when allowing others to access the modified
+version that you are thus distributing it and violating the conditions
+of this license in ways that could have legal implications and, worse,
+cause problems for the community. It is therefore usually in your
+best interest to keep your copy of the Work identical with the public
+one. Many works provide ways to control the behavior of that work
+without altering any of its licensed components.
+
+How to Use This License
+-----------------------
+
+To use this license, place in each of the components of your work both
+an explicit copyright notice including your name and the year the work
+was authored and/or last substantially modified. Include also a
+statement that the distribution and/or modification of that
+component is constrained by the conditions in this license.
+
+Here is an example of such a notice and statement:
+
+ %% pig.dtx
+ %% Copyright 2008 M. Y. Name
+ %
+ % 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
+ % https://www.latex-project.org/lppl.txt
+ % and version 1.3c or later is part of all distributions of LaTeX
+ % version 2008 or later.
+ %
+ % This work has the LPPL maintenance status `maintained'.
+ %
+ % The Current Maintainer of this work is M. Y. Name.
+ %
+ % This work consists of the files pig.dtx and pig.ins
+ % and the derived file pig.sty.
+
+Given such a notice and statement in a file, the conditions
+given in this license document would apply, with the `Work' referring
+to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being
+generated from `pig.dtx' using `pig.ins'), the `Base Interpreter'
+referring to any `LaTeX-Format', and both `Copyright Holder' and
+`Current Maintainer' referring to the person `M. Y. Name'.
+
+If you do not want the Maintenance section of LPPL to apply to your
+Work, change `maintained' above into `author-maintained'.
+However, we recommend that you use `maintained', as the Maintenance
+section was added in order to ensure that your Work remains useful to
+the community even when you can no longer maintain and support it
+yourself.
+
+Derived Works That Are Not Replacements
+---------------------------------------
+
+Several clauses of the LPPL specify means to provide reliability and
+stability for the user community. They therefore concern themselves
+with the case that a Derived Work is intended to be used as a
+(compatible or incompatible) replacement of the original Work. If
+this is not the case (e.g., if a few lines of code are reused for a
+completely different task), then clauses 6b and 6d shall not apply.
+
+
+Important Recommendations
+-------------------------
+
+ Defining What Constitutes the Work
+
+ The LPPL requires that distributions of the Work contain all the
+ files of the Work. It is therefore important that you provide a
+ way for the licensee to determine which files constitute the Work.
+ This could, for example, be achieved by explicitly listing all the
+ files of the Work near the copyright notice of each file or by
+ using a line such as:
+
+ % This work consists of all files listed in manifest.txt.
+
+ in that place. In the absence of an unequivocal list it might be
+ impossible for the licensee to determine what is considered by you
+ to comprise the Work and, in such a case, the licensee would be
+ entitled to make reasonable conjectures as to which files comprise
+ the Work.
+
Added: trunk/Master/texmf-dist/doc/generic/collargs/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/collargs/README.md (rev 0)
+++ trunk/Master/texmf-dist/doc/generic/collargs/README.md 2023-10-11 20:25:43 UTC (rev 68512)
@@ -0,0 +1,8 @@
+Package CollArgs provides a command which can determine the argument scope of
+any command whose argument structure conforms to
+[xparse](https://ctan.org/pkg/xparse)'s argument specification.
+
+This package was developed as an auxiliary package of
+[Memoize](https://ctan.org/pkg/memoize). This is why it is, somewhat
+unconventionally, documented alongside that package. This applies to both the
+manual and the documented code listing.
Property changes on: trunk/Master/texmf-dist/doc/generic/collargs/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/generic/collargs/Makefile
===================================================================
--- trunk/Master/texmf-dist/source/generic/collargs/Makefile (rev 0)
+++ trunk/Master/texmf-dist/source/generic/collargs/Makefile 2023-10-11 20:25:43 UTC (rev 68512)
@@ -0,0 +1,8 @@
+.PRECIOUS: %.dtx
+
+%.dtx: %.edtx
+ edtx2dtx $< > $@
+
+%.sty %.tex t-%.tex &: %.ins %.dtx
+ tex $<
+ sed -i -s -e 's/\\\(un\)\?expanded/\\normal\1expanded/g;' t-$*.tex
Property changes on: trunk/Master/texmf-dist/source/generic/collargs/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/generic/collargs/collargs.edtx
===================================================================
--- trunk/Master/texmf-dist/source/generic/collargs/collargs.edtx (rev 0)
+++ trunk/Master/texmf-dist/source/generic/collargs/collargs.edtx 2023-10-11 20:25:43 UTC (rev 68512)
@@ -0,0 +1,2938 @@
+% \iffalse
+% collargs.edtx (this is not a .dtx file; to produce a .dtx, process it with edtx2dtx)
+%%
+%% This file is a part of CollArgs, a TeX package providing a command which can
+%% determine the argument scope of any command whose argument structure
+%% conforms to xparse's argument specification, available at
+%% https://ctan.org/pkg/advice and https://github.com/sasozivanovic/advice.
+%%
+%% Copyright (c) 2023- Saso Zivanovic <saso.zivanovic at guest.arnes.si>
+%% (Sa\v{s}o \v{Z}ivanovi\'{c})
+%%
+%% 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 Saso Zivanovic.
+%%
+%% The files belonging to this work and covered by LPPL are listed in
+%% (<texmf>/doc/generic/collargs/)FILES.
+%
+% \fi
+%
+% \begin{macrocode}
+%
+% Package CollArgs provides commands |\CollectArguments| and
+% |\CollectArgumentsRaw|, which (what a surprise!) collect the arguments
+% conforming to the given (slightly extended) |xparse| argument specification.
+% The package was developed to help out with automemoization (see
+% section~\ref{sec:code:automemoization}). It started out as a few lines of
+% code, but had grown once I realized I want automemoization to work for
+% verbatim environments as well --- the environment-collecting code is based on
+% Bruno Le Floch's package |cprotect| --- and had then grown some more once I
+% decided to support the |xparse| argument specification in full detail, and to
+% make the verbatim mode flexible enough to deal with a variety of situations.
+%
+% The implementation of this package does not depend on |xparse|. Perhaps this
+% is a mistake, especially as the |xparse| code is now included in the base
+% \hologo{LaTeX}, but the idea was to have a light-weight package (not sure
+% this is the case anymore, given all the bells and whistles), to have its
+% functionality available in plain \hologo{TeX} and \hologo{ConTeXt} as well
+% (same as Memoize), and, perhaps most importantly, to have the ability to
+% collect the arguments verbatim.
+%
+%
+% \paragraph{Identification}
+%<latex>\ProvidesPackage{collargs}[2023/10/10 v1.0.0 Collect arguments of any command]
+%<context>%D \module[
+%<context>%D file=t-collargs.tex,
+%<context>%D version=1.0.0,
+%<context>%D title=CollArgs,
+%<context>%D subtitle=Collect arguments of any command,
+%<context>%D author=Saso Zivanovic,
+%<context>%D date=2023-10-10,
+%<context>%D copyright=Saso Zivanovic,
+%<context>%D license=LPPL,
+%<context>%D ]
+%<context>\writestatus{loading}{ConTeXt User Module / collargs}
+%<context>\unprotect
+%<context>\startmodule[collargs]
+% \paragraph{Required packages}
+%<latex>\RequirePackage{pgfkeys}
+%<plain>\input pgfkeys
+%<context>\input t-pgfkey
+%<latex>\RequirePackage{etoolbox}
+%<plain,context>\input etoolbox-generic
+%<plain>\edef\resetatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}
+%<plain>\catcode`\@11\relax
+%
+% \begin{macro}{\toksapp,\gtoksapp,\etoksapp,\xtoksapp}
+% Our macros for appending to a token register only accept a control sequence
+% defined by |\toksdef| (like |\mytoks|) but not an explicit register
+% designation like |\toks0|, so we only define them if noone else did; the
+% names of the macros match the \hologo{LuaTeX} primitives, so they surely
+% won't be defined there.
+\ifdefined\toksapp\else
+ \long\def\toksapp#1#2{#1\expandafter{\the#1#2}}%
+\fi
+\ifdefined\etoksapp\else
+ \long\def\etoksapp#1#2{#1\expandafter{\expanded{\the#1#2}}}%
+\fi
+\ifdefined\gtoksapp\else
+ \long\def\gtoksapp#1#2{\global#1\expandafter{\the#1#2}}%
+\fi
+\ifdefined\xtoksapp\else
+ \long\def\xtoksapp#1#2{\global#1\expandafter{\expanded{\the#1#2}}}%
+\fi
+\ifdefined\toks@\else\toksdef\toks@=0 \fi
+% \end{macro}
+%
+% \begin{macro}{\CollectArguments,\CollectArgumentsRaw}
+% These are the only public commands provided by the
+% package. |\CollectArguments| takes three arguments: the optional |#1| is
+% the option list, processed by |pgfkeys| (given the grouping structure,
+% these options will apply to all arguments); the mandatory |#2| is the
+% |xparse|-style argument specification; the mandatory |#3| is the ``next''
+% command (or a sequence of commands). The argument list is expected to
+% start immediately after the final argument; |\CollectArguments| parses it,
+% effectively figuring out its extent, and then passes the entire argument
+% list to the ``next'' command (as a single argument).
+%
+% |\CollectArgumentsRaw| differs only in how it takes and processes the
+% options. For one, these should be given as a mandatory argument.
+% Furthermore, they do not take the form of a keylist, but should deploy the
+% ``programmer's interface.'' |#1| should thus be a sequence of invocations
+% of the macro counterparts of the keys defined in
+% section~\ref{sec:code:collargs:keys}, which can be recognized as starting
+% with |\collargs| followed by a capital letter, e.g.\ |\collargsCaller|.
+% Note that |\collargsSet| may also be used in |#1|. (The ``optional,''
+% i.e.\ bracketed, argument of |\CollectArgumentsRaw| is in fact mandatory.)
+\protected\def\CollectArguments{%
+ \pgf at keys@utilifnextchar[\CollectArguments at i{\CollectArgumentsRaw{}}%]
+}
+\def\CollectArguments at i[#1]{\CollectArgumentsRaw{\collargsSet{#1}}}
+\protected\def\CollectArgumentsRaw#1#2#3{%
+ % This group will be closed by |\collargs at .| once we grinded through the
+ % argument specification.
+ \begingroup
+ % Initialize category code fixing; see section~\ref{sec:code:collargs:fix}
+ % for details. We have to do this before applying the settings, so that
+ % |\collargsFixFromNoVerbatim| et al can take effect.
+ \global\let\ifcollargs at last@verbatim\ifcollargs at verbatim
+ \global\let\ifcollargs at last@verbatimbraces\ifcollargs at verbatimbraces
+ \global\collargs at double@fixfalse
+ % Apply the settings.
+ \collargs at verbatim@wrap{#1}%
+ % Initialize the space-grabber.
+ \collargs at init@grabspaces
+ % Remember the code to execute after collection.
+ \def\collargs at next{#3}%
+ % Initialize the token register holding the collected arguments.
+ \global\collargs at toks{}%
+ % Execute the central loop macro, which expects the argument specification
+ % |#2| to be delimited from the following argument tokens by a dot.
+ \collargs@#2.%
+}
+% \end{macro}
+%
+% \begin{macro}{\collargsSet}
+% This macro processes the given keys in the |/collargs| keypath. When it is
+% used to process options given by the end user (the optional argument to
+% |\CollectArguments|, and the options given within the argument
+% specification, using the new modifier |&|), its invocation should be
+% wrapped in |\collargs at verbatim@wrap| to correctly deal with the changes of
+% the verbatim mode.
+\def\collargsSet#1{\pgfqkeys{/collargs}{#1}}
+% \end{macro}
+%
+%
+% \subsubsection{The keys}
+% \label{sec:code:collargs:keys}
+%
+% \begin{macro}{\collargs at cs@cases}
+% If the first argument of this auxiliary macro is a single control sequence,
+% then the second argument is executed. If the first argument starts with a
+% control sequence but this control sequence does not form the entire
+% argument, the third argument is executed. Otherwise, the fourth argument
+% is executed.
+%
+% This macro is defined in package CollArgs because we use it in key |caller|
+% below, but it is really useful in package Auto, where having it we don't
+% have to bother the end-user with a separate keys for commands and
+% environments, but automatically detect whether the argument of |auto| and
+% (|de|)|activate| is a command or an environment.
+\def\collargs at cs@cases#1{\collargs at cs@cases at i#1\collargs at cs@cases at end}
+\let\collargs at cs@cases at end\relax
+\def\collargs at cs@cases at i{\futurelet\collargs at temp\collargs at cs@cases at ii}
+\def\collargs at cs@cases at ii#1#2\collargs at cs@cases at end{%
+ \ifcat\noexpand\collargs at temp\relax
+ \ifx\relax#2\relax
+ \expandafter\expandafter\expandafter\@firstofthree
+ \else
+ \expandafter\expandafter\expandafter\@secondofthree
+ \fi
+ \else
+ \expandafter\@thirdofthree
+ \fi
+}
+\def\@firstofthree#1#2#3{#1}
+\def\@secondofthree#1#2#3{#2}
+\def\@thirdofthree#1#2#3{#3}
+% \end{macro}
+%
+% \begin{collargskey}{caller}
+% \begin{macro}{\collargsCaller}
+% Every macro which grabs a part of the argument list will be accessed
+% through the ``caller'' control sequence, so that \hologo{TeX}'s reports
+% of any errors in the argument structure can contain a command name
+% familiar to the author.\footnote{The idea is borrowed from package
+% |environ|, which is in turn based on code from |amsmath|.} For example,
+% if the argument list ``originally'' belonged to command |\foo| with
+% argument structure |r()|, but no parentheses follow in the input, we want
+% \hologo{TeX} to complain that |Use of \foo doesn't match its definition|.
+% This can be achieved by setting |caller=\foo|; the default is
+% |caller=\CollectArguments|, which is still better than seeing an error
+% involving some random internal control sequence. It is also ok to set an
+% environment name as the caller, see below.
+%
+% The key and macro defined below store the caller control sequence into
+% |\collargs at caller|, e.g.\ when we say |caller=\foo|, we effectively
+% execute |\def\collargs at caller{\foo}|.
+\collargsSet{
+ caller/.code={\collargsCaller{#1}},
+}
+\def\collargsCaller#1{%
+ \collargs at cs@cases{#1}{%
+ \let\collargs at temp\collargs at caller@cs
+ }{%
+ \let\collargs at temp\collargs at caller@csandmore
+ }{%
+ \let\collargs at temp\collargs at caller@env
+ }%
+ \collargs at temp{#1}%
+}
+\def\collargs at caller@cs#1{%
+ % If |#1| is a single control sequence, just use that as the caller.
+ \def\collargs at caller{#1}%
+}
+\def\collargs at caller@csandmore#1{%
+ % If |#1| starts with a control sequence, we don't complain, but convert the
+ % entire |#1| into a control sequence.
+ \begingroup
+ \escapechar -1
+ \expandafter\endgroup
+ \expandafter\def\expandafter\collargs at caller\expandafter{%
+ \csname\string#1\endcsname
+ }%
+}
+\def\collargs at caller@env#1{%
+ % If |#1| does not start with a control sequence, we assume that is an
+ % environment name, so we prepend |start| in \hologo{ConTeXt}, and dress it
+ % up into |\begin{#1}| in \hologo{LaTeX}.
+ \expandafter\def\expandafter\collargs at caller\expandafter{%
+ \csname
+ %<context>start%
+ %<latex>begin{%
+ #1%
+ %<latex>}%
+ \endcsname
+ }%
+}
+\collargsCaller\CollectArguments
+% \end{macro}
+% \end{collargskey}
+%
+% \begin{macro}{\ifcollargs at verbatim,\ifcollargs at verbatimbraces}
+% The first of these conditional
+% signals that we're collecting the arguments in one of the verbatim
+% modes; the second one signals the |verb| mode in particular.
+\newif\ifcollargs at verbatim
+\newif\ifcollargs at verbatimbraces
+% \end{macro}
+%
+% \begin{collargskey}{verbatim, verb, no verbatim}
+% \begin{macro}{\collargs at verbatim@wrap}
+% These keys set the verbatim mode macro which will be executed by
+% |\collargsSet| after processing all keys.
+% The verbatim mode macros |\collargsVerbatim|, |\collargsVerb| and
+% |\collargsNoVerbatim| are somewhat complex; we postpone their definition
+% until section~\ref{sec:code:collargs:verbatim}. Their main effect is to
+% set conditionals |\ifcollargs at verbatim| and |\ifcollargs at verbatimbraces|,
+% which are be inspected by the argument type handlers --- and to make
+% the requested category code changes, of course.
+%
+% Here, note that the verbatim-selection code is not executed while the
+% keylist is being processed. Rather, the verbatim keys simply set the macro
+% which will be executed \emph{after} the keylist is processed, and this is
+% why processing of a keylist given by the user must be always wrapped in
+% |\collargs at verbatim@wrap|.
+\collargsSet{
+ verbatim/.code={\let\collargs at apply@verbatim\collargsVerbatim},
+ verb/.code={\let\collargs at apply@verbatim\collargsVerb},
+ no verbatim/.code={\let\collargs at apply@verbatim\collargsNoVerbatim},
+}
+\def\collargs at verbatim@wrap#1{%
+ \let\collargs at apply@verbatim\relax
+ #1%
+ \collargs at apply@verbatim
+}
+% \end{macro}
+% \end{collargskey}
+%
+% \begin{collargskey}{fix from verbatim, fix from verb, fix from no verbatim}
+% \begin{macro}{\collargsFixFromVerbatim,\collargsFixFromVerb,\collargsFixFromNoVerbatim}
+% These keys and macros should be used to request a category code fix, when
+% the offending tokenization took place prior to invoking
+% |\CollectArguments|; see section~\ref{sec:code:collargs:fix} for details.
+% While I assume that only |\collargsFixFromNoVerbatim| will ever be used
+% (and it is used by |\mmz|), we provide macros for all three transitions,
+% for completeness.\indentmacrocode
+\collargsSet{
+ fix from verbatim/.code={\collargsFixFromVerbatim},
+ fix from verb/.code={\collargsFixFromVerb},
+ fix from no verbatim/.code={\collargsFixFromNoVerbatim},
+}
+% \noindentmacrocode
+\def\collargsFixFromNoVerbatim{%
+ \global\collargs at fix@requestedtrue
+ \global\let\ifcollargs at last@verbatim\iffalse
+}
+\def\collargsFixFromVerbatim{%
+ \global\collargs at fix@requestedtrue
+ \global\let\ifcollargs at last@verbatim\iftrue
+ \global\let\ifcollargs at last@verbatimbraces\iftrue
+}
+\def\collargsFixFromVerb{%
+ \global\collargs at fix@requestedtrue
+ \global\let\ifcollargs at last@verbatim\iftrue
+ \global\let\ifcollargs at last@verbatimbraces\iffalse
+}
+% \end{macro}
+% \end{collargskey}
+%
+% \begin{collargskey}{braces}
+% Set the characters which are used as the grouping characters in the full
+% verbatim mode. The user is only required to do this when multiple
+% character pairs serve as the grouping characters. The underlying macro,
+% |\collargsBraces|, will be defined in
+% section~\ref{sec:code:collargs:verbatim}.
+\collargsSet{
+ braces/.code={\collargsBraces{#1}}%
+}
+% \end{collargskey}
+%
+% \begin{collargskey}{environment}
+% \begin{macro}{\collargsEnvironment}
+% Set the environment name.
+% \indentmacrocode
+\collargsSet{
+ environment/.estore in=\collargs at b@envname
+}
+\def\collargsEnvironment#1{\edef\collargs at b@envname{#1}}
+\collargsEnvironment{}
+% \end{macro}
+% \end{collargskey}
+%
+% \begin{collargskey}{begin tag, end tag, tags}
+% \begin{macro}{\ifcollargsBeginTag,\ifcollargsEndTag,\ifcollargsAddTags}
+% When |begin tag|\slash|end tag| is in effect, the begin\slash end-tag will
+% be will be prepended/appended to the environment body. |tags| is a
+% shortcut for setting |begin tag| and |end tag| simultaneously.
+% \indentmacrocode
+\collargsSet{
+ begin tag/.is if=collargsBeginTag,
+ end tag/.is if=collargsEndTag,
+ tags/.style={begin tag=#1, end tag=#1},
+ tags/.default=true,
+}
+\newif\ifcollargsBeginTag
+\newif\ifcollargsEndTag
+% \end{macro}
+% \end{collargskey}
+%
+% \begin{collargskey}{ignore nesting}
+% \begin{macro}{\ifcollargsIgnoreNesting}
+% When this key is in effect, we will
+% ignore any \cs{begin}\marg{name}s and simply grab everything up to
+% the first \cs{end}\marg{name} (again, the markers are automatically
+% adapted to the format).
+\collargsSet{
+ ignore nesting/.is if=collargsIgnoreNesting,
+}
+\newif\ifcollargsIgnoreNesting
+% \end{macro}
+% \end{collargskey}
+%
+% \begin{collargskey}{ignore other tags}
+% \begin{macro}{\ifcollargsIgnoreOtherTags}
+% This key is only relevant in the
+% non-verbatim and partial verbatim modes in \hologo{LaTeX}. When it
+% is in effect, CollArgs checks the environment name following each
+% |\begin| and |\end|, ignoring the tags with an environment name other
+% than |\collargs at b@envname|.
+\collargsSet{
+ ignore other tags/.is if=collargsIgnoreOtherTags,
+}
+\newif\ifcollargsIgnoreOtherTags
+% \end{macro}
+% \end{collargskey}
+%
+% \begin{collargskey}[noindex]{(append/prepend) (pre/post)processor}
+% \begin{macro}[noindex]{\collargs(Append/Prepend)(Pre/Post)processor}
+% \begin{collargskey}[noprint]{append preprocessor, prepend preprocessor,
+% append postprocessor, prepend postprocessor}
+% \begin{macro}[noprint]{\collargsAppendPreprocessor,\collargsPrependPreprocessor,\collargsAppendPostprocessor,\collargsPrependPostprocessor}
+% These keys and
+% macros populate the list of preprocessors,
+% |\collargs at preprocess@arg|, and the list of post-processors,
+% |\collargs at postprocess@arg|, executed in |\collargs at appendarg|.
+\collargsSet{
+ append preprocessor/.code={\collargsAppendPreprocessor{#1}},
+ prepend preprocessor/.code={\collargsPrependPreprocessor{#1}},
+ append postprocessor/.code={\collargsAppendPostprocessor{#1}},
+ prepend postprocessor/.code={\collargsPrependPostprocessor{#1}},
+}
+\def\collargsAppendPreprocessor{%
+ \collargs at addprocessor\appto\collargs at preprocess@arg}
+\def\collargsPrependPreprocessor{%
+ \collargs at addprocessor\preto\collargs at preprocess@arg}
+\def\collargsAppendPostprocessor{%
+ \collargs at addprocessor\appto\collargs at postprocess@arg}
+\def\collargsPrependPostprocessor{%
+ \collargs at addprocessor\preto\collargs at postprocess@arg}
+% Here, |#1| will be either |\appto| or |\preto|, and |#2| will be either
+% |\collargs at preprocess@arg| or |\collargs at postprocess@arg|. |#3| is the
+% processor code.
+\def\collargs at addprocessor#1#2#3{%
+ #1#2{%
+ \expanded{%
+ \unexpanded{#3}{\the\collargsArg}%
+ }%
+ }%
+}
+% \end{macro}
+% \end{collargskey}
+% \end{macro}
+% \end{collargskey}
+%
+% \begin{collargskey}[noindex]{clear (pre/post)processors}
+% \begin{macro}[noindex]{\collargsClear(Pre/Post)processors}
+% \begin{collargskey}[noprint]{clear preprocessors, clear postprocessors}
+% \begin{macro}[noprint]{\collargsClearPreprocessors,\collargsClearPostprocessors}
+% These keys and macros
+% clear the pre- and post-processor lists, which are initially empty as
+% well.
+\def\collargs at preprocess@arg{}
+\def\collargs at postprocess@arg{}
+\collargsSet{
+ clear preprocessors/.code={\collargsClearPreprocessors},
+ clear postprocessors/.code={\collargsClearPostprocessors},
+}
+\def\collargsClearPreprocessors{\def\collargs at preprocess@arg{}}%
+\def\collargsClearPostprocessors{\def\collargs at postprocess@arg{}}%
+% \end{macro}
+% \end{collargskey}
+% \end{macro}
+% \end{collargskey}
+%
+% \begin{collargskey}[noindex]{(append/prepend) expandable (pre/post)processor}
+% \begin{macro}[noindex]{\collargs(Append/Prepend)Expandable(Pre/Post)processor}
+% \begin{collargskey}[noprint]{append expandable preprocessor, prepend expandable preprocessor, append expandable postprocessor, prepend expandable postprocessor}
+% \begin{macro}[noprint]{\collargsAppendExpandablePreprocessor,\collargsPrependExpandablePreprocessor,\collargsAppendExpandablePostprocessor,\collargsPrependExpandablePostprocessor}
+% These keys
+% and macros simplify the definition of fully expandable processors. Note
+% that expandable processors are added to the same list as non-expandable
+% processors.
+\collargsSet{
+ append expandable preprocessor/.code={%
+ \collargsAppendExpandablePreprocessor{#1}},
+ prepend expandable preprocessor/.code={%
+ \collargsPrependExpandablePreprocessor{#1}},
+ append expandable postprocessor/.code={%
+ \collargsAppendExpandablePostprocessor{#1}},
+ prepend expandable postprocessor/.code={%
+ \collargsPrependExpandablePostprocessor{#1}},
+}
+\def\collargsAppendExpandablePreprocessor{%
+ \collargs at addeprocessor\appto\collargs at preprocess@arg}
+\def\collargsPrependExpandablePreprocessor{%
+ \collargs at addeprocessor\preto\collargs at preprocess@arg}
+\def\collargsAppendExpandablePostprocessor{%
+ \collargs at addeprocessor\appto\collargs at postprocess@arg}
+\def\collargsPrependExpandablePostprocessor{%
+ \collargs at addeprocessor\preto\collargs at postprocess@arg}
+\def\collargs at addeprocessor#1#2#3{%
+ #1#2{%
+ \expanded{%
+ \edef\noexpand\collargs at temp{\unexpanded{#3}{\the\collargsArg}}%
+ \unexpanded{\expandafter\collargsArg\expandafter{\collargs at temp}}%
+ }%
+ }%
+}
+% \end{macro}
+% \end{collargskey}
+% \end{macro}
+% \end{collargskey}
+%
+% \begin{collargskey}[noindex]{(append/prepend) (pre/post)wrap}
+% \begin{macro}[noindex]{\collargs(Append/Prepend)(Pre/Post)wrap}
+% \begin{collargskey}[noprint]{append prewrap, prepend prewrap, append postwrap, prepend postwrap}
+% \begin{macro}[noprint]{\collargsAppendPrewrap,\collargsPrependPrewrap,\collargsAppendPostwrap,\collargsPrependPostwrap}
+% These keys and macros
+% simplify the definition of processors which yield the result after a
+% single expansion. Again, they are added to the same list as other
+% processors.
+\collargsSet{
+ append prewrap/.code={\collargsAppendPrewrap{#1}},
+ prepend prewrap/.code={\collargsPrependPrewrap{#1}},
+ append postwrap/.code={\collargsAppendPostwrap{#1}},
+ prepend postwrap/.code={\collargsPrependPostwrap{#1}},
+}
+\def\collargsAppendPrewrap{\collargs at addwrap\appto\collargs at preprocess@arg}
+\def\collargsPrependPrewrap{\collargs at addwrap\preto\collargs at preprocess@arg}
+\def\collargsAppendPostwrap{\collargs at addwrap\appto\collargs at postprocess@arg}
+\def\collargsPrependPostwrap{\collargs at addwrap\preto\collargs at postprocess@arg}
+\def\collargs at addwrap#1#2#3{%
+ #1#2{%
+ \long\def\collargs at temp##1{#3}%
+ \expandafter\expandafter\expandafter\collargsArg
+ \expandafter\expandafter\expandafter{%
+ \expandafter\collargs at temp\expandafter{\the\collargsArg}%
+ }%
+ }%
+}
+% \end{macro}
+% \end{collargskey}
+% \end{macro}
+% \end{collargskey}
+%
+%
+% \begin{collargskey}{no delimiters}
+% \begin{macro}{\ifcollargsNoDelimiters}
+% When this conditional is in effect, the
+% delimiter wrappers set by |\collargs at wrap| are ignored by
+% |\collargs at appendarg|.
+\collargsSet{%
+ no delimiters/.is if=collargsNoDelimiters,
+}
+\newif\ifcollargsNoDelimiters
+% \end{macro}
+% \end{collargskey}
+%
+% \subsubsection{The central loop}
+% \label{sec:code:collargs:central-loop}
+%
+% The central loop is where we grab the next \meta{token} from the argument
+% specification and execute the corresponding argument type or modifier
+% handler, |\collargs@|\meta{token}. The central loop consumes the argument
+% type \meta{token}; the handler will see the remainder of the argument
+% specification (which starts with the arguments to the argument type, if any,
+% e.g.\ by |()| of |d()|), followed by a dot, and then the tokens list from
+% which the arguments are to be collected. It is the responsibility of handler
+% to preserve the rest of the argument specification and reexecute the central
+% loop once it is finished.
+%
+% \begin{macro}{\collargs@}
+% Each argument is processed in a group to allow for local settings. This
+% group is closed by |\collargs at appendarg|.
+\def\collargs@{%
+ \begingroup
+ \collargs@@@
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs@@@}
+% This macro is where modifier handlers reenter the central loop --- we don't
+% want modifers to open a group, because their settings should remain in
+% effect until the next argument. Furthermore, modifiers do not trigger
+% category code fixes.
+\def\collargs@@@#1{%
+ \collargs at in@{#1}{&+!>.}%
+ \ifcollargs at in@
+ \expandafter\collargs@@@iii
+ \else
+ \expandafter\collargs@@@i
+ \fi
+ #1%
+}
+\def\collargs@@@i#1.{%
+ % Fix the category code of the next argument token, if necessary, and then
+ % proceed with the main loop.
+ \collargs at fix{\collargs@@@ii#1.}%
+}
+% Reset the fix request and set the last verbatim conditionals to the current
+% state.
+\def\collargs@@@ii{%
+ \global\collargs at fix@requestedfalse
+ \global\let\ifcollargs at last@verbatim\ifcollargs at verbatim
+ \global\let\ifcollargs at last@verbatimbraces\ifcollargs at verbatimbraces
+ \collargs@@@iii
+}
+% Call the modifier or argument type handler denoted by the first token of the
+% remainder of the argument specification.
+\def\collargs@@@iii#1{%
+ \ifcsname collargs@#1\endcsname
+ \csname collargs@#1\expandafter\endcsname
+ \else
+ % We throw an error if the token refers to no argument type or modifier.
+ \collargs at error@badtype{#1}%
+ \fi
+}
+% Throwing an error stops the processing of the argument specification, and
+% closes the group opened in |\collargs at i|.
+\def\collargs at error@badtype#1#2.{%
+ \PackageError{collargs}{Unknown xparse argument type or modifier "#1"
+ for "\expandafter\string\collargs at caller\space"}{}%
+ \endgroup
+}
+% \end{macro}
+%
+% {\catcode`\&=11
+% \begin{macro}{\collargs@&}
+% We extend the |xparse| syntax with modifier |&|, which applies the given
+% options to the following (and only the following) argument. If |&| is
+% followed by another |&|, the options are expected to occur in the raw
+% format, like the options given to |\CollectArgumentsRaw|. Otherwise, the
+% options should take the form of a keylist, which will be processed by
+% |\collargsSet|. In any case, the options should be given within the
+% argument specification, immediately following the (single or double) |&|.
+\csdef{collargs@&}{%
+ \futurelet\collargs at temp\collargs at amp@i
+}
+\def\collargs at amp@i{%
+ % In \hologo{ConTeXt}, |&| has character code ``other'' in the text.
+ %<!context>\ifx\collargs at temp&%
+ %<context>\expandafter\ifx\detokenize{&}\collargs at temp
+ \expandafter\collargs at amp@raw
+ \else
+ \expandafter\collargs at amp@set
+ \fi
+}
+\def\collargs at amp@raw#1#2{%
+ \collargs at verbatim@wrap{#2}%
+ \collargs@@@
+}
+\def\collargs at amp@set#1{%
+ \collargs at verbatim@wrap{\collargsSet{#1}}%
+ \collargs@@@
+}
+% \end{macro}}
+%
+% \begin{macro}[noindex]{\collargs at +}
+% \MyIndex{collargs@+}{\texttt{\textbackslash collargs at +}}{main}
+% This modifier makes the next argument long, i.e.\ accept paragraph tokens.
+\csdef{collargs at +}{%
+ \collargs at longtrue
+ \collargs@@@
+}
+\newif\ifcollargs at long
+% \end{macro}
+%
+% \begin{macro}{\collargs@>}
+% We can simply ignore the processor modifier. (This, |xparse|'s processor,
+% should not be confused with CollArgs's processors, which are set using
+% keys |append preprocessor| etc.)
+\csdef{collargs@>}#1{\collargs@@@}
+% \end{macro}
+%
+% \begin{macro}[noindex]{\collargs@!}
+% \MyIndex{collargs@!}{\texttt{\textbackslash collargs@\exclamationmark}}{main}
+% Should we accept spaces before an optional argument following a mandatory
+% argument (\pkg{xparse} manual, \S1.1)? By default, yes. This modifier is
+% only applicable to types |d| and |t|, and derived types, but, unlike
+% |xparse|, we don't bother to enforce this; when used with other types, |!|
+% simply has no effect.
+\csdef{collargs@!}{%
+ \collargs at grabspacesfalse
+ \collargs@@@
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at toks}
+% This token register is where we store the collected argument tokens. All
+% assignments to this register are global, because it needs to survive the
+% groups opened for individual arguments.
+\newtoks\collargs at toks
+% \end{macro}
+%
+% \begin{macro}{\collargsArg}
+% An auxiliary, but publicly available token register, used for processing
+% the argument, and by some argument type handlers.
+\newtoks\collargsArg
+% \end{macro}
+%
+% \begin{macro}{\collargs at .}
+% This fake argument type is used to signal the end of the argument list.
+% Note that this really counts as an extension of the |xparse| argument
+% specification.
+\csdef{collargs at .}{%
+ % Close the group opened in |\collargs@|.
+ \endgroup
+ % Close the main |\CollectArguments| group, fix the category code of the next
+ % token if necessary, and execute the next-code, followed by the collected
+ % arguments in braces. Any over-grabbed spaces are reinserted into the input
+ % stream, non-verbatim.
+ \expanded{%
+ \endgroup
+ \noexpand\collargs at fix{%
+ \expandonce\collargs at next{\the\collargs at toks}%
+ \collargs at spaces
+ }%
+ }%
+}
+% \end{macro}
+%
+% \subsubsection{Auxiliary macros}
+% \label{sec:code:collargs:aux}
+%
+% \begin{macro}{\collargs at appendarg}
+% This macro is used by the argument type
+% handlers to append the collected argument to the storage
+% (|\collargs at toks|).
+\long\def\collargs at appendarg#1{%
+ % Temporarily store the collected argument into a token register. The
+ % processors will manipulate the contents of this register.
+ \collargsArg={#1}%
+ % This will clear the double-fix conditional, and potentially request a
+ % normal, single fix. We can do this here because this macro is only called
+ % when something is actually collected. For details, see
+ % section~\ref{sec:code:collargs:fix}.
+ \ifcollargs at double@fix
+ \collargs at cancel@double at fix
+ \fi
+ % Process the argument with user-definable preprocessors, the wrapper defined
+ % by the argument type, and user-definable postprocessors.
+ \collargs at preprocess@arg
+ \ifcollargsNoDelimiters
+ \else
+ \collargs at process@arg
+ \fi
+ \collargs at postprocess@arg
+ % Append the processed argument, preceded by any grabbed spaces (in the
+ % correct mode), to the storage.
+ \xtoksapp\collargs at toks{\collargs at grabbed@spaces\the\collargsArg}%
+ % Initialize the space-grabber.
+ \collargs at init@grabspaces
+ % Once the argument was appended to the list, we can close its group, opened
+ % by |\collargs@|.
+ \endgroup
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at wrap}
+% This macro is used by argument type handlers to declare their delimiter
+% wrap, like square brackets around the optional argument of type |o|. It
+% uses |\collargs at addwrap|, defined in section~\ref{sec:code:collargs:keys},
+% but adds to |\collargs at process@arg|, which holds the delimiter wrapper
+% defined by the argument type handler. Note that this macro \emph{appends}
+% a wrapper, so multiple wrappers are allowed --- this is used by type |e|
+% handler.
+\def\collargs at wrap{\collargs at addwrap\appto\collargs at process@arg}
+\def\collargs at process@arg{}
+% \end{macro}
+%
+% \begin{macro}{\collargs at defcollector,\collargs at defusecollector,\collargs at letusecollector}
+% These macros streamline the usage of
+% the ``caller'' control sequence. They are like a |\def|, but should not
+% be given the control sequence to define, as they will automatically
+% define the control sequence residing in |\collargs at caller|; the usage is
+% thus |\collargs at defcollector<parameters>{<definition>}|. For example, if
+% |\collargs at caller| holds |\foo|, |\collargs at defcollector#1{(#1)}| is
+% equivalent to |\def\foo#1{(#1)}|. Macro |\collargs at defcollector| will
+% only define the caller control sequence to be the collector, while
+% |\collargs at defusecollector| will also immediately execute it.
+\def\collargs at defcollector#1#{%
+ \ifcollargs at long\long\fi
+ \expandafter\def\collargs at caller#1%
+}
+\def\collargs at defusecollector#1#{%
+ \afterassignment\collargs at caller
+ \ifcollargs at long\long\fi
+ \expandafter\def\collargs at caller#1%
+}
+\def\collargs at letusecollector#1{%
+ \expandafter\let\collargs at caller#1%
+ \collargs at caller
+}
+\newif\ifcollargs at grabspaces
+\collargs at grabspacestrue
+% \end{macro}
+%
+% \begin{macro}{\collargs at init@grabspaces}
+% The space-grabber macro
+% |\collargs at grabspaces| should be initialized by executing this macro. If
+% |\collargs at grabspaces| is called twice without an intermediate
+% initialization, it will assume it is in the same position in the input
+% stream and simply bail out.
+\def\collargs at init@grabspaces{%
+ \gdef\collargs at gs@state{0}%
+ \gdef\collargs at spaces{}%
+ \gdef\collargs at otherspaces{}%
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at grabspaces}
+% This auxiliary macro grabs any following
+% spaces, and then executes the next-code given as the sole argument. The
+% spaces will be stored into two macros, |\collargs at spaces| and
+% |\collargs at otherspaces|, which store the spaces in the non-verbatim and the
+% verbatim form. With the double storage, we can grab the spaces in the
+% verbatim mode and use them non-verbatim, or vice versa. The macro takes a
+% single argument, the code to execute after maybe grabbing the spaces.
+%
+\def\collargs at grabspaces#1{%
+ \edef\collargs at gs@next{\unexpanded{#1}}%
+ \ifnum\collargs at gs@state=0
+ \gdef\collargs at gs@state{1}%
+ \expandafter\collargs at gs@i
+ \else
+ \expandafter\collargs at gs@next
+ \fi
+}
+\def\collargs at gs@i{%
+ \futurelet\collargs at temp\collargs at gs@g
+}
+% We check for grouping characters even in the verbatim mode, because we might
+% be in the partial verbatim.
+\def\collargs at gs@g{%
+ \ifcat\noexpand\collargs at temp\bgroup
+ \expandafter\collargs at gs@next
+ \else
+ \ifcat\noexpand\collargs at temp\egroup
+ \expandafter\expandafter\expandafter\collargs at gs@next
+ \else
+ \expandafter\expandafter\expandafter\collargs at gs@ii
+ \fi
+ \fi
+}
+\def\collargs at gs@ii{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at gos@iii
+ \else
+ \expandafter\collargs at gs@iii
+ \fi
+}
+% This works because the character code of a space token is always 32.
+\def\collargs at gs@iii{%
+ \expandafter\ifx\space\collargs at temp
+ \expandafter\collargs at gs@iv
+ \else
+ \expandafter\collargs at gs@next
+ \fi
+}
+\expandafter\def\expandafter\collargs at gs@iv\space{%
+ \gappto\collargs at spaces{ }%
+ \xappto\collargs at otherspaces{\collargs at otherspace}%
+ \collargs at gs@i
+}
+% We need the space of category 12 above.
+\begingroup\catcode`\ =12\relax\gdef\collargs at otherspace{ }\endgroup
+\def\collargs at gos@iii#1{%
+ % Macro |\collargs at cc| recalls the ``outside'' category code of character
+ % |#1|; see section~\ref{sec:code:collargs:verbatim}.
+ \ifnum\collargs at cc{#1}=10
+ % We have a space.
+ \expandafter\collargs at gos@iv
+ \else
+ \ifnum\collargs at cc{#1}=5
+ % We have a newline.
+ \expandafter\expandafter\expandafter\collargs at gos@v
+ \else
+ \expandafter\expandafter\expandafter\collargs at gs@next
+ \fi
+ \fi
+ #1%
+}
+\def\collargs at gos@iv#1{%
+ \gappto\collargs at otherspaces{#1}%
+ % No matter how many verbatim spaces we collect, they equal a single
+ % non-verbatim space.
+ \gdef\collargs at spaces{ }%
+ \collargs at gs@i
+}
+\def\collargs at gos@v{%
+ % Only add the first newline.
+ \ifnum\collargs at gs@state=2
+ \expandafter\collargs at gs@next
+ \else
+ \expandafter\collargs at gs@vi
+ \fi
+}
+\def\collargs at gs@vi#1{%
+ \gdef\collargs at gs@state{2}%
+ \gappto\collargs at otherspaces{#1}%
+ \gdef\collargs at spaces{ }%
+ \collargs at gs@i
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at maybegrabspaces}
+% This macro grabs any following spaces, but it will do so only when
+% conditional |\ifcollargs at grabspaces|, which can be \emph{un}set by modifier
+% |!|, is in effect. The macro is used by handlers for types |d| and |t|.
+\def\collargs at maybegrabspaces{%
+ \ifcollargs at grabspaces
+ \expandafter\collargs at grabspaces
+ \else
+ \expandafter\@firstofone
+ \fi
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at grabbed@spaces}
+% This macro expands to either the verbatim
+% or the non-verbatim variant of the grabbed spaces, depending on the
+% verbatim mode in effect at the time of expansion.
+\def\collargs at grabbed@spaces{%
+ \ifcollargs at verbatim
+ \collargs at otherspaces
+ \else
+ \collargs at spaces
+ \fi
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at reinsert@spaces}
+% Inserts the grabbed spaces back into the
+% input stream, but with the category code appropriate for the verbatim mode
+% then in effect. After the insertion, the space-grabber is initialized and
+% the given next-code is executed in front of the inserted spaces.
+\def\collargs at reinsert@spaces#1{%
+ \expanded{%
+ \unexpanded{%
+ \collargs at init@grabspaces
+ #1%
+ }%
+ \collargs at grabbed@spaces
+ }%
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at ifnextcat}
+% An adaptation of |\pgf at keys@utilifnextchar|
+% which checks whether the \emph{category} code of the next non-space
+% character matches the category code of |#1|.
+\long\def\collargs at ifnextcat#1#2#3{%
+ \let\pgf at keys@utilreserved at d=#1%
+ \def\pgf at keys@utilreserved at a{#2}%
+ \def\pgf at keys@utilreserved at b{#3}%
+ \futurelet\pgf at keys@utillet at token\collargs at ifncat}
+\def\collargs at ifncat{%
+ \ifx\pgf at keys@utillet at token\pgf at keys@utilsptoken
+ \let\pgf at keys@utilreserved at c\collargsxifnch
+ \else
+ \ifcat\noexpand\pgf at keys@utillet at token\pgf at keys@utilreserved at d
+ \let\pgf at keys@utilreserved at c\pgf at keys@utilreserved at a
+ \else
+ \let\pgf at keys@utilreserved at c\pgf at keys@utilreserved at b
+ \fi
+ \fi
+ \pgf at keys@utilreserved at c}
+{%
+ \def\:{\collargs at xifncat}
+ \expandafter\gdef\: {\futurelet\pgf at keys@utillet at token\collargs at ifncat}
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at forrange}
+% This macro executes macro |\collargs at do| for every integer from |#1| and
+% |#2|, both inclusive. |\collargs at do| should take a single parameter, the
+% current number.
+\def\collargs at forrange#1#2{%
+ \expanded{%
+ \noexpand\collargs at forrange@i{\number#1}{\number#2}%
+ }%
+ }
+\def\collargs at forrange@i#1#2{%
+ \ifnum#1>#2 %
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+ {%
+ \collargs at do{#1}%
+ \expandafter\collargs at forrange@i\expandafter{\number\numexpr#1+1\relax}{#2}%
+ }%
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at forranges}
+% This macro executes macro |\collargs at do| for every integer falling into the
+% ranges specified in |#1|. The ranges should be given as a comma-separated
+% list of |from-to| items, e.g.\ |1-5,10-11|.
+\def\collargs at forranges{\forcsvlist\collarg at forrange@i}
+\def\collarg at forrange@i#1{\collarg at forrange@ii#1-}
+\def\collarg at forrange@ii#1-#2-{\collargs at forrange{#1}{#2}}
+% \end{macro}
+%
+% \begin{macro}{\collargs at percentchar}
+% This macro holds the percent character of category 12.
+\begingroup
+\catcode`\%=12
+\gdef\collargs at percentchar{%}
+\endgroup
+% \end{macro}
+%
+%
+% \subsubsection{The handlers}
+% \label{sec:code:collargs:handlers}
+%
+% \begin{macro}{\collargs at l}
+% We will first define the handler for the very funky argument type |l|,
+% which corresponds to \hologo{TeX}'s |\def\foo#1#{...}|, which grabs (into
+% |#1|) everything up to the first opening brace --- not because this type is
+% important or even recommended to use, but because the definition of the
+% handler is very simple, at least for the non-verbatim case.
+%
+\def\collargs at l#1.{%
+ % Any pre-grabbed spaces in fact belong into the argument.
+ \collargs at reinsert@spaces{\collargs at l@i#1.}%
+}
+\def\collargs at l@i{%
+ % We request a correction of the category code of the delimiting brace if the
+ % verbatim mode changes for the next argument; for details, see
+ % section~\ref{sec:code:collargs:fix}.
+ \global\collargs at fix@requestedtrue
+ % Most handlers will branch into the verbatim and the non-verbatim part using
+ % conditional |\ifcollargs at verbatim|. This handler is a bit special, because
+ % it needs to distinguish verbatim and non-verbatim \emph{braces}, and
+ % braces are verbatim only in the full verbatim mode, i.e.\ when
+ % |\ifcollargs at verbatimbraces| is true.
+ \ifcollargs at verbatimbraces
+ \expandafter\collargs at l@verb
+ \else
+ \expandafter\collargs at l@ii
+ \fi
+}
+% We grab the rest of the argument specification (|#1|), to be reinserted into
+% the token stream when we reexecute the central loop.
+\def\collargs at l@ii#1.{%
+ % In the non-verbatim mode, we merely have to define and execute the
+ % collector macro. The parameter text |##1##| (note the doubled hashes),
+ % which will put everything up to the first opening brace into the first
+ % argument, looks funky, but that's all.
+ \collargs at defusecollector##1##{%
+ % We append the collected argument, |##1|, to |\collargs at toks|, the token
+ % register holding the collected argument tokens.
+ \collargs at appendarg{##1}%
+ % Back to the central loop, with the rest of the argument specification
+ % reinserted.
+ \collargs@#1.%
+ }%
+}
+\def\collargs at l@verb#1.{%
+ % In the verbatim branch, we need to grab everything up to the first opening
+ % brace of category code 12, so we want to define the collector with
+ % parameter text |##1{|, with the opening brace of category 12. We have
+ % stored this token in macro |\collargs at other@bgroup|, which we now need to
+ % expand.
+ \expandafter\collargs at defusecollector
+ \expandafter##\expandafter1\collargs at other@bgroup{%
+ % Appending the argument works the same as in the non-verbatim case.
+ \collargs at appendarg{##1}%
+ % Reexecuting the central loop macro is a bit more involved, as we need to
+ % reinsert the verbatim opening brace (contrary to the regular brace above,
+ % the verbatim brace is consumed by the collector macro) back into the
+ % token stream, behind the reinserted argument specification.
+ \expanded{%
+ \noexpand\collargs@\unexpanded{#1.}%
+ \collargs at other@bgroup
+ }%
+ }%
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at u}
+% Another weird type --- |u|\meta{tokens} reads everything up to the given
+% \meta{tokens}, i.e.\ this is \hologo{TeX}'s
+% |\def\foo#1|\meta{tokens}|{...}| --- but again, simple enough to allow us
+% to showcase solutions to two recurring problems.
+%
+% We start by branching into the verbatim mode (full or partial) or the
+% non-verbatim mode.
+\def\collargs at u{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at u@verb
+ \else
+ \expandafter\collargs at u@i
+ \fi
+}
+% To deal with the verbatim mode, we only need to convert the above
+% \meta{tokens} (i.e.\ the argument of |u| in the argument specification) to
+% category 12, i.e.\ we have to |\detokenize| them. Then, we may proceed as in
+% the non-verbatim branch, |\collargs at u@ii|.
+\def\collargs at u@verb#1{%
+ % The |\string| here is a temporary solution to a problem with spaces. Our
+ % verbatim mode has them of category ``other'', but |\detokenize| produces a
+ % space of category ``space'' behind control words. ^^A todo
+ \expandafter\collargs at u@i\expandafter{\detokenize\expandafter{\string#1}}%
+}
+% We then reinsert any pre-grabbed spaces into the stream, but we take care not
+% to destroy the braces around our delimiter in the argument specification.
+\def\collargs at u@i#1#2.{%
+ \collargs at reinsert@spaces{\collargs at u@ii{#1}#2.}%
+}
+\def\collargs at u@ii#1#2.{%
+ % |#1| contains the delimiter tokens, so |##1| below will receive everything
+ % in the token stream up to these. But we have a problem: if we defined the
+ % collector as for the non-verbatim |l|, and the delimiter happened to be
+ % preceded by a single brace group, we would lose the braces. For example,
+ % if the delimiter was |-| and we received |{foo}-|, we would collect |foo-|.
+ % We solve this problem by inserting |\collargs at empty| (with an empty
+ % definition) into the input stream (at the end of this macro) --- this way,
+ % the delimiter can never be preceded by a single brace group --- and then
+ % expanding it away before appending to storage (within the argument of
+ % |\collargs at defusecollector|).
+ \collargs at defusecollector##1#1{%
+ % Define the wrapper which will add the delimiter tokens (|#1|) after the
+ % collected argument. The wrapper will be applied during argument
+ % processing in |\collargs at appendarg| (sandwiched between used-definable
+ % pre- and post-processors).
+ \collargs at wrap{####1#1}%
+ % Expand the first token in |##1|, which we know to be |\collargs at empty|,
+ % with empty expansion.
+ \expandafter\collargs at appendarg\expandafter{##1}%
+ \collargs@#2.%
+ }%
+ % Insert |\collargs at empty| into the input stream, in front of the ``real''
+ % argument tokens.
+ \collargs at empty
+}
+\def\collargs at empty{}
+% \end{macro}
+%
+% \begin{macro}{\collargs at r}
+% Finally, a real argument type: required delimited argument.
+\def\collargs at r{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at r@verb
+ \else
+ \expandafter\collargs at r@i
+ \fi
+}
+\def\collargs at r@verb#1#2{%
+ \expandafter\collargs at r@i\detokenize{#1#2}%
+}
+\def\collargs at r@i#1#2#3.{%
+ % We will need to use the |\collargs at empty| trick from type |u|, but with an
+ % additional twist: we need to insert it \emph{after} the opening delimiter
+ % |#1|. To do this, we consume the opening delimiter by the ``outer''
+ % collector below --- we need to use the collector so that we get a nice
+ % error message when the opening delimiter is not present --- and have this
+ % collector define the ``inner'' collector in the spirit of type |u|.
+ %
+ % The outer collector has no parameters, it just requires the presence of the
+ % opening delimiter.
+ \collargs at defcollector#1{%
+ % The inner collector will grab everything up to the closing delimiter.
+ \collargs at defusecollector####1#2{%
+ % Append the collected argument |####1| to the list, wrapping it into the
+ % delimiters (|#1| and |#2|), but not before expanding its first token,
+ % which we know to be |\collargs at empty|.
+ \collargs at wrap{#1########1#2}%
+ \expandafter\collargs at appendarg\expandafter{####1}%
+ \collargs@#3.%
+ }%
+ \collargs at empty
+ }%
+ % Another complication: our delimited argument may be preceded by spaces. To
+ % replicate the argument tokens faithfully, we need to collect them before
+ % trying to grab the argument itself.
+ \collargs at grabspaces\collargs at caller
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at R}
+% Discard the default and execute |r|.
+\def\collargs at R#1#2#3{\collargs at r#1#2}
+% \end{macro}
+%
+% \begin{macro}{\collargs at d}
+% Optional delimited argument. Very similar to |r|.
+\def\collargs at d{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at d@verb
+ \else
+ \expandafter\collargs at d@i
+ \fi
+}
+\def\collargs at d@verb#1#2{%
+ \expandafter\collargs at d@i\detokenize{#1#2}%
+}
+\def\collargs at d@i#1#2#3.{%
+ % This macro will be executed when the optional argument is not present. It
+ % simply closes the argument's group and reexecutes the central loop.
+ \def\collargs at d@noopt{%
+ \global\collargs at fix@requestedtrue
+ \endgroup
+ \collargs@#3.%
+ }%
+ % The collector(s) are exactly as for |r|.
+ \collargs at defcollector#1{%
+ \collargs at defusecollector####1#2{%
+ \collargs at wrap{#1########1#2}%
+ \expandafter\collargs at appendarg\expandafter{####1}%
+ \collargs@#3.%
+ }%
+ \collargs at empty
+ }%
+ % This macro will check, in conjunction with |\futurelet| below, whether the
+ % optional argument is present or not.
+ \def\collargs at d@ii{%
+ \ifx#1\collargs at temp
+ \expandafter\collargs at caller
+ \else
+ \expandafter\collargs at d@noopt
+ \fi
+ }%
+ % Whether spaces are allowed in front of this type of argument depends on the
+ % presence of modifier |!|.
+ \collargs at maybegrabspaces{\futurelet\collargs at temp\collargs at d@ii}%
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at D}
+% Discard the default and execute |d|.
+\def\collargs at D#1#2#3{\collargs at d#1#2}
+% \end{macro}
+%
+% \begin{macro}{\collargs at o}
+% |o| is just |d| with delimiters |[| and |]|.
+\def\collargs at o{\collargs at d[]}
+% \end{macro}
+%
+% \begin{macro}{\collargs at O}
+% |O| is just |d| with delimiters |[| and |]| and the discarded default.
+\def\collargs at O#1{\collargs at d[]}
+% \end{macro}
+%
+% \begin{macro}{\collargs at t}
+% An optional token. Similar to |d|.
+\def\collargs at t{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at t@verb
+ \else
+ \expandafter\collargs at t@i
+ \fi
+}
+\def\collargs at t@space{ }
+\def\collargs at t@verb#1{%
+ \let\collargs at t@space\collargs at otherspace
+ \expandafter\collargs at t@i\expandafter{\detokenize{#1}}%
+}
+\def\collargs at t@i#1{%
+ \expandafter\ifx\space#1%
+ \expandafter\collargs at t@s
+ \else
+ \expandafter\collargs at t@I\expandafter#1%
+ \fi
+}
+\def\collargs at t@s#1.{%
+ \collargs at grabspaces{%
+ \ifcollargs at grabspaces
+ \collargs at appendarg{}%
+ \else
+ \expanded{%
+ \noexpand\collargs at init@grabspaces
+ \noexpand\collargs at appendarg{\collargs at grabbed@spaces}%
+ }%
+ \fi
+ \collargs@#1.%
+ }%
+}
+\def\collargs at t@I#1#2.{%
+ \def\collargs at t@noopt{%
+ \global\collargs at fix@requestedtrue
+ \endgroup
+ \collargs@#2.%
+ }%
+ \def\collargs at t@opt##1{%
+ \collargs at appendarg{#1}%
+ \collargs@#2.%
+ }%
+ \def\collargs at t@ii{%
+ \ifx#1\collargs at temp
+ \expandafter\collargs at t@opt
+ \else
+ \expandafter\collargs at t@noopt
+ \fi
+ }%
+ \collargs at maybegrabspaces{\futurelet\collargs at temp\collargs at t@ii}%
+}
+\def\collargs at t@opt at space{%
+ \expanded{\noexpand\collargs at t@opt{\space}\expandafter}\romannumeral-0%
+}%
+% \end{macro}
+%
+% \begin{macro}{\collargs at s}
+% The optional star is just a special case of |t|.
+\def\collargs at s{\collargs at t*}
+% \end{macro}
+%
+% \begin{macro}{\collargs at m}
+% Mandatory argument. Interestingly, here's where things get complicated,
+% because we have to take care of several \hologo{TeX} quirks.
+\def\collargs at m{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at m@verb
+ \else
+ \expandafter\collargs at m@i
+ \fi
+}
+% The non-verbatim mode. First, collect any spaces in front of the argument.
+\def\collargs at m@i#1.{%
+ \collargs at grabspaces{\collargs at m@checkforgroup#1.}%
+}
+% Is the argument in braces or not?
+\def\collargs at m@checkforgroup#1.{%
+ \edef\collargs at action{\unexpanded{\collargs at m@checkforgroup at i#1.}}%
+ \futurelet\collargs at token\collargs at action
+}
+\def\collargs at m@checkforgroup at i{%
+ \ifcat\noexpand\collargs at token\bgroup
+ \expandafter\collargs at m@group
+ \else
+ \expandafter\collargs at m@token
+ \fi
+}
+% The argument is given in braces, so we put them back around it
+% (|\collargs at wrap|) when appending to the storage.
+\def\collargs at m@group#1.{%
+ \collargs at defusecollector##1{%
+ \collargs at wrap{{####1}}%
+ \collargs at appendarg{##1}%
+ \collargs@#1.%
+ }%
+}
+% The argument is a single token, we append it to the storage as is.
+\def\collargs at m@token#1.{%
+ \collargs at defusecollector##1{%
+ \collargs at appendarg{##1}%
+ \collargs@#1.%
+ }%
+}
+% The verbatim mode. Again, we first collect any spaces in front of the
+% argument.
+\def\collargs at m@verb#1.{%
+ \collargs at grabspaces{\collargs at m@verb at checkforgroup#1.}%
+}
+% We want to check whether we're dealing with a braced argument. We're in the
+% verbatim mode, but are braces verbatim as well? In other words, are we in
+% |verbatim| or |verb| mode? In the latter case, braces are regular, so we
+% redirect to the regular mode.
+\def\collargs at m@verb at checkforgroup{%
+ \ifcollargs at verbatimbraces
+ \expandafter\collargs at m@verb at checkforgroup@i
+ \else
+ \expandafter\collargs at m@checkforgroup
+ \fi
+}
+% Is the argument in verbatim braces?
+\def\collargs at m@verb at checkforgroup@i#1.{%
+ \def\collargs at m@verb at checkforgroup@ii{\collargs at m@verb at checkforgroup@iii#1.}%
+ \futurelet\collargs at temp\collargs at m@verb at checkforgroup@ii
+}
+\def\collargs at m@verb at checkforgroup@iii#1.{%
+ \expandafter\ifx\collargs at other@bgroup\collargs at temp
+ % Yes, the argument is in (verbatim) braces.
+ \expandafter\collargs at m@verb at group
+ \else
+ % We need to manually check whether the following token is a (verbatim)
+ % closing brace, and throw an error if it is.
+ \expandafter\ifx\collargs at other@egroup\collargs at temp
+ \expandafter\expandafter\expandafter\collargs at m@verb at egrouperror
+ \else
+ % The argument is a single token.
+ \expandafter\expandafter\expandafter\collargs at m@v at token
+ \fi
+ \fi
+ #1.%
+}
+\def\collargs at m@verb at egrouperror#1.{%
+ \PackageError{collargs}{%
+ Argument of \expandafter\string\collargs at caller\space has an extra
+ \iffalse{\else\string}}{}%
+}
+% A single-token verbatim argument.
+\def\collargs at m@v at token#1.#2{%
+ % Is it a control sequence? (Macro |\collargs at cc| recalls the ``outside''
+ % category code of character |#1|; see
+ % section~\ref{sec:code:collargs:verbatim}.)
+ \ifnum\collargs at cc{#2}=0
+ \expandafter\collargs at m@v at token@cs
+ \else
+ \expandafter\collargs at m@token
+ \fi
+ #1.#2%
+}
+% Is it a one-character control sequence?
+\def\collargs at m@v at token@cs#1.#2#3{%
+ \ifnum\collargs at cc{#3}=11
+ \expandafter\collargs at m@v at token@cs at letter
+ \else
+ \expandafter\collargs at m@v at token@cs at nonletter
+ \fi
+ #1.#2#3%
+}
+% Store |\<token>|.
+\def\collargs at m@v at token@cs at nonletter#1.#2#3{%
+ \collargs at appendarg{#2#3}%
+ \collargs@#1.%
+}
+% Store |\| to a temporary register, we'll parse the control sequence name now.
+\def\collargs at m@v at token@cs at letter#1.#2{%
+ \collargsArg{#2}%
+ \def\collargs at tempa{#1}%
+ \collargs at m@v at token@cs at letter@i
+}
+% Append a letter to the control sequence.
+\def\collargs at m@v at token@cs at letter@i#1{%
+ \ifnum\collargs at cc{#1}=11
+ \toksapp\collargsArg{#1}%
+ \expandafter\collargs at m@v at token@cs at letter@i
+ \else
+ % Finish, returning the non-letter to the input stream.
+ \expandafter\collargs at m@v at token@cs at letter@ii\expandafter#1%
+ \fi
+}
+% Store the verbatim control sequence.
+\def\collargs at m@v at token@cs at letter@ii{%
+ \expanded{%
+ \unexpanded{%
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ }%
+ \noexpand\collargs@\expandonce\collargs at tempa.%
+ }%
+}
+% The verbatim mandatory argument is delimited by verbatim braces. We have to
+% use the heavy machinery adapted from |cprotect|.
+\def\collargs at m@verb at group#1.#2{%
+ \let\collargs at begintag\collargs at other@bgroup
+ \let\collargs at endtag\collargs at other@egroup
+ \def\collargs at tagarg{}%
+ \def\collargs at commandatend{\collargs at m@verb at group@i#1.}%
+ \collargs at readContent
+}
+% This macro appends the result given by the heavy machinery, waiting for us in
+% macro |\collargsArg|, to |\collargs at toks|, but not before dressing
+% it up (via |\collargs at wrap|) in a pair of verbatim braces.
+\def\collargs at m@verb at group@i{%
+ \edef\collargs at temp{%
+ \collargs at other@bgroup\unexpanded{##1}\collargs at other@egroup}%
+ \expandafter\collargs at wrap\expandafter{\collargs at temp}%
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ \collargs@
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at g}
+% An optional group: same as |m|, but we simply bail out if we don't find the
+% group character.
+\def\collargs at g{%
+ \def\collargs at m@token{%
+ \global\collargs at fix@requestedtrue
+ \endgroup
+ \collargs@
+ }%
+ \let\collargs at m@v at token\collargs at m@token
+ \collargs at m
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at G}
+% Discard the default and execute |g|.
+\def\collargs at G#1{\collargs at g}
+% \end{macro}
+%
+% \begin{macro}{\collargs at v}
+% Verbatim argument. The code is executed in the group, deploying
+% |\collargsVerbatim|. The grouping characters are always set to braces, to
+% mimick |xparse| perfectly.
+\def\collargs at v#1.{%
+ \begingroup
+ \collargsBraces{{}}%
+ \collargsVerbatim
+ \collargs at grabspaces{\collargs at v@i#1.}%
+}
+\def\collargs at v@i#1.#2{%
+ \expandafter\ifx\collargs at other@bgroup#2%
+ % If the first token we see is an opening brace, use the |cprotect|
+ % adaptation to grab the group.
+ \let\collargs at begintag\collargs at other@bgroup
+ \let\collargs at endtag\collargs at other@egroup
+ \def\collargs at tagarg{}%
+ \def\collargs at commandatend{%
+ \edef\collargs at temp{%
+ \collargs at other@bgroup\unexpanded{####1}\collargs at other@egroup}%
+ \expandafter\collargs at wrap\expandafter{\collargs at temp}%
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ \endgroup
+ \collargs@#1.%
+ }%
+ \expandafter\collargs at readContent
+ \else
+ % Otherwise, the verbatim argument is delimited by two identical characters
+ % (|#2|).
+ \collargs at defcollector##1#2{%
+ \collargs at wrap{#2####1#2}%
+ \collargs at appendarg{##1}%
+ \endgroup
+ \collargs@#1.%
+ }%
+ \expandafter\collargs at caller
+ \fi
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at b}
+% Environments. Here's where all hell breaks loose. We survive by adapting
+% some code from Bruno Le Floch's |cprotect|. We first define the
+% environment-related keys, then provide the handler code, and finish with
+% the adaptation of |cprotect|'s environment-grabbing code.
+%
+% The argument type |b| token may be followed by a braced environment name
+% (in the argument specification).
+\def\collargs at b{%
+ \collargs at ifnextcat\bgroup\collargs at bg\collargs at bi
+}
+\def\collargs at bg#1{%
+ \edef\collargs at b@envname{#1}%
+ \collargs at bi
+}
+\def\collargs at bi#1.{%
+ % Convert the environment name to verbatim if necessary.
+ \ifcollargs at verbatim
+ \edef\collargs at b@envname{\detokenize\expandafter{\collargs at b@envname}}%
+ \fi
+ % This is a format-specific macro which sets up |\collargs at begintag| and
+ % |\collargs at endtag|.
+ \collargs at bi@defCPTbeginend
+ \edef\collargs at tagarg{%
+ \ifcollargs at verbatimbraces
+ \else
+ \ifcollargsIgnoreOtherTags
+ \collargs at b@envname
+ \fi
+ \fi
+ }%
+ % Run this after collecting the body.
+ \def\collargs at commandatend{%
+ % In \hologo{LaTeX}, we might, depending on the verbatim mode, need to
+ % check whether the environment name is correct.
+ %<latex>\collargs at bii
+ % In \hologo{plainTeX} and \hologo{ConTeXt}, we can skip directly to
+ % |\collargs at biii|.
+ %<plain,context>\collargs at biii
+ #1.%
+ }%
+ % Collect the environment body, but first, put any grabbed spaces back into
+ % the input stream.
+ \collargs at reinsert@spaces\collargs at readContent
+}
+%<*latex>
+% In \hologo{LaTeX} in the regular and the partial verbatim mode, we search for
+% |\begin|\slash|\end| --- as we cannot search for braces --- either as control
+% sequences in the regular mode, or as strings in the partial verbatim
+% mode. (After search, we will have to check whether the argument of
+% |\begin|\slash|\end| matches our environment name.) In the full verbatim
+% mode, we can search for the entire string |\begin|\slash|\end|\marg{name}.
+\def\collargs at bi@defCPTbeginend{%
+ \edef\collargs at begintag{%
+ \ifcollargs at verbatim
+ \expandafter\string
+ \else
+ \expandafter\noexpand
+ \fi
+ \begin
+ \ifcollargs at verbatimbraces
+ \collargs at other@bgroup\collargs at b@envname\collargs at other@egroup
+ \fi
+ }%
+ \edef\collargs at endtag{%
+ \ifcollargs at verbatim
+ \expandafter\string
+ \else
+ \expandafter\noexpand
+ \fi
+ \end
+ \ifcollargs at verbatimbraces
+ \collargs at other@bgroup\collargs at b@envname\collargs at other@egroup
+ \fi
+ }%
+}
+%</latex>
+%<*plain,context>
+% We can search for the entire |\|\meta{name}\slash|\end|\meta{name} (in
+% \hologo{TeX}) or |\start|\meta{name}\slash|\stop|\meta{name} (in
+% \hologo{ConTeXt}), either as a control sequence (in the regular mode), or as
+% a string (in the verbatim modes).
+\def\collargs at bi@defCPTbeginend{%
+ \edef\collargs at begintag{%
+ \ifcollargs at verbatim
+ \expandafter\expandafter\expandafter\string
+ \else
+ \expandafter\expandafter\expandafter\noexpand
+ \fi
+ \csname
+ %<context>start%
+ \collargs at b@envname
+ \endcsname
+ }%
+ \edef\collargs at endtag{%
+ \ifcollargs at verbatim
+ \expandafter\expandafter\expandafter\string
+ \else
+ \expandafter\expandafter\expandafter\noexpand
+ \fi
+ \csname
+ %<plain>end%
+ %<context>stop%
+ \collargs at b@envname
+ \endcsname
+ }%
+}
+%</plain,context>
+%<*latex>
+% Check whether we're in front of the (braced) environment name (in
+% \hologo{LaTeX}), and consume it.
+\def\collargs at bii{%
+ \ifcollargs at verbatimbraces
+ \expandafter\collargs at biii
+ \else
+ \ifcollargsIgnoreOtherTags
+ % We shouldn't check the name in this case, because it was already
+ % checked, and consumed.
+ \expandafter\expandafter\expandafter\collargs at biii
+ \else
+ \expandafter\expandafter\expandafter\collargs at b@checkend
+ \fi
+ \fi
+}
+\def\collargs at b@checkend#1.{%
+ \collargs at grabspaces{\collargs at b@checkend at i#1.}%
+}
+\def\collargs at b@checkend at i#1.#2{%
+ \def\collargs at temp{#2}%
+ \ifx\collargs at temp\collargs at b@envname
+ \else
+ \collargs at b@checkend at error
+ \fi
+ \collargs at biii#1.%
+}
+\def\collargs at b@checkend at error{%
+ \PackageError{collargs}{Environment "\collargs at b@envname" ended as
+ "\collargs at temp"}{}%
+}
+%</latex>
+% This macro stores the collected body.
+\def\collargs at biii{%
+ % Define the wrapper macro (|\collargs at temp|).
+ \collargs at b@def at wrapper
+ % Execute |\collargs at appendarg| to append the body to the list. Expand the
+ % wrapper in |\collargs at temp| first and the body in |\collargsArg| next.
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ % Reexecute the central loop.
+ \collargs@
+}
+\def\collargs at b@def at wrapper{%
+ %<latex>\edef\collargs at temp{{\collargs at b@envname}}%
+ \edef\collargs at temp{%
+ % Was the begin-tag requested?
+ \ifcollargsBeginTag
+ % |\collargs at begintag| is already adapted to the format and the verbatim mode.
+ \expandonce\collargs at begintag
+ % Add the braced environment name in \hologo{LaTeX} in the regular and
+ % partial verbatim mode.
+ %
+ %<*latex>
+ \ifcollargs at verbatimbraces\else\collargs at temp\fi
+ %</latex>
+ \fi
+ % This is the body.
+ ####1%
+ % Rinse and repeat for the end-tag.
+ \ifcollargsEndTag
+ \expandonce\collargs at endtag
+ %<*latex>
+ \ifcollargs at verbatimbraces\else\collargs at temp\fi
+ %</latex>
+ \fi
+ }%
+ \expandafter\collargs at wrap\expandafter{\collargs at temp}%
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at readContent}
+% This macro, which is an adaptation of
+% \texttt{cprotect}'s environment-grabbing code, collects some delimited
+% text, leaving the result in |\collargsArg|. Before calling it, one must
+% define the following macros: |\collargs at begintag| and |\collargs at endtag|
+% are the content delimiters; |\collargs at tagarg|, if non-empty, is the token
+% or grouped text which must follow a delimiter to be taken into account;
+% |\collargs at commandatend| is the command that will be executed once the
+% content is collected.
+\def\collargs at readContent{%
+ % Define macro which will search for the first begin-tag.
+ \ifcollargs at long\long\fi
+ \collargs at CPT@def\collargs at gobbleOneB\collargs at begintag{%
+ % Assign the collected tokens into a register. The first token in |##1|
+ % will be |\collargs at empty|, so we expand to get rid of it.
+ \expandafter\toks@\expandafter{##1}%
+ % |cprotect| simply grabs the token following the |\collargs at begintag| with
+ % a parameter. We can't do this, because we need the code to work in the
+ % non-verbatim mode, as well, and we might stumble upon a brace there. So
+ % we take a peek.
+ \futurelet\collargs at temp\collargs at gobbleOneB@i
+ }%
+ % Define macro which will search for the first end-tag. We make it long if
+ % so required (by |+|).
+ \ifcollargs at long\long\fi
+ \collargs at CPT@def\collargs at gobbleUntilE\collargs at endtag{%
+ % Expand |\collargs at empty| at the start of |##1|.
+ \expandafter\toksapp\expandafter\toks@\expandafter{##1}%
+ \collargs at gobbleUntilE@i
+ }%
+ % Initialize.
+ \collargs at begins=0\relax
+ \collargsArg{}%
+ \toks@{}%
+ % We will call |\collargs at gobbleUntilE| via the caller control sequence.
+ \collargs at letusecollector\collargs at gobbleUntilE
+ % We insert |\collargs at empty| to avoid the potential debracing problem.
+ \collargs at empty
+}
+% How many begin-tags do we have opened?
+\newcount\collargs at begins
+% An auxiliary macro which |\def|s |#1| so that it will grab everything up
+% until |#2|. Additional parameters may be present before the definition.
+\def\collargs at CPT@def#1#2{%
+ \expandafter\def\expandafter#1%
+ \expandafter##\expandafter1#2%
+}
+% A quark quard.
+\def\collargs at qend{\collargs at qend}
+% This macro will collect the ``environment'', leaving the result in
+% |\collargsArg|. It expects |\collargs at begintag|, |\collargs at endtag| and
+% |\collargs at commandatend| to be set.
+\def\collargs at gobbleOneB@i{%
+ \def\collargs at begins@increment{1}%
+ \ifx\collargs at qend\collargs at temp
+ % We have reached the fake begin-tag. Note that we found the end-tag.
+ \def\collargs at begins@increment{-1}%
+ % Gobble the quark guard.
+ \expandafter\collargs at gobbleOneB@v
+ \else
+ % Append the real begin-tag to the temporary tokens.
+ \etoksapp\toks@{\expandonce\collargs at begintag}%
+ \expandafter\collargs at gobbleOneB@ii
+ \fi
+}%
+% Do we have to check the tag argument (i.e.\ the environment name after |\begin|)?
+\def\collargs at gobbleOneB@ii{%
+ \expandafter\ifx\expandafter\relax\collargs at tagarg\relax
+ \expandafter\collargs at gobbleOneB@vi
+ \else
+ % Yup, so let's (carefully) collect the tag argument.
+ \expandafter\collargs at gobbleOneB@iii
+ \fi
+}
+\def\collargs at gobbleOneB@iii{%
+ \collargs at grabspaces{%
+ \collargs at letusecollector\collargs at gobbleOneB@iv
+ }%
+}
+\def\collargs at gobbleOneB@iv#1{%
+ \def\collargs at temp{#1}%
+ \ifx\collargs at temp\collargs at tagarg
+ % This is the tag argument we've been waiting for!
+ \else
+ % Nope, this |\begin| belongs to someone else.
+ \def\collargs at begins@increment{0}%
+ \fi
+ % Whatever the result was, we have to append the gobbled group to the
+ % temporary toks.
+ \etoksapp\toks@{\collargs at grabbed@spaces\unexpanded{{#1}}}%
+ \collargs at init@grabspaces
+ \collargs at gobbleOneB@vi
+}
+\def\collargs at gobbleOneB@v#1{\collargs at gobbleOneB@vi}
+\def\collargs at gobbleOneB@vi{%
+ % Store.
+ \etoksapp\collargsArg{\the\toks@}%
+ % Advance the begin-tag counter.
+ \advance\collargs at begins\collargs at begins@increment\relax
+ % Find more begin-tags, unless this was the final one.
+ \ifnum\collargs at begins@increment=-1
+ \else
+ \expandafter\collargs at gobbleOneB\expandafter\collargs at empty
+ \fi
+}
+\def\collargs at gobbleUntilE@i{%
+ % Do we have to check the tag argument (i.e.\ the environment name after |\end|)?
+ \expandafter\ifx\expandafter\relax\collargs at tagarg\relax
+ \expandafter\collargs at gobbleUntilE@iv
+ \else
+ % Yup, so let's (carefully) collect the tag argument.
+ \expandafter\collargs at gobbleUntilE@ii
+ \fi
+}
+\def\collargs at gobbleUntilE@ii{%
+ \collargs at grabspaces{%
+ \collargs at letusecollector\collargs at gobbleUntilE@iii
+ }%
+}
+\def\collargs at gobbleUntilE@iii#1{%
+ \etoksapp\toks@{\collargs at grabbed@spaces}%
+ \collargs at init@grabspaces
+ \def\collargs at tempa{#1}%
+ \ifx\collargs at tempa\collargs at tagarg
+ % This is the tag argument we've been waiting for!
+ \expandafter\collargs at gobbleUntilE@iv
+ \else
+ % Nope, this |\end| belongs to someone else. Insert the end tag plus the
+ % tag argument, and collect until the next |\end|.
+ \expandafter\toksapp\expandafter\toks@\expandafter{\collargs at endtag{#1}}%
+ \expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
+ \fi
+}
+\def\collargs at gobbleUntilE@iv{%
+ % Invoke |\collargs at gobbleOneB| with the collected material, plus a fake
+ % begin-tag and a quark guard.
+ \ifcollargsIgnoreNesting
+ \expandafter\collargsArg\expandafter{\the\toks@}%
+ \expandafter\collargs at commandatend
+ \else
+ \expandafter\collargs at gobbleUntilE@v
+ \fi
+}
+\def\collargs at gobbleUntilE@v{%
+ \expanded{%
+ \noexpand\collargs at letusecollector\noexpand\collargs at gobbleOneB
+ \noexpand\collargs at empty
+ \the\toks@
+ % Add a fake begin-tag and a quark guard.
+ \expandonce\collargs at begintag
+ \noexpand\collargs at qend
+ }%
+ \ifnum\collargs at begins<0
+ \expandafter\collargs at commandatend
+ \else
+ \etoksapp\collargsArg{%
+ \expandonce\collargs at endtag
+ \expandafter\ifx\expandafter\relax\collargs at tagarg\relax\else{%
+ \expandonce\collargs at tagarg}\fi
+ }%
+ \toks@={}%
+ \expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
+ \expandafter\collargs at empty
+ \fi
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at e}
+% Embellishments. Each embellishment counts as an argument, in the sense
+% that we will execute |\collargs at appendarg|, with all the processors, for
+% each embellishment separately.
+\def\collargs at e{%
+ % We open an extra group, because |\collargs at appendarg| will close a group
+ % for each embellishment.
+ \global\collargs at fix@requestedtrue
+ \begingroup
+ \ifcollargs at verbatim
+ \expandafter\collargs at e@verbatim
+ \else
+ \expandafter\collargs at e@i
+ \fi
+}
+% Detokenize the embellishment tokens in the verbatim mode.
+\def\collargs at e@verbatim#1{%
+ \expandafter\collargs at e@i\expandafter{\detokenize{#1}}%
+}
+% Ungroup the embellishment tokens, separating them from the rest of the
+% argument specification by a dot.
+\def\collargs at e@i#1{\collargs at e@ii#1.}
+% We now have embellishment tokens in |#1| and the rest of the argument
+% specification in |#2|. Let's grab spaces first.
+\def\collargs at e@ii#1.#2.{%
+ \collargs at grabspaces{\collargs at e@iii#1.#2.}%
+}
+% What's the argument token?
+\def\collargs at e@iii#1.#2.{%
+ \def\collargs at e@iv{\collargs at e@v#1.#2.}%
+ \futurelet\collargs at temp\collargs at e@iv
+}
+% If it is a open or close group character, we surely don't have an
+% embellishment.
+\def\collargs at e@v{%
+ \ifcat\noexpand\collargs at temp\bgroup\relax
+ \let\collargs at marshal\collargs at e@z
+ \else
+ \ifcat\noexpand\collargs at temp\egroup\relax
+ \let\collargs at marshal\collargs at e@z
+ \else
+ \let\collargs at marshal\collargs at e@vi
+ \fi
+ \fi
+ \collargs at marshal
+}
+% We borrow the ``Does |#1| occur within |#2|?'' macro from |pgfutil-common|,
+% but we fix it by executing |\collargs at in@@| in a braced group. This will
+% prevent an |&| in an argument to function as an alignment character; the
+% minor price to pay is that we assign the conditional globally.
+\newif\ifcollargs at in@
+\def\collargs at in@#1#2{%
+ \def\collargs at in@@##1#1##2##3\collargs at in@@{%
+ \ifx\collargs at in@##2\global\collargs at in@false\else\global\collargs at in@true\fi
+ }%
+ {\collargs at in@@#2#1\collargs at in@\collargs at in@@}%
+}
+% Let' see whether the following token, now |#3|, is an embellishment token.
+\def\collargs at e@vi#1.#2.#3{%
+ \collargs at in@{#3}{#1}%
+ \ifcollargs at in@
+ \expandafter\collargs at e@vii
+ \else
+ \expandafter\collargs at e@z
+ \fi
+ #1.#2.#3%
+}
+% |#3| is the current embellishment token. We'll collect its argument using
+% |\collargs at m|, but to do that, we have to (locally) redefine
+% |\collargs at appendarg| and |\collargs@|, which get called by |\collargs at m|.
+\def\collargs at e@vii#1.#2.#3{%
+ % We'll have to execute the original |\collargs at appendarg| later, so let's
+ % remember it. The temporary |\collargs at appendarg| simply stores the
+ % collected argument into |\collargsArg| --- we'll do the processing etc.\
+ % later.
+ \let\collargs at real@appendarg\collargs at appendarg
+ \def\collargs at appendarg##1{\collargsArg{##1}}%
+ % Once |\collargs at m| is done, it will call the redefined |\collargs@| and
+ % thereby get us back into this handler.
+ \def\collargs@{\collargs at e@viii#1.#3}%
+ \collargs at m#2.%
+}
+% The parameters here are as follows. |#1| are the embellishment tokens, and
+% |#2| is the current embellishment token; these get here via our local
+% redefinition of |\collargs@| in |\collargs at e@vii|. |#3| are the rest of the
+% argument specification, which is put behind control sequence |\collargs@| by
+% the |m| handler.
+\def\collargs at e@viii#1.#2#3.{%
+ % Our wrapper puts the current embellishment token in front of the collected
+ % embellishment argument. Note that if the embellishment argument was in
+ % braces, |\collargs at m| has already set one wrapper (which will apply first).
+ \collargs at wrap{#2##1}%
+ % We need to get rid of the current embellishment from embellishments, not to
+ % catch the same embellishment twice.
+ \def\collargs at e@ix##1#2{\collargs at e@x##1}%
+ \collargs at e@ix#1.#3.%
+}
+% When this is executed, the input stream starts with the (remaining)
+% embellishment tokens, followed by a dot, then the rest of the argument
+% specification, also followed by a dot.
+\def\collargs at e@x{%
+ % Process the argument and append it to the storage.
+ \expandafter\collargs at real@appendarg\expandafter{\the\collargsArg}%
+ % |\collargs at real@appendarg| has closed a group, so we open it again, and
+ % start looking for another embellishment token in the input stream.
+ \begingroup
+ \collargs at e@ii
+}
+% The first argument token in not an embellishment token. We finish by
+% consuming the list of embellishment tokens, closing the two groups opened by
+% this handler, and reexecuting the central loop.
+\def\collargs at e@z#1.{\endgroup\endgroup\collargs@}
+% \end{macro}
+%
+% \begin{macro}{\collargs at E}
+% Discard the defaults and execute |e|.
+\def\collargs at E#1#2{\collargs at e{#1}}
+% \end{macro}
+%
+%
+% \subsubsection{The verbatim modes}
+% \label{sec:code:collargs:verbatim}
+%
+% \begin{macro}{\collargsVerbatim,\collargsVerb,\collargsNoVerbatim}
+% These macros set the two verbatim-related
+% conditionals, |\ifcollargs at verbatim| and |\ifcollargs at verbatimbraces|,
+% and then call |\collargs at make@verbatim| to effect the requested
+% category code changes (among other things). A group should be opened
+% prior to executing either of them. After execution, they are
+% redefined to minimize the effort needed to enter into another mode in
+% an embedded group. Below, we first define all the possible transitions.
+\let\collargs at NoVerbatimAfterNoVerbatim\relax
+\def\collargs at VerbAfterNoVerbatim{%
+ \collargs at verbatimtrue
+ \collargs at verbatimbracesfalse
+ \collargs at make@verbatim
+ \collargs at after{Verb}%
+}
+\def\collargs at VerbatimAfterNoVerbatim{%
+ \collargs at verbatimtrue
+ \collargs at verbatimbracestrue
+ \collargs at make@verbatim
+ \collargs at after{Verbatim}%
+}
+\def\collargs at NoVerbatimAfterVerb{%
+ \collargs at verbatimfalse
+ \collargs at verbatimbracesfalse
+ \collargs at make@other at groups
+ \collargs at make@no at verbatim
+ \collargs at after{NoVerbatim}%
+}
+\def\collargs at VerbAfterVerb{%
+ \collargs at make@other at groups
+}
+\def\collargs at VerbatimAfterVerb{%
+ \collargs at verbatimbracestrue
+ \collargs at make@other at groups
+ % Process the lists of grouping characters, created by
+ % |\collargs at make@verbatim|, making these characters of category ``other''.
+ \def\collargs at do##1{\catcode##1=12 }%
+ \collargs at bgroups
+ \collargs at egroups
+ \collargs at after{Verbatim}%
+}%
+\let\collargs at NoVerbatimAfterVerbatim\collargs at NoVerbatimAfterVerb
+\def\collargs at VerbAfterVerbatim{%
+ \collargs at verbatimbracesfalse
+ \collargs at make@other at groups
+ % Process the lists of grouping characters, created by
+ % |\collargs at make@verbatim|, making these characters be of their normal
+ % category.
+ \def\collargs at do##1{\catcode##1=1 }%
+ \collargs at bgroups
+ \def\collargs at do##1{\catcode##1=2 }%
+ \collargs at egroups
+ \collargs at after{Verb}%
+}%
+\let\collargs at VerbatimAfterVerbatim\collargs at VerbAfterVerb
+% This macro expects |#1| to be the mode just entered (|Verbatim|, |Verb| or
+% |NoVerbatim|), and points macros |\collargsVerbatim|, |\collargsVerb| and
+% |\collargsNoVerbatim| to the appropriate transition macro.
+\def\collargs at after#1{%
+ \letcs\collargsVerbatim{collargs at VerbatimAfter#1}%
+ \letcs\collargsVerb{collargs at VerbAfter#1}%
+ \letcs\collargsNoVerbatim{collargs at NoVerbatimAfter#1}%
+}
+% The first transition is always from the non-verbatim mode.
+\collargs at after{NoVerbatim}
+% \end{macro}
+%
+% \begin{macro}{\collargs at bgroups,\collargs at egroups}
+% Initialize the lists of the current grouping characters used in the
+% redefinitions of macros |\collargsVerbatim| and |\collargsVerb| above.
+% Each entry is of form |\collargs at do|\marg{character code}. These lists
+% will be populated by |\collargs at make@verbatim|. They may be local, as they
+% only used within the group opened for a verbatim environment.
+\def\collargs at bgroups{}%
+\def\collargs at egroups{}%
+% \end{macro}
+%
+% \begin{macro}{\collargs at cc}
+% This macro recalls the category code of character |#1|. In
+% \hologo{LuaTeX}, we simply look up the category code in the original
+% category code table; in other engines, we have stored the original category
+% code into |\collargs at cc@|\meta{character code} by
+% |\collargs at make@verbatim|. (Note that |#1| is a character, not a number.)
+\ifdefined\luatexversion
+ \def\collargs at cc#1{%
+ \directlua{tex.sprint(tex.getcatcode(\collargs at catcodetable@original,
+ \the\numexpr\expandafter`\csname#1\endcsname\relax))}%
+ }
+\else
+ \def\collargs at cc#1{%
+ \ifcsname collargs at cc@\the\numexpr\expandafter`\csname#1\endcsname\endcsname
+ \csname collargs at cc@\the\numexpr\expandafter`\csname#1\endcsname\endcsname
+ \else
+ 12%
+ \fi
+ }
+\fi
+% \end{macro}
+%
+%
+% \begin{macro}{\collargs at other@bgroup,\collargs at other@egroup,\collargsBraces}
+% Macros |\collargs at other@bgroup| and
+% |\collargs at other@egroup| hold the characters of category code ``other''
+% which will play the role of grouping characters in the full verbatim mode.
+% They are usually defined when entering a verbatim mode in
+% |\collargs at make@verbatim|, but may be also set by the user via
+% |\collargsBraces| (it is not even necessary to select characters which
+% indeed have the grouping function in the outside category code regime).
+% The setting process is indirect: executing |\collargsBraces| merely sets
+% |\collargs at make@other at groups|, which gets executed by the subsequent
+% |\collargsVerbatim|, |\collargsVerb| or |\collargsNoVerbatim| (either
+% directly or via |\collargs at make@verbatim|).
+\def\collargsBraces#1{%
+ \expandafter\collargs at braces@i\detokenize{#1}\relax
+}
+\def\collargs at braces@i#1#2#3\relax{%
+ \def\collargs at make@other at groups{%
+ \def\collargs at other@bgroup{#1}%
+ \def\collargs at other@egroup{#2}%
+ }%
+}
+\def\collargs at make@other at groups{}
+% \end{macro}
+%
+% \begin{macro}{\collargs at catcodetable@verbatim,\catcodetable at atletter,\collargs at catcodetable@initex}
+% We declare several new catcode tables in \hologo{LuaTeX}, the most
+% important one being |\collargs at catcodetable@verbatim|, where all characters
+% have category code 12. We only need the other two tables in some formats:
+% |\collargs at catcodetable@atletter| holds the catcode in effect at the time
+% of loading the package, and |\collargs at catcodetable@initex| is the
+% \hologo{iniTeX} table.
+\ifdefined\luatexversion
+ %<*latex,context>
+ \newcatcodetable\collargs at catcodetable@verbatim
+ %<latex>\let\collargs at catcodetable@atletter\catcodetable at atletter
+ %<context>\newcatcodetable\collargs at catcodetable@atletter
+ %</latex,context>
+ %<*plain>
+ \ifdefined\collargs at catcodetable@verbatim\else
+ \chardef\collargs at catcodetable@verbatim=4242
+ \fi
+ \chardef\collargs at catcodetable@atletter=%
+ \number\numexpr\collargs at catcodetable@verbatim+1\relax
+ \chardef\collargs at catcodetable@initex=%
+ \number\numexpr\collargs at catcodetable@verbatim+2\relax
+ \initcatcodetable\collargs at catcodetable@initex
+ %</plain>
+ %<plain,context>\savecatcodetable\collargs at catcodetable@atletter
+ \begingroup
+ \@firstofone{%
+ %<latex>\catcodetable\catcodetable at initex
+ %<plain>\catcodetable\collargs at catcodetable@initex
+ %<context>\catcodetable\inicatcodes
+ \catcode`\\=12
+ \catcode13=12
+ \catcode0=12
+ \catcode32=12
+ \catcode`\%=12
+ \catcode127=12
+ \def\collargs at do#1{\catcode#1=12 }%
+ \collargs at forrange{`\a}{`\z}%
+ \collargs at forrange{`\A}{`\Z}%
+ \savecatcodetable\collargs at catcodetable@verbatim
+ \endgroup
+ }%
+\fi
+% \end{macro}
+%
+% \begin{collargskey}{verbatim ranges}
+% \begin{macro}{\collargsVerbatimRanges,\collargs at verbatim@ranges}
+% This key and macro set the character ranges to which the verbatim mode
+% will apply (in \hologo{pdfTeX} and \hologo{XeTeX}), or which will be
+% inspected for grouping and comment characters (in \hologo{LuaTeX}). In
+% \hologo{pdfTeX}, the default value |0-255| should really remain
+% unchanged.
+\collargsSet{
+ verbatim ranges/.store in=\collargs at verbatim@ranges,
+}
+\def\collargsVerbatimRanges#1{\def\collargs at verbatim@ranges{#1}}
+\def\collargs at verbatim@ranges{0-255}
+% \end{macro}
+% \end{collargskey}
+%
+% \begin{macro}{\collargs at make@verbatim}
+% This macro changes the category code of all characters to ``other'' ---
+% except the grouping characters in the partial verbatim mode. While doing
+% that, it also stores (unless we're in \hologo{LuaTeX}) the current category
+% codes into |\collargs at cc@|\meta{character code} (easily recallable by
+% |\collargs at cc|), redefines the ``primary'' grouping characters
+% |\collargs at make@other at bgroup| and |\collargs at make@other at egroup| if
+% necessary, and ``remembers'' the grouping characters (storing them into
+% |\collargs at bgroups| and |\collargs at egroups|) and the comment characters
+% (storing them into |\collargs at comments|).
+%
+% In \hologo{LuaTeX}, we can use catcode tables, so we change the category
+% codes by switching to category code table
+% |\collargs at catcodetable@verbatim|. In other engines, we have to change the
+% codes manually. In order to offer some flexibility in \hologo{XeTeX}, we
+% perform the change for characters in |verbatim ranges|.
+\ifdefined\luatexversion
+ \def\collargs at make@verbatim{%
+ \directlua{%
+ for from, to in string.gmatch(
+ "\luaescapestring{\collargs at verbatim@ranges}",
+ "(\collargs at percentchar d+)-(\collargs at percentchar d+)"
+ ) do
+ for char = tex.round(from), tex.round(to) do
+ catcode = tex.catcode[char]
+ % For category codes 1, 2 and 14, we have to call macros
+ % |\collargs at make@verbatim at bgroup|, |\collargs at make@verbatim at egroup|
+ % and |\collargs at make@verbatim at comment|, same as for engines other
+ % than \hologo{LuaTeX}.
+ if catcode == 1 then
+ tex.sprint(
+ \number\collargs at catcodetable@atletter,
+ "\noexpand\\collargs at make@verbatim at bgroup{" .. char .. "}")
+ elseif catcode == 2 then
+ tex.sprint(
+ \number\collargs at catcodetable@atletter,
+ "\noexpand\\collargs at make@verbatim at egroup{" .. char .. "}")
+ elseif catcode == 14 then
+ tex.sprint(
+ \number\collargs at catcodetable@atletter,
+ "\noexpand\\collargs at make@verbatim at comment{" .. char .. "}")
+ end
+ end
+ end
+ }%
+ \edef\collargs at catcodetable@original{\the\catcodetable}%
+ \catcodetable\collargs at catcodetable@verbatim
+ % Even in \hologo{LuaTeX}, we switch between the verbatim braces regimes by
+ % hand.
+ \ifcollargs at verbatimbraces
+ \else
+ \def\collargs at do##1{\catcode##1=1\relax}%
+ \collargs at bgroups
+ \def\collargs at do##1{\catcode##1=2\relax}%
+ \collargs at egroups
+ \fi
+ }
+\else
+ % The non-\hologo{LuaTeX} version:
+ \def\collargs at make@verbatim{%
+ \ifdefempty\collargs at make@other at groups{}{%
+ % The user has executed |\collargsBraces|. We first apply that setting
+ % by executing macro |\collargs at make@other at groups|, and then disable our
+ % automatic setting of the primary grouping characters.
+ \collargs at make@other at groups
+ \def\collargs at make@other at groups{}%
+ \let\collargs at make@other at bgroup\@gobble
+ \let\collargs at make@other at egroup\@gobble
+ }%
+ % Initialize the list of current comment characters. Each entry is of
+ % form |\collargs at do|\marg{character code}. The definition must be global,
+ % because the macro will be used only once we exit the current group (by
+ % |\collargs at fix@cc at from@other at comment|, if at all).
+ \gdef\collargs at comments{}%
+ \let\collargs at do\collargs at make@verbatim at char
+ \expandafter\collargs at forranges\expandafter{\collargs at verbatim@ranges}%
+ }
+ \def\collargs at make@verbatim at char#1{%
+ % Store the current category code of the current character.
+ \ifnum\catcode#1=12
+ \else
+ \csedef{collargs at cc@#1}{\the\catcode#1}%
+ \fi
+ \ifnum\catcode#1=1
+ \collargs at make@verbatim at bgroup{#1}%
+ \else
+ \ifnum\catcode#1=2
+ \collargs at make@verbatim at egroup{#1}%
+ \else
+ \ifnum\catcode#1=14
+ \collargs at make@verbatim at comment{#1}%
+ \fi
+ % Change the category code of the current character (including the
+ % comment characters).
+ \ifnum\catcode#1=12
+ \else
+ \catcode#1=12\relax
+ \fi
+ \fi
+ \fi
+ }
+\fi
+% \end{macro}
+%
+% \begin{macro}{\collargs at make@verbatim at bgroup}
+% This macro changes the category of
+% the opening group character to ``other'', but only in the full verbatim
+% mode. Next, it populates |\collargs at bgroups|, to facilitate the potential
+% transition into the other verbatim mode. Finally, it executes
+% |\collargs at make@other at bgroup|, which stores the ``other'' variant of the
+% current character into |\collargs at other@bgroup|, and automatically disables
+% itself, so that it is only executed for the first encountered opening group
+% character --- unless it was already |\relax|ed at the top of
+% |\collargs at make@verbatim| as a consequence of the user executing
+% |\collargsBraces|.
+\def\collargs at make@verbatim at bgroup#1{%
+ \ifcollargs at verbatimbraces
+ \catcode#1=12\relax
+ \fi
+ \appto\collargs at bgroups{\collargs at do{#1}}%
+ \collargs at make@other at bgroup{#1}%
+}
+\def\collargs at make@other at bgroup#1{%
+ \collargs at make@char\collargs at other@bgroup{#1}{12}%
+ \let\collargs at make@other at bgroup\@gobble
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at make@verbatim at egroup}
+% Ditto for the closing group character.
+\def\collargs at make@verbatim at egroup#1{%
+ \ifcollargs at verbatimbraces
+ \catcode#1=12\relax
+ \fi
+ \appto\collargs at egroups{\collargs at do{#1}}%
+ \collargs at make@other at egroup{#1}%
+}
+\def\collargs at make@other at egroup#1{%
+ \collargs at make@char\collargs at other@egroup{#1}{12}%
+ \let\collargs at make@other at egroup\@gobble
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at make@verbatim at comment}
+% This macro populates
+% |\collargs at make@comments at other|.
+\def\collargs at make@verbatim at comment#1{%
+ \gappto\collargs at comments{\collargs at do{#1}}%
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at make@no at verbatim}
+% This macro switches back to the non-verbatim mode: in \hologo{LuaTeX}, by
+% switching to the original catcode table; in other engines, by recalling the
+% stored category codes.
+\ifdefined\luatexversion
+ \def\collargs at make@no at verbatim{%
+ \catcodetable\collargs at catcodetable@original\relax
+ }%
+\else
+\def\collargs at make@no at verbatim{%
+ \let\collargs at do\collargs at make@no at verbatim@char
+ \expandafter\collargs at forranges\expandafter{\collargs at verbatim@ranges}%
+}
+\fi
+\def\collargs at make@no at verbatim@char#1{%
+ % The original category code of a characted was stored into
+ % |\collargs at cc@|\meta{character code} by |\collargs at make@verbatim|. (We don't
+ % use |\collargs at cc|, because we have a number.)
+ \ifcsname collargs at cc@#1\endcsname
+ \catcode#1=\csname collargs at cc@#1\endcsname\relax
+ % We don't have to restore category code 12.
+ \fi
+}
+% \end{macro}
+%
+%
+% \subsubsection{Transition between the verbatim and the non-verbatim mode}
+% \label{sec:code:collargs:fix}
+%
+% At the transition from verbatim to non-verbatim mode, and vice versa, we
+% sometimes have to fix the category code of the next argument token. This
+% happens when we have an optional argument type in one mode followed by an
+% argument type in another mode, but the optional argument is absent, or when
+% an optional, but absent, verbatim argument is the last argument in the
+% specification. The problem arises because the presence of optional arguments
+% is determined by looking ahead in the input stream; when the argument is
+% absent, this means that we have fixed the category code of the next token.
+% CollArgs addresses this issue by noting the situations where a token receives
+% the wrong category code, and then does its best to replace that token with
+% the same character of the appropriate category code.
+%
+% \begin{macro}{\ifcollargs at fix@requested}
+% This conditional is set, globally,
+% by the optional argument handlers when the argument is in fact absent,
+% and reset in the central loop after applying the fix if necessary.
+\newif\ifcollargs at fix@requested
+% \end{macro}
+%
+% \begin{macro}{\collargs at fix}
+% This macro selects the fixer appropriate to the transition between the
+% previous verbatim mode (determined by |\ifcollargs at last@verbatim| and
+% |\ifcollargs at last@verbatimbraces|) and the current verbatim mode (which
+% is determined by macros |\ifcollargs at verbatim| and
+% |\ifcollargs at verbatimbraces|); if the category code fix was not
+% requested (for this, we check |\ifcollargs at fix@requested|), the
+% macro simply executes the next-code given as the sole argument.
+% The name of the fixer macro has the form
+% |\collargs at fix@|\meta{last mode}|to|\meta{current mode}, where
+% the modes are given by mnemonic codes: |V| = full verbatim, |v| =
+% partial verbatim, and |N| = non-verbatim.
+\long\def\collargs at fix#1{%
+ % Going through |\edef| + |\unexpanded| avoids doubling the hashes.
+ \edef\collargs at fix@next{\unexpanded{#1}}%
+ \ifcollargs at fix@requested
+ \letcs\collargs at action{collargs at fix@%
+ \ifcollargs at last@verbatim
+ \ifcollargs at last@verbatimbraces V\else v\fi
+ \else
+ N%
+ \fi
+ to%
+ \ifcollargs at verbatim
+ \ifcollargs at verbatimbraces V\else v\fi
+ \else
+ N%
+ \fi
+ }%
+ \else
+ \let\collargs at action\collargs at fix@next
+ \fi
+ \collargs at action
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at fix@NtoN,\collargs at fix@vtov,\collargs at fix@VtoV}
+% \indentmacrocode
+% Nothing to do, continue with the next-code.
+\def\collargs at fix@NtoN{\collargs at fix@next}
+\let\collargs at fix@vtov\collargs at fix@NtoN
+\let\collargs at fix@VtoV\collargs at fix@NtoN
+% \end{macro}
+%
+% \begin{macro}{\collargs at fix@Ntov}
+% We do nothing for the group tokens; for other tokens, we redirect to
+% |\collargs at fix@NtoV|.
+\def\collargs at fix@Ntov{%
+ \futurelet\collargs at temp\collargs at fix@cc at to@other at ii
+}
+\def\collargs at fix@cc at to@other at ii{%
+ \ifcat\noexpand\collargs at temp\bgroup
+ \let\collargs at action\collargs at fix@next
+ \else
+ \ifcat\noexpand\collargs at temp\egroup
+ \let\collargs at action\collargs at fix@next
+ \else
+ \let\collargs at action\collargs at fix@NtoV
+ \fi
+ \fi
+ \collargs at action
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at fix@NtoV}
+% The only complication here is that we might be in front of a control
+% sequence that was a result of a previous fix in the other direction.
+\def\collargs at fix@NtoV{%
+ \ifcollargs at double@fix
+ \ifcollargs at in@second at fix
+ \expandafter\expandafter\expandafter\collargs at fix@NtoV at secondfix
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@NtoV at onemore
+ \fi
+ \else
+ \expandafter\collargs at fix@NtoV at singlefix
+ \fi
+}
+% This is the usual situation of a single fix. We just use |\string| on
+% the next token here (but note that some situations can't be saved: noone
+% can bring a comment back to life, or distinguish a newline and a space)
+\def\collargs at fix@NtoV at singlefix{%
+ \expandafter\collargs at fix@next\string
+}
+% If this is the first fix of two, we know |#1| is a control sequence, so it is
+% safe to grab it.
+\def\collargs at fix@NtoV at onemore#1{%
+ \collargs at do@one at more@fix{%
+ \expandafter\collargs at fix@next\string#1%
+ }%
+}
+% If this is the second fix of the two, we have to check whether the next token
+% is a control sequence, and if it is, we need to remember it. Afterwards, we
+% redirect to the single-fix.
+\def\collargs at fix@NtoV at secondfix{%
+ \if\noexpand\collargs at temp\relax
+ \expandafter\collargs at fix@NtoV at secondfix@i
+ \else
+ \expandafter\collargs at fix@NtoV at singlefix
+ \fi
+}
+\def\collargs at fix@NtoV at secondfix@i#1{%
+ \gdef\collargs at double@fix at cs@ii{#1}%
+ \collargs at fix@NtoV at singlefix#1%
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at fix@vtoN}
+% Do nothing for the grouping tokens, redirect to |\collargs at fix@VtoN| for
+% other tokens.
+\def\collargs at fix@vtoN{%
+ \futurelet\collargs at token\collargs at fix@vtoN at i
+}
+\def\collargs at fix@vtoN at i{%
+ \ifcat\noexpand\collargs at token\bgroup
+ \expandafter\collargs at fix@next
+ \else
+ \ifcat\noexpand\collargs at token\egroup
+ \expandafter\expandafter\expandafter\collargs at fix@next
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN
+ \fi
+ \fi
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at fix@vtoV}
+% Redirect group tokens to |\collargs at fix@NtoV|, and do nothing for other
+% tokens.
+\def\collargs at fix@vtoV{%
+ \futurelet\collargs at token\collargs at fix@vtoV at i
+}
+\def\collargs at fix@vtoV at i{%
+ \ifcat\noexpand\collargs at token\bgroup
+ \expandafter\collargs at fix@NtoV
+ \else
+ \ifcat\noexpand\collargs at token\egroup
+ \expandafter\expandafter\expandafter\collargs at fix@NtoV
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@next
+ \fi
+ \fi
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at fix@Vtov}
+% Redirect group tokens to |\collargs at fix@VtoN|, and do nothing for other
+% tokens. |#1| is surely of category 12, so we can safely grab it.
+\def\collargs at fix@catcode at of@braces at fromverbatim#1{%
+ \ifnum\catcode`#1=1
+ \expandafter\collargs at fix@VtoN
+ \expandafter#1%
+ \else
+ \ifnum\catcode`#1=2
+ \expandafter\expandafter\expandafter\collargs at fix@cc at VtoN
+ \expandafter\expandafter\expandafter#1%
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@next
+ \fi
+ \fi
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at fix@VtoN}
+% This is the only complicated part. Control sequences and comments (but not
+% grouping characters!) require special attention. We're fine to grab the
+% token right away, as we know it is of category 12.
+\def\collargs at fix@VtoN#1{%
+ \ifnum\catcode`#1=0
+ \expandafter\collargs at fix@VtoN at escape
+ \else
+ \ifnum\catcode`#1=14
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at comment
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at token
+ \fi
+ \fi
+ #1%
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at fix@VtoN at token}
+% We create a new character with the current
+% category code behing the next-code. This works even for grouping
+% characters.
+\def\collargs at fix@VtoN at token#1{%
+ \collargs at insert@char\collargs at fix@next{`#1}{\the\catcode`#1}%
+}
+% \end{macro}
+%
+% \begin{macro}{\collargs at fix@VtoN at comment}
+% This macro defines a macro which will,
+% when placed at a comment character, remove the tokens until the end of the
+% line. The code is adapted from the TeX.SE answer at
+% \url(https://){tex.stackexchange.com/a/10454/16819} by Bruno Le Floch.
+\def\collargs at defcommentstripper#1#2{%
+ % We chuck a parameter into the following definition, to grab the (verbatim)
+ % comment character. This is why this macro must be executed precisely
+ % before the (verbatim) comment character.
+ \def#1##1{%
+ \begingroup%
+ \escapechar=`\\%
+ \catcode\endlinechar=\active%
+ % We assign the ``other'' category code to comment characters. Without
+ % this, comment characters behind the first one make trouble: there would
+ % be no |^||^M| at the end of the line, so the comment stripper would
+ % gobble the following line as well; in fact, it would gobble all
+ % subsequent lines containing a comment character. We also make sure to
+ % change the category code of \emph{all} comment characters, even if there
+ % is usually just one.
+ \def\collargs at do####1{\catcode####1=12 }%
+ \collargs at comments
+ \csname\string#1\endcsname%
+ }%
+ \begingroup%
+ \escapechar=`\\%
+ \lccode`\~=\endlinechar%
+ \lowercase{%
+ \expandafter\endgroup
+ \expandafter\def\csname\string#1\endcsname##1~%
+ }{%
+ % I have removed |\space| from the end of the following line. We don't
+ % want it for our application.
+ \endgroup#2%
+ }%
+}
+\collargs at defcommentstripper\collargs at fix@VtoN at comment{%
+ \collargs at fix@next
+}
+% We don't need the generator any more.
+\let\collargs at defcommentstripper\relax
+% \end{macro}
+%
+% \begin{macro}{\collargs at fix@VtoN at escape}
+% An escape character of category code 12
+% is the most challenging --- and we won't get things completely right --- as
+% we have swim further down the input stream to create a control sequence.
+% This macro will throw away the verbatim escape character |#1|.
+\def\collargs at fix@VtoN at escape#1{%
+ \ifcollargs at double@fix
+ % We need to do things in a special way if we're in the double-fix
+ % situation triggered by the previous fixing of a control sequence
+ % (probably this very one). In that case, we can't collect it in the usual
+ % way because the entire control sequence is spelled out in verbatim.
+ \expandafter\collargs at fix@VtoN at escape@d
+ \else
+ % This here is the usual situation where the escape character was tokenized
+ % verbatim, but the control sequence name itself will be collected (right
+ % away) in the non-verbatim regime.
+ \expandafter\collargs at fix@VtoN at escape@i
+ \fi
+}
+\def\collargs at fix@VtoN at escape@i{%
+ % The sole character forming a control symbol name may be of any category.
+ % Temporarily redefining the category codes of the craziest characters allows
+ % |\collargs at fix@VtoN at escape@ii| to simply grab the following
+ % character.
+ \begingroup
+ \catcode`\\=12
+ \catcode`\{=12
+ \catcode`\}=12
+ \catcode`\ =12
+ \collargs at fix@VtoN at escape@ii
+}
+% The argument is the first character of the control sequence name.
+\def\collargs at fix@VtoN at escape@ii#1{%
+ \endgroup
+ \def\collargs at csname{#1}%
+ % Only if |#1| is a letter may the control sequence name continue.
+ \ifnum\catcode`#1=11
+ \expandafter\collargs at fix@VtoN at escape@iii
+ \else
+ % In the case of a control space, we have to throw away the following
+ % spaces.
+ \ifnum\catcode`#1=10
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at escape@s
+ \else
+ % We have a control symbol. That means that we haven't peeked ahead and
+ % can thus skip |\collargs at fix@VtoN at escape@z|.
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at escape@z at i
+ \fi
+ \fi
+}
+% We still have to collect the rest of the control sequence name. Braces have
+% their usual meaning again, so we have to check for them explicitly (and bail
+% out if we stumble upon them).
+\def\collargs at fix@VtoN at escape@iii{%
+ \futurelet\collargs at temp\collargs at fix@VtoN at escape@iv
+}
+\def\collargs at fix@VtoN at escape@iv{%
+ \ifcat\noexpand\collargs at temp\bgroup
+ \let\collargs at action\collargs at fix@VtoN at escape@z
+ \else
+ \ifcat\noexpand\collargs at temp\egroup
+ \let\collargs at action\collargs at fix@VtoN at escape@z
+ \else
+ \expandafter\ifx\space\collargs at temp
+ \let\collargs at action\collargs at fix@VtoN at escape@s
+ \else
+ \let\collargs at action\collargs at fix@VtoN at escape@v
+ \fi
+ \fi
+ \fi
+ \collargs at action
+}
+% If we have a letter, store it and loop back, otherwise finish.
+\def\collargs at fix@VtoN at escape@v#1{%
+ \ifcat\noexpand#1a%
+ \appto\collargs at csname{#1}%
+ \expandafter\collargs at fix@VtoN at escape@iii
+ \else
+ \expandafter\collargs at fix@VtoN at escape@z\expandafter#1%
+ \fi
+}
+% Throw away the following spaces.
+\def\collargs at fix@VtoN at escape@s{%
+ \futurelet\collargs at temp\collargs at fix@VtoN at escape@s at i
+}
+\def\collargs at fix@VtoN at escape@s at i{%
+ \expandafter\ifx\space\collargs at temp
+ \expandafter\collargs at fix@VtoN at escape@s at ii
+ \else
+ \expandafter\collargs at fix@VtoN at escape@z
+ \fi
+}
+\def\collargs at fix@VtoN at escape@s at ii{%
+ \expandafter\collargs at fix@VtoN at escape@z\romannumeral-0%
+}
+% Once we have collected the control sequence name into |\collargs at csname|, we
+% will create the control sequence behind the next-code. However, we have two
+% complications. The minor one is that |\csname| defines an unexisting control
+% sequence to mean |\relax|, so we have to check whether the control sequence
+% we will create is defined, and if not, ``undefine'' it in advance.
+% ^^A todo: do nicer
+\def\collargs at fix@VtoN at escape@z at i{%
+ \collargs at fix@VtoN at escape@z at maybe@undefine at cs@begin
+ \collargs at fix@VtoN at escape@z at ii
+}%
+\def\collargs at fix@VtoN at escape@z at maybe@undefine at cs@begin{%
+ \ifcsname\collargs at csname\endcsname
+ \@tempswatrue
+ \else
+ \@tempswafalse
+ \fi
+}
+\def\collargs at fix@VtoN at escape@z at maybe@undefine at cs@end{%
+ \if at tempswa
+ \else
+ \cslet{\collargs at csname}\collargs at undefined
+ \fi
+}
+\def\collargs at fix@VtoN at escape@z at ii{%
+ \expandafter\collargs at fix@VtoN at escape@z at maybe@undefine at cs@end
+ \expandafter\collargs at fix@next\csname\collargs at csname\endcsname
+}
+% The second complication is much greater, but it only applies to control words
+% and spaces, and that's why control symbols went directly to the macro above.
+% Control words and spaces will only get there via a detour through the
+% following macro.
+%
+% The problem is that collecting the control word\slash space name peeked ahead
+% in the stream, so the character following the control sequence (name) is
+% already tokenized. We will (at least partially) address this by requesting a
+% ``double-fix'': until the control sequence we're about to create is consumed
+% into some argument, each category code fix will fix two ``tokens'' rather
+% than one.
+\def\collargs at fix@VtoN at escape@z{%
+ \collargs at if@one at more@fix{%
+ % Some previous fixing has requested a double fix, so let's do it.
+ % Afterwards, redirect to the control symbol code
+ % |\collargs at fix@VtoN at escape@z at i|. It will surely use the correct
+ % |\collargs at csname| because we do the second fix in a group.
+ \collargs at do@one at more@fix\collargs at fix@VtoN at escape@z at i
+ }{%
+ % Remember the collected control sequence. It will be used in
+ % |\collargs at cancel@double at fix|.
+ \collargs at fix@VtoN at escape@z at maybe@undefine at cs@begin
+ \xdef\collargs at double@fix at cs@i{\expandonce{\csname\collargs at csname\endcsname}}%
+ \collargs at fix@VtoN at escape@z at maybe@undefine at cs@end
+ % Request the double-fix.
+ \global\collargs at double@fixtrue
+ % The complication is addressed, redirect to the control symbol finish.
+ \collargs at fix@VtoN at escape@z at ii
+ }%
+}
+% When we have to ``redo'' a control sequence, because it was ping-ponged back
+% into the verbatim mode, we cannot collect it by
+% |\collargs at fix@VtoN at escape@i|, because it is spelled out entirely in
+% verbatim. However, we have seen this control sequence before, and remembered
+% it, so we'll simply grab it. Another complication is that we might be either
+% at the ``first'' control sequence, whose fixing created all these double-fix
+% trouble, or at the ``second'' control sequence, if the first one was
+% immediately followed by another one. But we have remembered both of them:
+% the first one in |\collargs at fix@VtoN at escape@z|, the second one in
+% |\collargs at fix@NtoV at secondfix|.
+\def\collargs at fix@VtoN at escape@d{%
+ \ifcollargs at in@second at fix
+ \expandafter\collargs at fix@VtoN at escape@d at i
+ \expandafter\collargs at double@fix at cs@ii
+ \else
+ \expandafter\collargs at fix@VtoN at escape@d at i
+ \expandafter\collargs at double@fix at cs@i
+ \fi
+}
+% We have the contents of either |\collargs at double@fix at cs@i| or
+% |\collargs at double@fix at cs@ii| here, a control sequence in both cases.
+\def\collargs at fix@VtoN at escape@d at i#1{%
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at escape@d at ii
+ \expandafter\string#1\relax
+}
+% We have the verbatimized control sequence name in |#2| (|#1| is the escape
+% character). By storing it into |\collargs at csname|, we pretend we have
+% collected it. By defining and executing |\collargs at fix@VtoN at escape@d at iii|,
+% we actually gobble it from the input stream. Finally, we reroute to
+% |\collargs at fix@VtoN at escape@z|.
+\def\collargs at fix@VtoN at escape@d at ii#1#2\relax{%
+ \def\collargs at csname{#2}%
+ \def\collargs at fix@VtoN at escape@d at iii#2{%
+ \collargs at fix@VtoN at escape@z
+ }%
+ \collargs at fix@VtoN at escape@d at iii
+}
+% This conditional signals a double-fix request. It should be always set
+% globally, because it is cleared by |\collargs at double@fixfalse| in a group.
+\newif\ifcollargs at double@fix
+% This conditional signals that we're currently performing the second fix.
+\newif\ifcollargs at in@second at fix
+% Inspect the two conditionals above to decide whether we have to perform
+% another fix: if so, execute the first argument, otherwise the second one.
+% This macro is called only from |\collargs at fix@VtoN at escape@z| and
+% |\collargs at fix@NtoV|, because these are the only two places where we might
+% need the second fix, ping-ponging a control sequence between the verbatim and
+% the non-verbatim mode.
+\def\collargs at if@one at more@fix{%
+ \ifcollargs at double@fix
+ \ifcollargs at in@second at fix
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \else
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \fi
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+\def\collargs at do@one at more@fix#1{%
+ % We perform the second fix in a group, signalling that we're performing
+ % it.
+ \begingroup
+ \collargs at in@second at fixtrue
+ % Reexecute the fixing routine, at the end, close the group and execute
+ % the given code afterwards.
+ \collargs at fix{%
+ \endgroup
+ #1%
+ }%
+}
+% This macro is called from |\collargs at appendarg| to cancel the double-fix
+% request.
+\def\collargs at cancel@double at fix{%
+ % |\collargs at appendarg| is only executed when something was actually
+ % consumed. We thus know that at least one of the problematic ``tokens'' is
+ % gone, so the double fix is not necessary anymore.
+ \global\collargs at double@fixfalse
+ % What we have to figure out, still, is whether both problematic ``tokens''
+ % we consumed. If so, no more fixing is required. But if only one of them
+ % was consumed, we need to request the normal, single, fix for the remaining
+ % ``token''.
+ \begingroup
+ % This will attach the delimiters directly to the argument, so we'll see what
+ % was actually consumed.
+ \collargs at process@arg
+ % We compare what was consumed when collecting the current argument with the
+ % control word that triggered double-fixing. If they match, only the
+ % offending control word was consumed, so we need to set the fix request to
+ % true for the following token.
+ \edef\collargs at temp{\the\collargsArg}%
+ \edef\collargs at tempa{\expandafter\string\collargs at double@fix at cs@i}%
+ \ifx\collargs at temp\collargs at tempa
+ \global\collargs at fix@requestedtrue
+ \fi
+ \endgroup
+}
+% \end{macro}
+%
+%
+% \begin{macro}{\collargs at insert@char,\collargs at make@char}
+% These macros create a character of character code |#2| and category code
+% |#3|. The first macro inserts it into the stream behind the code in |#1|;
+% the second one defines the control sequence in |#1| to hold the created
+% character (clearly, it should not be used for categories 1 and 2).
+%
+% We use the facilities of \hologo{LuaTeX}, \hologo{XeTeX} and \hologo{LaTeX}
+% where possible. In the end, we only have to implement our own macros for
+% plain \hologo{pdfTeX}.
+%<!context>\ifdefined\luatexversion
+ \def\collargs at insert@char#1#2#3{%
+ \edef\collargs at temp{\unexpanded{#1}}%
+ \expandafter\collargs at temp\directlua{%
+ tex.cprint(\number#3,string.char(\number#2))}%
+ }%
+ \def\collargs at make@char#1#2#3{%
+ \edef#1{\directlua{tex.cprint(\number#3,string.char(\number#2))}}%
+ }%
+%<*!context>
+\else
+ \ifdefined\XeTeXversion
+ \def\collargs at insert@char#1#2#3{%
+ \edef\collargs at temp{\unexpanded{#1}}%
+ \expandafter\collargs at temp\Ucharcat #2 #3
+ }%
+ \def\collargs at make@char#1#2#3{%
+ \edef#1{\Ucharcat#2 #3}%
+ }%
+ \else
+ %<*latex>
+ \ExplSyntaxOn
+ \def\collargs at insert@char#1#2#3{%
+ \edef\collargs at temp{\unexpanded{#1}}%
+ \expandafter\expandafter\expandafter\collargs at temp\char_generate:nn{#2}{#3}%
+ }%
+ \def\collargs at make@char#1#2#3{%
+ \edef#1{\char_generate:nn{#2}{#3}}%
+ }%
+ \ExplSyntaxOff
+ %</latex>
+ %<*plain>
+ % The implementation is inspired by |expl3|'s implementation of
+ % |\char_generate:nn|, but our implementation is not expandable, for
+ % simplicity. We first store an (arbitrary) character |^||^@| of category
+ % code $n$ into control sequence |\collargs at charofcat@|$n$, for every
+ % (implementable) category code.
+ \begingroup
+ \catcode`\^^@=1 \csgdef{collargs at charofcat@1}{%
+ \noexpand\expandafter^^@\iffalse}\fi}
+ \catcode`\^^@=2 \csgdef{collargs at charofcat@2}{\iffalse{\fi^^@}
+ \catcode`\^^@=3 \csgdef{collargs at charofcat@3}{^^@}
+ \catcode`\^^@=4 \csgdef{collargs at charofcat@4}{^^@}
+ % As we have grabbed the spaces already, a remaining newline should surely be
+ % fixed into a |\par|.
+ \csgdef{collargs at charofcat@5}{\par}
+ \catcode`\^^@=6 \csxdef{collargs at charofcat@6}{\unexpanded{^^@}}
+ \catcode`\^^@=7 \csgdef{collargs at charofcat@7}{^^@}
+ \catcode`\^^@=8 \csgdef{collargs at charofcat@8}{^^@}
+ \csgdef{collargs at charofcat@10}{\noexpand\space}
+ \catcode`\^^@=11 \csgdef{collargs at charofcat@11}{^^@}
+ \catcode`\^^@=12 \csgdef{collargs at charofcat@12}{^^@}
+ \catcode`\^^@=13 \csgdef{collargs at charofcat@13}{^^@}
+ \endgroup
+ \def\collargs at insert@char#1#2#3{%
+ % Temporarily change the lowercase code of |^||^@| to the requested character
+ % |#2|.
+ \begingroup
+ \lccode`\^^@=#2\relax
+ % We'll have to close the group before executing the next-code.
+ \def\collargs at temp{\endgroup#1}%
+ % |\collargs at charofcat@|\meta{requested category code} is f-expanded first,
+ % leaving us to lowercase |\expandafter\collargs at temp^||^@|. Clearly,
+ % lowercasing |\expandafter\collargs at temp| is a no-op, but lowercasing
+ % |^||^@| gets us the requested character of the requested category.
+ % |\expandafter| is executed next, and this gets rid of the conditional for
+ % category codes 1 and 2.
+ \expandafter\lowercase\expandafter{%
+ \expandafter\expandafter\expandafter\collargs at temp
+ \romannumeral-`0\csname collargs at charofcat@\the\numexpr#3\relax\endcsname
+ }%
+ }
+ % This macro cannot not work for category code 6 (because we assign the
+ % result to a macro), but no matter, we only use it for category code 12
+ % anyway.
+ \def\collargs at make@char#1#2#3{%
+ \begingroup
+ \lccode`\^^@=#2\relax
+ % Define |\collargs at temp| to hold |^||^@| of the appropriate category.
+ \edef\collargs at temp{%
+ \csname collargs at charofcat@\the\numexpr#3\relax\endcsname}%
+ % Preexpand the second |\collargs at temp| so that we lowercase
+ % |\def\collargs at temp{^||^@}|, with |^||^@| of the appropriate category.
+ \expandafter\lowercase\expandafter{%
+ \expandafter\def\expandafter\collargs at temp\expandafter{\collargs at temp}%
+ }%
+ \expandafter\endgroup
+ \expandafter\def\expandafter#1\expandafter{\collargs at temp}%
+ }
+ %</plain>
+ \fi
+\fi
+%</!context>
+% \end{macro}
+%
+%<plain>\resetatcatcode
+%<context>\stopmodule
+%<context>\protect
+% \end{macrocode}
+%
+% Local Variables:
+% TeX-engine: luatex
+% TeX-master: "doc/memoize-code.tex"
+% TeX-auto-save: nil
+% End:
\ No newline at end of file
Added: trunk/Master/texmf-dist/source/generic/collargs/collargs.ins
===================================================================
--- trunk/Master/texmf-dist/source/generic/collargs/collargs.ins (rev 0)
+++ trunk/Master/texmf-dist/source/generic/collargs/collargs.ins 2023-10-11 20:25:43 UTC (rev 68512)
@@ -0,0 +1,33 @@
+%% collargs.ins
+%%
+%% This file is a part of CollArgs, a TeX package providing a command which can
+%% determine the argument scope of any command whose argument structure
+%% conforms to xparse's argument specification, available at
+%% https://ctan.org/pkg/advice and https://github.com/sasozivanovic/advice.
+%%
+%% Copyright (c) 2023- Saso Zivanovic <saso.zivanovic at guest.arnes.si>
+%% (Sa\v{s}o \v{Z}ivanovi\'{c})
+%%
+%% 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 Saso Zivanovic.
+%%
+%% The files belonging to this work and covered by LPPL are listed in
+%% (<texmf>/doc/generic/collargs/)FILES.
+%%
+\input docstrip.tex
+\keepsilent
+\preamble
+\endpreamble
+\askforoverwritefalse
+\generate{%
+ \file{collargs.sty}{\from{collargs.dtx}{latex}}%
+ \file{collargs.tex}{\from{collargs.dtx}{plain}}%
+ \file{t-collargs.tex}{\from{collargs.dtx}{context}}%
+}
+\endbatchfile
Added: trunk/Master/texmf-dist/tex/context/collargs/t-collargs.tex
===================================================================
--- trunk/Master/texmf-dist/tex/context/collargs/t-collargs.tex (rev 0)
+++ trunk/Master/texmf-dist/tex/context/collargs/t-collargs.tex 2023-10-11 20:25:43 UTC (rev 68512)
@@ -0,0 +1,1598 @@
+%%
+%% This is file `t-collargs.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% collargs.dtx (with options: `context')
+%%
+%%
+%% This file is a part of CollArgs, a TeX package providing a command which can
+%% determine the argument scope of any command whose argument structure
+%% conforms to xparse's argument specification, available at
+%% https://ctan.org/pkg/advice and https://github.com/sasozivanovic/advice.
+%%
+%% Copyright (c) 2023- Saso Zivanovic <saso.zivanovic at guest.arnes.si>
+%% (Sa\v{s}o \v{Z}ivanovi\'{c})
+%%
+%% 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 Saso Zivanovic.
+%%
+%% The files belonging to this work and covered by LPPL are listed in
+%% (<texmf>/doc/generic/collargs/)FILES.
+%D \module[
+%D file=t-collargs.tex,
+%D version=1.0.0,
+%D title=CollArgs,
+%D subtitle=Collect arguments of any command,
+%D author=Saso Zivanovic,
+%D date=2023-10-07,
+%D copyright=Saso Zivanovic,
+%D license=LPPL,
+%D ]
+\writestatus{loading}{ConTeXt User Module / collargs}
+\unprotect
+\startmodule[collargs]
+\input t-pgfkey
+\input etoolbox-generic
+\ifdefined\toksapp\else
+ \long\def\toksapp#1#2{#1\expandafter{\the#1#2}}%
+\fi
+\ifdefined\etoksapp\else
+ \long\def\etoksapp#1#2{#1\expandafter{\normalexpanded{\the#1#2}}}%
+\fi
+\ifdefined\gtoksapp\else
+ \long\def\gtoksapp#1#2{\global#1\expandafter{\the#1#2}}%
+\fi
+\ifdefined\xtoksapp\else
+ \long\def\xtoksapp#1#2{\global#1\expandafter{\normalexpanded{\the#1#2}}}%
+\fi
+\ifdefined\toks@\else\toksdef\toks@=0 \fi
+\protected\def\CollectArguments{%
+ \pgf at keys@utilifnextchar[\CollectArguments at i{\CollectArgumentsRaw{}}%]
+}
+\def\CollectArguments at i[#1]{\CollectArgumentsRaw{\collargsSet{#1}}}
+\protected\def\CollectArgumentsRaw#1#2#3{%
+ \begingroup
+ \global\let\ifcollargs at last@verbatim\ifcollargs at verbatim
+ \global\let\ifcollargs at last@verbatimbraces\ifcollargs at verbatimbraces
+ \global\collargs at double@fixfalse
+ \collargs at verbatim@wrap{#1}%
+ \collargs at init@grabspaces
+ \def\collargs at next{#3}%
+ \global\collargs at toks{}%
+ \collargs@#2.%
+}
+\def\collargsSet#1{\pgfqkeys{/collargs}{#1}}
+\def\collargs at cs@cases#1{\collargs at cs@cases at i#1\collargs at cs@cases at end}
+\let\collargs at cs@cases at end\relax
+\def\collargs at cs@cases at i{\futurelet\collargs at temp\collargs at cs@cases at ii}
+\def\collargs at cs@cases at ii#1#2\collargs at cs@cases at end{%
+ \ifcat\noexpand\collargs at temp\relax
+ \ifx\relax#2\relax
+ \expandafter\expandafter\expandafter\@firstofthree
+ \else
+ \expandafter\expandafter\expandafter\@secondofthree
+ \fi
+ \else
+ \expandafter\@thirdofthree
+ \fi
+}
+\def\@firstofthree#1#2#3{#1}
+\def\@secondofthree#1#2#3{#2}
+\def\@thirdofthree#1#2#3{#3}
+\collargsSet{
+ caller/.code={\collargsCaller{#1}},
+}
+\def\collargsCaller#1{%
+ \collargs at cs@cases{#1}{%
+ \let\collargs at temp\collargs at caller@cs
+ }{%
+ \let\collargs at temp\collargs at caller@csandmore
+ }{%
+ \let\collargs at temp\collargs at caller@env
+ }%
+ \collargs at temp{#1}%
+}
+\def\collargs at caller@cs#1{%
+ \def\collargs at caller{#1}%
+}
+\def\collargs at caller@csandmore#1{%
+ \begingroup
+ \escapechar -1
+ \expandafter\endgroup
+ \expandafter\def\expandafter\collargs at caller\expandafter{%
+ \csname\string#1\endcsname
+ }%
+}
+\def\collargs at caller@env#1{%
+ \expandafter\def\expandafter\collargs at caller\expandafter{%
+ \csname
+ start%
+ #1%
+ \endcsname
+ }%
+}
+\collargsCaller\CollectArguments
+\newif\ifcollargs at verbatim
+\newif\ifcollargs at verbatimbraces
+\collargsSet{
+ verbatim/.code={\let\collargs at apply@verbatim\collargsVerbatim},
+ verb/.code={\let\collargs at apply@verbatim\collargsVerb},
+ no verbatim/.code={\let\collargs at apply@verbatim\collargsNoVerbatim},
+}
+\def\collargs at verbatim@wrap#1{%
+ \let\collargs at apply@verbatim\relax
+ #1%
+ \collargs at apply@verbatim
+}
+\collargsSet{
+ fix from verbatim/.code={\collargsFixFromVerbatim},
+ fix from verb/.code={\collargsFixFromVerb},
+ fix from no verbatim/.code={\collargsFixFromNoVerbatim},
+}
+\def\collargsFixFromNoVerbatim{%
+ \global\collargs at fix@requestedtrue
+ \global\let\ifcollargs at last@verbatim\iffalse
+}
+\def\collargsFixFromVerbatim{%
+ \global\collargs at fix@requestedtrue
+ \global\let\ifcollargs at last@verbatim\iftrue
+ \global\let\ifcollargs at last@verbatimbraces\iftrue
+}
+\def\collargsFixFromVerb{%
+ \global\collargs at fix@requestedtrue
+ \global\let\ifcollargs at last@verbatim\iftrue
+ \global\let\ifcollargs at last@verbatimbraces\iffalse
+}
+\collargsSet{
+ braces/.code={\collargsBraces{#1}}%
+}
+\collargsSet{
+ environment/.estore in=\collargs at b@envname
+}
+\def\collargsEnvironment#1{\edef\collargs at b@envname{#1}}
+\collargsEnvironment{}
+\collargsSet{
+ begin tag/.is if=collargsBeginTag,
+ end tag/.is if=collargsEndTag,
+ tags/.style={begin tag=#1, end tag=#1},
+ tags/.default=true,
+}
+\newif\ifcollargsBeginTag
+\newif\ifcollargsEndTag
+\collargsSet{
+ ignore nesting/.is if=collargsIgnoreNesting,
+}
+\newif\ifcollargsIgnoreNesting
+\collargsSet{
+ ignore other tags/.is if=collargsIgnoreOtherTags,
+}
+\newif\ifcollargsIgnoreOtherTags
+\collargsSet{
+ append preprocessor/.code={\collargsAppendPreprocessor{#1}},
+ prepend preprocessor/.code={\collargsPrependPreprocessor{#1}},
+ append postprocessor/.code={\collargsAppendPostprocessor{#1}},
+ prepend postprocessor/.code={\collargsPrependPostprocessor{#1}},
+}
+\def\collargsAppendPreprocessor{%
+ \collargs at addprocessor\appto\collargs at preprocess@arg}
+\def\collargsPrependPreprocessor{%
+ \collargs at addprocessor\preto\collargs at preprocess@arg}
+\def\collargsAppendPostprocessor{%
+ \collargs at addprocessor\appto\collargs at postprocess@arg}
+\def\collargsPrependPostprocessor{%
+ \collargs at addprocessor\preto\collargs at postprocess@arg}
+\def\collargs at addprocessor#1#2#3{%
+ #1#2{%
+ \normalexpanded{%
+ \normalunexpanded{#3}{\the\collargsArg}%
+ }%
+ }%
+}
+\def\collargs at preprocess@arg{}
+\def\collargs at postprocess@arg{}
+\collargsSet{
+ clear preprocessors/.code={\collargsClearPreprocessors},
+ clear postprocessors/.code={\collargsClearPostprocessors},
+}
+\def\collargsClearPreprocessors{\def\collargs at preprocess@arg{}}%
+\def\collargsClearPostprocessors{\def\collargs at postprocess@arg{}}%
+\collargsSet{
+ append expandable preprocessor/.code={%
+ \collargsAppendExpandablePreprocessor{#1}},
+ prepend expandable preprocessor/.code={%
+ \collargsPrependExpandablePreprocessor{#1}},
+ append expandable postprocessor/.code={%
+ \collargsAppendExpandablePostprocessor{#1}},
+ prepend expandable postprocessor/.code={%
+ \collargsPrependExpandablePostprocessor{#1}},
+}
+\def\collargsAppendExpandablePreprocessor{%
+ \collargs at addeprocessor\appto\collargs at preprocess@arg}
+\def\collargsPrependExpandablePreprocessor{%
+ \collargs at addeprocessor\preto\collargs at preprocess@arg}
+\def\collargsAppendExpandablePostprocessor{%
+ \collargs at addeprocessor\appto\collargs at postprocess@arg}
+\def\collargsPrependExpandablePostprocessor{%
+ \collargs at addeprocessor\preto\collargs at postprocess@arg}
+\def\collargs at addeprocessor#1#2#3{%
+ #1#2{%
+ \normalexpanded{%
+ \edef\noexpand\collargs at temp{\normalunexpanded{#3}{\the\collargsArg}}%
+ \normalunexpanded{\expandafter\collargsArg\expandafter{\collargs at temp}}%
+ }%
+ }%
+}
+\collargsSet{
+ append prewrap/.code={\collargsAppendPrewrap{#1}},
+ prepend prewrap/.code={\collargsPrependPrewrap{#1}},
+ append postwrap/.code={\collargsAppendPostwrap{#1}},
+ prepend postwrap/.code={\collargsPrependPostwrap{#1}},
+}
+\def\collargsAppendPrewrap{\collargs at addwrap\appto\collargs at preprocess@arg}
+\def\collargsPrependPrewrap{\collargs at addwrap\preto\collargs at preprocess@arg}
+\def\collargsAppendPostwrap{\collargs at addwrap\appto\collargs at postprocess@arg}
+\def\collargsPrependPostwrap{\collargs at addwrap\preto\collargs at postprocess@arg}
+\def\collargs at addwrap#1#2#3{%
+ #1#2{%
+ \long\def\collargs at temp##1{#3}%
+ \expandafter\expandafter\expandafter\collargsArg
+ \expandafter\expandafter\expandafter{%
+ \expandafter\collargs at temp\expandafter{\the\collargsArg}%
+ }%
+ }%
+}
+\collargsSet{%
+ no delimiters/.is if=collargsNoDelimiters,
+}
+\newif\ifcollargsNoDelimiters
+\def\collargs@{%
+ \begingroup
+ \collargs@@@
+}
+\def\collargs@@@#1{%
+ \collargs at in@{#1}{&+!>.}%
+ \ifcollargs at in@
+ \expandafter\collargs@@@iii
+ \else
+ \expandafter\collargs@@@i
+ \fi
+ #1%
+}
+\def\collargs@@@i#1.{%
+ \collargs at fix{\collargs@@@ii#1.}%
+}
+\def\collargs@@@ii{%
+ \global\collargs at fix@requestedfalse
+ \global\let\ifcollargs at last@verbatim\ifcollargs at verbatim
+ \global\let\ifcollargs at last@verbatimbraces\ifcollargs at verbatimbraces
+ \collargs@@@iii
+}
+\def\collargs@@@iii#1{%
+ \ifcsname collargs@#1\endcsname
+ \csname collargs@#1\expandafter\endcsname
+ \else
+ \collargs at error@badtype{#1}%
+ \fi
+}
+\def\collargs at error@badtype#1#2.{%
+ \PackageError{collargs}{Unknown xparse argument type or modifier "#1"
+ for "\expandafter\string\collargs at caller\space"}{}%
+ \endgroup
+}
+\csdef{collargs@&}{%
+ \futurelet\collargs at temp\collargs at amp@i
+}
+\def\collargs at amp@i{%
+ \expandafter\ifx\detokenize{&}\collargs at temp
+ \expandafter\collargs at amp@raw
+ \else
+ \expandafter\collargs at amp@set
+ \fi
+}
+\def\collargs at amp@raw#1#2{%
+ \collargs at verbatim@wrap{#2}%
+ \collargs@@@
+}
+\def\collargs at amp@set#1{%
+ \collargs at verbatim@wrap{\collargsSet{#1}}%
+ \collargs@@@
+}
+\csdef{collargs at +}{%
+ \collargs at longtrue
+ \collargs@@@
+}
+\newif\ifcollargs at long
+\csdef{collargs@>}#1{\collargs@@@}
+\csdef{collargs@!}{%
+ \collargs at grabspacesfalse
+ \collargs@@@
+}
+\newtoks\collargs at toks
+\newtoks\collargsArg
+\csdef{collargs at .}{%
+ \endgroup
+ \normalexpanded{%
+ \endgroup
+ \noexpand\collargs at fix{%
+ \expandonce\collargs at next{\the\collargs at toks}%
+ \collargs at spaces
+ }%
+ }%
+}
+\long\def\collargs at appendarg#1{%
+ \collargsArg={#1}%
+ \ifcollargs at double@fix
+ \collargs at cancel@double at fix
+ \fi
+ \collargs at preprocess@arg
+ \ifcollargsNoDelimiters
+ \else
+ \collargs at process@arg
+ \fi
+ \collargs at postprocess@arg
+ \xtoksapp\collargs at toks{\collargs at grabbed@spaces\the\collargsArg}%
+ \collargs at init@grabspaces
+ \endgroup
+}
+\def\collargs at wrap{\collargs at addwrap\appto\collargs at process@arg}
+\def\collargs at process@arg{}
+\def\collargs at defcollector#1#{%
+ \ifcollargs at long\long\fi
+ \expandafter\def\collargs at caller#1%
+}
+\def\collargs at defusecollector#1#{%
+ \afterassignment\collargs at caller
+ \ifcollargs at long\long\fi
+ \expandafter\def\collargs at caller#1%
+}
+\def\collargs at letusecollector#1{%
+ \expandafter\let\collargs at caller#1%
+ \collargs at caller
+}
+\newif\ifcollargs at grabspaces
+\collargs at grabspacestrue
+\def\collargs at init@grabspaces{%
+ \gdef\collargs at gs@state{0}%
+ \gdef\collargs at spaces{}%
+ \gdef\collargs at otherspaces{}%
+}
+\def\collargs at grabspaces#1{%
+ \edef\collargs at gs@next{\normalunexpanded{#1}}%
+ \ifnum\collargs at gs@state=0
+ \gdef\collargs at gs@state{1}%
+ \expandafter\collargs at gs@i
+ \else
+ \expandafter\collargs at gs@next
+ \fi
+}
+\def\collargs at gs@i{%
+ \futurelet\collargs at temp\collargs at gs@g
+}
+\def\collargs at gs@g{%
+ \ifcat\noexpand\collargs at temp\bgroup
+ \expandafter\collargs at gs@next
+ \else
+ \ifcat\noexpand\collargs at temp\egroup
+ \expandafter\expandafter\expandafter\collargs at gs@next
+ \else
+ \expandafter\expandafter\expandafter\collargs at gs@ii
+ \fi
+ \fi
+}
+\def\collargs at gs@ii{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at gos@iii
+ \else
+ \expandafter\collargs at gs@iii
+ \fi
+}
+\def\collargs at gs@iii{%
+ \expandafter\ifx\space\collargs at temp
+ \expandafter\collargs at gs@iv
+ \else
+ \expandafter\collargs at gs@next
+ \fi
+}
+\expandafter\def\expandafter\collargs at gs@iv\space{%
+ \gappto\collargs at spaces{ }%
+ \xappto\collargs at otherspaces{\collargs at otherspace}%
+ \collargs at gs@i
+}
+\begingroup\catcode`\ =12\relax\gdef\collargs at otherspace{ }\endgroup
+\def\collargs at gos@iii#1{%
+ \ifnum\collargs at cc{#1}=10
+ \expandafter\collargs at gos@iv
+ \else
+ \ifnum\collargs at cc{#1}=5
+ \expandafter\expandafter\expandafter\collargs at gos@v
+ \else
+ \expandafter\expandafter\expandafter\collargs at gs@next
+ \fi
+ \fi
+ #1%
+}
+\def\collargs at gos@iv#1{%
+ \gappto\collargs at otherspaces{#1}%
+ \gdef\collargs at spaces{ }%
+ \collargs at gs@i
+}
+\def\collargs at gos@v{%
+ \ifnum\collargs at gs@state=2
+ \expandafter\collargs at gs@next
+ \else
+ \expandafter\collargs at gs@vi
+ \fi
+}
+\def\collargs at gs@vi#1{%
+ \gdef\collargs at gs@state{2}%
+ \gappto\collargs at otherspaces{#1}%
+ \gdef\collargs at spaces{ }%
+ \collargs at gs@i
+}
+\def\collargs at maybegrabspaces{%
+ \ifcollargs at grabspaces
+ \expandafter\collargs at grabspaces
+ \else
+ \expandafter\@firstofone
+ \fi
+}
+\def\collargs at grabbed@spaces{%
+ \ifcollargs at verbatim
+ \collargs at otherspaces
+ \else
+ \collargs at spaces
+ \fi
+}
+\def\collargs at reinsert@spaces#1{%
+ \normalexpanded{%
+ \normalunexpanded{%
+ \collargs at init@grabspaces
+ #1%
+ }%
+ \collargs at grabbed@spaces
+ }%
+}
+\long\def\collargs at ifnextcat#1#2#3{%
+ \let\pgf at keys@utilreserved at d=#1%
+ \def\pgf at keys@utilreserved at a{#2}%
+ \def\pgf at keys@utilreserved at b{#3}%
+ \futurelet\pgf at keys@utillet at token\collargs at ifncat}
+\def\collargs at ifncat{%
+ \ifx\pgf at keys@utillet at token\pgf at keys@utilsptoken
+ \let\pgf at keys@utilreserved at c\collargsxifnch
+ \else
+ \ifcat\noexpand\pgf at keys@utillet at token\pgf at keys@utilreserved at d
+ \let\pgf at keys@utilreserved at c\pgf at keys@utilreserved at a
+ \else
+ \let\pgf at keys@utilreserved at c\pgf at keys@utilreserved at b
+ \fi
+ \fi
+ \pgf at keys@utilreserved at c}
+{%
+ \def\:{\collargs at xifncat}
+ \expandafter\gdef\: {\futurelet\pgf at keys@utillet at token\collargs at ifncat}
+}
+\def\collargs at forrange#1#2{%
+ \normalexpanded{%
+ \noexpand\collargs at forrange@i{\number#1}{\number#2}%
+ }%
+ }
+\def\collargs at forrange@i#1#2{%
+ \ifnum#1>#2 %
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+ {%
+ \collargs at do{#1}%
+ \expandafter\collargs at forrange@i\expandafter{\number\numexpr#1+1\relax}{#2}%
+ }%
+}
+\def\collargs at forranges{\forcsvlist\collarg at forrange@i}
+\def\collarg at forrange@i#1{\collarg at forrange@ii#1-}
+\def\collarg at forrange@ii#1-#2-{\collargs at forrange{#1}{#2}}
+\begingroup
+\catcode`\%=12
+\gdef\collargs at percentchar{%}
+\endgroup
+\def\collargs at l#1.{%
+ \collargs at reinsert@spaces{\collargs at l@i#1.}%
+}
+\def\collargs at l@i{%
+ \global\collargs at fix@requestedtrue
+ \ifcollargs at verbatimbraces
+ \expandafter\collargs at l@verb
+ \else
+ \expandafter\collargs at l@ii
+ \fi
+}
+\def\collargs at l@ii#1.{%
+ \collargs at defusecollector##1##{%
+ \collargs at appendarg{##1}%
+ \collargs@#1.%
+ }%
+}
+\def\collargs at l@verb#1.{%
+ \expandafter\collargs at defusecollector
+ \expandafter##\expandafter1\collargs at other@bgroup{%
+ \collargs at appendarg{##1}%
+ \normalexpanded{%
+ \noexpand\collargs@\normalunexpanded{#1.}%
+ \collargs at other@bgroup
+ }%
+ }%
+}
+\def\collargs at u{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at u@verb
+ \else
+ \expandafter\collargs at u@i
+ \fi
+}
+\def\collargs at u@verb#1{%
+ \expandafter\collargs at u@i\expandafter{\detokenize\expandafter{\string#1}}%
+}
+\def\collargs at u@i#1#2.{%
+ \collargs at reinsert@spaces{\collargs at u@ii{#1}#2.}%
+}
+\def\collargs at u@ii#1#2.{%
+ \collargs at defusecollector##1#1{%
+ \collargs at wrap{####1#1}%
+ \expandafter\collargs at appendarg\expandafter{##1}%
+ \collargs@#2.%
+ }%
+ \collargs at empty
+}
+\def\collargs at empty{}
+\def\collargs at r{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at r@verb
+ \else
+ \expandafter\collargs at r@i
+ \fi
+}
+\def\collargs at r@verb#1#2{%
+ \expandafter\collargs at r@i\detokenize{#1#2}%
+}
+\def\collargs at r@i#1#2#3.{%
+ \collargs at defcollector#1{%
+ \collargs at defusecollector####1#2{%
+ \collargs at wrap{#1########1#2}%
+ \expandafter\collargs at appendarg\expandafter{####1}%
+ \collargs@#3.%
+ }%
+ \collargs at empty
+ }%
+ \collargs at grabspaces\collargs at caller
+}
+\def\collargs at R#1#2#3{\collargs at r#1#2}
+\def\collargs at d{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at d@verb
+ \else
+ \expandafter\collargs at d@i
+ \fi
+}
+\def\collargs at d@verb#1#2{%
+ \expandafter\collargs at d@i\detokenize{#1#2}%
+}
+\def\collargs at d@i#1#2#3.{%
+ \def\collargs at d@noopt{%
+ \global\collargs at fix@requestedtrue
+ \endgroup
+ \collargs@#3.%
+ }%
+ \collargs at defcollector#1{%
+ \collargs at defusecollector####1#2{%
+ \collargs at wrap{#1########1#2}%
+ \expandafter\collargs at appendarg\expandafter{####1}%
+ \collargs@#3.%
+ }%
+ \collargs at empty
+ }%
+ \def\collargs at d@ii{%
+ \ifx#1\collargs at temp
+ \expandafter\collargs at caller
+ \else
+ \expandafter\collargs at d@noopt
+ \fi
+ }%
+ \collargs at maybegrabspaces{\futurelet\collargs at temp\collargs at d@ii}%
+}
+\def\collargs at D#1#2#3{\collargs at d#1#2}
+\def\collargs at o{\collargs at d[]}
+\def\collargs at O#1{\collargs at d[]}
+\def\collargs at t{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at t@verb
+ \else
+ \expandafter\collargs at t@i
+ \fi
+}
+\def\collargs at t@space{ }
+\def\collargs at t@verb#1{%
+ \let\collargs at t@space\collargs at otherspace
+ \expandafter\collargs at t@i\expandafter{\detokenize{#1}}%
+}
+\def\collargs at t@i#1{%
+ \expandafter\ifx\space#1%
+ \expandafter\collargs at t@s
+ \else
+ \expandafter\collargs at t@I\expandafter#1%
+ \fi
+}
+\def\collargs at t@s#1.{%
+ \collargs at grabspaces{%
+ \ifcollargs at grabspaces
+ \collargs at appendarg{}%
+ \else
+ \normalexpanded{%
+ \noexpand\collargs at init@grabspaces
+ \noexpand\collargs at appendarg{\collargs at grabbed@spaces}%
+ }%
+ \fi
+ \collargs@#1.%
+ }%
+}
+\def\collargs at t@I#1#2.{%
+ \def\collargs at t@noopt{%
+ \global\collargs at fix@requestedtrue
+ \endgroup
+ \collargs@#2.%
+ }%
+ \def\collargs at t@opt##1{%
+ \collargs at appendarg{#1}%
+ \collargs@#2.%
+ }%
+ \def\collargs at t@ii{%
+ \ifx#1\collargs at temp
+ \expandafter\collargs at t@opt
+ \else
+ \expandafter\collargs at t@noopt
+ \fi
+ }%
+ \collargs at maybegrabspaces{\futurelet\collargs at temp\collargs at t@ii}%
+}
+\def\collargs at t@opt at space{%
+ \normalexpanded{\noexpand\collargs at t@opt{\space}\expandafter}\romannumeral-0%
+}%
+\def\collargs at s{\collargs at t*}
+\def\collargs at m{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at m@verb
+ \else
+ \expandafter\collargs at m@i
+ \fi
+}
+\def\collargs at m@i#1.{%
+ \collargs at grabspaces{\collargs at m@checkforgroup#1.}%
+}
+\def\collargs at m@checkforgroup#1.{%
+ \edef\collargs at action{\normalunexpanded{\collargs at m@checkforgroup at i#1.}}%
+ \futurelet\collargs at token\collargs at action
+}
+\def\collargs at m@checkforgroup at i{%
+ \ifcat\noexpand\collargs at token\bgroup
+ \expandafter\collargs at m@group
+ \else
+ \expandafter\collargs at m@token
+ \fi
+}
+\def\collargs at m@group#1.{%
+ \collargs at defusecollector##1{%
+ \collargs at wrap{{####1}}%
+ \collargs at appendarg{##1}%
+ \collargs@#1.%
+ }%
+}
+\def\collargs at m@token#1.{%
+ \collargs at defusecollector##1{%
+ \collargs at appendarg{##1}%
+ \collargs@#1.%
+ }%
+}
+\def\collargs at m@verb#1.{%
+ \collargs at grabspaces{\collargs at m@verb at checkforgroup#1.}%
+}
+\def\collargs at m@verb at checkforgroup{%
+ \ifcollargs at verbatimbraces
+ \expandafter\collargs at m@verb at checkforgroup@i
+ \else
+ \expandafter\collargs at m@checkforgroup
+ \fi
+}
+\def\collargs at m@verb at checkforgroup@i#1.{%
+ \def\collargs at m@verb at checkforgroup@ii{\collargs at m@verb at checkforgroup@iii#1.}%
+ \futurelet\collargs at temp\collargs at m@verb at checkforgroup@ii
+}
+\def\collargs at m@verb at checkforgroup@iii#1.{%
+ \expandafter\ifx\collargs at other@bgroup\collargs at temp
+ \expandafter\collargs at m@verb at group
+ \else
+ \expandafter\ifx\collargs at other@egroup\collargs at temp
+ \expandafter\expandafter\expandafter\collargs at m@verb at egrouperror
+ \else
+ \expandafter\expandafter\expandafter\collargs at m@v at token
+ \fi
+ \fi
+ #1.%
+}
+\def\collargs at m@verb at egrouperror#1.{%
+ \PackageError{collargs}{%
+ Argument of \expandafter\string\collargs at caller\space has an extra
+ \iffalse{\else\string}}{}%
+}
+\def\collargs at m@v at token#1.#2{%
+ \ifnum\collargs at cc{#2}=0
+ \expandafter\collargs at m@v at token@cs
+ \else
+ \expandafter\collargs at m@token
+ \fi
+ #1.#2%
+}
+\def\collargs at m@v at token@cs#1.#2#3{%
+ \ifnum\collargs at cc{#3}=11
+ \expandafter\collargs at m@v at token@cs at letter
+ \else
+ \expandafter\collargs at m@v at token@cs at nonletter
+ \fi
+ #1.#2#3%
+}
+\def\collargs at m@v at token@cs at nonletter#1.#2#3{%
+ \collargs at appendarg{#2#3}%
+ \collargs@#1.%
+}
+\def\collargs at m@v at token@cs at letter#1.#2{%
+ \collargsArg{#2}%
+ \def\collargs at tempa{#1}%
+ \collargs at m@v at token@cs at letter@i
+}
+\def\collargs at m@v at token@cs at letter@i#1{%
+ \ifnum\collargs at cc{#1}=11
+ \toksapp\collargsArg{#1}%
+ \expandafter\collargs at m@v at token@cs at letter@i
+ \else
+ \expandafter\collargs at m@v at token@cs at letter@ii\expandafter#1%
+ \fi
+}
+\def\collargs at m@v at token@cs at letter@ii{%
+ \normalexpanded{%
+ \normalunexpanded{%
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ }%
+ \noexpand\collargs@\expandonce\collargs at tempa.%
+ }%
+}
+\def\collargs at m@verb at group#1.#2{%
+ \let\collargs at begintag\collargs at other@bgroup
+ \let\collargs at endtag\collargs at other@egroup
+ \def\collargs at tagarg{}%
+ \def\collargs at commandatend{\collargs at m@verb at group@i#1.}%
+ \collargs at readContent
+}
+\def\collargs at m@verb at group@i{%
+ \edef\collargs at temp{%
+ \collargs at other@bgroup\normalunexpanded{##1}\collargs at other@egroup}%
+ \expandafter\collargs at wrap\expandafter{\collargs at temp}%
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ \collargs@
+}
+\def\collargs at g{%
+ \def\collargs at m@token{%
+ \global\collargs at fix@requestedtrue
+ \endgroup
+ \collargs@
+ }%
+ \let\collargs at m@v at token\collargs at m@token
+ \collargs at m
+}
+\def\collargs at G#1{\collargs at g}
+\def\collargs at v#1.{%
+ \begingroup
+ \collargsBraces{{}}%
+ \collargsVerbatim
+ \collargs at grabspaces{\collargs at v@i#1.}%
+}
+\def\collargs at v@i#1.#2{%
+ \expandafter\ifx\collargs at other@bgroup#2%
+ \let\collargs at begintag\collargs at other@bgroup
+ \let\collargs at endtag\collargs at other@egroup
+ \def\collargs at tagarg{}%
+ \def\collargs at commandatend{%
+ \edef\collargs at temp{%
+ \collargs at other@bgroup\normalunexpanded{####1}\collargs at other@egroup}%
+ \expandafter\collargs at wrap\expandafter{\collargs at temp}%
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ \endgroup
+ \collargs@#1.%
+ }%
+ \expandafter\collargs at readContent
+ \else
+ \collargs at defcollector##1#2{%
+ \collargs at wrap{#2####1#2}%
+ \collargs at appendarg{##1}%
+ \endgroup
+ \collargs@#1.%
+ }%
+ \expandafter\collargs at caller
+ \fi
+}
+\def\collargs at b{%
+ \collargs at ifnextcat\bgroup\collargs at bg\collargs at bi
+}
+\def\collargs at bg#1{%
+ \edef\collargs at b@envname{#1}%
+ \collargs at bi
+}
+\def\collargs at bi#1.{%
+ \ifcollargs at verbatim
+ \edef\collargs at b@envname{\detokenize\expandafter{\collargs at b@envname}}%
+ \fi
+ \collargs at bi@defCPTbeginend
+ \edef\collargs at tagarg{%
+ \ifcollargs at verbatimbraces
+ \else
+ \ifcollargsIgnoreOtherTags
+ \collargs at b@envname
+ \fi
+ \fi
+ }%
+ \def\collargs at commandatend{%
+ \collargs at biii
+ #1.%
+ }%
+ \collargs at reinsert@spaces\collargs at readContent
+}
+\def\collargs at bi@defCPTbeginend{%
+ \edef\collargs at begintag{%
+ \ifcollargs at verbatim
+ \expandafter\expandafter\expandafter\string
+ \else
+ \expandafter\expandafter\expandafter\noexpand
+ \fi
+ \csname
+ start%
+ \collargs at b@envname
+ \endcsname
+ }%
+ \edef\collargs at endtag{%
+ \ifcollargs at verbatim
+ \expandafter\expandafter\expandafter\string
+ \else
+ \expandafter\expandafter\expandafter\noexpand
+ \fi
+ \csname
+ stop%
+ \collargs at b@envname
+ \endcsname
+ }%
+}
+\def\collargs at biii{%
+ \collargs at b@def at wrapper
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ \collargs@
+}
+\def\collargs at b@def at wrapper{%
+ \edef\collargs at temp{%
+ \ifcollargsBeginTag
+ \expandonce\collargs at begintag
+ \fi
+ ####1%
+ \ifcollargsEndTag
+ \expandonce\collargs at endtag
+ \fi
+ }%
+ \expandafter\collargs at wrap\expandafter{\collargs at temp}%
+}
+\def\collargs at readContent{%
+ \ifcollargs at long\long\fi
+ \collargs at CPT@def\collargs at gobbleOneB\collargs at begintag{%
+ \expandafter\toks@\expandafter{##1}%
+ \futurelet\collargs at temp\collargs at gobbleOneB@i
+ }%
+ \ifcollargs at long\long\fi
+ \collargs at CPT@def\collargs at gobbleUntilE\collargs at endtag{%
+ \expandafter\toksapp\expandafter\toks@\expandafter{##1}%
+ \collargs at gobbleUntilE@i
+ }%
+ \collargs at begins=0\relax
+ \collargsArg{}%
+ \toks@{}%
+ \collargs at letusecollector\collargs at gobbleUntilE
+ \collargs at empty
+}
+\newcount\collargs at begins
+\def\collargs at CPT@def#1#2{%
+ \expandafter\def\expandafter#1%
+ \expandafter##\expandafter1#2%
+}
+\def\collargs at qend{\collargs at qend}
+\def\collargs at gobbleOneB@i{%
+ \def\collargs at begins@increment{1}%
+ \ifx\collargs at qend\collargs at temp
+ \def\collargs at begins@increment{-1}%
+ \expandafter\collargs at gobbleOneB@v
+ \else
+ \etoksapp\toks@{\expandonce\collargs at begintag}%
+ \expandafter\collargs at gobbleOneB@ii
+ \fi
+}%
+\def\collargs at gobbleOneB@ii{%
+ \expandafter\ifx\expandafter\relax\collargs at tagarg\relax
+ \expandafter\collargs at gobbleOneB@vi
+ \else
+ \expandafter\collargs at gobbleOneB@iii
+ \fi
+}
+\def\collargs at gobbleOneB@iii{%
+ \collargs at grabspaces{%
+ \collargs at letusecollector\collargs at gobbleOneB@iv
+ }%
+}
+\def\collargs at gobbleOneB@iv#1{%
+ \def\collargs at temp{#1}%
+ \ifx\collargs at temp\collargs at tagarg
+ \else
+ \def\collargs at begins@increment{0}%
+ \fi
+ \etoksapp\toks@{\collargs at grabbed@spaces\normalunexpanded{{#1}}}%
+ \collargs at init@grabspaces
+ \collargs at gobbleOneB@vi
+}
+\def\collargs at gobbleOneB@v#1{\collargs at gobbleOneB@vi}
+\def\collargs at gobbleOneB@vi{%
+ \etoksapp\collargsArg{\the\toks@}%
+ \advance\collargs at begins\collargs at begins@increment\relax
+ \ifnum\collargs at begins@increment=-1
+ \else
+ \expandafter\collargs at gobbleOneB\expandafter\collargs at empty
+ \fi
+}
+\def\collargs at gobbleUntilE@i{%
+ \expandafter\ifx\expandafter\relax\collargs at tagarg\relax
+ \expandafter\collargs at gobbleUntilE@iv
+ \else
+ \expandafter\collargs at gobbleUntilE@ii
+ \fi
+}
+\def\collargs at gobbleUntilE@ii{%
+ \collargs at grabspaces{%
+ \collargs at letusecollector\collargs at gobbleUntilE@iii
+ }%
+}
+\def\collargs at gobbleUntilE@iii#1{%
+ \etoksapp\toks@{\collargs at grabbed@spaces}%
+ \collargs at init@grabspaces
+ \def\collargs at tempa{#1}%
+ \ifx\collargs at tempa\collargs at tagarg
+ \expandafter\collargs at gobbleUntilE@iv
+ \else
+ \expandafter\toksapp\expandafter\toks@\expandafter{\collargs at endtag{#1}}%
+ \expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
+ \fi
+}
+\def\collargs at gobbleUntilE@iv{%
+ \ifcollargsIgnoreNesting
+ \expandafter\collargsArg\expandafter{\the\toks@}%
+ \expandafter\collargs at commandatend
+ \else
+ \expandafter\collargs at gobbleUntilE@v
+ \fi
+}
+\def\collargs at gobbleUntilE@v{%
+ \normalexpanded{%
+ \noexpand\collargs at letusecollector\noexpand\collargs at gobbleOneB
+ \noexpand\collargs at empty
+ \the\toks@
+ \expandonce\collargs at begintag
+ \noexpand\collargs at qend
+ }%
+ \ifnum\collargs at begins<0
+ \expandafter\collargs at commandatend
+ \else
+ \etoksapp\collargsArg{%
+ \expandonce\collargs at endtag
+ \expandafter\ifx\expandafter\relax\collargs at tagarg\relax\else{%
+ \expandonce\collargs at tagarg}\fi
+ }%
+ \toks@={}%
+ \expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
+ \expandafter\collargs at empty
+ \fi
+}
+\def\collargs at e{%
+ \global\collargs at fix@requestedtrue
+ \begingroup
+ \ifcollargs at verbatim
+ \expandafter\collargs at e@verbatim
+ \else
+ \expandafter\collargs at e@i
+ \fi
+}
+\def\collargs at e@verbatim#1{%
+ \expandafter\collargs at e@i\expandafter{\detokenize{#1}}%
+}
+\def\collargs at e@i#1{\collargs at e@ii#1.}
+\def\collargs at e@ii#1.#2.{%
+ \collargs at grabspaces{\collargs at e@iii#1.#2.}%
+}
+\def\collargs at e@iii#1.#2.{%
+ \def\collargs at e@iv{\collargs at e@v#1.#2.}%
+ \futurelet\collargs at temp\collargs at e@iv
+}
+\def\collargs at e@v{%
+ \ifcat\noexpand\collargs at temp\bgroup\relax
+ \let\collargs at marshal\collargs at e@z
+ \else
+ \ifcat\noexpand\collargs at temp\egroup\relax
+ \let\collargs at marshal\collargs at e@z
+ \else
+ \let\collargs at marshal\collargs at e@vi
+ \fi
+ \fi
+ \collargs at marshal
+}
+\newif\ifcollargs at in@
+\def\collargs at in@#1#2{%
+ \def\collargs at in@@##1#1##2##3\collargs at in@@{%
+ \ifx\collargs at in@##2\global\collargs at in@false\else\global\collargs at in@true\fi
+ }%
+ {\collargs at in@@#2#1\collargs at in@\collargs at in@@}%
+}
+\def\collargs at e@vi#1.#2.#3{%
+ \collargs at in@{#3}{#1}%
+ \ifcollargs at in@
+ \expandafter\collargs at e@vii
+ \else
+ \expandafter\collargs at e@z
+ \fi
+ #1.#2.#3%
+}
+\def\collargs at e@vii#1.#2.#3{%
+ \let\collargs at real@appendarg\collargs at appendarg
+ \def\collargs at appendarg##1{\collargsArg{##1}}%
+ \def\collargs@{\collargs at e@viii#1.#3}%
+ \collargs at m#2.%
+}
+\def\collargs at e@viii#1.#2#3.{%
+ \collargs at wrap{#2##1}%
+ \def\collargs at e@ix##1#2{\collargs at e@x##1}%
+ \collargs at e@ix#1.#3.%
+}
+\def\collargs at e@x{%
+ \expandafter\collargs at real@appendarg\expandafter{\the\collargsArg}%
+ \begingroup
+ \collargs at e@ii
+}
+\def\collargs at e@z#1.{\endgroup\endgroup\collargs@}
+\def\collargs at E#1#2{\collargs at e{#1}}
+\let\collargs at NoVerbatimAfterNoVerbatim\relax
+\def\collargs at VerbAfterNoVerbatim{%
+ \collargs at verbatimtrue
+ \collargs at verbatimbracesfalse
+ \collargs at make@verbatim
+ \collargs at after{Verb}%
+}
+\def\collargs at VerbatimAfterNoVerbatim{%
+ \collargs at verbatimtrue
+ \collargs at verbatimbracestrue
+ \collargs at make@verbatim
+ \collargs at after{Verbatim}%
+}
+\def\collargs at NoVerbatimAfterVerb{%
+ \collargs at verbatimfalse
+ \collargs at verbatimbracesfalse
+ \collargs at make@other at groups
+ \collargs at make@no at verbatim
+ \collargs at after{NoVerbatim}%
+}
+\def\collargs at VerbAfterVerb{%
+ \collargs at make@other at groups
+}
+\def\collargs at VerbatimAfterVerb{%
+ \collargs at verbatimbracestrue
+ \collargs at make@other at groups
+ \def\collargs at do##1{\catcode##1=12 }%
+ \collargs at bgroups
+ \collargs at egroups
+ \collargs at after{Verbatim}%
+}%
+\let\collargs at NoVerbatimAfterVerbatim\collargs at NoVerbatimAfterVerb
+\def\collargs at VerbAfterVerbatim{%
+ \collargs at verbatimbracesfalse
+ \collargs at make@other at groups
+ \def\collargs at do##1{\catcode##1=1 }%
+ \collargs at bgroups
+ \def\collargs at do##1{\catcode##1=2 }%
+ \collargs at egroups
+ \collargs at after{Verb}%
+}%
+\let\collargs at VerbatimAfterVerbatim\collargs at VerbAfterVerb
+\def\collargs at after#1{%
+ \letcs\collargsVerbatim{collargs at VerbatimAfter#1}%
+ \letcs\collargsVerb{collargs at VerbAfter#1}%
+ \letcs\collargsNoVerbatim{collargs at NoVerbatimAfter#1}%
+}
+\collargs at after{NoVerbatim}
+\def\collargs at bgroups{}%
+\def\collargs at egroups{}%
+\ifdefined\luatexversion
+ \def\collargs at cc#1{%
+ \directlua{tex.sprint(tex.getcatcode(\collargs at catcodetable@original,
+ \the\numexpr\expandafter`\csname#1\endcsname\relax))}%
+ }
+\else
+ \def\collargs at cc#1{%
+ \ifcsname collargs at cc@\the\numexpr\expandafter`\csname#1\endcsname\endcsname
+ \csname collargs at cc@\the\numexpr\expandafter`\csname#1\endcsname\endcsname
+ \else
+ 12%
+ \fi
+ }
+\fi
+\def\collargsBraces#1{%
+ \expandafter\collargs at braces@i\detokenize{#1}\relax
+}
+\def\collargs at braces@i#1#2#3\relax{%
+ \def\collargs at make@other at groups{%
+ \def\collargs at other@bgroup{#1}%
+ \def\collargs at other@egroup{#2}%
+ }%
+}
+\def\collargs at make@other at groups{}
+\ifdefined\luatexversion
+ \newcatcodetable\collargs at catcodetable@verbatim
+ \newcatcodetable\collargs at catcodetable@atletter
+ \savecatcodetable\collargs at catcodetable@atletter
+ \begingroup
+ \@firstofone{%
+ \catcodetable\inicatcodes
+ \catcode`\\=12
+ \catcode13=12
+ \catcode0=12
+ \catcode32=12
+ \catcode`\%=12
+ \catcode127=12
+ \def\collargs at do#1{\catcode#1=12 }%
+ \collargs at forrange{`\a}{`\z}%
+ \collargs at forrange{`\A}{`\Z}%
+ \savecatcodetable\collargs at catcodetable@verbatim
+ \endgroup
+ }%
+\fi
+\collargsSet{
+ verbatim ranges/.store in=\collargs at verbatim@ranges,
+}
+\def\collargsVerbatimRanges#1{\def\collargs at verbatim@ranges{#1}}
+\def\collargs at verbatim@ranges{0-255}
+\ifdefined\luatexversion
+ \def\collargs at make@verbatim{%
+ \directlua{%
+ for from, to in string.gmatch(
+ "\luaescapestring{\collargs at verbatim@ranges}",
+ "(\collargs at percentchar d+)-(\collargs at percentchar d+)"
+ ) do
+ for char = tex.round(from), tex.round(to) do
+ catcode = tex.catcode[char]
+ if catcode == 1 then
+ tex.sprint(
+ \number\collargs at catcodetable@atletter,
+ "\noexpand\\collargs at make@verbatim at bgroup{" .. char .. "}")
+ elseif catcode == 2 then
+ tex.sprint(
+ \number\collargs at catcodetable@atletter,
+ "\noexpand\\collargs at make@verbatim at egroup{" .. char .. "}")
+ elseif catcode == 14 then
+ tex.sprint(
+ \number\collargs at catcodetable@atletter,
+ "\noexpand\\collargs at make@verbatim at comment{" .. char .. "}")
+ end
+ end
+ end
+ }%
+ \edef\collargs at catcodetable@original{\the\catcodetable}%
+ \catcodetable\collargs at catcodetable@verbatim
+ \ifcollargs at verbatimbraces
+ \else
+ \def\collargs at do##1{\catcode##1=1\relax}%
+ \collargs at bgroups
+ \def\collargs at do##1{\catcode##1=2\relax}%
+ \collargs at egroups
+ \fi
+ }
+\else
+ \def\collargs at make@verbatim{%
+ \ifdefempty\collargs at make@other at groups{}{%
+ \collargs at make@other at groups
+ \def\collargs at make@other at groups{}%
+ \let\collargs at make@other at bgroup\@gobble
+ \let\collargs at make@other at egroup\@gobble
+ }%
+ \gdef\collargs at comments{}%
+ \let\collargs at do\collargs at make@verbatim at char
+ \expandafter\collargs at forranges\expandafter{\collargs at verbatim@ranges}%
+ }
+ \def\collargs at make@verbatim at char#1{%
+ \ifnum\catcode#1=12
+ \else
+ \csedef{collargs at cc@#1}{\the\catcode#1}%
+ \fi
+ \ifnum\catcode#1=1
+ \collargs at make@verbatim at bgroup{#1}%
+ \else
+ \ifnum\catcode#1=2
+ \collargs at make@verbatim at egroup{#1}%
+ \else
+ \ifnum\catcode#1=14
+ \collargs at make@verbatim at comment{#1}%
+ \fi
+ \ifnum\catcode#1=12
+ \else
+ \catcode#1=12\relax
+ \fi
+ \fi
+ \fi
+ }
+\fi
+\def\collargs at make@verbatim at bgroup#1{%
+ \ifcollargs at verbatimbraces
+ \catcode#1=12\relax
+ \fi
+ \appto\collargs at bgroups{\collargs at do{#1}}%
+ \collargs at make@other at bgroup{#1}%
+}
+\def\collargs at make@other at bgroup#1{%
+ \collargs at make@char\collargs at other@bgroup{#1}{12}%
+ \let\collargs at make@other at bgroup\@gobble
+}
+\def\collargs at make@verbatim at egroup#1{%
+ \ifcollargs at verbatimbraces
+ \catcode#1=12\relax
+ \fi
+ \appto\collargs at egroups{\collargs at do{#1}}%
+ \collargs at make@other at egroup{#1}%
+}
+\def\collargs at make@other at egroup#1{%
+ \collargs at make@char\collargs at other@egroup{#1}{12}%
+ \let\collargs at make@other at egroup\@gobble
+}
+\def\collargs at make@verbatim at comment#1{%
+ \gappto\collargs at comments{\collargs at do{#1}}%
+}
+\ifdefined\luatexversion
+ \def\collargs at make@no at verbatim{%
+ \catcodetable\collargs at catcodetable@original\relax
+ }%
+\else
+\def\collargs at make@no at verbatim{%
+ \let\collargs at do\collargs at make@no at verbatim@char
+ \expandafter\collargs at forranges\expandafter{\collargs at verbatim@ranges}%
+}
+\fi
+\def\collargs at make@no at verbatim@char#1{%
+ \ifcsname collargs at cc@#1\endcsname
+ \catcode#1=\csname collargs at cc@#1\endcsname\relax
+ \fi
+}
+\newif\ifcollargs at fix@requested
+\long\def\collargs at fix#1{%
+ \edef\collargs at fix@next{\normalunexpanded{#1}}%
+ \ifcollargs at fix@requested
+ \letcs\collargs at action{collargs at fix@%
+ \ifcollargs at last@verbatim
+ \ifcollargs at last@verbatimbraces V\else v\fi
+ \else
+ N%
+ \fi
+ to%
+ \ifcollargs at verbatim
+ \ifcollargs at verbatimbraces V\else v\fi
+ \else
+ N%
+ \fi
+ }%
+ \else
+ \let\collargs at action\collargs at fix@next
+ \fi
+ \collargs at action
+}
+\def\collargs at fix@NtoN{\collargs at fix@next}
+\let\collargs at fix@vtov\collargs at fix@NtoN
+\let\collargs at fix@VtoV\collargs at fix@NtoN
+\def\collargs at fix@Ntov{%
+ \futurelet\collargs at temp\collargs at fix@cc at to@other at ii
+}
+\def\collargs at fix@cc at to@other at ii{%
+ \ifcat\noexpand\collargs at temp\bgroup
+ \let\collargs at action\collargs at fix@next
+ \else
+ \ifcat\noexpand\collargs at temp\egroup
+ \let\collargs at action\collargs at fix@next
+ \else
+ \let\collargs at action\collargs at fix@NtoV
+ \fi
+ \fi
+ \collargs at action
+}
+\def\collargs at fix@NtoV{%
+ \ifcollargs at double@fix
+ \ifcollargs at in@second at fix
+ \expandafter\expandafter\expandafter\collargs at fix@NtoV at secondfix
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@NtoV at onemore
+ \fi
+ \else
+ \expandafter\collargs at fix@NtoV at singlefix
+ \fi
+}
+\def\collargs at fix@NtoV at singlefix{%
+ \expandafter\collargs at fix@next\string
+}
+\def\collargs at fix@NtoV at onemore#1{%
+ \collargs at do@one at more@fix{%
+ \expandafter\collargs at fix@next\string#1%
+ }%
+}
+\def\collargs at fix@NtoV at secondfix{%
+ \if\noexpand\collargs at temp\relax
+ \expandafter\collargs at fix@NtoV at secondfix@i
+ \else
+ \expandafter\collargs at fix@NtoV at singlefix
+ \fi
+}
+\def\collargs at fix@NtoV at secondfix@i#1{%
+ \gdef\collargs at double@fix at cs@ii{#1}%
+ \collargs at fix@NtoV at singlefix#1%
+}
+\def\collargs at fix@vtoN{%
+ \futurelet\collargs at token\collargs at fix@vtoN at i
+}
+\def\collargs at fix@vtoN at i{%
+ \ifcat\noexpand\collargs at token\bgroup
+ \expandafter\collargs at fix@next
+ \else
+ \ifcat\noexpand\collargs at token\egroup
+ \expandafter\expandafter\expandafter\collargs at fix@next
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN
+ \fi
+ \fi
+}
+\def\collargs at fix@vtoV{%
+ \futurelet\collargs at token\collargs at fix@vtoV at i
+}
+\def\collargs at fix@vtoV at i{%
+ \ifcat\noexpand\collargs at token\bgroup
+ \expandafter\collargs at fix@NtoV
+ \else
+ \ifcat\noexpand\collargs at token\egroup
+ \expandafter\expandafter\expandafter\collargs at fix@NtoV
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@next
+ \fi
+ \fi
+}
+\def\collargs at fix@catcode at of@braces at fromverbatim#1{%
+ \ifnum\catcode`#1=1
+ \expandafter\collargs at fix@VtoN
+ \expandafter#1%
+ \else
+ \ifnum\catcode`#1=2
+ \expandafter\expandafter\expandafter\collargs at fix@cc at VtoN
+ \expandafter\expandafter\expandafter#1%
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@next
+ \fi
+ \fi
+}
+\def\collargs at fix@VtoN#1{%
+ \ifnum\catcode`#1=0
+ \expandafter\collargs at fix@VtoN at escape
+ \else
+ \ifnum\catcode`#1=14
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at comment
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at token
+ \fi
+ \fi
+ #1%
+}
+\def\collargs at fix@VtoN at token#1{%
+ \collargs at insert@char\collargs at fix@next{`#1}{\the\catcode`#1}%
+}
+\def\collargs at defcommentstripper#1#2{%
+ \def#1##1{%
+ \begingroup%
+ \escapechar=`\\%
+ \catcode\endlinechar=\active%
+ \def\collargs at do####1{\catcode####1=12 }%
+ \collargs at comments
+ \csname\string#1\endcsname%
+ }%
+ \begingroup%
+ \escapechar=`\\%
+ \lccode`\~=\endlinechar%
+ \lowercase{%
+ \expandafter\endgroup
+ \expandafter\def\csname\string#1\endcsname##1~%
+ }{%
+ \endgroup#2%
+ }%
+}
+\collargs at defcommentstripper\collargs at fix@VtoN at comment{%
+ \collargs at fix@next
+}
+\let\collargs at defcommentstripper\relax
+\def\collargs at fix@VtoN at escape#1{%
+ \ifcollargs at double@fix
+ \expandafter\collargs at fix@VtoN at escape@d
+ \else
+ \expandafter\collargs at fix@VtoN at escape@i
+ \fi
+}
+\def\collargs at fix@VtoN at escape@i{%
+ \begingroup
+ \catcode`\\=12
+ \catcode`\{=12
+ \catcode`\}=12
+ \catcode`\ =12
+ \collargs at fix@VtoN at escape@ii
+}
+\def\collargs at fix@VtoN at escape@ii#1{%
+ \endgroup
+ \def\collargs at csname{#1}%
+ \ifnum\catcode`#1=11
+ \expandafter\collargs at fix@VtoN at escape@iii
+ \else
+ \ifnum\catcode`#1=10
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at escape@s
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at escape@z at i
+ \fi
+ \fi
+}
+\def\collargs at fix@VtoN at escape@iii{%
+ \futurelet\collargs at temp\collargs at fix@VtoN at escape@iv
+}
+\def\collargs at fix@VtoN at escape@iv{%
+ \ifcat\noexpand\collargs at temp\bgroup
+ \let\collargs at action\collargs at fix@VtoN at escape@z
+ \else
+ \ifcat\noexpand\collargs at temp\egroup
+ \let\collargs at action\collargs at fix@VtoN at escape@z
+ \else
+ \expandafter\ifx\space\collargs at temp
+ \let\collargs at action\collargs at fix@VtoN at escape@s
+ \else
+ \let\collargs at action\collargs at fix@VtoN at escape@v
+ \fi
+ \fi
+ \fi
+ \collargs at action
+}
+\def\collargs at fix@VtoN at escape@v#1{%
+ \ifcat\noexpand#1a%
+ \appto\collargs at csname{#1}%
+ \expandafter\collargs at fix@VtoN at escape@iii
+ \else
+ \expandafter\collargs at fix@VtoN at escape@z\expandafter#1%
+ \fi
+}
+\def\collargs at fix@VtoN at escape@s{%
+ \futurelet\collargs at temp\collargs at fix@VtoN at escape@s at i
+}
+\def\collargs at fix@VtoN at escape@s at i{%
+ \expandafter\ifx\space\collargs at temp
+ \expandafter\collargs at fix@VtoN at escape@s at ii
+ \else
+ \expandafter\collargs at fix@VtoN at escape@z
+ \fi
+}
+\def\collargs at fix@VtoN at escape@s at ii{%
+ \expandafter\collargs at fix@VtoN at escape@z\romannumeral-0%
+}
+\def\collargs at fix@VtoN at escape@z at i{%
+ \collargs at fix@VtoN at escape@z at maybe@undefine at cs@begin
+ \collargs at fix@VtoN at escape@z at ii
+}%
+\def\collargs at fix@VtoN at escape@z at maybe@undefine at cs@begin{%
+ \ifcsname\collargs at csname\endcsname
+ \@tempswatrue
+ \else
+ \@tempswafalse
+ \fi
+}
+\def\collargs at fix@VtoN at escape@z at maybe@undefine at cs@end{%
+ \if at tempswa
+ \else
+ \cslet{\collargs at csname}\collargs at undefined
+ \fi
+}
+\def\collargs at fix@VtoN at escape@z at ii{%
+ \expandafter\collargs at fix@VtoN at escape@z at maybe@undefine at cs@end
+ \expandafter\collargs at fix@next\csname\collargs at csname\endcsname
+}
+\def\collargs at fix@VtoN at escape@z{%
+ \collargs at if@one at more@fix{%
+ \collargs at do@one at more@fix\collargs at fix@VtoN at escape@z at i
+ }{%
+ \collargs at fix@VtoN at escape@z at maybe@undefine at cs@begin
+ \xdef\collargs at double@fix at cs@i{\expandonce{\csname\collargs at csname\endcsname}}%
+ \collargs at fix@VtoN at escape@z at maybe@undefine at cs@end
+ \global\collargs at double@fixtrue
+ \collargs at fix@VtoN at escape@z at ii
+ }%
+}
+\def\collargs at fix@VtoN at escape@d{%
+ \ifcollargs at in@second at fix
+ \expandafter\collargs at fix@VtoN at escape@d at i
+ \expandafter\collargs at double@fix at cs@ii
+ \else
+ \expandafter\collargs at fix@VtoN at escape@d at i
+ \expandafter\collargs at double@fix at cs@i
+ \fi
+}
+\def\collargs at fix@VtoN at escape@d at i#1{%
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at escape@d at ii
+ \expandafter\string#1\relax
+}
+\def\collargs at fix@VtoN at escape@d at ii#1#2\relax{%
+ \def\collargs at csname{#2}%
+ \def\collargs at fix@VtoN at escape@d at iii#2{%
+ \collargs at fix@VtoN at escape@z
+ }%
+ \collargs at fix@VtoN at escape@d at iii
+}
+\newif\ifcollargs at double@fix
+\newif\ifcollargs at in@second at fix
+\def\collargs at if@one at more@fix{%
+ \ifcollargs at double@fix
+ \ifcollargs at in@second at fix
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \else
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \fi
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+\def\collargs at do@one at more@fix#1{%
+ \begingroup
+ \collargs at in@second at fixtrue
+ \collargs at fix{%
+ \endgroup
+ #1%
+ }%
+}
+\def\collargs at cancel@double at fix{%
+ \global\collargs at double@fixfalse
+ \begingroup
+ \collargs at process@arg
+ \edef\collargs at temp{\the\collargsArg}%
+ \edef\collargs at tempa{\expandafter\string\collargs at double@fix at cs@i}%
+ \ifx\collargs at temp\collargs at tempa
+ \global\collargs at fix@requestedtrue
+ \fi
+ \endgroup
+}
+ \def\collargs at insert@char#1#2#3{%
+ \edef\collargs at temp{\normalunexpanded{#1}}%
+ \expandafter\collargs at temp\directlua{%
+ tex.cprint(\number#3,string.char(\number#2))}%
+ }%
+ \def\collargs at make@char#1#2#3{%
+ \edef#1{\directlua{tex.cprint(\number#3,string.char(\number#2))}}%
+ }%
+\stopmodule
+\protect
+\endinput
+%%
+%% End of file `t-collargs.tex'.
Property changes on: trunk/Master/texmf-dist/tex/context/collargs/t-collargs.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty 2023-10-11 20:25:43 UTC (rev 68512)
@@ -0,0 +1,1635 @@
+%%
+%% This is file `collargs.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% collargs.dtx (with options: `latex')
+%%
+%%
+%% This file is a part of CollArgs, a TeX package providing a command which can
+%% determine the argument scope of any command whose argument structure
+%% conforms to xparse's argument specification, available at
+%% https://ctan.org/pkg/advice and https://github.com/sasozivanovic/advice.
+%%
+%% Copyright (c) 2023- Saso Zivanovic <saso.zivanovic at guest.arnes.si>
+%% (Sa\v{s}o \v{Z}ivanovi\'{c})
+%%
+%% 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 Saso Zivanovic.
+%%
+%% The files belonging to this work and covered by LPPL are listed in
+%% (<texmf>/doc/generic/collargs/)FILES.
+\ProvidesPackage{collargs}[2023/10/07 v1.0.0 Collect arguments of any command]
+\RequirePackage{pgfkeys}
+\RequirePackage{etoolbox}
+\ifdefined\toksapp\else
+ \long\def\toksapp#1#2{#1\expandafter{\the#1#2}}%
+\fi
+\ifdefined\etoksapp\else
+ \long\def\etoksapp#1#2{#1\expandafter{\expanded{\the#1#2}}}%
+\fi
+\ifdefined\gtoksapp\else
+ \long\def\gtoksapp#1#2{\global#1\expandafter{\the#1#2}}%
+\fi
+\ifdefined\xtoksapp\else
+ \long\def\xtoksapp#1#2{\global#1\expandafter{\expanded{\the#1#2}}}%
+\fi
+\ifdefined\toks@\else\toksdef\toks@=0 \fi
+\protected\def\CollectArguments{%
+ \pgf at keys@utilifnextchar[\CollectArguments at i{\CollectArgumentsRaw{}}%]
+}
+\def\CollectArguments at i[#1]{\CollectArgumentsRaw{\collargsSet{#1}}}
+\protected\def\CollectArgumentsRaw#1#2#3{%
+ \begingroup
+ \global\let\ifcollargs at last@verbatim\ifcollargs at verbatim
+ \global\let\ifcollargs at last@verbatimbraces\ifcollargs at verbatimbraces
+ \global\collargs at double@fixfalse
+ \collargs at verbatim@wrap{#1}%
+ \collargs at init@grabspaces
+ \def\collargs at next{#3}%
+ \global\collargs at toks{}%
+ \collargs@#2.%
+}
+\def\collargsSet#1{\pgfqkeys{/collargs}{#1}}
+\def\collargs at cs@cases#1{\collargs at cs@cases at i#1\collargs at cs@cases at end}
+\let\collargs at cs@cases at end\relax
+\def\collargs at cs@cases at i{\futurelet\collargs at temp\collargs at cs@cases at ii}
+\def\collargs at cs@cases at ii#1#2\collargs at cs@cases at end{%
+ \ifcat\noexpand\collargs at temp\relax
+ \ifx\relax#2\relax
+ \expandafter\expandafter\expandafter\@firstofthree
+ \else
+ \expandafter\expandafter\expandafter\@secondofthree
+ \fi
+ \else
+ \expandafter\@thirdofthree
+ \fi
+}
+\def\@firstofthree#1#2#3{#1}
+\def\@secondofthree#1#2#3{#2}
+\def\@thirdofthree#1#2#3{#3}
+\collargsSet{
+ caller/.code={\collargsCaller{#1}},
+}
+\def\collargsCaller#1{%
+ \collargs at cs@cases{#1}{%
+ \let\collargs at temp\collargs at caller@cs
+ }{%
+ \let\collargs at temp\collargs at caller@csandmore
+ }{%
+ \let\collargs at temp\collargs at caller@env
+ }%
+ \collargs at temp{#1}%
+}
+\def\collargs at caller@cs#1{%
+ \def\collargs at caller{#1}%
+}
+\def\collargs at caller@csandmore#1{%
+ \begingroup
+ \escapechar -1
+ \expandafter\endgroup
+ \expandafter\def\expandafter\collargs at caller\expandafter{%
+ \csname\string#1\endcsname
+ }%
+}
+\def\collargs at caller@env#1{%
+ \expandafter\def\expandafter\collargs at caller\expandafter{%
+ \csname
+ begin{%
+ #1%
+ }%
+ \endcsname
+ }%
+}
+\collargsCaller\CollectArguments
+\newif\ifcollargs at verbatim
+\newif\ifcollargs at verbatimbraces
+\collargsSet{
+ verbatim/.code={\let\collargs at apply@verbatim\collargsVerbatim},
+ verb/.code={\let\collargs at apply@verbatim\collargsVerb},
+ no verbatim/.code={\let\collargs at apply@verbatim\collargsNoVerbatim},
+}
+\def\collargs at verbatim@wrap#1{%
+ \let\collargs at apply@verbatim\relax
+ #1%
+ \collargs at apply@verbatim
+}
+\collargsSet{
+ fix from verbatim/.code={\collargsFixFromVerbatim},
+ fix from verb/.code={\collargsFixFromVerb},
+ fix from no verbatim/.code={\collargsFixFromNoVerbatim},
+}
+\def\collargsFixFromNoVerbatim{%
+ \global\collargs at fix@requestedtrue
+ \global\let\ifcollargs at last@verbatim\iffalse
+}
+\def\collargsFixFromVerbatim{%
+ \global\collargs at fix@requestedtrue
+ \global\let\ifcollargs at last@verbatim\iftrue
+ \global\let\ifcollargs at last@verbatimbraces\iftrue
+}
+\def\collargsFixFromVerb{%
+ \global\collargs at fix@requestedtrue
+ \global\let\ifcollargs at last@verbatim\iftrue
+ \global\let\ifcollargs at last@verbatimbraces\iffalse
+}
+\collargsSet{
+ braces/.code={\collargsBraces{#1}}%
+}
+\collargsSet{
+ environment/.estore in=\collargs at b@envname
+}
+\def\collargsEnvironment#1{\edef\collargs at b@envname{#1}}
+\collargsEnvironment{}
+\collargsSet{
+ begin tag/.is if=collargsBeginTag,
+ end tag/.is if=collargsEndTag,
+ tags/.style={begin tag=#1, end tag=#1},
+ tags/.default=true,
+}
+\newif\ifcollargsBeginTag
+\newif\ifcollargsEndTag
+\collargsSet{
+ ignore nesting/.is if=collargsIgnoreNesting,
+}
+\newif\ifcollargsIgnoreNesting
+\collargsSet{
+ ignore other tags/.is if=collargsIgnoreOtherTags,
+}
+\newif\ifcollargsIgnoreOtherTags
+\collargsSet{
+ append preprocessor/.code={\collargsAppendPreprocessor{#1}},
+ prepend preprocessor/.code={\collargsPrependPreprocessor{#1}},
+ append postprocessor/.code={\collargsAppendPostprocessor{#1}},
+ prepend postprocessor/.code={\collargsPrependPostprocessor{#1}},
+}
+\def\collargsAppendPreprocessor{%
+ \collargs at addprocessor\appto\collargs at preprocess@arg}
+\def\collargsPrependPreprocessor{%
+ \collargs at addprocessor\preto\collargs at preprocess@arg}
+\def\collargsAppendPostprocessor{%
+ \collargs at addprocessor\appto\collargs at postprocess@arg}
+\def\collargsPrependPostprocessor{%
+ \collargs at addprocessor\preto\collargs at postprocess@arg}
+\def\collargs at addprocessor#1#2#3{%
+ #1#2{%
+ \expanded{%
+ \unexpanded{#3}{\the\collargsArg}%
+ }%
+ }%
+}
+\def\collargs at preprocess@arg{}
+\def\collargs at postprocess@arg{}
+\collargsSet{
+ clear preprocessors/.code={\collargsClearPreprocessors},
+ clear postprocessors/.code={\collargsClearPostprocessors},
+}
+\def\collargsClearPreprocessors{\def\collargs at preprocess@arg{}}%
+\def\collargsClearPostprocessors{\def\collargs at postprocess@arg{}}%
+\collargsSet{
+ append expandable preprocessor/.code={%
+ \collargsAppendExpandablePreprocessor{#1}},
+ prepend expandable preprocessor/.code={%
+ \collargsPrependExpandablePreprocessor{#1}},
+ append expandable postprocessor/.code={%
+ \collargsAppendExpandablePostprocessor{#1}},
+ prepend expandable postprocessor/.code={%
+ \collargsPrependExpandablePostprocessor{#1}},
+}
+\def\collargsAppendExpandablePreprocessor{%
+ \collargs at addeprocessor\appto\collargs at preprocess@arg}
+\def\collargsPrependExpandablePreprocessor{%
+ \collargs at addeprocessor\preto\collargs at preprocess@arg}
+\def\collargsAppendExpandablePostprocessor{%
+ \collargs at addeprocessor\appto\collargs at postprocess@arg}
+\def\collargsPrependExpandablePostprocessor{%
+ \collargs at addeprocessor\preto\collargs at postprocess@arg}
+\def\collargs at addeprocessor#1#2#3{%
+ #1#2{%
+ \expanded{%
+ \edef\noexpand\collargs at temp{\unexpanded{#3}{\the\collargsArg}}%
+ \unexpanded{\expandafter\collargsArg\expandafter{\collargs at temp}}%
+ }%
+ }%
+}
+\collargsSet{
+ append prewrap/.code={\collargsAppendPrewrap{#1}},
+ prepend prewrap/.code={\collargsPrependPrewrap{#1}},
+ append postwrap/.code={\collargsAppendPostwrap{#1}},
+ prepend postwrap/.code={\collargsPrependPostwrap{#1}},
+}
+\def\collargsAppendPrewrap{\collargs at addwrap\appto\collargs at preprocess@arg}
+\def\collargsPrependPrewrap{\collargs at addwrap\preto\collargs at preprocess@arg}
+\def\collargsAppendPostwrap{\collargs at addwrap\appto\collargs at postprocess@arg}
+\def\collargsPrependPostwrap{\collargs at addwrap\preto\collargs at postprocess@arg}
+\def\collargs at addwrap#1#2#3{%
+ #1#2{%
+ \long\def\collargs at temp##1{#3}%
+ \expandafter\expandafter\expandafter\collargsArg
+ \expandafter\expandafter\expandafter{%
+ \expandafter\collargs at temp\expandafter{\the\collargsArg}%
+ }%
+ }%
+}
+\collargsSet{%
+ no delimiters/.is if=collargsNoDelimiters,
+}
+\newif\ifcollargsNoDelimiters
+\def\collargs@{%
+ \begingroup
+ \collargs@@@
+}
+\def\collargs@@@#1{%
+ \collargs at in@{#1}{&+!>.}%
+ \ifcollargs at in@
+ \expandafter\collargs@@@iii
+ \else
+ \expandafter\collargs@@@i
+ \fi
+ #1%
+}
+\def\collargs@@@i#1.{%
+ \collargs at fix{\collargs@@@ii#1.}%
+}
+\def\collargs@@@ii{%
+ \global\collargs at fix@requestedfalse
+ \global\let\ifcollargs at last@verbatim\ifcollargs at verbatim
+ \global\let\ifcollargs at last@verbatimbraces\ifcollargs at verbatimbraces
+ \collargs@@@iii
+}
+\def\collargs@@@iii#1{%
+ \ifcsname collargs@#1\endcsname
+ \csname collargs@#1\expandafter\endcsname
+ \else
+ \collargs at error@badtype{#1}%
+ \fi
+}
+\def\collargs at error@badtype#1#2.{%
+ \PackageError{collargs}{Unknown xparse argument type or modifier "#1"
+ for "\expandafter\string\collargs at caller\space"}{}%
+ \endgroup
+}
+\csdef{collargs@&}{%
+ \futurelet\collargs at temp\collargs at amp@i
+}
+\def\collargs at amp@i{%
+ \ifx\collargs at temp&%
+ \expandafter\collargs at amp@raw
+ \else
+ \expandafter\collargs at amp@set
+ \fi
+}
+\def\collargs at amp@raw#1#2{%
+ \collargs at verbatim@wrap{#2}%
+ \collargs@@@
+}
+\def\collargs at amp@set#1{%
+ \collargs at verbatim@wrap{\collargsSet{#1}}%
+ \collargs@@@
+}
+\csdef{collargs at +}{%
+ \collargs at longtrue
+ \collargs@@@
+}
+\newif\ifcollargs at long
+\csdef{collargs@>}#1{\collargs@@@}
+\csdef{collargs@!}{%
+ \collargs at grabspacesfalse
+ \collargs@@@
+}
+\newtoks\collargs at toks
+\newtoks\collargsArg
+\csdef{collargs at .}{%
+ \endgroup
+ \expanded{%
+ \endgroup
+ \noexpand\collargs at fix{%
+ \expandonce\collargs at next{\the\collargs at toks}%
+ \collargs at spaces
+ }%
+ }%
+}
+\long\def\collargs at appendarg#1{%
+ \collargsArg={#1}%
+ \ifcollargs at double@fix
+ \collargs at cancel@double at fix
+ \fi
+ \collargs at preprocess@arg
+ \ifcollargsNoDelimiters
+ \else
+ \collargs at process@arg
+ \fi
+ \collargs at postprocess@arg
+ \xtoksapp\collargs at toks{\collargs at grabbed@spaces\the\collargsArg}%
+ \collargs at init@grabspaces
+ \endgroup
+}
+\def\collargs at wrap{\collargs at addwrap\appto\collargs at process@arg}
+\def\collargs at process@arg{}
+\def\collargs at defcollector#1#{%
+ \ifcollargs at long\long\fi
+ \expandafter\def\collargs at caller#1%
+}
+\def\collargs at defusecollector#1#{%
+ \afterassignment\collargs at caller
+ \ifcollargs at long\long\fi
+ \expandafter\def\collargs at caller#1%
+}
+\def\collargs at letusecollector#1{%
+ \expandafter\let\collargs at caller#1%
+ \collargs at caller
+}
+\newif\ifcollargs at grabspaces
+\collargs at grabspacestrue
+\def\collargs at init@grabspaces{%
+ \gdef\collargs at gs@state{0}%
+ \gdef\collargs at spaces{}%
+ \gdef\collargs at otherspaces{}%
+}
+\def\collargs at grabspaces#1{%
+ \edef\collargs at gs@next{\unexpanded{#1}}%
+ \ifnum\collargs at gs@state=0
+ \gdef\collargs at gs@state{1}%
+ \expandafter\collargs at gs@i
+ \else
+ \expandafter\collargs at gs@next
+ \fi
+}
+\def\collargs at gs@i{%
+ \futurelet\collargs at temp\collargs at gs@g
+}
+\def\collargs at gs@g{%
+ \ifcat\noexpand\collargs at temp\bgroup
+ \expandafter\collargs at gs@next
+ \else
+ \ifcat\noexpand\collargs at temp\egroup
+ \expandafter\expandafter\expandafter\collargs at gs@next
+ \else
+ \expandafter\expandafter\expandafter\collargs at gs@ii
+ \fi
+ \fi
+}
+\def\collargs at gs@ii{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at gos@iii
+ \else
+ \expandafter\collargs at gs@iii
+ \fi
+}
+\def\collargs at gs@iii{%
+ \expandafter\ifx\space\collargs at temp
+ \expandafter\collargs at gs@iv
+ \else
+ \expandafter\collargs at gs@next
+ \fi
+}
+\expandafter\def\expandafter\collargs at gs@iv\space{%
+ \gappto\collargs at spaces{ }%
+ \xappto\collargs at otherspaces{\collargs at otherspace}%
+ \collargs at gs@i
+}
+\begingroup\catcode`\ =12\relax\gdef\collargs at otherspace{ }\endgroup
+\def\collargs at gos@iii#1{%
+ \ifnum\collargs at cc{#1}=10
+ \expandafter\collargs at gos@iv
+ \else
+ \ifnum\collargs at cc{#1}=5
+ \expandafter\expandafter\expandafter\collargs at gos@v
+ \else
+ \expandafter\expandafter\expandafter\collargs at gs@next
+ \fi
+ \fi
+ #1%
+}
+\def\collargs at gos@iv#1{%
+ \gappto\collargs at otherspaces{#1}%
+ \gdef\collargs at spaces{ }%
+ \collargs at gs@i
+}
+\def\collargs at gos@v{%
+ \ifnum\collargs at gs@state=2
+ \expandafter\collargs at gs@next
+ \else
+ \expandafter\collargs at gs@vi
+ \fi
+}
+\def\collargs at gs@vi#1{%
+ \gdef\collargs at gs@state{2}%
+ \gappto\collargs at otherspaces{#1}%
+ \gdef\collargs at spaces{ }%
+ \collargs at gs@i
+}
+\def\collargs at maybegrabspaces{%
+ \ifcollargs at grabspaces
+ \expandafter\collargs at grabspaces
+ \else
+ \expandafter\@firstofone
+ \fi
+}
+\def\collargs at grabbed@spaces{%
+ \ifcollargs at verbatim
+ \collargs at otherspaces
+ \else
+ \collargs at spaces
+ \fi
+}
+\def\collargs at reinsert@spaces#1{%
+ \expanded{%
+ \unexpanded{%
+ \collargs at init@grabspaces
+ #1%
+ }%
+ \collargs at grabbed@spaces
+ }%
+}
+\long\def\collargs at ifnextcat#1#2#3{%
+ \let\pgf at keys@utilreserved at d=#1%
+ \def\pgf at keys@utilreserved at a{#2}%
+ \def\pgf at keys@utilreserved at b{#3}%
+ \futurelet\pgf at keys@utillet at token\collargs at ifncat}
+\def\collargs at ifncat{%
+ \ifx\pgf at keys@utillet at token\pgf at keys@utilsptoken
+ \let\pgf at keys@utilreserved at c\collargsxifnch
+ \else
+ \ifcat\noexpand\pgf at keys@utillet at token\pgf at keys@utilreserved at d
+ \let\pgf at keys@utilreserved at c\pgf at keys@utilreserved at a
+ \else
+ \let\pgf at keys@utilreserved at c\pgf at keys@utilreserved at b
+ \fi
+ \fi
+ \pgf at keys@utilreserved at c}
+{%
+ \def\:{\collargs at xifncat}
+ \expandafter\gdef\: {\futurelet\pgf at keys@utillet at token\collargs at ifncat}
+}
+\def\collargs at forrange#1#2{%
+ \expanded{%
+ \noexpand\collargs at forrange@i{\number#1}{\number#2}%
+ }%
+ }
+\def\collargs at forrange@i#1#2{%
+ \ifnum#1>#2 %
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+ {%
+ \collargs at do{#1}%
+ \expandafter\collargs at forrange@i\expandafter{\number\numexpr#1+1\relax}{#2}%
+ }%
+}
+\def\collargs at forranges{\forcsvlist\collarg at forrange@i}
+\def\collarg at forrange@i#1{\collarg at forrange@ii#1-}
+\def\collarg at forrange@ii#1-#2-{\collargs at forrange{#1}{#2}}
+\begingroup
+\catcode`\%=12
+\gdef\collargs at percentchar{%}
+\endgroup
+\def\collargs at l#1.{%
+ \collargs at reinsert@spaces{\collargs at l@i#1.}%
+}
+\def\collargs at l@i{%
+ \global\collargs at fix@requestedtrue
+ \ifcollargs at verbatimbraces
+ \expandafter\collargs at l@verb
+ \else
+ \expandafter\collargs at l@ii
+ \fi
+}
+\def\collargs at l@ii#1.{%
+ \collargs at defusecollector##1##{%
+ \collargs at appendarg{##1}%
+ \collargs@#1.%
+ }%
+}
+\def\collargs at l@verb#1.{%
+ \expandafter\collargs at defusecollector
+ \expandafter##\expandafter1\collargs at other@bgroup{%
+ \collargs at appendarg{##1}%
+ \expanded{%
+ \noexpand\collargs@\unexpanded{#1.}%
+ \collargs at other@bgroup
+ }%
+ }%
+}
+\def\collargs at u{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at u@verb
+ \else
+ \expandafter\collargs at u@i
+ \fi
+}
+\def\collargs at u@verb#1{%
+ \expandafter\collargs at u@i\expandafter{\detokenize\expandafter{\string#1}}%
+}
+\def\collargs at u@i#1#2.{%
+ \collargs at reinsert@spaces{\collargs at u@ii{#1}#2.}%
+}
+\def\collargs at u@ii#1#2.{%
+ \collargs at defusecollector##1#1{%
+ \collargs at wrap{####1#1}%
+ \expandafter\collargs at appendarg\expandafter{##1}%
+ \collargs@#2.%
+ }%
+ \collargs at empty
+}
+\def\collargs at empty{}
+\def\collargs at r{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at r@verb
+ \else
+ \expandafter\collargs at r@i
+ \fi
+}
+\def\collargs at r@verb#1#2{%
+ \expandafter\collargs at r@i\detokenize{#1#2}%
+}
+\def\collargs at r@i#1#2#3.{%
+ \collargs at defcollector#1{%
+ \collargs at defusecollector####1#2{%
+ \collargs at wrap{#1########1#2}%
+ \expandafter\collargs at appendarg\expandafter{####1}%
+ \collargs@#3.%
+ }%
+ \collargs at empty
+ }%
+ \collargs at grabspaces\collargs at caller
+}
+\def\collargs at R#1#2#3{\collargs at r#1#2}
+\def\collargs at d{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at d@verb
+ \else
+ \expandafter\collargs at d@i
+ \fi
+}
+\def\collargs at d@verb#1#2{%
+ \expandafter\collargs at d@i\detokenize{#1#2}%
+}
+\def\collargs at d@i#1#2#3.{%
+ \def\collargs at d@noopt{%
+ \global\collargs at fix@requestedtrue
+ \endgroup
+ \collargs@#3.%
+ }%
+ \collargs at defcollector#1{%
+ \collargs at defusecollector####1#2{%
+ \collargs at wrap{#1########1#2}%
+ \expandafter\collargs at appendarg\expandafter{####1}%
+ \collargs@#3.%
+ }%
+ \collargs at empty
+ }%
+ \def\collargs at d@ii{%
+ \ifx#1\collargs at temp
+ \expandafter\collargs at caller
+ \else
+ \expandafter\collargs at d@noopt
+ \fi
+ }%
+ \collargs at maybegrabspaces{\futurelet\collargs at temp\collargs at d@ii}%
+}
+\def\collargs at D#1#2#3{\collargs at d#1#2}
+\def\collargs at o{\collargs at d[]}
+\def\collargs at O#1{\collargs at d[]}
+\def\collargs at t{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at t@verb
+ \else
+ \expandafter\collargs at t@i
+ \fi
+}
+\def\collargs at t@space{ }
+\def\collargs at t@verb#1{%
+ \let\collargs at t@space\collargs at otherspace
+ \expandafter\collargs at t@i\expandafter{\detokenize{#1}}%
+}
+\def\collargs at t@i#1{%
+ \expandafter\ifx\space#1%
+ \expandafter\collargs at t@s
+ \else
+ \expandafter\collargs at t@I\expandafter#1%
+ \fi
+}
+\def\collargs at t@s#1.{%
+ \collargs at grabspaces{%
+ \ifcollargs at grabspaces
+ \collargs at appendarg{}%
+ \else
+ \expanded{%
+ \noexpand\collargs at init@grabspaces
+ \noexpand\collargs at appendarg{\collargs at grabbed@spaces}%
+ }%
+ \fi
+ \collargs@#1.%
+ }%
+}
+\def\collargs at t@I#1#2.{%
+ \def\collargs at t@noopt{%
+ \global\collargs at fix@requestedtrue
+ \endgroup
+ \collargs@#2.%
+ }%
+ \def\collargs at t@opt##1{%
+ \collargs at appendarg{#1}%
+ \collargs@#2.%
+ }%
+ \def\collargs at t@ii{%
+ \ifx#1\collargs at temp
+ \expandafter\collargs at t@opt
+ \else
+ \expandafter\collargs at t@noopt
+ \fi
+ }%
+ \collargs at maybegrabspaces{\futurelet\collargs at temp\collargs at t@ii}%
+}
+\def\collargs at t@opt at space{%
+ \expanded{\noexpand\collargs at t@opt{\space}\expandafter}\romannumeral-0%
+}%
+\def\collargs at s{\collargs at t*}
+\def\collargs at m{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at m@verb
+ \else
+ \expandafter\collargs at m@i
+ \fi
+}
+\def\collargs at m@i#1.{%
+ \collargs at grabspaces{\collargs at m@checkforgroup#1.}%
+}
+\def\collargs at m@checkforgroup#1.{%
+ \edef\collargs at action{\unexpanded{\collargs at m@checkforgroup at i#1.}}%
+ \futurelet\collargs at token\collargs at action
+}
+\def\collargs at m@checkforgroup at i{%
+ \ifcat\noexpand\collargs at token\bgroup
+ \expandafter\collargs at m@group
+ \else
+ \expandafter\collargs at m@token
+ \fi
+}
+\def\collargs at m@group#1.{%
+ \collargs at defusecollector##1{%
+ \collargs at wrap{{####1}}%
+ \collargs at appendarg{##1}%
+ \collargs@#1.%
+ }%
+}
+\def\collargs at m@token#1.{%
+ \collargs at defusecollector##1{%
+ \collargs at appendarg{##1}%
+ \collargs@#1.%
+ }%
+}
+\def\collargs at m@verb#1.{%
+ \collargs at grabspaces{\collargs at m@verb at checkforgroup#1.}%
+}
+\def\collargs at m@verb at checkforgroup{%
+ \ifcollargs at verbatimbraces
+ \expandafter\collargs at m@verb at checkforgroup@i
+ \else
+ \expandafter\collargs at m@checkforgroup
+ \fi
+}
+\def\collargs at m@verb at checkforgroup@i#1.{%
+ \def\collargs at m@verb at checkforgroup@ii{\collargs at m@verb at checkforgroup@iii#1.}%
+ \futurelet\collargs at temp\collargs at m@verb at checkforgroup@ii
+}
+\def\collargs at m@verb at checkforgroup@iii#1.{%
+ \expandafter\ifx\collargs at other@bgroup\collargs at temp
+ \expandafter\collargs at m@verb at group
+ \else
+ \expandafter\ifx\collargs at other@egroup\collargs at temp
+ \expandafter\expandafter\expandafter\collargs at m@verb at egrouperror
+ \else
+ \expandafter\expandafter\expandafter\collargs at m@v at token
+ \fi
+ \fi
+ #1.%
+}
+\def\collargs at m@verb at egrouperror#1.{%
+ \PackageError{collargs}{%
+ Argument of \expandafter\string\collargs at caller\space has an extra
+ \iffalse{\else\string}}{}%
+}
+\def\collargs at m@v at token#1.#2{%
+ \ifnum\collargs at cc{#2}=0
+ \expandafter\collargs at m@v at token@cs
+ \else
+ \expandafter\collargs at m@token
+ \fi
+ #1.#2%
+}
+\def\collargs at m@v at token@cs#1.#2#3{%
+ \ifnum\collargs at cc{#3}=11
+ \expandafter\collargs at m@v at token@cs at letter
+ \else
+ \expandafter\collargs at m@v at token@cs at nonletter
+ \fi
+ #1.#2#3%
+}
+\def\collargs at m@v at token@cs at nonletter#1.#2#3{%
+ \collargs at appendarg{#2#3}%
+ \collargs@#1.%
+}
+\def\collargs at m@v at token@cs at letter#1.#2{%
+ \collargsArg{#2}%
+ \def\collargs at tempa{#1}%
+ \collargs at m@v at token@cs at letter@i
+}
+\def\collargs at m@v at token@cs at letter@i#1{%
+ \ifnum\collargs at cc{#1}=11
+ \toksapp\collargsArg{#1}%
+ \expandafter\collargs at m@v at token@cs at letter@i
+ \else
+ \expandafter\collargs at m@v at token@cs at letter@ii\expandafter#1%
+ \fi
+}
+\def\collargs at m@v at token@cs at letter@ii{%
+ \expanded{%
+ \unexpanded{%
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ }%
+ \noexpand\collargs@\expandonce\collargs at tempa.%
+ }%
+}
+\def\collargs at m@verb at group#1.#2{%
+ \let\collargs at begintag\collargs at other@bgroup
+ \let\collargs at endtag\collargs at other@egroup
+ \def\collargs at tagarg{}%
+ \def\collargs at commandatend{\collargs at m@verb at group@i#1.}%
+ \collargs at readContent
+}
+\def\collargs at m@verb at group@i{%
+ \edef\collargs at temp{%
+ \collargs at other@bgroup\unexpanded{##1}\collargs at other@egroup}%
+ \expandafter\collargs at wrap\expandafter{\collargs at temp}%
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ \collargs@
+}
+\def\collargs at g{%
+ \def\collargs at m@token{%
+ \global\collargs at fix@requestedtrue
+ \endgroup
+ \collargs@
+ }%
+ \let\collargs at m@v at token\collargs at m@token
+ \collargs at m
+}
+\def\collargs at G#1{\collargs at g}
+\def\collargs at v#1.{%
+ \begingroup
+ \collargsBraces{{}}%
+ \collargsVerbatim
+ \collargs at grabspaces{\collargs at v@i#1.}%
+}
+\def\collargs at v@i#1.#2{%
+ \expandafter\ifx\collargs at other@bgroup#2%
+ \let\collargs at begintag\collargs at other@bgroup
+ \let\collargs at endtag\collargs at other@egroup
+ \def\collargs at tagarg{}%
+ \def\collargs at commandatend{%
+ \edef\collargs at temp{%
+ \collargs at other@bgroup\unexpanded{####1}\collargs at other@egroup}%
+ \expandafter\collargs at wrap\expandafter{\collargs at temp}%
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ \endgroup
+ \collargs@#1.%
+ }%
+ \expandafter\collargs at readContent
+ \else
+ \collargs at defcollector##1#2{%
+ \collargs at wrap{#2####1#2}%
+ \collargs at appendarg{##1}%
+ \endgroup
+ \collargs@#1.%
+ }%
+ \expandafter\collargs at caller
+ \fi
+}
+\def\collargs at b{%
+ \collargs at ifnextcat\bgroup\collargs at bg\collargs at bi
+}
+\def\collargs at bg#1{%
+ \edef\collargs at b@envname{#1}%
+ \collargs at bi
+}
+\def\collargs at bi#1.{%
+ \ifcollargs at verbatim
+ \edef\collargs at b@envname{\detokenize\expandafter{\collargs at b@envname}}%
+ \fi
+ \collargs at bi@defCPTbeginend
+ \edef\collargs at tagarg{%
+ \ifcollargs at verbatimbraces
+ \else
+ \ifcollargsIgnoreOtherTags
+ \collargs at b@envname
+ \fi
+ \fi
+ }%
+ \def\collargs at commandatend{%
+ \collargs at bii
+ #1.%
+ }%
+ \collargs at reinsert@spaces\collargs at readContent
+}
+\def\collargs at bi@defCPTbeginend{%
+ \edef\collargs at begintag{%
+ \ifcollargs at verbatim
+ \expandafter\string
+ \else
+ \expandafter\noexpand
+ \fi
+ \begin
+ \ifcollargs at verbatimbraces
+ \collargs at other@bgroup\collargs at b@envname\collargs at other@egroup
+ \fi
+ }%
+ \edef\collargs at endtag{%
+ \ifcollargs at verbatim
+ \expandafter\string
+ \else
+ \expandafter\noexpand
+ \fi
+ \end
+ \ifcollargs at verbatimbraces
+ \collargs at other@bgroup\collargs at b@envname\collargs at other@egroup
+ \fi
+ }%
+}
+\def\collargs at bii{%
+ \ifcollargs at verbatimbraces
+ \expandafter\collargs at biii
+ \else
+ \ifcollargsIgnoreOtherTags
+ \expandafter\expandafter\expandafter\collargs at biii
+ \else
+ \expandafter\expandafter\expandafter\collargs at b@checkend
+ \fi
+ \fi
+}
+\def\collargs at b@checkend#1.{%
+ \collargs at grabspaces{\collargs at b@checkend at i#1.}%
+}
+\def\collargs at b@checkend at i#1.#2{%
+ \def\collargs at temp{#2}%
+ \ifx\collargs at temp\collargs at b@envname
+ \else
+ \collargs at b@checkend at error
+ \fi
+ \collargs at biii#1.%
+}
+\def\collargs at b@checkend at error{%
+ \PackageError{collargs}{Environment "\collargs at b@envname" ended as
+ "\collargs at temp"}{}%
+}
+\def\collargs at biii{%
+ \collargs at b@def at wrapper
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ \collargs@
+}
+\def\collargs at b@def at wrapper{%
+ \edef\collargs at temp{{\collargs at b@envname}}%
+ \edef\collargs at temp{%
+ \ifcollargsBeginTag
+ \expandonce\collargs at begintag
+ \ifcollargs at verbatimbraces\else\collargs at temp\fi
+ \fi
+ ####1%
+ \ifcollargsEndTag
+ \expandonce\collargs at endtag
+ \ifcollargs at verbatimbraces\else\collargs at temp\fi
+ \fi
+ }%
+ \expandafter\collargs at wrap\expandafter{\collargs at temp}%
+}
+\def\collargs at readContent{%
+ \ifcollargs at long\long\fi
+ \collargs at CPT@def\collargs at gobbleOneB\collargs at begintag{%
+ \expandafter\toks@\expandafter{##1}%
+ \futurelet\collargs at temp\collargs at gobbleOneB@i
+ }%
+ \ifcollargs at long\long\fi
+ \collargs at CPT@def\collargs at gobbleUntilE\collargs at endtag{%
+ \expandafter\toksapp\expandafter\toks@\expandafter{##1}%
+ \collargs at gobbleUntilE@i
+ }%
+ \collargs at begins=0\relax
+ \collargsArg{}%
+ \toks@{}%
+ \collargs at letusecollector\collargs at gobbleUntilE
+ \collargs at empty
+}
+\newcount\collargs at begins
+\def\collargs at CPT@def#1#2{%
+ \expandafter\def\expandafter#1%
+ \expandafter##\expandafter1#2%
+}
+\def\collargs at qend{\collargs at qend}
+\def\collargs at gobbleOneB@i{%
+ \def\collargs at begins@increment{1}%
+ \ifx\collargs at qend\collargs at temp
+ \def\collargs at begins@increment{-1}%
+ \expandafter\collargs at gobbleOneB@v
+ \else
+ \etoksapp\toks@{\expandonce\collargs at begintag}%
+ \expandafter\collargs at gobbleOneB@ii
+ \fi
+}%
+\def\collargs at gobbleOneB@ii{%
+ \expandafter\ifx\expandafter\relax\collargs at tagarg\relax
+ \expandafter\collargs at gobbleOneB@vi
+ \else
+ \expandafter\collargs at gobbleOneB@iii
+ \fi
+}
+\def\collargs at gobbleOneB@iii{%
+ \collargs at grabspaces{%
+ \collargs at letusecollector\collargs at gobbleOneB@iv
+ }%
+}
+\def\collargs at gobbleOneB@iv#1{%
+ \def\collargs at temp{#1}%
+ \ifx\collargs at temp\collargs at tagarg
+ \else
+ \def\collargs at begins@increment{0}%
+ \fi
+ \etoksapp\toks@{\collargs at grabbed@spaces\unexpanded{{#1}}}%
+ \collargs at init@grabspaces
+ \collargs at gobbleOneB@vi
+}
+\def\collargs at gobbleOneB@v#1{\collargs at gobbleOneB@vi}
+\def\collargs at gobbleOneB@vi{%
+ \etoksapp\collargsArg{\the\toks@}%
+ \advance\collargs at begins\collargs at begins@increment\relax
+ \ifnum\collargs at begins@increment=-1
+ \else
+ \expandafter\collargs at gobbleOneB\expandafter\collargs at empty
+ \fi
+}
+\def\collargs at gobbleUntilE@i{%
+ \expandafter\ifx\expandafter\relax\collargs at tagarg\relax
+ \expandafter\collargs at gobbleUntilE@iv
+ \else
+ \expandafter\collargs at gobbleUntilE@ii
+ \fi
+}
+\def\collargs at gobbleUntilE@ii{%
+ \collargs at grabspaces{%
+ \collargs at letusecollector\collargs at gobbleUntilE@iii
+ }%
+}
+\def\collargs at gobbleUntilE@iii#1{%
+ \etoksapp\toks@{\collargs at grabbed@spaces}%
+ \collargs at init@grabspaces
+ \def\collargs at tempa{#1}%
+ \ifx\collargs at tempa\collargs at tagarg
+ \expandafter\collargs at gobbleUntilE@iv
+ \else
+ \expandafter\toksapp\expandafter\toks@\expandafter{\collargs at endtag{#1}}%
+ \expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
+ \fi
+}
+\def\collargs at gobbleUntilE@iv{%
+ \ifcollargsIgnoreNesting
+ \expandafter\collargsArg\expandafter{\the\toks@}%
+ \expandafter\collargs at commandatend
+ \else
+ \expandafter\collargs at gobbleUntilE@v
+ \fi
+}
+\def\collargs at gobbleUntilE@v{%
+ \expanded{%
+ \noexpand\collargs at letusecollector\noexpand\collargs at gobbleOneB
+ \noexpand\collargs at empty
+ \the\toks@
+ \expandonce\collargs at begintag
+ \noexpand\collargs at qend
+ }%
+ \ifnum\collargs at begins<0
+ \expandafter\collargs at commandatend
+ \else
+ \etoksapp\collargsArg{%
+ \expandonce\collargs at endtag
+ \expandafter\ifx\expandafter\relax\collargs at tagarg\relax\else{%
+ \expandonce\collargs at tagarg}\fi
+ }%
+ \toks@={}%
+ \expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
+ \expandafter\collargs at empty
+ \fi
+}
+\def\collargs at e{%
+ \global\collargs at fix@requestedtrue
+ \begingroup
+ \ifcollargs at verbatim
+ \expandafter\collargs at e@verbatim
+ \else
+ \expandafter\collargs at e@i
+ \fi
+}
+\def\collargs at e@verbatim#1{%
+ \expandafter\collargs at e@i\expandafter{\detokenize{#1}}%
+}
+\def\collargs at e@i#1{\collargs at e@ii#1.}
+\def\collargs at e@ii#1.#2.{%
+ \collargs at grabspaces{\collargs at e@iii#1.#2.}%
+}
+\def\collargs at e@iii#1.#2.{%
+ \def\collargs at e@iv{\collargs at e@v#1.#2.}%
+ \futurelet\collargs at temp\collargs at e@iv
+}
+\def\collargs at e@v{%
+ \ifcat\noexpand\collargs at temp\bgroup\relax
+ \let\collargs at marshal\collargs at e@z
+ \else
+ \ifcat\noexpand\collargs at temp\egroup\relax
+ \let\collargs at marshal\collargs at e@z
+ \else
+ \let\collargs at marshal\collargs at e@vi
+ \fi
+ \fi
+ \collargs at marshal
+}
+\newif\ifcollargs at in@
+\def\collargs at in@#1#2{%
+ \def\collargs at in@@##1#1##2##3\collargs at in@@{%
+ \ifx\collargs at in@##2\global\collargs at in@false\else\global\collargs at in@true\fi
+ }%
+ {\collargs at in@@#2#1\collargs at in@\collargs at in@@}%
+}
+\def\collargs at e@vi#1.#2.#3{%
+ \collargs at in@{#3}{#1}%
+ \ifcollargs at in@
+ \expandafter\collargs at e@vii
+ \else
+ \expandafter\collargs at e@z
+ \fi
+ #1.#2.#3%
+}
+\def\collargs at e@vii#1.#2.#3{%
+ \let\collargs at real@appendarg\collargs at appendarg
+ \def\collargs at appendarg##1{\collargsArg{##1}}%
+ \def\collargs@{\collargs at e@viii#1.#3}%
+ \collargs at m#2.%
+}
+\def\collargs at e@viii#1.#2#3.{%
+ \collargs at wrap{#2##1}%
+ \def\collargs at e@ix##1#2{\collargs at e@x##1}%
+ \collargs at e@ix#1.#3.%
+}
+\def\collargs at e@x{%
+ \expandafter\collargs at real@appendarg\expandafter{\the\collargsArg}%
+ \begingroup
+ \collargs at e@ii
+}
+\def\collargs at e@z#1.{\endgroup\endgroup\collargs@}
+\def\collargs at E#1#2{\collargs at e{#1}}
+\let\collargs at NoVerbatimAfterNoVerbatim\relax
+\def\collargs at VerbAfterNoVerbatim{%
+ \collargs at verbatimtrue
+ \collargs at verbatimbracesfalse
+ \collargs at make@verbatim
+ \collargs at after{Verb}%
+}
+\def\collargs at VerbatimAfterNoVerbatim{%
+ \collargs at verbatimtrue
+ \collargs at verbatimbracestrue
+ \collargs at make@verbatim
+ \collargs at after{Verbatim}%
+}
+\def\collargs at NoVerbatimAfterVerb{%
+ \collargs at verbatimfalse
+ \collargs at verbatimbracesfalse
+ \collargs at make@other at groups
+ \collargs at make@no at verbatim
+ \collargs at after{NoVerbatim}%
+}
+\def\collargs at VerbAfterVerb{%
+ \collargs at make@other at groups
+}
+\def\collargs at VerbatimAfterVerb{%
+ \collargs at verbatimbracestrue
+ \collargs at make@other at groups
+ \def\collargs at do##1{\catcode##1=12 }%
+ \collargs at bgroups
+ \collargs at egroups
+ \collargs at after{Verbatim}%
+}%
+\let\collargs at NoVerbatimAfterVerbatim\collargs at NoVerbatimAfterVerb
+\def\collargs at VerbAfterVerbatim{%
+ \collargs at verbatimbracesfalse
+ \collargs at make@other at groups
+ \def\collargs at do##1{\catcode##1=1 }%
+ \collargs at bgroups
+ \def\collargs at do##1{\catcode##1=2 }%
+ \collargs at egroups
+ \collargs at after{Verb}%
+}%
+\let\collargs at VerbatimAfterVerbatim\collargs at VerbAfterVerb
+\def\collargs at after#1{%
+ \letcs\collargsVerbatim{collargs at VerbatimAfter#1}%
+ \letcs\collargsVerb{collargs at VerbAfter#1}%
+ \letcs\collargsNoVerbatim{collargs at NoVerbatimAfter#1}%
+}
+\collargs at after{NoVerbatim}
+\def\collargs at bgroups{}%
+\def\collargs at egroups{}%
+\ifdefined\luatexversion
+ \def\collargs at cc#1{%
+ \directlua{tex.sprint(tex.getcatcode(\collargs at catcodetable@original,
+ \the\numexpr\expandafter`\csname#1\endcsname\relax))}%
+ }
+\else
+ \def\collargs at cc#1{%
+ \ifcsname collargs at cc@\the\numexpr\expandafter`\csname#1\endcsname\endcsname
+ \csname collargs at cc@\the\numexpr\expandafter`\csname#1\endcsname\endcsname
+ \else
+ 12%
+ \fi
+ }
+\fi
+\def\collargsBraces#1{%
+ \expandafter\collargs at braces@i\detokenize{#1}\relax
+}
+\def\collargs at braces@i#1#2#3\relax{%
+ \def\collargs at make@other at groups{%
+ \def\collargs at other@bgroup{#1}%
+ \def\collargs at other@egroup{#2}%
+ }%
+}
+\def\collargs at make@other at groups{}
+\ifdefined\luatexversion
+ \newcatcodetable\collargs at catcodetable@verbatim
+ \let\collargs at catcodetable@atletter\catcodetable at atletter
+ \begingroup
+ \@firstofone{%
+ \catcodetable\catcodetable at initex
+ \catcode`\\=12
+ \catcode13=12
+ \catcode0=12
+ \catcode32=12
+ \catcode`\%=12
+ \catcode127=12
+ \def\collargs at do#1{\catcode#1=12 }%
+ \collargs at forrange{`\a}{`\z}%
+ \collargs at forrange{`\A}{`\Z}%
+ \savecatcodetable\collargs at catcodetable@verbatim
+ \endgroup
+ }%
+\fi
+\collargsSet{
+ verbatim ranges/.store in=\collargs at verbatim@ranges,
+}
+\def\collargsVerbatimRanges#1{\def\collargs at verbatim@ranges{#1}}
+\def\collargs at verbatim@ranges{0-255}
+\ifdefined\luatexversion
+ \def\collargs at make@verbatim{%
+ \directlua{%
+ for from, to in string.gmatch(
+ "\luaescapestring{\collargs at verbatim@ranges}",
+ "(\collargs at percentchar d+)-(\collargs at percentchar d+)"
+ ) do
+ for char = tex.round(from), tex.round(to) do
+ catcode = tex.catcode[char]
+ if catcode == 1 then
+ tex.sprint(
+ \number\collargs at catcodetable@atletter,
+ "\noexpand\\collargs at make@verbatim at bgroup{" .. char .. "}")
+ elseif catcode == 2 then
+ tex.sprint(
+ \number\collargs at catcodetable@atletter,
+ "\noexpand\\collargs at make@verbatim at egroup{" .. char .. "}")
+ elseif catcode == 14 then
+ tex.sprint(
+ \number\collargs at catcodetable@atletter,
+ "\noexpand\\collargs at make@verbatim at comment{" .. char .. "}")
+ end
+ end
+ end
+ }%
+ \edef\collargs at catcodetable@original{\the\catcodetable}%
+ \catcodetable\collargs at catcodetable@verbatim
+ \ifcollargs at verbatimbraces
+ \else
+ \def\collargs at do##1{\catcode##1=1\relax}%
+ \collargs at bgroups
+ \def\collargs at do##1{\catcode##1=2\relax}%
+ \collargs at egroups
+ \fi
+ }
+\else
+ \def\collargs at make@verbatim{%
+ \ifdefempty\collargs at make@other at groups{}{%
+ \collargs at make@other at groups
+ \def\collargs at make@other at groups{}%
+ \let\collargs at make@other at bgroup\@gobble
+ \let\collargs at make@other at egroup\@gobble
+ }%
+ \gdef\collargs at comments{}%
+ \let\collargs at do\collargs at make@verbatim at char
+ \expandafter\collargs at forranges\expandafter{\collargs at verbatim@ranges}%
+ }
+ \def\collargs at make@verbatim at char#1{%
+ \ifnum\catcode#1=12
+ \else
+ \csedef{collargs at cc@#1}{\the\catcode#1}%
+ \fi
+ \ifnum\catcode#1=1
+ \collargs at make@verbatim at bgroup{#1}%
+ \else
+ \ifnum\catcode#1=2
+ \collargs at make@verbatim at egroup{#1}%
+ \else
+ \ifnum\catcode#1=14
+ \collargs at make@verbatim at comment{#1}%
+ \fi
+ \ifnum\catcode#1=12
+ \else
+ \catcode#1=12\relax
+ \fi
+ \fi
+ \fi
+ }
+\fi
+\def\collargs at make@verbatim at bgroup#1{%
+ \ifcollargs at verbatimbraces
+ \catcode#1=12\relax
+ \fi
+ \appto\collargs at bgroups{\collargs at do{#1}}%
+ \collargs at make@other at bgroup{#1}%
+}
+\def\collargs at make@other at bgroup#1{%
+ \collargs at make@char\collargs at other@bgroup{#1}{12}%
+ \let\collargs at make@other at bgroup\@gobble
+}
+\def\collargs at make@verbatim at egroup#1{%
+ \ifcollargs at verbatimbraces
+ \catcode#1=12\relax
+ \fi
+ \appto\collargs at egroups{\collargs at do{#1}}%
+ \collargs at make@other at egroup{#1}%
+}
+\def\collargs at make@other at egroup#1{%
+ \collargs at make@char\collargs at other@egroup{#1}{12}%
+ \let\collargs at make@other at egroup\@gobble
+}
+\def\collargs at make@verbatim at comment#1{%
+ \gappto\collargs at comments{\collargs at do{#1}}%
+}
+\ifdefined\luatexversion
+ \def\collargs at make@no at verbatim{%
+ \catcodetable\collargs at catcodetable@original\relax
+ }%
+\else
+\def\collargs at make@no at verbatim{%
+ \let\collargs at do\collargs at make@no at verbatim@char
+ \expandafter\collargs at forranges\expandafter{\collargs at verbatim@ranges}%
+}
+\fi
+\def\collargs at make@no at verbatim@char#1{%
+ \ifcsname collargs at cc@#1\endcsname
+ \catcode#1=\csname collargs at cc@#1\endcsname\relax
+ \fi
+}
+\newif\ifcollargs at fix@requested
+\long\def\collargs at fix#1{%
+ \edef\collargs at fix@next{\unexpanded{#1}}%
+ \ifcollargs at fix@requested
+ \letcs\collargs at action{collargs at fix@%
+ \ifcollargs at last@verbatim
+ \ifcollargs at last@verbatimbraces V\else v\fi
+ \else
+ N%
+ \fi
+ to%
+ \ifcollargs at verbatim
+ \ifcollargs at verbatimbraces V\else v\fi
+ \else
+ N%
+ \fi
+ }%
+ \else
+ \let\collargs at action\collargs at fix@next
+ \fi
+ \collargs at action
+}
+\def\collargs at fix@NtoN{\collargs at fix@next}
+\let\collargs at fix@vtov\collargs at fix@NtoN
+\let\collargs at fix@VtoV\collargs at fix@NtoN
+\def\collargs at fix@Ntov{%
+ \futurelet\collargs at temp\collargs at fix@cc at to@other at ii
+}
+\def\collargs at fix@cc at to@other at ii{%
+ \ifcat\noexpand\collargs at temp\bgroup
+ \let\collargs at action\collargs at fix@next
+ \else
+ \ifcat\noexpand\collargs at temp\egroup
+ \let\collargs at action\collargs at fix@next
+ \else
+ \let\collargs at action\collargs at fix@NtoV
+ \fi
+ \fi
+ \collargs at action
+}
+\def\collargs at fix@NtoV{%
+ \ifcollargs at double@fix
+ \ifcollargs at in@second at fix
+ \expandafter\expandafter\expandafter\collargs at fix@NtoV at secondfix
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@NtoV at onemore
+ \fi
+ \else
+ \expandafter\collargs at fix@NtoV at singlefix
+ \fi
+}
+\def\collargs at fix@NtoV at singlefix{%
+ \expandafter\collargs at fix@next\string
+}
+\def\collargs at fix@NtoV at onemore#1{%
+ \collargs at do@one at more@fix{%
+ \expandafter\collargs at fix@next\string#1%
+ }%
+}
+\def\collargs at fix@NtoV at secondfix{%
+ \if\noexpand\collargs at temp\relax
+ \expandafter\collargs at fix@NtoV at secondfix@i
+ \else
+ \expandafter\collargs at fix@NtoV at singlefix
+ \fi
+}
+\def\collargs at fix@NtoV at secondfix@i#1{%
+ \gdef\collargs at double@fix at cs@ii{#1}%
+ \collargs at fix@NtoV at singlefix#1%
+}
+\def\collargs at fix@vtoN{%
+ \futurelet\collargs at token\collargs at fix@vtoN at i
+}
+\def\collargs at fix@vtoN at i{%
+ \ifcat\noexpand\collargs at token\bgroup
+ \expandafter\collargs at fix@next
+ \else
+ \ifcat\noexpand\collargs at token\egroup
+ \expandafter\expandafter\expandafter\collargs at fix@next
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN
+ \fi
+ \fi
+}
+\def\collargs at fix@vtoV{%
+ \futurelet\collargs at token\collargs at fix@vtoV at i
+}
+\def\collargs at fix@vtoV at i{%
+ \ifcat\noexpand\collargs at token\bgroup
+ \expandafter\collargs at fix@NtoV
+ \else
+ \ifcat\noexpand\collargs at token\egroup
+ \expandafter\expandafter\expandafter\collargs at fix@NtoV
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@next
+ \fi
+ \fi
+}
+\def\collargs at fix@catcode at of@braces at fromverbatim#1{%
+ \ifnum\catcode`#1=1
+ \expandafter\collargs at fix@VtoN
+ \expandafter#1%
+ \else
+ \ifnum\catcode`#1=2
+ \expandafter\expandafter\expandafter\collargs at fix@cc at VtoN
+ \expandafter\expandafter\expandafter#1%
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@next
+ \fi
+ \fi
+}
+\def\collargs at fix@VtoN#1{%
+ \ifnum\catcode`#1=0
+ \expandafter\collargs at fix@VtoN at escape
+ \else
+ \ifnum\catcode`#1=14
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at comment
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at token
+ \fi
+ \fi
+ #1%
+}
+\def\collargs at fix@VtoN at token#1{%
+ \collargs at insert@char\collargs at fix@next{`#1}{\the\catcode`#1}%
+}
+\def\collargs at defcommentstripper#1#2{%
+ \def#1##1{%
+ \begingroup%
+ \escapechar=`\\%
+ \catcode\endlinechar=\active%
+ \def\collargs at do####1{\catcode####1=12 }%
+ \collargs at comments
+ \csname\string#1\endcsname%
+ }%
+ \begingroup%
+ \escapechar=`\\%
+ \lccode`\~=\endlinechar%
+ \lowercase{%
+ \expandafter\endgroup
+ \expandafter\def\csname\string#1\endcsname##1~%
+ }{%
+ \endgroup#2%
+ }%
+}
+\collargs at defcommentstripper\collargs at fix@VtoN at comment{%
+ \collargs at fix@next
+}
+\let\collargs at defcommentstripper\relax
+\def\collargs at fix@VtoN at escape#1{%
+ \ifcollargs at double@fix
+ \expandafter\collargs at fix@VtoN at escape@d
+ \else
+ \expandafter\collargs at fix@VtoN at escape@i
+ \fi
+}
+\def\collargs at fix@VtoN at escape@i{%
+ \begingroup
+ \catcode`\\=12
+ \catcode`\{=12
+ \catcode`\}=12
+ \catcode`\ =12
+ \collargs at fix@VtoN at escape@ii
+}
+\def\collargs at fix@VtoN at escape@ii#1{%
+ \endgroup
+ \def\collargs at csname{#1}%
+ \ifnum\catcode`#1=11
+ \expandafter\collargs at fix@VtoN at escape@iii
+ \else
+ \ifnum\catcode`#1=10
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at escape@s
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at escape@z at i
+ \fi
+ \fi
+}
+\def\collargs at fix@VtoN at escape@iii{%
+ \futurelet\collargs at temp\collargs at fix@VtoN at escape@iv
+}
+\def\collargs at fix@VtoN at escape@iv{%
+ \ifcat\noexpand\collargs at temp\bgroup
+ \let\collargs at action\collargs at fix@VtoN at escape@z
+ \else
+ \ifcat\noexpand\collargs at temp\egroup
+ \let\collargs at action\collargs at fix@VtoN at escape@z
+ \else
+ \expandafter\ifx\space\collargs at temp
+ \let\collargs at action\collargs at fix@VtoN at escape@s
+ \else
+ \let\collargs at action\collargs at fix@VtoN at escape@v
+ \fi
+ \fi
+ \fi
+ \collargs at action
+}
+\def\collargs at fix@VtoN at escape@v#1{%
+ \ifcat\noexpand#1a%
+ \appto\collargs at csname{#1}%
+ \expandafter\collargs at fix@VtoN at escape@iii
+ \else
+ \expandafter\collargs at fix@VtoN at escape@z\expandafter#1%
+ \fi
+}
+\def\collargs at fix@VtoN at escape@s{%
+ \futurelet\collargs at temp\collargs at fix@VtoN at escape@s at i
+}
+\def\collargs at fix@VtoN at escape@s at i{%
+ \expandafter\ifx\space\collargs at temp
+ \expandafter\collargs at fix@VtoN at escape@s at ii
+ \else
+ \expandafter\collargs at fix@VtoN at escape@z
+ \fi
+}
+\def\collargs at fix@VtoN at escape@s at ii{%
+ \expandafter\collargs at fix@VtoN at escape@z\romannumeral-0%
+}
+\def\collargs at fix@VtoN at escape@z at i{%
+ \collargs at fix@VtoN at escape@z at maybe@undefine at cs@begin
+ \collargs at fix@VtoN at escape@z at ii
+}%
+\def\collargs at fix@VtoN at escape@z at maybe@undefine at cs@begin{%
+ \ifcsname\collargs at csname\endcsname
+ \@tempswatrue
+ \else
+ \@tempswafalse
+ \fi
+}
+\def\collargs at fix@VtoN at escape@z at maybe@undefine at cs@end{%
+ \if at tempswa
+ \else
+ \cslet{\collargs at csname}\collargs at undefined
+ \fi
+}
+\def\collargs at fix@VtoN at escape@z at ii{%
+ \expandafter\collargs at fix@VtoN at escape@z at maybe@undefine at cs@end
+ \expandafter\collargs at fix@next\csname\collargs at csname\endcsname
+}
+\def\collargs at fix@VtoN at escape@z{%
+ \collargs at if@one at more@fix{%
+ \collargs at do@one at more@fix\collargs at fix@VtoN at escape@z at i
+ }{%
+ \collargs at fix@VtoN at escape@z at maybe@undefine at cs@begin
+ \xdef\collargs at double@fix at cs@i{\expandonce{\csname\collargs at csname\endcsname}}%
+ \collargs at fix@VtoN at escape@z at maybe@undefine at cs@end
+ \global\collargs at double@fixtrue
+ \collargs at fix@VtoN at escape@z at ii
+ }%
+}
+\def\collargs at fix@VtoN at escape@d{%
+ \ifcollargs at in@second at fix
+ \expandafter\collargs at fix@VtoN at escape@d at i
+ \expandafter\collargs at double@fix at cs@ii
+ \else
+ \expandafter\collargs at fix@VtoN at escape@d at i
+ \expandafter\collargs at double@fix at cs@i
+ \fi
+}
+\def\collargs at fix@VtoN at escape@d at i#1{%
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at escape@d at ii
+ \expandafter\string#1\relax
+}
+\def\collargs at fix@VtoN at escape@d at ii#1#2\relax{%
+ \def\collargs at csname{#2}%
+ \def\collargs at fix@VtoN at escape@d at iii#2{%
+ \collargs at fix@VtoN at escape@z
+ }%
+ \collargs at fix@VtoN at escape@d at iii
+}
+\newif\ifcollargs at double@fix
+\newif\ifcollargs at in@second at fix
+\def\collargs at if@one at more@fix{%
+ \ifcollargs at double@fix
+ \ifcollargs at in@second at fix
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \else
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \fi
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+\def\collargs at do@one at more@fix#1{%
+ \begingroup
+ \collargs at in@second at fixtrue
+ \collargs at fix{%
+ \endgroup
+ #1%
+ }%
+}
+\def\collargs at cancel@double at fix{%
+ \global\collargs at double@fixfalse
+ \begingroup
+ \collargs at process@arg
+ \edef\collargs at temp{\the\collargsArg}%
+ \edef\collargs at tempa{\expandafter\string\collargs at double@fix at cs@i}%
+ \ifx\collargs at temp\collargs at tempa
+ \global\collargs at fix@requestedtrue
+ \fi
+ \endgroup
+}
+\ifdefined\luatexversion
+ \def\collargs at insert@char#1#2#3{%
+ \edef\collargs at temp{\unexpanded{#1}}%
+ \expandafter\collargs at temp\directlua{%
+ tex.cprint(\number#3,string.char(\number#2))}%
+ }%
+ \def\collargs at make@char#1#2#3{%
+ \edef#1{\directlua{tex.cprint(\number#3,string.char(\number#2))}}%
+ }%
+\else
+ \ifdefined\XeTeXversion
+ \def\collargs at insert@char#1#2#3{%
+ \edef\collargs at temp{\unexpanded{#1}}%
+ \expandafter\collargs at temp\Ucharcat #2 #3
+ }%
+ \def\collargs at make@char#1#2#3{%
+ \edef#1{\Ucharcat#2 #3}%
+ }%
+ \else
+ \ExplSyntaxOn
+ \def\collargs at insert@char#1#2#3{%
+ \edef\collargs at temp{\unexpanded{#1}}%
+ \expandafter\expandafter\expandafter\collargs at temp\char_generate:nn{#2}{#3}%
+ }%
+ \def\collargs at make@char#1#2#3{%
+ \edef#1{\char_generate:nn{#2}{#3}}%
+ }%
+ \ExplSyntaxOff
+ \fi
+\fi
+\endinput
+%%
+%% End of file `collargs.sty'.
Property changes on: trunk/Master/texmf-dist/tex/latex/collargs/collargs.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex (rev 0)
+++ trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex 2023-10-11 20:25:43 UTC (rev 68512)
@@ -0,0 +1,1638 @@
+%%
+%% This is file `collargs.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% collargs.dtx (with options: `plain')
+%%
+%%
+%% This file is a part of CollArgs, a TeX package providing a command which can
+%% determine the argument scope of any command whose argument structure
+%% conforms to xparse's argument specification, available at
+%% https://ctan.org/pkg/advice and https://github.com/sasozivanovic/advice.
+%%
+%% Copyright (c) 2023- Saso Zivanovic <saso.zivanovic at guest.arnes.si>
+%% (Sa\v{s}o \v{Z}ivanovi\'{c})
+%%
+%% 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 Saso Zivanovic.
+%%
+%% The files belonging to this work and covered by LPPL are listed in
+%% (<texmf>/doc/generic/collargs/)FILES.
+\input pgfkeys
+\input etoolbox-generic
+\edef\resetatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}
+\catcode`\@11\relax
+\ifdefined\toksapp\else
+ \long\def\toksapp#1#2{#1\expandafter{\the#1#2}}%
+\fi
+\ifdefined\etoksapp\else
+ \long\def\etoksapp#1#2{#1\expandafter{\expanded{\the#1#2}}}%
+\fi
+\ifdefined\gtoksapp\else
+ \long\def\gtoksapp#1#2{\global#1\expandafter{\the#1#2}}%
+\fi
+\ifdefined\xtoksapp\else
+ \long\def\xtoksapp#1#2{\global#1\expandafter{\expanded{\the#1#2}}}%
+\fi
+\ifdefined\toks@\else\toksdef\toks@=0 \fi
+\protected\def\CollectArguments{%
+ \pgf at keys@utilifnextchar[\CollectArguments at i{\CollectArgumentsRaw{}}%]
+}
+\def\CollectArguments at i[#1]{\CollectArgumentsRaw{\collargsSet{#1}}}
+\protected\def\CollectArgumentsRaw#1#2#3{%
+ \begingroup
+ \global\let\ifcollargs at last@verbatim\ifcollargs at verbatim
+ \global\let\ifcollargs at last@verbatimbraces\ifcollargs at verbatimbraces
+ \global\collargs at double@fixfalse
+ \collargs at verbatim@wrap{#1}%
+ \collargs at init@grabspaces
+ \def\collargs at next{#3}%
+ \global\collargs at toks{}%
+ \collargs@#2.%
+}
+\def\collargsSet#1{\pgfqkeys{/collargs}{#1}}
+\def\collargs at cs@cases#1{\collargs at cs@cases at i#1\collargs at cs@cases at end}
+\let\collargs at cs@cases at end\relax
+\def\collargs at cs@cases at i{\futurelet\collargs at temp\collargs at cs@cases at ii}
+\def\collargs at cs@cases at ii#1#2\collargs at cs@cases at end{%
+ \ifcat\noexpand\collargs at temp\relax
+ \ifx\relax#2\relax
+ \expandafter\expandafter\expandafter\@firstofthree
+ \else
+ \expandafter\expandafter\expandafter\@secondofthree
+ \fi
+ \else
+ \expandafter\@thirdofthree
+ \fi
+}
+\def\@firstofthree#1#2#3{#1}
+\def\@secondofthree#1#2#3{#2}
+\def\@thirdofthree#1#2#3{#3}
+\collargsSet{
+ caller/.code={\collargsCaller{#1}},
+}
+\def\collargsCaller#1{%
+ \collargs at cs@cases{#1}{%
+ \let\collargs at temp\collargs at caller@cs
+ }{%
+ \let\collargs at temp\collargs at caller@csandmore
+ }{%
+ \let\collargs at temp\collargs at caller@env
+ }%
+ \collargs at temp{#1}%
+}
+\def\collargs at caller@cs#1{%
+ \def\collargs at caller{#1}%
+}
+\def\collargs at caller@csandmore#1{%
+ \begingroup
+ \escapechar -1
+ \expandafter\endgroup
+ \expandafter\def\expandafter\collargs at caller\expandafter{%
+ \csname\string#1\endcsname
+ }%
+}
+\def\collargs at caller@env#1{%
+ \expandafter\def\expandafter\collargs at caller\expandafter{%
+ \csname
+ #1%
+ \endcsname
+ }%
+}
+\collargsCaller\CollectArguments
+\newif\ifcollargs at verbatim
+\newif\ifcollargs at verbatimbraces
+\collargsSet{
+ verbatim/.code={\let\collargs at apply@verbatim\collargsVerbatim},
+ verb/.code={\let\collargs at apply@verbatim\collargsVerb},
+ no verbatim/.code={\let\collargs at apply@verbatim\collargsNoVerbatim},
+}
+\def\collargs at verbatim@wrap#1{%
+ \let\collargs at apply@verbatim\relax
+ #1%
+ \collargs at apply@verbatim
+}
+\collargsSet{
+ fix from verbatim/.code={\collargsFixFromVerbatim},
+ fix from verb/.code={\collargsFixFromVerb},
+ fix from no verbatim/.code={\collargsFixFromNoVerbatim},
+}
+\def\collargsFixFromNoVerbatim{%
+ \global\collargs at fix@requestedtrue
+ \global\let\ifcollargs at last@verbatim\iffalse
+}
+\def\collargsFixFromVerbatim{%
+ \global\collargs at fix@requestedtrue
+ \global\let\ifcollargs at last@verbatim\iftrue
+ \global\let\ifcollargs at last@verbatimbraces\iftrue
+}
+\def\collargsFixFromVerb{%
+ \global\collargs at fix@requestedtrue
+ \global\let\ifcollargs at last@verbatim\iftrue
+ \global\let\ifcollargs at last@verbatimbraces\iffalse
+}
+\collargsSet{
+ braces/.code={\collargsBraces{#1}}%
+}
+\collargsSet{
+ environment/.estore in=\collargs at b@envname
+}
+\def\collargsEnvironment#1{\edef\collargs at b@envname{#1}}
+\collargsEnvironment{}
+\collargsSet{
+ begin tag/.is if=collargsBeginTag,
+ end tag/.is if=collargsEndTag,
+ tags/.style={begin tag=#1, end tag=#1},
+ tags/.default=true,
+}
+\newif\ifcollargsBeginTag
+\newif\ifcollargsEndTag
+\collargsSet{
+ ignore nesting/.is if=collargsIgnoreNesting,
+}
+\newif\ifcollargsIgnoreNesting
+\collargsSet{
+ ignore other tags/.is if=collargsIgnoreOtherTags,
+}
+\newif\ifcollargsIgnoreOtherTags
+\collargsSet{
+ append preprocessor/.code={\collargsAppendPreprocessor{#1}},
+ prepend preprocessor/.code={\collargsPrependPreprocessor{#1}},
+ append postprocessor/.code={\collargsAppendPostprocessor{#1}},
+ prepend postprocessor/.code={\collargsPrependPostprocessor{#1}},
+}
+\def\collargsAppendPreprocessor{%
+ \collargs at addprocessor\appto\collargs at preprocess@arg}
+\def\collargsPrependPreprocessor{%
+ \collargs at addprocessor\preto\collargs at preprocess@arg}
+\def\collargsAppendPostprocessor{%
+ \collargs at addprocessor\appto\collargs at postprocess@arg}
+\def\collargsPrependPostprocessor{%
+ \collargs at addprocessor\preto\collargs at postprocess@arg}
+\def\collargs at addprocessor#1#2#3{%
+ #1#2{%
+ \expanded{%
+ \unexpanded{#3}{\the\collargsArg}%
+ }%
+ }%
+}
+\def\collargs at preprocess@arg{}
+\def\collargs at postprocess@arg{}
+\collargsSet{
+ clear preprocessors/.code={\collargsClearPreprocessors},
+ clear postprocessors/.code={\collargsClearPostprocessors},
+}
+\def\collargsClearPreprocessors{\def\collargs at preprocess@arg{}}%
+\def\collargsClearPostprocessors{\def\collargs at postprocess@arg{}}%
+\collargsSet{
+ append expandable preprocessor/.code={%
+ \collargsAppendExpandablePreprocessor{#1}},
+ prepend expandable preprocessor/.code={%
+ \collargsPrependExpandablePreprocessor{#1}},
+ append expandable postprocessor/.code={%
+ \collargsAppendExpandablePostprocessor{#1}},
+ prepend expandable postprocessor/.code={%
+ \collargsPrependExpandablePostprocessor{#1}},
+}
+\def\collargsAppendExpandablePreprocessor{%
+ \collargs at addeprocessor\appto\collargs at preprocess@arg}
+\def\collargsPrependExpandablePreprocessor{%
+ \collargs at addeprocessor\preto\collargs at preprocess@arg}
+\def\collargsAppendExpandablePostprocessor{%
+ \collargs at addeprocessor\appto\collargs at postprocess@arg}
+\def\collargsPrependExpandablePostprocessor{%
+ \collargs at addeprocessor\preto\collargs at postprocess@arg}
+\def\collargs at addeprocessor#1#2#3{%
+ #1#2{%
+ \expanded{%
+ \edef\noexpand\collargs at temp{\unexpanded{#3}{\the\collargsArg}}%
+ \unexpanded{\expandafter\collargsArg\expandafter{\collargs at temp}}%
+ }%
+ }%
+}
+\collargsSet{
+ append prewrap/.code={\collargsAppendPrewrap{#1}},
+ prepend prewrap/.code={\collargsPrependPrewrap{#1}},
+ append postwrap/.code={\collargsAppendPostwrap{#1}},
+ prepend postwrap/.code={\collargsPrependPostwrap{#1}},
+}
+\def\collargsAppendPrewrap{\collargs at addwrap\appto\collargs at preprocess@arg}
+\def\collargsPrependPrewrap{\collargs at addwrap\preto\collargs at preprocess@arg}
+\def\collargsAppendPostwrap{\collargs at addwrap\appto\collargs at postprocess@arg}
+\def\collargsPrependPostwrap{\collargs at addwrap\preto\collargs at postprocess@arg}
+\def\collargs at addwrap#1#2#3{%
+ #1#2{%
+ \long\def\collargs at temp##1{#3}%
+ \expandafter\expandafter\expandafter\collargsArg
+ \expandafter\expandafter\expandafter{%
+ \expandafter\collargs at temp\expandafter{\the\collargsArg}%
+ }%
+ }%
+}
+\collargsSet{%
+ no delimiters/.is if=collargsNoDelimiters,
+}
+\newif\ifcollargsNoDelimiters
+\def\collargs@{%
+ \begingroup
+ \collargs@@@
+}
+\def\collargs@@@#1{%
+ \collargs at in@{#1}{&+!>.}%
+ \ifcollargs at in@
+ \expandafter\collargs@@@iii
+ \else
+ \expandafter\collargs@@@i
+ \fi
+ #1%
+}
+\def\collargs@@@i#1.{%
+ \collargs at fix{\collargs@@@ii#1.}%
+}
+\def\collargs@@@ii{%
+ \global\collargs at fix@requestedfalse
+ \global\let\ifcollargs at last@verbatim\ifcollargs at verbatim
+ \global\let\ifcollargs at last@verbatimbraces\ifcollargs at verbatimbraces
+ \collargs@@@iii
+}
+\def\collargs@@@iii#1{%
+ \ifcsname collargs@#1\endcsname
+ \csname collargs@#1\expandafter\endcsname
+ \else
+ \collargs at error@badtype{#1}%
+ \fi
+}
+\def\collargs at error@badtype#1#2.{%
+ \PackageError{collargs}{Unknown xparse argument type or modifier "#1"
+ for "\expandafter\string\collargs at caller\space"}{}%
+ \endgroup
+}
+\csdef{collargs@&}{%
+ \futurelet\collargs at temp\collargs at amp@i
+}
+\def\collargs at amp@i{%
+ \ifx\collargs at temp&%
+ \expandafter\collargs at amp@raw
+ \else
+ \expandafter\collargs at amp@set
+ \fi
+}
+\def\collargs at amp@raw#1#2{%
+ \collargs at verbatim@wrap{#2}%
+ \collargs@@@
+}
+\def\collargs at amp@set#1{%
+ \collargs at verbatim@wrap{\collargsSet{#1}}%
+ \collargs@@@
+}
+\csdef{collargs at +}{%
+ \collargs at longtrue
+ \collargs@@@
+}
+\newif\ifcollargs at long
+\csdef{collargs@>}#1{\collargs@@@}
+\csdef{collargs@!}{%
+ \collargs at grabspacesfalse
+ \collargs@@@
+}
+\newtoks\collargs at toks
+\newtoks\collargsArg
+\csdef{collargs at .}{%
+ \endgroup
+ \expanded{%
+ \endgroup
+ \noexpand\collargs at fix{%
+ \expandonce\collargs at next{\the\collargs at toks}%
+ \collargs at spaces
+ }%
+ }%
+}
+\long\def\collargs at appendarg#1{%
+ \collargsArg={#1}%
+ \ifcollargs at double@fix
+ \collargs at cancel@double at fix
+ \fi
+ \collargs at preprocess@arg
+ \ifcollargsNoDelimiters
+ \else
+ \collargs at process@arg
+ \fi
+ \collargs at postprocess@arg
+ \xtoksapp\collargs at toks{\collargs at grabbed@spaces\the\collargsArg}%
+ \collargs at init@grabspaces
+ \endgroup
+}
+\def\collargs at wrap{\collargs at addwrap\appto\collargs at process@arg}
+\def\collargs at process@arg{}
+\def\collargs at defcollector#1#{%
+ \ifcollargs at long\long\fi
+ \expandafter\def\collargs at caller#1%
+}
+\def\collargs at defusecollector#1#{%
+ \afterassignment\collargs at caller
+ \ifcollargs at long\long\fi
+ \expandafter\def\collargs at caller#1%
+}
+\def\collargs at letusecollector#1{%
+ \expandafter\let\collargs at caller#1%
+ \collargs at caller
+}
+\newif\ifcollargs at grabspaces
+\collargs at grabspacestrue
+\def\collargs at init@grabspaces{%
+ \gdef\collargs at gs@state{0}%
+ \gdef\collargs at spaces{}%
+ \gdef\collargs at otherspaces{}%
+}
+\def\collargs at grabspaces#1{%
+ \edef\collargs at gs@next{\unexpanded{#1}}%
+ \ifnum\collargs at gs@state=0
+ \gdef\collargs at gs@state{1}%
+ \expandafter\collargs at gs@i
+ \else
+ \expandafter\collargs at gs@next
+ \fi
+}
+\def\collargs at gs@i{%
+ \futurelet\collargs at temp\collargs at gs@g
+}
+\def\collargs at gs@g{%
+ \ifcat\noexpand\collargs at temp\bgroup
+ \expandafter\collargs at gs@next
+ \else
+ \ifcat\noexpand\collargs at temp\egroup
+ \expandafter\expandafter\expandafter\collargs at gs@next
+ \else
+ \expandafter\expandafter\expandafter\collargs at gs@ii
+ \fi
+ \fi
+}
+\def\collargs at gs@ii{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at gos@iii
+ \else
+ \expandafter\collargs at gs@iii
+ \fi
+}
+\def\collargs at gs@iii{%
+ \expandafter\ifx\space\collargs at temp
+ \expandafter\collargs at gs@iv
+ \else
+ \expandafter\collargs at gs@next
+ \fi
+}
+\expandafter\def\expandafter\collargs at gs@iv\space{%
+ \gappto\collargs at spaces{ }%
+ \xappto\collargs at otherspaces{\collargs at otherspace}%
+ \collargs at gs@i
+}
+\begingroup\catcode`\ =12\relax\gdef\collargs at otherspace{ }\endgroup
+\def\collargs at gos@iii#1{%
+ \ifnum\collargs at cc{#1}=10
+ \expandafter\collargs at gos@iv
+ \else
+ \ifnum\collargs at cc{#1}=5
+ \expandafter\expandafter\expandafter\collargs at gos@v
+ \else
+ \expandafter\expandafter\expandafter\collargs at gs@next
+ \fi
+ \fi
+ #1%
+}
+\def\collargs at gos@iv#1{%
+ \gappto\collargs at otherspaces{#1}%
+ \gdef\collargs at spaces{ }%
+ \collargs at gs@i
+}
+\def\collargs at gos@v{%
+ \ifnum\collargs at gs@state=2
+ \expandafter\collargs at gs@next
+ \else
+ \expandafter\collargs at gs@vi
+ \fi
+}
+\def\collargs at gs@vi#1{%
+ \gdef\collargs at gs@state{2}%
+ \gappto\collargs at otherspaces{#1}%
+ \gdef\collargs at spaces{ }%
+ \collargs at gs@i
+}
+\def\collargs at maybegrabspaces{%
+ \ifcollargs at grabspaces
+ \expandafter\collargs at grabspaces
+ \else
+ \expandafter\@firstofone
+ \fi
+}
+\def\collargs at grabbed@spaces{%
+ \ifcollargs at verbatim
+ \collargs at otherspaces
+ \else
+ \collargs at spaces
+ \fi
+}
+\def\collargs at reinsert@spaces#1{%
+ \expanded{%
+ \unexpanded{%
+ \collargs at init@grabspaces
+ #1%
+ }%
+ \collargs at grabbed@spaces
+ }%
+}
+\long\def\collargs at ifnextcat#1#2#3{%
+ \let\pgf at keys@utilreserved at d=#1%
+ \def\pgf at keys@utilreserved at a{#2}%
+ \def\pgf at keys@utilreserved at b{#3}%
+ \futurelet\pgf at keys@utillet at token\collargs at ifncat}
+\def\collargs at ifncat{%
+ \ifx\pgf at keys@utillet at token\pgf at keys@utilsptoken
+ \let\pgf at keys@utilreserved at c\collargsxifnch
+ \else
+ \ifcat\noexpand\pgf at keys@utillet at token\pgf at keys@utilreserved at d
+ \let\pgf at keys@utilreserved at c\pgf at keys@utilreserved at a
+ \else
+ \let\pgf at keys@utilreserved at c\pgf at keys@utilreserved at b
+ \fi
+ \fi
+ \pgf at keys@utilreserved at c}
+{%
+ \def\:{\collargs at xifncat}
+ \expandafter\gdef\: {\futurelet\pgf at keys@utillet at token\collargs at ifncat}
+}
+\def\collargs at forrange#1#2{%
+ \expanded{%
+ \noexpand\collargs at forrange@i{\number#1}{\number#2}%
+ }%
+ }
+\def\collargs at forrange@i#1#2{%
+ \ifnum#1>#2 %
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+ {%
+ \collargs at do{#1}%
+ \expandafter\collargs at forrange@i\expandafter{\number\numexpr#1+1\relax}{#2}%
+ }%
+}
+\def\collargs at forranges{\forcsvlist\collarg at forrange@i}
+\def\collarg at forrange@i#1{\collarg at forrange@ii#1-}
+\def\collarg at forrange@ii#1-#2-{\collargs at forrange{#1}{#2}}
+\begingroup
+\catcode`\%=12
+\gdef\collargs at percentchar{%}
+\endgroup
+\def\collargs at l#1.{%
+ \collargs at reinsert@spaces{\collargs at l@i#1.}%
+}
+\def\collargs at l@i{%
+ \global\collargs at fix@requestedtrue
+ \ifcollargs at verbatimbraces
+ \expandafter\collargs at l@verb
+ \else
+ \expandafter\collargs at l@ii
+ \fi
+}
+\def\collargs at l@ii#1.{%
+ \collargs at defusecollector##1##{%
+ \collargs at appendarg{##1}%
+ \collargs@#1.%
+ }%
+}
+\def\collargs at l@verb#1.{%
+ \expandafter\collargs at defusecollector
+ \expandafter##\expandafter1\collargs at other@bgroup{%
+ \collargs at appendarg{##1}%
+ \expanded{%
+ \noexpand\collargs@\unexpanded{#1.}%
+ \collargs at other@bgroup
+ }%
+ }%
+}
+\def\collargs at u{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at u@verb
+ \else
+ \expandafter\collargs at u@i
+ \fi
+}
+\def\collargs at u@verb#1{%
+ \expandafter\collargs at u@i\expandafter{\detokenize\expandafter{\string#1}}%
+}
+\def\collargs at u@i#1#2.{%
+ \collargs at reinsert@spaces{\collargs at u@ii{#1}#2.}%
+}
+\def\collargs at u@ii#1#2.{%
+ \collargs at defusecollector##1#1{%
+ \collargs at wrap{####1#1}%
+ \expandafter\collargs at appendarg\expandafter{##1}%
+ \collargs@#2.%
+ }%
+ \collargs at empty
+}
+\def\collargs at empty{}
+\def\collargs at r{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at r@verb
+ \else
+ \expandafter\collargs at r@i
+ \fi
+}
+\def\collargs at r@verb#1#2{%
+ \expandafter\collargs at r@i\detokenize{#1#2}%
+}
+\def\collargs at r@i#1#2#3.{%
+ \collargs at defcollector#1{%
+ \collargs at defusecollector####1#2{%
+ \collargs at wrap{#1########1#2}%
+ \expandafter\collargs at appendarg\expandafter{####1}%
+ \collargs@#3.%
+ }%
+ \collargs at empty
+ }%
+ \collargs at grabspaces\collargs at caller
+}
+\def\collargs at R#1#2#3{\collargs at r#1#2}
+\def\collargs at d{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at d@verb
+ \else
+ \expandafter\collargs at d@i
+ \fi
+}
+\def\collargs at d@verb#1#2{%
+ \expandafter\collargs at d@i\detokenize{#1#2}%
+}
+\def\collargs at d@i#1#2#3.{%
+ \def\collargs at d@noopt{%
+ \global\collargs at fix@requestedtrue
+ \endgroup
+ \collargs@#3.%
+ }%
+ \collargs at defcollector#1{%
+ \collargs at defusecollector####1#2{%
+ \collargs at wrap{#1########1#2}%
+ \expandafter\collargs at appendarg\expandafter{####1}%
+ \collargs@#3.%
+ }%
+ \collargs at empty
+ }%
+ \def\collargs at d@ii{%
+ \ifx#1\collargs at temp
+ \expandafter\collargs at caller
+ \else
+ \expandafter\collargs at d@noopt
+ \fi
+ }%
+ \collargs at maybegrabspaces{\futurelet\collargs at temp\collargs at d@ii}%
+}
+\def\collargs at D#1#2#3{\collargs at d#1#2}
+\def\collargs at o{\collargs at d[]}
+\def\collargs at O#1{\collargs at d[]}
+\def\collargs at t{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at t@verb
+ \else
+ \expandafter\collargs at t@i
+ \fi
+}
+\def\collargs at t@space{ }
+\def\collargs at t@verb#1{%
+ \let\collargs at t@space\collargs at otherspace
+ \expandafter\collargs at t@i\expandafter{\detokenize{#1}}%
+}
+\def\collargs at t@i#1{%
+ \expandafter\ifx\space#1%
+ \expandafter\collargs at t@s
+ \else
+ \expandafter\collargs at t@I\expandafter#1%
+ \fi
+}
+\def\collargs at t@s#1.{%
+ \collargs at grabspaces{%
+ \ifcollargs at grabspaces
+ \collargs at appendarg{}%
+ \else
+ \expanded{%
+ \noexpand\collargs at init@grabspaces
+ \noexpand\collargs at appendarg{\collargs at grabbed@spaces}%
+ }%
+ \fi
+ \collargs@#1.%
+ }%
+}
+\def\collargs at t@I#1#2.{%
+ \def\collargs at t@noopt{%
+ \global\collargs at fix@requestedtrue
+ \endgroup
+ \collargs@#2.%
+ }%
+ \def\collargs at t@opt##1{%
+ \collargs at appendarg{#1}%
+ \collargs@#2.%
+ }%
+ \def\collargs at t@ii{%
+ \ifx#1\collargs at temp
+ \expandafter\collargs at t@opt
+ \else
+ \expandafter\collargs at t@noopt
+ \fi
+ }%
+ \collargs at maybegrabspaces{\futurelet\collargs at temp\collargs at t@ii}%
+}
+\def\collargs at t@opt at space{%
+ \expanded{\noexpand\collargs at t@opt{\space}\expandafter}\romannumeral-0%
+}%
+\def\collargs at s{\collargs at t*}
+\def\collargs at m{%
+ \ifcollargs at verbatim
+ \expandafter\collargs at m@verb
+ \else
+ \expandafter\collargs at m@i
+ \fi
+}
+\def\collargs at m@i#1.{%
+ \collargs at grabspaces{\collargs at m@checkforgroup#1.}%
+}
+\def\collargs at m@checkforgroup#1.{%
+ \edef\collargs at action{\unexpanded{\collargs at m@checkforgroup at i#1.}}%
+ \futurelet\collargs at token\collargs at action
+}
+\def\collargs at m@checkforgroup at i{%
+ \ifcat\noexpand\collargs at token\bgroup
+ \expandafter\collargs at m@group
+ \else
+ \expandafter\collargs at m@token
+ \fi
+}
+\def\collargs at m@group#1.{%
+ \collargs at defusecollector##1{%
+ \collargs at wrap{{####1}}%
+ \collargs at appendarg{##1}%
+ \collargs@#1.%
+ }%
+}
+\def\collargs at m@token#1.{%
+ \collargs at defusecollector##1{%
+ \collargs at appendarg{##1}%
+ \collargs@#1.%
+ }%
+}
+\def\collargs at m@verb#1.{%
+ \collargs at grabspaces{\collargs at m@verb at checkforgroup#1.}%
+}
+\def\collargs at m@verb at checkforgroup{%
+ \ifcollargs at verbatimbraces
+ \expandafter\collargs at m@verb at checkforgroup@i
+ \else
+ \expandafter\collargs at m@checkforgroup
+ \fi
+}
+\def\collargs at m@verb at checkforgroup@i#1.{%
+ \def\collargs at m@verb at checkforgroup@ii{\collargs at m@verb at checkforgroup@iii#1.}%
+ \futurelet\collargs at temp\collargs at m@verb at checkforgroup@ii
+}
+\def\collargs at m@verb at checkforgroup@iii#1.{%
+ \expandafter\ifx\collargs at other@bgroup\collargs at temp
+ \expandafter\collargs at m@verb at group
+ \else
+ \expandafter\ifx\collargs at other@egroup\collargs at temp
+ \expandafter\expandafter\expandafter\collargs at m@verb at egrouperror
+ \else
+ \expandafter\expandafter\expandafter\collargs at m@v at token
+ \fi
+ \fi
+ #1.%
+}
+\def\collargs at m@verb at egrouperror#1.{%
+ \PackageError{collargs}{%
+ Argument of \expandafter\string\collargs at caller\space has an extra
+ \iffalse{\else\string}}{}%
+}
+\def\collargs at m@v at token#1.#2{%
+ \ifnum\collargs at cc{#2}=0
+ \expandafter\collargs at m@v at token@cs
+ \else
+ \expandafter\collargs at m@token
+ \fi
+ #1.#2%
+}
+\def\collargs at m@v at token@cs#1.#2#3{%
+ \ifnum\collargs at cc{#3}=11
+ \expandafter\collargs at m@v at token@cs at letter
+ \else
+ \expandafter\collargs at m@v at token@cs at nonletter
+ \fi
+ #1.#2#3%
+}
+\def\collargs at m@v at token@cs at nonletter#1.#2#3{%
+ \collargs at appendarg{#2#3}%
+ \collargs@#1.%
+}
+\def\collargs at m@v at token@cs at letter#1.#2{%
+ \collargsArg{#2}%
+ \def\collargs at tempa{#1}%
+ \collargs at m@v at token@cs at letter@i
+}
+\def\collargs at m@v at token@cs at letter@i#1{%
+ \ifnum\collargs at cc{#1}=11
+ \toksapp\collargsArg{#1}%
+ \expandafter\collargs at m@v at token@cs at letter@i
+ \else
+ \expandafter\collargs at m@v at token@cs at letter@ii\expandafter#1%
+ \fi
+}
+\def\collargs at m@v at token@cs at letter@ii{%
+ \expanded{%
+ \unexpanded{%
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ }%
+ \noexpand\collargs@\expandonce\collargs at tempa.%
+ }%
+}
+\def\collargs at m@verb at group#1.#2{%
+ \let\collargs at begintag\collargs at other@bgroup
+ \let\collargs at endtag\collargs at other@egroup
+ \def\collargs at tagarg{}%
+ \def\collargs at commandatend{\collargs at m@verb at group@i#1.}%
+ \collargs at readContent
+}
+\def\collargs at m@verb at group@i{%
+ \edef\collargs at temp{%
+ \collargs at other@bgroup\unexpanded{##1}\collargs at other@egroup}%
+ \expandafter\collargs at wrap\expandafter{\collargs at temp}%
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ \collargs@
+}
+\def\collargs at g{%
+ \def\collargs at m@token{%
+ \global\collargs at fix@requestedtrue
+ \endgroup
+ \collargs@
+ }%
+ \let\collargs at m@v at token\collargs at m@token
+ \collargs at m
+}
+\def\collargs at G#1{\collargs at g}
+\def\collargs at v#1.{%
+ \begingroup
+ \collargsBraces{{}}%
+ \collargsVerbatim
+ \collargs at grabspaces{\collargs at v@i#1.}%
+}
+\def\collargs at v@i#1.#2{%
+ \expandafter\ifx\collargs at other@bgroup#2%
+ \let\collargs at begintag\collargs at other@bgroup
+ \let\collargs at endtag\collargs at other@egroup
+ \def\collargs at tagarg{}%
+ \def\collargs at commandatend{%
+ \edef\collargs at temp{%
+ \collargs at other@bgroup\unexpanded{####1}\collargs at other@egroup}%
+ \expandafter\collargs at wrap\expandafter{\collargs at temp}%
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ \endgroup
+ \collargs@#1.%
+ }%
+ \expandafter\collargs at readContent
+ \else
+ \collargs at defcollector##1#2{%
+ \collargs at wrap{#2####1#2}%
+ \collargs at appendarg{##1}%
+ \endgroup
+ \collargs@#1.%
+ }%
+ \expandafter\collargs at caller
+ \fi
+}
+\def\collargs at b{%
+ \collargs at ifnextcat\bgroup\collargs at bg\collargs at bi
+}
+\def\collargs at bg#1{%
+ \edef\collargs at b@envname{#1}%
+ \collargs at bi
+}
+\def\collargs at bi#1.{%
+ \ifcollargs at verbatim
+ \edef\collargs at b@envname{\detokenize\expandafter{\collargs at b@envname}}%
+ \fi
+ \collargs at bi@defCPTbeginend
+ \edef\collargs at tagarg{%
+ \ifcollargs at verbatimbraces
+ \else
+ \ifcollargsIgnoreOtherTags
+ \collargs at b@envname
+ \fi
+ \fi
+ }%
+ \def\collargs at commandatend{%
+ \collargs at biii
+ #1.%
+ }%
+ \collargs at reinsert@spaces\collargs at readContent
+}
+\def\collargs at bi@defCPTbeginend{%
+ \edef\collargs at begintag{%
+ \ifcollargs at verbatim
+ \expandafter\expandafter\expandafter\string
+ \else
+ \expandafter\expandafter\expandafter\noexpand
+ \fi
+ \csname
+ \collargs at b@envname
+ \endcsname
+ }%
+ \edef\collargs at endtag{%
+ \ifcollargs at verbatim
+ \expandafter\expandafter\expandafter\string
+ \else
+ \expandafter\expandafter\expandafter\noexpand
+ \fi
+ \csname
+ end%
+ \collargs at b@envname
+ \endcsname
+ }%
+}
+\def\collargs at biii{%
+ \collargs at b@def at wrapper
+ \expandafter\collargs at appendarg\expandafter{\the\collargsArg}%
+ \collargs@
+}
+\def\collargs at b@def at wrapper{%
+ \edef\collargs at temp{%
+ \ifcollargsBeginTag
+ \expandonce\collargs at begintag
+ \fi
+ ####1%
+ \ifcollargsEndTag
+ \expandonce\collargs at endtag
+ \fi
+ }%
+ \expandafter\collargs at wrap\expandafter{\collargs at temp}%
+}
+\def\collargs at readContent{%
+ \ifcollargs at long\long\fi
+ \collargs at CPT@def\collargs at gobbleOneB\collargs at begintag{%
+ \expandafter\toks@\expandafter{##1}%
+ \futurelet\collargs at temp\collargs at gobbleOneB@i
+ }%
+ \ifcollargs at long\long\fi
+ \collargs at CPT@def\collargs at gobbleUntilE\collargs at endtag{%
+ \expandafter\toksapp\expandafter\toks@\expandafter{##1}%
+ \collargs at gobbleUntilE@i
+ }%
+ \collargs at begins=0\relax
+ \collargsArg{}%
+ \toks@{}%
+ \collargs at letusecollector\collargs at gobbleUntilE
+ \collargs at empty
+}
+\newcount\collargs at begins
+\def\collargs at CPT@def#1#2{%
+ \expandafter\def\expandafter#1%
+ \expandafter##\expandafter1#2%
+}
+\def\collargs at qend{\collargs at qend}
+\def\collargs at gobbleOneB@i{%
+ \def\collargs at begins@increment{1}%
+ \ifx\collargs at qend\collargs at temp
+ \def\collargs at begins@increment{-1}%
+ \expandafter\collargs at gobbleOneB@v
+ \else
+ \etoksapp\toks@{\expandonce\collargs at begintag}%
+ \expandafter\collargs at gobbleOneB@ii
+ \fi
+}%
+\def\collargs at gobbleOneB@ii{%
+ \expandafter\ifx\expandafter\relax\collargs at tagarg\relax
+ \expandafter\collargs at gobbleOneB@vi
+ \else
+ \expandafter\collargs at gobbleOneB@iii
+ \fi
+}
+\def\collargs at gobbleOneB@iii{%
+ \collargs at grabspaces{%
+ \collargs at letusecollector\collargs at gobbleOneB@iv
+ }%
+}
+\def\collargs at gobbleOneB@iv#1{%
+ \def\collargs at temp{#1}%
+ \ifx\collargs at temp\collargs at tagarg
+ \else
+ \def\collargs at begins@increment{0}%
+ \fi
+ \etoksapp\toks@{\collargs at grabbed@spaces\unexpanded{{#1}}}%
+ \collargs at init@grabspaces
+ \collargs at gobbleOneB@vi
+}
+\def\collargs at gobbleOneB@v#1{\collargs at gobbleOneB@vi}
+\def\collargs at gobbleOneB@vi{%
+ \etoksapp\collargsArg{\the\toks@}%
+ \advance\collargs at begins\collargs at begins@increment\relax
+ \ifnum\collargs at begins@increment=-1
+ \else
+ \expandafter\collargs at gobbleOneB\expandafter\collargs at empty
+ \fi
+}
+\def\collargs at gobbleUntilE@i{%
+ \expandafter\ifx\expandafter\relax\collargs at tagarg\relax
+ \expandafter\collargs at gobbleUntilE@iv
+ \else
+ \expandafter\collargs at gobbleUntilE@ii
+ \fi
+}
+\def\collargs at gobbleUntilE@ii{%
+ \collargs at grabspaces{%
+ \collargs at letusecollector\collargs at gobbleUntilE@iii
+ }%
+}
+\def\collargs at gobbleUntilE@iii#1{%
+ \etoksapp\toks@{\collargs at grabbed@spaces}%
+ \collargs at init@grabspaces
+ \def\collargs at tempa{#1}%
+ \ifx\collargs at tempa\collargs at tagarg
+ \expandafter\collargs at gobbleUntilE@iv
+ \else
+ \expandafter\toksapp\expandafter\toks@\expandafter{\collargs at endtag{#1}}%
+ \expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
+ \fi
+}
+\def\collargs at gobbleUntilE@iv{%
+ \ifcollargsIgnoreNesting
+ \expandafter\collargsArg\expandafter{\the\toks@}%
+ \expandafter\collargs at commandatend
+ \else
+ \expandafter\collargs at gobbleUntilE@v
+ \fi
+}
+\def\collargs at gobbleUntilE@v{%
+ \expanded{%
+ \noexpand\collargs at letusecollector\noexpand\collargs at gobbleOneB
+ \noexpand\collargs at empty
+ \the\toks@
+ \expandonce\collargs at begintag
+ \noexpand\collargs at qend
+ }%
+ \ifnum\collargs at begins<0
+ \expandafter\collargs at commandatend
+ \else
+ \etoksapp\collargsArg{%
+ \expandonce\collargs at endtag
+ \expandafter\ifx\expandafter\relax\collargs at tagarg\relax\else{%
+ \expandonce\collargs at tagarg}\fi
+ }%
+ \toks@={}%
+ \expandafter\collargs at letusecollector\expandafter\collargs at gobbleUntilE
+ \expandafter\collargs at empty
+ \fi
+}
+\def\collargs at e{%
+ \global\collargs at fix@requestedtrue
+ \begingroup
+ \ifcollargs at verbatim
+ \expandafter\collargs at e@verbatim
+ \else
+ \expandafter\collargs at e@i
+ \fi
+}
+\def\collargs at e@verbatim#1{%
+ \expandafter\collargs at e@i\expandafter{\detokenize{#1}}%
+}
+\def\collargs at e@i#1{\collargs at e@ii#1.}
+\def\collargs at e@ii#1.#2.{%
+ \collargs at grabspaces{\collargs at e@iii#1.#2.}%
+}
+\def\collargs at e@iii#1.#2.{%
+ \def\collargs at e@iv{\collargs at e@v#1.#2.}%
+ \futurelet\collargs at temp\collargs at e@iv
+}
+\def\collargs at e@v{%
+ \ifcat\noexpand\collargs at temp\bgroup\relax
+ \let\collargs at marshal\collargs at e@z
+ \else
+ \ifcat\noexpand\collargs at temp\egroup\relax
+ \let\collargs at marshal\collargs at e@z
+ \else
+ \let\collargs at marshal\collargs at e@vi
+ \fi
+ \fi
+ \collargs at marshal
+}
+\newif\ifcollargs at in@
+\def\collargs at in@#1#2{%
+ \def\collargs at in@@##1#1##2##3\collargs at in@@{%
+ \ifx\collargs at in@##2\global\collargs at in@false\else\global\collargs at in@true\fi
+ }%
+ {\collargs at in@@#2#1\collargs at in@\collargs at in@@}%
+}
+\def\collargs at e@vi#1.#2.#3{%
+ \collargs at in@{#3}{#1}%
+ \ifcollargs at in@
+ \expandafter\collargs at e@vii
+ \else
+ \expandafter\collargs at e@z
+ \fi
+ #1.#2.#3%
+}
+\def\collargs at e@vii#1.#2.#3{%
+ \let\collargs at real@appendarg\collargs at appendarg
+ \def\collargs at appendarg##1{\collargsArg{##1}}%
+ \def\collargs@{\collargs at e@viii#1.#3}%
+ \collargs at m#2.%
+}
+\def\collargs at e@viii#1.#2#3.{%
+ \collargs at wrap{#2##1}%
+ \def\collargs at e@ix##1#2{\collargs at e@x##1}%
+ \collargs at e@ix#1.#3.%
+}
+\def\collargs at e@x{%
+ \expandafter\collargs at real@appendarg\expandafter{\the\collargsArg}%
+ \begingroup
+ \collargs at e@ii
+}
+\def\collargs at e@z#1.{\endgroup\endgroup\collargs@}
+\def\collargs at E#1#2{\collargs at e{#1}}
+\let\collargs at NoVerbatimAfterNoVerbatim\relax
+\def\collargs at VerbAfterNoVerbatim{%
+ \collargs at verbatimtrue
+ \collargs at verbatimbracesfalse
+ \collargs at make@verbatim
+ \collargs at after{Verb}%
+}
+\def\collargs at VerbatimAfterNoVerbatim{%
+ \collargs at verbatimtrue
+ \collargs at verbatimbracestrue
+ \collargs at make@verbatim
+ \collargs at after{Verbatim}%
+}
+\def\collargs at NoVerbatimAfterVerb{%
+ \collargs at verbatimfalse
+ \collargs at verbatimbracesfalse
+ \collargs at make@other at groups
+ \collargs at make@no at verbatim
+ \collargs at after{NoVerbatim}%
+}
+\def\collargs at VerbAfterVerb{%
+ \collargs at make@other at groups
+}
+\def\collargs at VerbatimAfterVerb{%
+ \collargs at verbatimbracestrue
+ \collargs at make@other at groups
+ \def\collargs at do##1{\catcode##1=12 }%
+ \collargs at bgroups
+ \collargs at egroups
+ \collargs at after{Verbatim}%
+}%
+\let\collargs at NoVerbatimAfterVerbatim\collargs at NoVerbatimAfterVerb
+\def\collargs at VerbAfterVerbatim{%
+ \collargs at verbatimbracesfalse
+ \collargs at make@other at groups
+ \def\collargs at do##1{\catcode##1=1 }%
+ \collargs at bgroups
+ \def\collargs at do##1{\catcode##1=2 }%
+ \collargs at egroups
+ \collargs at after{Verb}%
+}%
+\let\collargs at VerbatimAfterVerbatim\collargs at VerbAfterVerb
+\def\collargs at after#1{%
+ \letcs\collargsVerbatim{collargs at VerbatimAfter#1}%
+ \letcs\collargsVerb{collargs at VerbAfter#1}%
+ \letcs\collargsNoVerbatim{collargs at NoVerbatimAfter#1}%
+}
+\collargs at after{NoVerbatim}
+\def\collargs at bgroups{}%
+\def\collargs at egroups{}%
+\ifdefined\luatexversion
+ \def\collargs at cc#1{%
+ \directlua{tex.sprint(tex.getcatcode(\collargs at catcodetable@original,
+ \the\numexpr\expandafter`\csname#1\endcsname\relax))}%
+ }
+\else
+ \def\collargs at cc#1{%
+ \ifcsname collargs at cc@\the\numexpr\expandafter`\csname#1\endcsname\endcsname
+ \csname collargs at cc@\the\numexpr\expandafter`\csname#1\endcsname\endcsname
+ \else
+ 12%
+ \fi
+ }
+\fi
+\def\collargsBraces#1{%
+ \expandafter\collargs at braces@i\detokenize{#1}\relax
+}
+\def\collargs at braces@i#1#2#3\relax{%
+ \def\collargs at make@other at groups{%
+ \def\collargs at other@bgroup{#1}%
+ \def\collargs at other@egroup{#2}%
+ }%
+}
+\def\collargs at make@other at groups{}
+\ifdefined\luatexversion
+ \ifdefined\collargs at catcodetable@verbatim\else
+ \chardef\collargs at catcodetable@verbatim=4242
+ \fi
+ \chardef\collargs at catcodetable@atletter=%
+ \number\numexpr\collargs at catcodetable@verbatim+1\relax
+ \chardef\collargs at catcodetable@initex=%
+ \number\numexpr\collargs at catcodetable@verbatim+2\relax
+ \initcatcodetable\collargs at catcodetable@initex
+ \savecatcodetable\collargs at catcodetable@atletter
+ \begingroup
+ \@firstofone{%
+ \catcodetable\collargs at catcodetable@initex
+ \catcode`\\=12
+ \catcode13=12
+ \catcode0=12
+ \catcode32=12
+ \catcode`\%=12
+ \catcode127=12
+ \def\collargs at do#1{\catcode#1=12 }%
+ \collargs at forrange{`\a}{`\z}%
+ \collargs at forrange{`\A}{`\Z}%
+ \savecatcodetable\collargs at catcodetable@verbatim
+ \endgroup
+ }%
+\fi
+\collargsSet{
+ verbatim ranges/.store in=\collargs at verbatim@ranges,
+}
+\def\collargsVerbatimRanges#1{\def\collargs at verbatim@ranges{#1}}
+\def\collargs at verbatim@ranges{0-255}
+\ifdefined\luatexversion
+ \def\collargs at make@verbatim{%
+ \directlua{%
+ for from, to in string.gmatch(
+ "\luaescapestring{\collargs at verbatim@ranges}",
+ "(\collargs at percentchar d+)-(\collargs at percentchar d+)"
+ ) do
+ for char = tex.round(from), tex.round(to) do
+ catcode = tex.catcode[char]
+ if catcode == 1 then
+ tex.sprint(
+ \number\collargs at catcodetable@atletter,
+ "\noexpand\\collargs at make@verbatim at bgroup{" .. char .. "}")
+ elseif catcode == 2 then
+ tex.sprint(
+ \number\collargs at catcodetable@atletter,
+ "\noexpand\\collargs at make@verbatim at egroup{" .. char .. "}")
+ elseif catcode == 14 then
+ tex.sprint(
+ \number\collargs at catcodetable@atletter,
+ "\noexpand\\collargs at make@verbatim at comment{" .. char .. "}")
+ end
+ end
+ end
+ }%
+ \edef\collargs at catcodetable@original{\the\catcodetable}%
+ \catcodetable\collargs at catcodetable@verbatim
+ \ifcollargs at verbatimbraces
+ \else
+ \def\collargs at do##1{\catcode##1=1\relax}%
+ \collargs at bgroups
+ \def\collargs at do##1{\catcode##1=2\relax}%
+ \collargs at egroups
+ \fi
+ }
+\else
+ \def\collargs at make@verbatim{%
+ \ifdefempty\collargs at make@other at groups{}{%
+ \collargs at make@other at groups
+ \def\collargs at make@other at groups{}%
+ \let\collargs at make@other at bgroup\@gobble
+ \let\collargs at make@other at egroup\@gobble
+ }%
+ \gdef\collargs at comments{}%
+ \let\collargs at do\collargs at make@verbatim at char
+ \expandafter\collargs at forranges\expandafter{\collargs at verbatim@ranges}%
+ }
+ \def\collargs at make@verbatim at char#1{%
+ \ifnum\catcode#1=12
+ \else
+ \csedef{collargs at cc@#1}{\the\catcode#1}%
+ \fi
+ \ifnum\catcode#1=1
+ \collargs at make@verbatim at bgroup{#1}%
+ \else
+ \ifnum\catcode#1=2
+ \collargs at make@verbatim at egroup{#1}%
+ \else
+ \ifnum\catcode#1=14
+ \collargs at make@verbatim at comment{#1}%
+ \fi
+ \ifnum\catcode#1=12
+ \else
+ \catcode#1=12\relax
+ \fi
+ \fi
+ \fi
+ }
+\fi
+\def\collargs at make@verbatim at bgroup#1{%
+ \ifcollargs at verbatimbraces
+ \catcode#1=12\relax
+ \fi
+ \appto\collargs at bgroups{\collargs at do{#1}}%
+ \collargs at make@other at bgroup{#1}%
+}
+\def\collargs at make@other at bgroup#1{%
+ \collargs at make@char\collargs at other@bgroup{#1}{12}%
+ \let\collargs at make@other at bgroup\@gobble
+}
+\def\collargs at make@verbatim at egroup#1{%
+ \ifcollargs at verbatimbraces
+ \catcode#1=12\relax
+ \fi
+ \appto\collargs at egroups{\collargs at do{#1}}%
+ \collargs at make@other at egroup{#1}%
+}
+\def\collargs at make@other at egroup#1{%
+ \collargs at make@char\collargs at other@egroup{#1}{12}%
+ \let\collargs at make@other at egroup\@gobble
+}
+\def\collargs at make@verbatim at comment#1{%
+ \gappto\collargs at comments{\collargs at do{#1}}%
+}
+\ifdefined\luatexversion
+ \def\collargs at make@no at verbatim{%
+ \catcodetable\collargs at catcodetable@original\relax
+ }%
+\else
+\def\collargs at make@no at verbatim{%
+ \let\collargs at do\collargs at make@no at verbatim@char
+ \expandafter\collargs at forranges\expandafter{\collargs at verbatim@ranges}%
+}
+\fi
+\def\collargs at make@no at verbatim@char#1{%
+ \ifcsname collargs at cc@#1\endcsname
+ \catcode#1=\csname collargs at cc@#1\endcsname\relax
+ \fi
+}
+\newif\ifcollargs at fix@requested
+\long\def\collargs at fix#1{%
+ \edef\collargs at fix@next{\unexpanded{#1}}%
+ \ifcollargs at fix@requested
+ \letcs\collargs at action{collargs at fix@%
+ \ifcollargs at last@verbatim
+ \ifcollargs at last@verbatimbraces V\else v\fi
+ \else
+ N%
+ \fi
+ to%
+ \ifcollargs at verbatim
+ \ifcollargs at verbatimbraces V\else v\fi
+ \else
+ N%
+ \fi
+ }%
+ \else
+ \let\collargs at action\collargs at fix@next
+ \fi
+ \collargs at action
+}
+\def\collargs at fix@NtoN{\collargs at fix@next}
+\let\collargs at fix@vtov\collargs at fix@NtoN
+\let\collargs at fix@VtoV\collargs at fix@NtoN
+\def\collargs at fix@Ntov{%
+ \futurelet\collargs at temp\collargs at fix@cc at to@other at ii
+}
+\def\collargs at fix@cc at to@other at ii{%
+ \ifcat\noexpand\collargs at temp\bgroup
+ \let\collargs at action\collargs at fix@next
+ \else
+ \ifcat\noexpand\collargs at temp\egroup
+ \let\collargs at action\collargs at fix@next
+ \else
+ \let\collargs at action\collargs at fix@NtoV
+ \fi
+ \fi
+ \collargs at action
+}
+\def\collargs at fix@NtoV{%
+ \ifcollargs at double@fix
+ \ifcollargs at in@second at fix
+ \expandafter\expandafter\expandafter\collargs at fix@NtoV at secondfix
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@NtoV at onemore
+ \fi
+ \else
+ \expandafter\collargs at fix@NtoV at singlefix
+ \fi
+}
+\def\collargs at fix@NtoV at singlefix{%
+ \expandafter\collargs at fix@next\string
+}
+\def\collargs at fix@NtoV at onemore#1{%
+ \collargs at do@one at more@fix{%
+ \expandafter\collargs at fix@next\string#1%
+ }%
+}
+\def\collargs at fix@NtoV at secondfix{%
+ \if\noexpand\collargs at temp\relax
+ \expandafter\collargs at fix@NtoV at secondfix@i
+ \else
+ \expandafter\collargs at fix@NtoV at singlefix
+ \fi
+}
+\def\collargs at fix@NtoV at secondfix@i#1{%
+ \gdef\collargs at double@fix at cs@ii{#1}%
+ \collargs at fix@NtoV at singlefix#1%
+}
+\def\collargs at fix@vtoN{%
+ \futurelet\collargs at token\collargs at fix@vtoN at i
+}
+\def\collargs at fix@vtoN at i{%
+ \ifcat\noexpand\collargs at token\bgroup
+ \expandafter\collargs at fix@next
+ \else
+ \ifcat\noexpand\collargs at token\egroup
+ \expandafter\expandafter\expandafter\collargs at fix@next
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN
+ \fi
+ \fi
+}
+\def\collargs at fix@vtoV{%
+ \futurelet\collargs at token\collargs at fix@vtoV at i
+}
+\def\collargs at fix@vtoV at i{%
+ \ifcat\noexpand\collargs at token\bgroup
+ \expandafter\collargs at fix@NtoV
+ \else
+ \ifcat\noexpand\collargs at token\egroup
+ \expandafter\expandafter\expandafter\collargs at fix@NtoV
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@next
+ \fi
+ \fi
+}
+\def\collargs at fix@catcode at of@braces at fromverbatim#1{%
+ \ifnum\catcode`#1=1
+ \expandafter\collargs at fix@VtoN
+ \expandafter#1%
+ \else
+ \ifnum\catcode`#1=2
+ \expandafter\expandafter\expandafter\collargs at fix@cc at VtoN
+ \expandafter\expandafter\expandafter#1%
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@next
+ \fi
+ \fi
+}
+\def\collargs at fix@VtoN#1{%
+ \ifnum\catcode`#1=0
+ \expandafter\collargs at fix@VtoN at escape
+ \else
+ \ifnum\catcode`#1=14
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at comment
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at token
+ \fi
+ \fi
+ #1%
+}
+\def\collargs at fix@VtoN at token#1{%
+ \collargs at insert@char\collargs at fix@next{`#1}{\the\catcode`#1}%
+}
+\def\collargs at defcommentstripper#1#2{%
+ \def#1##1{%
+ \begingroup%
+ \escapechar=`\\%
+ \catcode\endlinechar=\active%
+ \def\collargs at do####1{\catcode####1=12 }%
+ \collargs at comments
+ \csname\string#1\endcsname%
+ }%
+ \begingroup%
+ \escapechar=`\\%
+ \lccode`\~=\endlinechar%
+ \lowercase{%
+ \expandafter\endgroup
+ \expandafter\def\csname\string#1\endcsname##1~%
+ }{%
+ \endgroup#2%
+ }%
+}
+\collargs at defcommentstripper\collargs at fix@VtoN at comment{%
+ \collargs at fix@next
+}
+\let\collargs at defcommentstripper\relax
+\def\collargs at fix@VtoN at escape#1{%
+ \ifcollargs at double@fix
+ \expandafter\collargs at fix@VtoN at escape@d
+ \else
+ \expandafter\collargs at fix@VtoN at escape@i
+ \fi
+}
+\def\collargs at fix@VtoN at escape@i{%
+ \begingroup
+ \catcode`\\=12
+ \catcode`\{=12
+ \catcode`\}=12
+ \catcode`\ =12
+ \collargs at fix@VtoN at escape@ii
+}
+\def\collargs at fix@VtoN at escape@ii#1{%
+ \endgroup
+ \def\collargs at csname{#1}%
+ \ifnum\catcode`#1=11
+ \expandafter\collargs at fix@VtoN at escape@iii
+ \else
+ \ifnum\catcode`#1=10
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at escape@s
+ \else
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at escape@z at i
+ \fi
+ \fi
+}
+\def\collargs at fix@VtoN at escape@iii{%
+ \futurelet\collargs at temp\collargs at fix@VtoN at escape@iv
+}
+\def\collargs at fix@VtoN at escape@iv{%
+ \ifcat\noexpand\collargs at temp\bgroup
+ \let\collargs at action\collargs at fix@VtoN at escape@z
+ \else
+ \ifcat\noexpand\collargs at temp\egroup
+ \let\collargs at action\collargs at fix@VtoN at escape@z
+ \else
+ \expandafter\ifx\space\collargs at temp
+ \let\collargs at action\collargs at fix@VtoN at escape@s
+ \else
+ \let\collargs at action\collargs at fix@VtoN at escape@v
+ \fi
+ \fi
+ \fi
+ \collargs at action
+}
+\def\collargs at fix@VtoN at escape@v#1{%
+ \ifcat\noexpand#1a%
+ \appto\collargs at csname{#1}%
+ \expandafter\collargs at fix@VtoN at escape@iii
+ \else
+ \expandafter\collargs at fix@VtoN at escape@z\expandafter#1%
+ \fi
+}
+\def\collargs at fix@VtoN at escape@s{%
+ \futurelet\collargs at temp\collargs at fix@VtoN at escape@s at i
+}
+\def\collargs at fix@VtoN at escape@s at i{%
+ \expandafter\ifx\space\collargs at temp
+ \expandafter\collargs at fix@VtoN at escape@s at ii
+ \else
+ \expandafter\collargs at fix@VtoN at escape@z
+ \fi
+}
+\def\collargs at fix@VtoN at escape@s at ii{%
+ \expandafter\collargs at fix@VtoN at escape@z\romannumeral-0%
+}
+\def\collargs at fix@VtoN at escape@z at i{%
+ \collargs at fix@VtoN at escape@z at maybe@undefine at cs@begin
+ \collargs at fix@VtoN at escape@z at ii
+}%
+\def\collargs at fix@VtoN at escape@z at maybe@undefine at cs@begin{%
+ \ifcsname\collargs at csname\endcsname
+ \@tempswatrue
+ \else
+ \@tempswafalse
+ \fi
+}
+\def\collargs at fix@VtoN at escape@z at maybe@undefine at cs@end{%
+ \if at tempswa
+ \else
+ \cslet{\collargs at csname}\collargs at undefined
+ \fi
+}
+\def\collargs at fix@VtoN at escape@z at ii{%
+ \expandafter\collargs at fix@VtoN at escape@z at maybe@undefine at cs@end
+ \expandafter\collargs at fix@next\csname\collargs at csname\endcsname
+}
+\def\collargs at fix@VtoN at escape@z{%
+ \collargs at if@one at more@fix{%
+ \collargs at do@one at more@fix\collargs at fix@VtoN at escape@z at i
+ }{%
+ \collargs at fix@VtoN at escape@z at maybe@undefine at cs@begin
+ \xdef\collargs at double@fix at cs@i{\expandonce{\csname\collargs at csname\endcsname}}%
+ \collargs at fix@VtoN at escape@z at maybe@undefine at cs@end
+ \global\collargs at double@fixtrue
+ \collargs at fix@VtoN at escape@z at ii
+ }%
+}
+\def\collargs at fix@VtoN at escape@d{%
+ \ifcollargs at in@second at fix
+ \expandafter\collargs at fix@VtoN at escape@d at i
+ \expandafter\collargs at double@fix at cs@ii
+ \else
+ \expandafter\collargs at fix@VtoN at escape@d at i
+ \expandafter\collargs at double@fix at cs@i
+ \fi
+}
+\def\collargs at fix@VtoN at escape@d at i#1{%
+ \expandafter\expandafter\expandafter\collargs at fix@VtoN at escape@d at ii
+ \expandafter\string#1\relax
+}
+\def\collargs at fix@VtoN at escape@d at ii#1#2\relax{%
+ \def\collargs at csname{#2}%
+ \def\collargs at fix@VtoN at escape@d at iii#2{%
+ \collargs at fix@VtoN at escape@z
+ }%
+ \collargs at fix@VtoN at escape@d at iii
+}
+\newif\ifcollargs at double@fix
+\newif\ifcollargs at in@second at fix
+\def\collargs at if@one at more@fix{%
+ \ifcollargs at double@fix
+ \ifcollargs at in@second at fix
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \else
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \fi
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+\def\collargs at do@one at more@fix#1{%
+ \begingroup
+ \collargs at in@second at fixtrue
+ \collargs at fix{%
+ \endgroup
+ #1%
+ }%
+}
+\def\collargs at cancel@double at fix{%
+ \global\collargs at double@fixfalse
+ \begingroup
+ \collargs at process@arg
+ \edef\collargs at temp{\the\collargsArg}%
+ \edef\collargs at tempa{\expandafter\string\collargs at double@fix at cs@i}%
+ \ifx\collargs at temp\collargs at tempa
+ \global\collargs at fix@requestedtrue
+ \fi
+ \endgroup
+}
+\ifdefined\luatexversion
+ \def\collargs at insert@char#1#2#3{%
+ \edef\collargs at temp{\unexpanded{#1}}%
+ \expandafter\collargs at temp\directlua{%
+ tex.cprint(\number#3,string.char(\number#2))}%
+ }%
+ \def\collargs at make@char#1#2#3{%
+ \edef#1{\directlua{tex.cprint(\number#3,string.char(\number#2))}}%
+ }%
+\else
+ \ifdefined\XeTeXversion
+ \def\collargs at insert@char#1#2#3{%
+ \edef\collargs at temp{\unexpanded{#1}}%
+ \expandafter\collargs at temp\Ucharcat #2 #3
+ }%
+ \def\collargs at make@char#1#2#3{%
+ \edef#1{\Ucharcat#2 #3}%
+ }%
+ \else
+ \begingroup
+ \catcode`\^^@=1 \csgdef{collargs at charofcat@1}{%
+ \noexpand\expandafter^^@\iffalse}\fi}
+ \catcode`\^^@=2 \csgdef{collargs at charofcat@2}{\iffalse{\fi^^@}
+ \catcode`\^^@=3 \csgdef{collargs at charofcat@3}{^^@}
+ \catcode`\^^@=4 \csgdef{collargs at charofcat@4}{^^@}
+ \csgdef{collargs at charofcat@5}{\par}
+ \catcode`\^^@=6 \csxdef{collargs at charofcat@6}{\unexpanded{^^@}}
+ \catcode`\^^@=7 \csgdef{collargs at charofcat@7}{^^@}
+ \catcode`\^^@=8 \csgdef{collargs at charofcat@8}{^^@}
+ \csgdef{collargs at charofcat@10}{\noexpand\space}
+ \catcode`\^^@=11 \csgdef{collargs at charofcat@11}{^^@}
+ \catcode`\^^@=12 \csgdef{collargs at charofcat@12}{^^@}
+ \catcode`\^^@=13 \csgdef{collargs at charofcat@13}{^^@}
+ \endgroup
+ \def\collargs at insert@char#1#2#3{%
+ \begingroup
+ \lccode`\^^@=#2\relax
+ \def\collargs at temp{\endgroup#1}%
+ \expandafter\lowercase\expandafter{%
+ \expandafter\expandafter\expandafter\collargs at temp
+ \romannumeral-`0\csname collargs at charofcat@\the\numexpr#3\relax\endcsname
+ }%
+ }
+ \def\collargs at make@char#1#2#3{%
+ \begingroup
+ \lccode`\^^@=#2\relax
+ \edef\collargs at temp{%
+ \csname collargs at charofcat@\the\numexpr#3\relax\endcsname}%
+ \expandafter\lowercase\expandafter{%
+ \expandafter\def\expandafter\collargs at temp\expandafter{\collargs at temp}%
+ }%
+ \expandafter\endgroup
+ \expandafter\def\expandafter#1\expandafter{\collargs at temp}%
+ }
+ \fi
+\fi
+\resetatcatcode
+\endinput
+%%
+%% End of file `collargs.tex'.
Property changes on: trunk/Master/texmf-dist/tex/plain/collargs/collargs.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check 2023-10-11 20:25:00 UTC (rev 68511)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check 2023-10-11 20:25:43 UTC (rev 68512)
@@ -198,7 +198,7 @@
cmupint cnbwp cnltx cntformats cntperchap
cochineal codeanatomy codebox codedescribe codedoc
codehigh codepage codesection codicefiscaleitaliano
- coelacanth coffeestains collcell collectbox collref
+ coelacanth coffeestains collargs collcell collectbox collref
colophon color-edits colordoc colorframed
colorinfo coloring colorist colorprofiles
colorsep colorspace colortab
Added: trunk/Master/tlpkg/tlpsrc/collargs.tlpsrc
===================================================================
Modified: trunk/Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc 2023-10-11 20:25:00 UTC (rev 68511)
+++ trunk/Master/tlpkg/tlpsrc/collection-plaingeneric.tlpsrc 2023-10-11 20:25:43 UTC (rev 68512)
@@ -16,6 +16,7 @@
depend c-pascal
depend catcodes
depend chronosys
+depend collargs
depend colorsep
depend compare
depend crossrefenum
More information about the tex-live-commits
mailing list.