diff options
Diffstat (limited to 'macros/latex/contrib')
104 files changed, 1311 insertions, 427 deletions
diff --git a/macros/latex/contrib/biblatex2bibitem/LICENSE.txt b/macros/latex/contrib/biblatex2bibitem/LICENSE.txt new file mode 100644 index 0000000000..2244313901 --- /dev/null +++ b/macros/latex/contrib/biblatex2bibitem/LICENSE.txt @@ -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 2005 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 + % 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 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. + diff --git a/macros/latex/contrib/biblatex2bibitem/README.md b/macros/latex/contrib/biblatex2bibitem/README.md index 6873f6272d..7358a0e7de 100644 --- a/macros/latex/contrib/biblatex2bibitem/README.md +++ b/macros/latex/contrib/biblatex2bibitem/README.md @@ -1,10 +1,106 @@ +## The Problem Being Solved + +Some journals accept the reference list only as `\bibitem`s. +If you use BibTeX, there is no problem: +just paste the content of the `.bbl` file into your document. +However, there were no out-of-the-box way to do the same for `biblatex`, +and you had to struggle with searching appropriate `.bst` files, +or formatting your reference list by hand, +or something like that. + +Now you haven't to. + ## Usage -In preamble: -``` +In preamble, after the `biblatex` package is loaded via `\usepackage[...]{biblatex}`: +```latex \usepackage{biblatex2bibitem} ``` At the very end of document: -``` +```latex \printbibitembibliography ``` + +The desired `bibitem`s will be written directly to the PDF file. + +When it's time to switch to `bibitem`s (e.g. before sending the paper to the journal), +just copy them to the to your `.tex` file, remove `biblatex` commands and load `cite` package. + +### Disclaimer + +This package itself is a hack. +Moreover, it is (as for 02 March 2020) under rather an active development. +New features may appear and disappear, and the API may be unstable. +Thus, you may want to download `biblatex2bibitem.sty` and keep it near your article +instead of (or in addition to) having installing it system-wide. + +## Tips + +### Linebreaks in generated bibliography + +You can pass `block=par` option to `biblatex` like that: + +```latex +\usepackage[block=par,...]{biblatex} +``` +but not like that (see also https://github.com/plk/biblatex/issues/968): +```latex +\printbibliography[block=par,env=bibitembibliography] +``` + +It will add linebreaks in generated `bibitem`s and make the code a bit more beautiful :) + +### (Un)desired spaces + +If you really want to have a space after the title of an e.g. an article, just +```latex +\renewcommand{\ignorespacesaftertitlecase}{} +``` + +### `bibitem` separators + +By default, generated `bibitem`s are separated by a line with a percent sign on it to make the readng of the cde easier. +You can tweak this by e.g. +```latex +\renewcommand{\printgeneratedbibitemseparator}{\ttfamily\%\\} +``` +(for putting all the `bibitem`s into monotype font) or e.g. +```latex +\renewcommand{\printgeneratedbibitemseparator}{} +``` +(for disabling "blank" lines but not linebreaks when copying). + +### Other redefinable commands + +Don't forget about `\makeatletter` and `\makeatother`! + ++ `\print@begin@thebibliography` - default: `\textbackslash begin\{thebibliography\}\{99\}` + ++ `\print@end@thebibliography` - default: `\textbackslash end\{thebibliography\} ` + + +## See also + ++ https://github.com/plk/biblatex/issues/783 + ++ https://github.com/plk/biblatex/issues/292 + ++ https://tex.stackexchange.com/questions/12175/biblatex-submitting-to-a-journal (a hopeless discussion) + ++ https://github.com/odomanov/biblatex-gost/issues/20 (in Russian) + +## Repostories + ++ [CTAN](https://ctan.org/pkg/biblatex2bibitem) + ++ [GitLab](https://gitlab.com/Nickkolok/biblatex2bibitem) + +## License + +LPPL - LaTeX Project Public License v1.3c+, DFSG compat. + +## Authors + ++ Nikolai Avdeev aka @nickkolok + ++ [@odomanov](https://github.com/odomanov/) diff --git a/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem-examples.bib b/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem-examples.bib new file mode 100644 index 0000000000..c07dcbbbf9 --- /dev/null +++ b/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem-examples.bib @@ -0,0 +1,30 @@ +@article{solymosi2010question, + title={On a question\relax ~of Erd\H{o}s and Ulam}, + author={Solymosi, Jozsef and De Zeeuw, Frank}, + archivePrefix = {arXiv}, + eprint = {0806.3095}, + journal={Discrete \& Computational Geometry}, + volume={43}, + number={2}, + pages={393--401}, + year={2010}, + publisher={Springer}, +} + +@article{halbeisen2019geometric, + title={A geometric representation of integral solutions of $x^2+ xy+ y^2= m^2$}, + author={Halbeisen, Lorenz and Hungerb{\"u}hler, Norbert}, + journal={Quaestiones Mathematicae}, + pages={1--15}, + year={2019}, + publisher={Taylor \& Francis}, +} + +@article{Kohnert2006IntegralPS, + title={Integral point sets over {$\mathbb{Z}^m_n$}}, + author={Axel Kohnert and Sascha Kurz}, + year={2006}, + journal={Discrete Applied Mathematics}, + volume={157}, + pages={2105–2117}, +} diff --git a/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem-mwe.pdf b/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem-mwe.pdf Binary files differnew file mode 100644 index 0000000000..26eb8348c0 --- /dev/null +++ b/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem-mwe.pdf diff --git a/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem-mwe.tex b/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem-mwe.tex new file mode 100644 index 0000000000..5f6a805a22 --- /dev/null +++ b/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem-mwe.tex @@ -0,0 +1,23 @@ +\documentclass[british]{article} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage{babel} +\usepackage{csquotes} + +\usepackage{amssymb} % Just for \mathbb + +\usepackage[style=numeric, backend=biber]{biblatex} +\usepackage{biblatex2bibitem} + +\addbibresource{biblatex-examples.bib} + +\addbibresource{biblatex2bibitem-examples.bib} + +\begin{document} +\cite{sigfridsson,knuth:ct:e}. + +See also \cite{solymosi2010question,halbeisen2019geometric,Kohnert2006IntegralPS}. +\printbibliography + +\printbibitembibliography +\end{document} diff --git a/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem.sty b/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem.sty index cc3ff68bcf..6065032d98 100644 --- a/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem.sty +++ b/macros/latex/contrib/biblatex2bibitem/biblatex2bibitem.sty @@ -10,49 +10,67 @@ % \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesPackage{biblatex2bibitem} - [2020/02/24 v0.01 LaTeX package to convert biblatex-generated bibliography to bibitem commands] + [2020/03/03 v0.2.0 LaTeX package to convert biblatex-generated bibliography to bibitem commands] \RequirePackage{biblatex} +\newcommand{\printgeneratedbibitemseparator}{\%\\} + +\newcommand{\print@begin@thebibliography}{\textbackslash begin\{thebibliography\}\{99\}} +\newcommand{\print@end@thebibliography }{\textbackslash end\{thebibliography\} } + + \defbibenvironment{bibitembibliography} - {\textbackslash begin\{thebibliography\}\{99\} + { % Page numbers and page headings are not wanted when copying \thispagestyle{empty} \pagestyle{empty} \hyphenpenalty=10000 \exhyphenpenalty=10000 + \raggedright \renewcommand*{\&}{\textbackslash \symbol{38}}% + \ifcsname mkbibsc\endcsname% Sometimes it is not defined + \renewcommand*{\mkbibsc}[1]{\textbackslash textsc\{##1\}}% + \fi% + \renewcommand*{\texttt}[1]{\textbackslash texttt\{##1\}}% + \renewcommand*{\textit}[1]{\textbackslash textit\{##1\}}% + \renewcommand*{\textbf}[1]{\textbackslash textbf\{##1\}}% + \renewcommand*{\textsc}[1]{\textbackslash textsc\{##1\}}% + \renewcommand*{\emph}[1]{\textbackslash emph\{##1\}}% + % \renewcommand*{\mkbibemph}[1]{\textbackslash emph\{##1\}}% \renewcommand*{\mkbibitalic}[1]{\textbackslash textit\{##1\}}% \renewcommand*{\mkbibbold}[1]{\textbackslash textbf\{##1\}}% %\DeclareFieldFormat{titlecase}{\texttt{\utffriendlydetokenize{#1}}} + \print@begin@thebibliography \list{}{}} {\endlist - \textbackslash end\{thebibliography\} + \print@end@thebibliography \thispagestyle{empty} \pagestyle{empty} } - {\item\%\\~\textbackslash bibitem\{\printfield{entrykey}\}\\} + {\item\printgeneratedbibitemseparator\textbackslash bibitem\{\printfield{entrykey}\}\\} -\newcommand{\utffriendlydetokenize}[1]{ - \scantokens{ - \catcode`\_=12 - \catcode`\^=12 - \catcode`\{=12 - \catcode`\}=12 - \catcode`\&=12 - \catcode`\$=12 - \catcode`\#=12 - \catcode`\\=12 - #1 - } +\newcommand{\utffriendlydetokenize}[1]{% +\scantokens{% +\catcode`\_=12% +\catcode`\^=12% +\catcode`\{=12% +\catcode`\}=12% +\catcode`\&=12% +\catcode`\$=12% +\catcode`\#=12% +\catcode`\~=12% +\catcode`\\=12% +#1% +}% } +\newcommand{\ignorespacesaftertitlecase}{\leavevmode\unskip} \newcommand{\printbibitembibliography}{ - \raggedright - \DeclareFieldFormat{titlecase}{\utffriendlydetokenize{##1}} + \DeclareFieldFormat{titlecase}{\utffriendlydetokenize{##1}\ignorespacesaftertitlecase} %\DeclareDelimFormat[bib]{nametitledelim}{\newline\bibsentence} \printbibliography[env=bibitembibliography] } diff --git a/macros/latex/contrib/fei/fei.dtx b/macros/latex/contrib/fei/fei.dtx index fae4eba53a..1225ee097a 100644 --- a/macros/latex/contrib/fei/fei.dtx +++ b/macros/latex/contrib/fei/fei.dtx @@ -340,6 +340,7 @@ A classe da FEI pode receber as seguintes opções: \item \texttt{nopdfa}: desabilita a geração do documento no formato PDF/A. Essa função é disponibilizada para fins de compatibilidade, para que trabalhos antigos que possivelmente sejam corrompidos durante o processo de compilação devido ao padrão PDF/A ainda possam ser compilados; \item \texttt{deposito}: Procura por arquivos PDF referentes à ficha catalográfica e folha de aprovação no diretório do documento e os insere nos locais em que \lstinline+\fichacatalografica+ e \lstinline+\folhadeaprovacao+ são chamados. Caso contrário, insere páginas indicativas, para fins de contagem de número de páginas; \item \texttt{sublist}: configura o pacote \texttt{glossaries} para que sub-listas de símbolos sejam usadas. Mais sobre sub-listas na seção \ref{sec:sublist}; + \item \texttt{numeric}: troca as citações e referências autor-data para numéricas; \item \texttt{algo-as-figure}: configura o pacote \texttt{algorithm2e} para que algoritmos sejam listados na lista de ilustrações. Essa configuração é preferível, uma vez que a formatação das legendas e da lista de algoritmos, no presente, não condiz com as recomendações do guia da biblioteca; \item \texttt{twoside}: a atualização de 2015 do guia da biblioteca recomenda que trabalhos acadêmicos com mais de 100 páginas sejam impressos em formato \index{frente-e-verso}frente-e-verso. Por ser derivada da classe \texttt{memoir}, a classe da FEI pode receber algumas opções nativas de \texttt{memoir}. Um exemplo de opção que pode ser útil é \texttt{twoside}, a qual alterna o tamanho das margens direita e esquerda das páginas, assim como a posição da numeração, permitindo realizar uma impressão frente-e-verso de melhor qualidade. Alterações adicionais foram realizadas para que todos os elementos pré-textuais sejam corretamente iniciados nas páginas ímpares, como recomenda o guia e a norma. É importante reparar, contudo, que a utilização de \texttt{twoside} acarreta no aumento do número de páginas, uma vez que os versos de algumas páginas no pré-texto podem ser deixados em branco em prol da norma. \item \texttt{acronym}: passado para o pacote \texttt{glossaries-extra}, sinaliza o uso de abreviaturas no trabalho; @@ -710,50 +711,46 @@ Ao contrário dos apêndices, o \LaTeX{} não possui um comando nativo para decl A biblioteca permite a criação de um índice remissivo de palavras, para que estas sejam encontradas com maior facilidade no decorrer do trabalho. O capítulo, \ref{chap:indice} explica com detalhes os diferentes programas e comandos envolvidos na indexação de palavras e compilação dos arquivos de índices, mas, por motivos de completude, o comando para se imprimir o índice é \lstinline+\printindex+. -\chapter{CITAÇÕES USANDO O abn\TeX}\label{chap:referencia} - -O \gls{abntex} (\url{http://www.abntex.net.br/}) é um conjunto de macros (comandos e ambientes) que busca seguir as normas da \index{ABNT}\gls{abnt} para formatos acadêmicos. O pacote completo do \gls{abntex}~fornece tanto uma classe para a formatação do texto quanto um pacote para a formatação das referências bibliográficas. Para a formatação correta das citações e referências de acordo com o padrão da biblioteca da \index{FEI}\gls{fei}, foi importado o pacote \texttt{biblatex-abnt}, que utiliza o modelo autor-data. - -As seções a seguir disponibilizam exemplos dos comandos mais comuns. Para uma lista detalhada, o leitor é referenciado ao manual do \texttt{biblatex-abnt}. - -\section{CITAÇÃO NO FINAL DE LINHA} -A citação no final de linha deve deixar os nomes dos autores, seguido do ano, entre parenteses e em letras maiúsculas. Este resultado pode ser obtido utilizando o comando \lstinline+\cite{obra}+. - -Exemplo: Este texto deveria ser uma referência \lstinline+\cite{turing50}+. $\to$ Este texto deveria ser uma referência \cite{turing50}. - -\section{CITAÇÃO DURANTE O TEXTO} -Para que a citação seja feita durante o texto, o nome do autor é formatado somente com as iniciais maiúsculas e o ano entre parenteses. O pacote da \gls{abntex}~fornece o comando \lstinline+\textcite{obra}+ para este caso. - -Exemplo: Segundo \lstinline+\textcite{haykin99a}+, este texto deveria ser uma referência. $\to$ Segundo \textcite{haykin99a}, este texto deveria ser uma referência. - -\section{CITAÇÃO INDIRETA} -Quando se deseja citar uma obra a qual o autor não possui acesso direto a ela, pode-se citar uma outra obra que, por sua vez, cita a primeira. O \gls{abntex}~disponibiliza esse tipo de citação através do comando \lstinline+\apud{obra_inacessivel}{obra_acessivel}+. - -Exemplo: \lstinline+\apud{kahneman2011}{stewart2012}+ formata a citação de forma semelhante a \apud{kahneman2011}{stewart2012}. - -\section{CITAÇÕES MÚLTIPLAS} - -Os comandos \lstinline+\cites{obra_1}{...}{obra_n}+ e \lstinline+\textcites{obra_1}{}...}{obra_m}+ também possibilitam a utilização de citações múltiplas. - -Exemplos: - -\lstinline+\cites{mcc43}{kurzweil2013}{haykin99a}+ \(\to\) \cites{mcc43}{kurzweil2013}{haykin99a}. - -\lstinline+\textcites{clarke19932001}{hamlet}{art1}+ \(\to\) \textcites{clarke19932001}{hamlet}{art1}. - -\section{CITAÇÕES DE CAMPOS ESPECÍFICOS} - -Para citar o nome do autor em linha, utilize o comando \lstinline+\citeauthor*{obra}+. - -\lstinline+\citeauthor*{galilei_dialogue_1953}+ \(\to\) \citeauthor*{galilei_dialogue_1953} - -Para citar o nome do autor em letras maiúsculas, utilize\lstinline+\citeauthor{obra}+. - -\lstinline+\citeauthor{galilei_dialogue_1953}+ \(\to\) \citeauthor{galilei_dialogue_1953} - -Para citar o ano de uma obra, utilize \lstinline+\citeyear{obra}+. - -\lstinline+\citeyear{galilei_dialogue_1953}+ \(\to\) \citeyear{galilei_dialogue_1953} +\chapter{CITAÇÕES EM FORMATO AUTOR-DATA E NUMÉRICAS} \label{chap:referencia} + +A classe da \index{FEI}\gls{fei} faz uso do pacote \texttt{biblatex-abnt} para inserção de citações ao longo do texto e impressão da lista de referências bibliográficas ao final do texto. O \texttt{biblatex-abnt} é responsável por formatar tanto citações quanto referências bibliográficas sob os padrões da ABNT. A classe da \index{FEI}\gls{fei} realiza algumas modificações no estilo fornecido pelo \texttt{biblatex-abnt} para se adequar ao guia da biblioteca. Por padrão, as citações são feitas no formato autor-data. Para utilizar o formato numérico, adicione a opção \texttt{numeric} à declaração da classe: \lstinline+\documentclass[numeric]{fei}+. + +Os comandos mais comuns de citação são exemplificados abaixo e nas próximas seções. Para uma lista detalhada de todos os comandos tanto do formato autor-data como numérico, o leitor é referenciado ao manual do \texttt{biblatex-abnt} \footnote{\url{https://www.ctan.org/pkg/biblatex-abnt}}. O formato autor-data é mencionado como \texttt{abnt}, enquanto o formato numérico é mencionado na documentação como \texttt{abnt-numeric}. + +\begin{itemize} + \item citação no final de linha: + + \begin{itemize} + \item Este texto deveria ser uma referência \lstinline+\cite{turing50}+. $\to$ Este texto deveria ser uma referência \cite{turing50}. + \end{itemize} + + \item citação durante o texto: + + \begin{itemize} + \item Segundo \lstinline+\textcite{haykin99a}+, este texto deveria ser uma referência. $\to$ Segundo \textcite{haykin99a}, este texto deveria ser uma referência. + \end{itemize} + + \item citação indireta: + + \begin{itemize} + \item \lstinline+\apud{kahneman2011}{stewart2012}+ formata a citação de forma semelhante a \apud{kahneman2011}{stewart2012}. + \end{itemize} + + \item citações múltiplas: + + \begin{itemize} + \item \lstinline+\cites{mcc43}{kurzweil2013}{haykin99a}+ \(\to\) \cites{mcc43}{kurzweil2013}{haykin99a} + \item \lstinline+\textcites{clarke19932001}{hamlet}{art1}+ \(\to\) \textcites{clarke19932001}{hamlet}{art1} + \end{itemize} + + \item citações de campos específicos: + + \begin{itemize} + \item \lstinline+\citeauthor*{galilei_dialogue_1953}+ \(\to\) \citeauthor*{galilei_dialogue_1953} + \item \lstinline+\citeauthor{galilei_dialogue_1953}+ \(\to\) \citeauthor{galilei_dialogue_1953} + \item \lstinline+\citeyear{galilei_dialogue_1953}+ \(\to\) \citeyear{galilei_dialogue_1953} + \end{itemize} +\end{itemize} \section{CITAÇÃO PARA \emph{FLOATS}} @@ -761,22 +758,6 @@ No caso das citações que devem ser feitas em \emph{floats}, como ilustrações \lstinline+Fonte: \citefloat{Kernighan1988}.+ \(\to\) Fonte: \citefloat{Kernighan1988}. -% \section{OUTROS EXEMPLOS} -% -% \lstinline+\Idem[p.~2]{turing50}+ \(\to\) \Idem[p.~2]{turing50} -% -% \lstinline+\Ibidem[p.~2]{turing50}+ \(\to\) \Ibidem[p.~2]{turing50} -% -% \lstinline+\opcit[p.~2]{turing50}+ \(\to\) \opcit[p.~2]{turing50} -% -% \lstinline+\passim{turing50}+ \(\to\) \passim{turing50} -% -% \lstinline+\loccit{turing50}+ \(\to\) \loccit{turing50} -% -% \lstinline+\cfcite[p.~2]{turing50}+ \(\to\) \cfcite[p.~2]{turing50} -% -% \lstinline+\etseq[p.~2]{turing50}+ \(\to\) \etseq[p.~2]{turing50} - \section{CITAÇÕES COM MAIS DE TRÊS LINHAS} De acordo com o guia da biblioteca, a citação direta com mais de 3 linhas deve ter recuo de 4 cm da margem esquerda, letra de tamanho 10 pt, espaçamento simples e não deve conter aspas nem recuo no início do parágrafo. O \index{Latex@\LaTeX}\LaTeX{} já disponibiliza os ambientes \texttt{quote}, para citações de um parágrafo, e \texttt{quotation}, para citações com mais de um parágrafo. Para conseguir a formatação especificada pela biblioteca, os usuários da classe da FEI devem utilizar o ambiente \texttt{quote}. O ambiente \texttt{quotation} também foi reestruturado para ficar similar à formatação do ambiente \texttt{quote}, porém, como não há instruções para a realização de citações com mais de um parágrafo no guia da biblioteca, não existe recomendação para seu uso. @@ -1081,7 +1062,7 @@ A seguir, as descrições dos arquivos auxiliares gerados durante o processo de \item\lstinline+pdflatex documento.tex+ \begin{enumerate} \item \texttt{alg}: \emph{log} do \index{makeindex@\emph{MakeIndex}}\emph{MakeIndex}; - \item \texttt{bcf}: arquivo com as referências a serem processadas pelo Biber; + \item \texttt{bcf}: arquivo com as referências a serem processadas pelo \index{Biber}Biber; \item \texttt{glo,acn,sym}: listas de abreviaturas e símbolos. \item \texttt{idx}: arquivo com os termos a serem adicionados no índice pelo \emph{MakeIndex}; \item \texttt{loa}: lista de algoritmos; @@ -1331,7 +1312,7 @@ A seguir, as descrições dos arquivos auxiliares gerados durante o processo de % \fi %<*class> \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{fei}[2020/02/09 4.7 Modelo da FEI] +\ProvidesClass{fei}[2020/03/03 4.8 Modelo da FEI] % passa a opção draft para a classe \DeclareOption{draft}{ @@ -1377,18 +1358,20 @@ A seguir, as descrições dos arquivos auxiliares gerados durante o processo de \DeclareOption{arial}{\arialtrue} \DeclareOption{times}{\arialfalse} +\newif\ifnumeric +\numericfalse +\DeclareOption{numeric}{\numerictrue} + \newif\ifoneside \DeclareOption{oneside}{\onesidetrue} \DeclareOption{twoside}{\onesidefalse} \DeclareOption{algo-as-figure}{\PassOptionsToPackage{figure}{algorithm2e}}% +% opção para configurar a lista de símbolos \newif\ifpdfa \pdfatrue -% opção para configurar a lista de símbolos -\DeclareOption{nopdfa}{ - \pdfafalse -} +\DeclareOption{nopdfa}{\pdfafalse} % Assume that any unknown option will be understood by the base class: % \DeclareOption*{% @@ -2017,13 +2000,19 @@ A seguir, as descrições dos arquivos auxiliares gerados durante o processo de % referências e citações % abnTeX alfabético com títulos das publicações em negrito nas referências (como no modelo antigo da ABNT) -% para 2019, poderá ter DOI e ISBN -\RequirePackage[backend=biber, - safeinputenc=true, - uniquelist=false, - isbn=false, - doi=false, - style=abnt]{biblatex} + +\ifnumeric + \RequirePackage[backend=biber, + safeinputenc=true, + uniquelist=false, + style=abnt-numeric]{biblatex} +\else + \RequirePackage[backend=biber, + safeinputenc=true, + uniquelist=false, + style=abnt]{biblatex} +\fi + \setlength{\bibitemsep}{1.0\baselineskip} \DefineBibliographyStrings{brazil}{% diff --git a/macros/latex/contrib/fei/fei.pdf b/macros/latex/contrib/fei/fei.pdf Binary files differindex f35c2c7424..6e21bff80b 100644 --- a/macros/latex/contrib/fei/fei.pdf +++ b/macros/latex/contrib/fei/fei.pdf diff --git a/macros/latex/contrib/l3kernel/CHANGELOG.md b/macros/latex/contrib/l3kernel/CHANGELOG.md index 9ce3fed751..75151331dd 100644 --- a/macros/latex/contrib/l3kernel/CHANGELOG.md +++ b/macros/latex/contrib/l3kernel/CHANGELOG.md @@ -7,6 +7,18 @@ this project uses date-based 'snapshot' version identifiers. ## [Unreleased] +## [2020-03-03] + +### Added +- `\tex...:D` coverage for TeX Live 2020 engine changes + +### Changed +- New implementation for `\keyval_parse:NNn` - around 40% speed improvement, + also *expandable* + +### Fixed +- Make `expl3` reload-safe for `latexrelease` (see latex3/latex2e#295) + ## [2020-02-25] ### Changed @@ -179,7 +191,7 @@ this project uses date-based 'snapshot' version identifiers. ## [2019-09-28] ### Changed -- Speed up variants and reduce their \tracingall output +- Speed up variants and reduce their `\tracingall` output - Debug and deprecation code are now loaded independently of expl3 core - `\file_compare_timestamp:nNn(TF)` now usable in expansion contexts - Moved to stable: @@ -410,7 +422,7 @@ this project uses date-based 'snapshot' version identifiers. ### Deprecated - `\box_(g)set_eq_clear:NN`, replaced by `\box_(g)set_eq_drop:NN` -- `\(h|v)box_unpack_clear:N`, replaced by `\(h|v)box_unpack_drop:N +- `\(h|v)box_unpack_clear:N`, replaced by `\(h|v)box_unpack_drop:N` - `\tl_(g)set_from_file(_x):Nnn`, replaced by `\file_get:nnN` ### Fixed @@ -446,7 +458,7 @@ this project uses date-based 'snapshot' version identifiers. ### Fixed - Correct fp randint with zero argument (see #507) -- Handling of `\current@color` with (x)dvipdfmx` (see #510) +- Handling of `\current@color` with `(x)dvipdfmx` (see #510) ### Removed - Support for stand-alone `l3regex`, `l3sort`, `l3srt`, `l3tl-analysis`, @@ -587,10 +599,10 @@ this project uses date-based 'snapshot' version identifiers. ## [2018-04-30] ### Added -- Implement \tl_analysis_map_inline:nn -- Implement \exp_args_generate:n to define new \exp_args:N... +- Implement `\tl_analysis_map_inline:nn` +- Implement `\exp_args_generate:n` to define new `\exp_args:N...` functions -- Low-level \int_value:w function +- Low-level `\int_value:w` function - New experimental functions for - Building token lists piecewise - Fast manipulation of integer arrays @@ -604,7 +616,7 @@ this project uses date-based 'snapshot' version identifiers. - Better documentation of cross-module kernel-internal functions - Enable `\char_generate:nn` for active chars - Renamed `\tl_show_analysis:(N|n)n` as `\tl_analysis_show:(N|n)n` -- Change \int_rand:nn (and rand_item functions) to better use +- Change `\int_rand:nn` (and rand_item functions) to better use the RNG - Make prg break functions public - Make scan marks mechanism public @@ -635,7 +647,8 @@ this project uses date-based 'snapshot' version identifiers. - Step functions have been added for dim variables, e.g. `\dim_step_inline:nnnn` -[Unreleased]: https://github.com/latex3/latex3/compare/2020-02-25...HEAD +[Unreleased]: https://github.com/latex3/latex3/compare/2020-03-03...HEAD +[2020-03-03]: https://github.com/latex3/latex3/compare/2020-02-25...2020-03-03 [2020-02-25]: https://github.com/latex3/latex3/compare/2020-02-21...2020-02-25 [2020-02-21]: https://github.com/latex3/latex3/compare/2020-02-14...2020-02-21 [2020-02-14]: https://github.com/latex3/latex3/compare/2020-02-13...2020-02-14 diff --git a/macros/latex/contrib/l3kernel/README.md b/macros/latex/contrib/l3kernel/README.md index 4337693ae2..81d6baa3fc 100644 --- a/macros/latex/contrib/l3kernel/README.md +++ b/macros/latex/contrib/l3kernel/README.md @@ -1,7 +1,7 @@ LaTeX3 Programming Conventions ============================== -Release 2020-02-25 +Release 2020-03-03 Overview -------- diff --git a/macros/latex/contrib/l3kernel/expl3.dtx b/macros/latex/contrib/l3kernel/expl3.dtx index 3f2f1c78b4..bbe0f740fc 100644 --- a/macros/latex/contrib/l3kernel/expl3.dtx +++ b/macros/latex/contrib/l3kernel/expl3.dtx @@ -24,7 +24,7 @@ % %<*driver|generic|package|2ekernel> %</driver|generic|package|2ekernel> -\def\ExplFileDate{2020-02-25}% +\def\ExplFileDate{2020-03-03}% %<*driver> \documentclass[full]{l3doc} \usepackage{graphicx} @@ -51,7 +51,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % @@ -1196,11 +1196,9 @@ % simply turn it on. We use \tn{@pushfilenameaux} as a marker: it's defined % a little later. % \begin{macrocode} -%<*!2ekernel> \ifdefined\@pushfilenameaux \ExplSyntaxOn \fi -%</!2ekernel> % \end{macrocode} % % \begin{macrocode} @@ -1279,7 +1277,7 @@ \sys_load_debug: \debug_on:n { log-functions } } , - suppress-backend-headers .bool_set_inverse:N + suppress-backend-headers .bool_gset_inverse:N = \g__kernel_backend_header_bool , suppress-backend-headers .initial:n = false , undo-recent-deprecations .code:n = @@ -1381,7 +1379,7 @@ % saves the rest of the stack and then does the test. The flag here % is not a proper \texttt{bool}, so a low-level test is used. % \begin{macrocode} -\cs_new_protected:Npn \@@_status_pop:w #1#2 \q_stop +\cs_gset_protected:Npn \@@_status_pop:w #1#2 \q_stop { \tl_set:Nn \l_@@_status_stack_tl {#2} \int_if_odd:nTF {#1} @@ -1397,8 +1395,11 @@ % already active, at the end of the package \cs{ExplSyntaxOff} can % safely be called. % \begin{macrocode} -\tl_new:N \l_@@_status_stack_tl -\tl_set:Nn \l_@@_status_stack_tl { 0 } +\tl_if_exist:NF \l_@@_status_stack_tl + { + \tl_new:N \l_@@_status_stack_tl + \tl_set:Nn \l_@@_status_stack_tl { 0 } + } % \end{macrocode} % \end{variable} % diff --git a/macros/latex/contrib/l3kernel/expl3.pdf b/macros/latex/contrib/l3kernel/expl3.pdf Binary files differindex 10bc95f1d0..9c593937fd 100644 --- a/macros/latex/contrib/l3kernel/expl3.pdf +++ b/macros/latex/contrib/l3kernel/expl3.pdf diff --git a/macros/latex/contrib/l3kernel/interface3.pdf b/macros/latex/contrib/l3kernel/interface3.pdf Binary files differindex 91aff8e85b..311daaad87 100644 --- a/macros/latex/contrib/l3kernel/interface3.pdf +++ b/macros/latex/contrib/l3kernel/interface3.pdf diff --git a/macros/latex/contrib/l3kernel/interface3.tex b/macros/latex/contrib/l3kernel/interface3.tex index edac55de1e..3074dade2d 100644 --- a/macros/latex/contrib/l3kernel/interface3.tex +++ b/macros/latex/contrib/l3kernel/interface3.tex @@ -54,7 +54,7 @@ for those people who are interested. {latex-team@latex-project.org}% }% } -\date{Released 2020-02-25} +\date{Released 2020-03-03} \pagenumbering{roman} \maketitle diff --git a/macros/latex/contrib/l3kernel/l3alloc.dtx b/macros/latex/contrib/l3kernel/l3alloc.dtx index 41a3e7e26c..0023ac5c81 100644 --- a/macros/latex/contrib/l3kernel/l3alloc.dtx +++ b/macros/latex/contrib/l3kernel/l3alloc.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3basics.dtx b/macros/latex/contrib/l3kernel/l3basics.dtx index b65f0feca4..e1f0f44552 100644 --- a/macros/latex/contrib/l3kernel/l3basics.dtx +++ b/macros/latex/contrib/l3kernel/l3basics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % @@ -1606,7 +1606,7 @@ % % \begin{macro}{\use:x} % Fully expands its argument and passes it to the input stream. Uses -% the reserved \cs{l_@@_internal_tl} which will be set up in \pkg{l3expan}. +% the reserved \cs{l_@@_internal_tl} which we've set up above. % \begin{macrocode} \cs_set_protected:Npn \use:x #1 { @@ -1621,7 +1621,7 @@ % \end{macrocode} % % \begin{macro}[EXP]{\use:e} -% Currently \LuaTeX-only: emulated for older engines. +% In non-\LuaTeX engines older than 2019, \cs{expanded} is emulated. % \begin{macrocode} \cs_set:Npn \use:e #1 { \tex_expanded:D {#1} } \tex_ifdefined:D \tex_expanded:D \tex_else:D diff --git a/macros/latex/contrib/l3kernel/l3bootstrap.dtx b/macros/latex/contrib/l3kernel/l3bootstrap.dtx index 113fa59ab6..b5b8197a88 100644 --- a/macros/latex/contrib/l3kernel/l3bootstrap.dtx +++ b/macros/latex/contrib/l3kernel/l3bootstrap.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3box.dtx b/macros/latex/contrib/l3kernel/l3box.dtx index efbbb2ca11..1610fd79ef 100644 --- a/macros/latex/contrib/l3kernel/l3box.dtx +++ b/macros/latex/contrib/l3kernel/l3box.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3candidates.dtx b/macros/latex/contrib/l3kernel/l3candidates.dtx index f36843ad33..1aa7572365 100644 --- a/macros/latex/contrib/l3kernel/l3candidates.dtx +++ b/macros/latex/contrib/l3kernel/l3candidates.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3clist.dtx b/macros/latex/contrib/l3kernel/l3clist.dtx index 739764ad2b..d50ead8069 100644 --- a/macros/latex/contrib/l3kernel/l3clist.dtx +++ b/macros/latex/contrib/l3kernel/l3clist.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3coffins.dtx b/macros/latex/contrib/l3kernel/l3coffins.dtx index f3a7ba081c..ec9e53693c 100644 --- a/macros/latex/contrib/l3kernel/l3coffins.dtx +++ b/macros/latex/contrib/l3kernel/l3coffins.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3color-base.dtx b/macros/latex/contrib/l3kernel/l3color-base.dtx index 6ca023be82..3076d372bb 100644 --- a/macros/latex/contrib/l3kernel/l3color-base.dtx +++ b/macros/latex/contrib/l3kernel/l3color-base.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3debug.dtx b/macros/latex/contrib/l3kernel/l3debug.dtx index bcdcb0cdd6..f1afae3f7a 100644 --- a/macros/latex/contrib/l3kernel/l3debug.dtx +++ b/macros/latex/contrib/l3kernel/l3debug.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3deprecation.dtx b/macros/latex/contrib/l3kernel/l3deprecation.dtx index a52f33774f..61249b69c8 100644 --- a/macros/latex/contrib/l3kernel/l3deprecation.dtx +++ b/macros/latex/contrib/l3kernel/l3deprecation.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3doc.dtx b/macros/latex/contrib/l3kernel/l3doc.dtx index c4bd0f7751..cced26c55a 100644 --- a/macros/latex/contrib/l3kernel/l3doc.dtx +++ b/macros/latex/contrib/l3kernel/l3doc.dtx @@ -79,7 +79,7 @@ and all files in that bundle must be distributed together. % % \title{The \cls{l3doc} class} % \author{\Team} -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % \maketitle % \tableofcontents % diff --git a/macros/latex/contrib/l3kernel/l3docstrip.dtx b/macros/latex/contrib/l3kernel/l3docstrip.dtx index 5cc079b2a0..8b5d6093ad 100644 --- a/macros/latex/contrib/l3kernel/l3docstrip.dtx +++ b/macros/latex/contrib/l3kernel/l3docstrip.dtx @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3docstrip.pdf b/macros/latex/contrib/l3kernel/l3docstrip.pdf Binary files differindex ba9d9375ed..5198841d10 100644 --- a/macros/latex/contrib/l3kernel/l3docstrip.pdf +++ b/macros/latex/contrib/l3kernel/l3docstrip.pdf diff --git a/macros/latex/contrib/l3kernel/l3expan.dtx b/macros/latex/contrib/l3kernel/l3expan.dtx index be01476521..89b10a06a2 100644 --- a/macros/latex/contrib/l3kernel/l3expan.dtx +++ b/macros/latex/contrib/l3kernel/l3expan.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3file.dtx b/macros/latex/contrib/l3kernel/l3file.dtx index d474dba637..fccaf3717a 100644 --- a/macros/latex/contrib/l3kernel/l3file.dtx +++ b/macros/latex/contrib/l3kernel/l3file.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3final.dtx b/macros/latex/contrib/l3kernel/l3final.dtx index 4c573fc3a4..4d3f9e6eb5 100644 --- a/macros/latex/contrib/l3kernel/l3final.dtx +++ b/macros/latex/contrib/l3kernel/l3final.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3flag.dtx b/macros/latex/contrib/l3kernel/l3flag.dtx index 15865ffa92..82889959d5 100644 --- a/macros/latex/contrib/l3kernel/l3flag.dtx +++ b/macros/latex/contrib/l3kernel/l3flag.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-assign.dtx b/macros/latex/contrib/l3kernel/l3fp-assign.dtx index 34f8eea19b..1cad6e13c2 100644 --- a/macros/latex/contrib/l3kernel/l3fp-assign.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-assign.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % \maketitle % % \begin{documentation} diff --git a/macros/latex/contrib/l3kernel/l3fp-aux.dtx b/macros/latex/contrib/l3kernel/l3fp-aux.dtx index 6b8e4ae9de..e94dacb368 100644 --- a/macros/latex/contrib/l3kernel/l3fp-aux.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-aux.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-basics.dtx b/macros/latex/contrib/l3kernel/l3fp-basics.dtx index ee77e00c6f..b9f1340e73 100644 --- a/macros/latex/contrib/l3kernel/l3fp-basics.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-basics.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-convert.dtx b/macros/latex/contrib/l3kernel/l3fp-convert.dtx index 404e2a5145..185676d381 100644 --- a/macros/latex/contrib/l3kernel/l3fp-convert.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-convert.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-expo.dtx b/macros/latex/contrib/l3kernel/l3fp-expo.dtx index 5a2214748d..2ee3267fbf 100644 --- a/macros/latex/contrib/l3kernel/l3fp-expo.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-expo.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-extended.dtx b/macros/latex/contrib/l3kernel/l3fp-extended.dtx index 263c82ff46..0566df9d98 100644 --- a/macros/latex/contrib/l3kernel/l3fp-extended.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-extended.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-logic.dtx b/macros/latex/contrib/l3kernel/l3fp-logic.dtx index 66756acde0..6231aea96c 100644 --- a/macros/latex/contrib/l3kernel/l3fp-logic.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-logic.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-parse.dtx b/macros/latex/contrib/l3kernel/l3fp-parse.dtx index 4a06f89be8..4df86f2ffc 100644 --- a/macros/latex/contrib/l3kernel/l3fp-parse.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-parse.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-random.dtx b/macros/latex/contrib/l3kernel/l3fp-random.dtx index 71127ebd03..3138da7a5d 100644 --- a/macros/latex/contrib/l3kernel/l3fp-random.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-random.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-round.dtx b/macros/latex/contrib/l3kernel/l3fp-round.dtx index 951e5dec81..d5f84ba41a 100644 --- a/macros/latex/contrib/l3kernel/l3fp-round.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-round.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-traps.dtx b/macros/latex/contrib/l3kernel/l3fp-traps.dtx index 9db9324a39..51bbf6c3dc 100644 --- a/macros/latex/contrib/l3kernel/l3fp-traps.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-traps.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % \maketitle % % \begin{documentation} diff --git a/macros/latex/contrib/l3kernel/l3fp-trig.dtx b/macros/latex/contrib/l3kernel/l3fp-trig.dtx index e52aeffe54..b5997b15d5 100644 --- a/macros/latex/contrib/l3kernel/l3fp-trig.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-trig.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp.dtx b/macros/latex/contrib/l3kernel/l3fp.dtx index bc408b3a26..9496226575 100644 --- a/macros/latex/contrib/l3kernel/l3fp.dtx +++ b/macros/latex/contrib/l3kernel/l3fp.dtx @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fparray.dtx b/macros/latex/contrib/l3kernel/l3fparray.dtx index d4a0045e96..ec21dc624d 100644 --- a/macros/latex/contrib/l3kernel/l3fparray.dtx +++ b/macros/latex/contrib/l3kernel/l3fparray.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3int.dtx b/macros/latex/contrib/l3kernel/l3int.dtx index ff70d60c54..fbf0cc9b15 100644 --- a/macros/latex/contrib/l3kernel/l3int.dtx +++ b/macros/latex/contrib/l3kernel/l3int.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3intarray.dtx b/macros/latex/contrib/l3kernel/l3intarray.dtx index 477a6b66ff..56b293db63 100644 --- a/macros/latex/contrib/l3kernel/l3intarray.dtx +++ b/macros/latex/contrib/l3kernel/l3intarray.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3kernel-functions.dtx b/macros/latex/contrib/l3kernel/l3kernel-functions.dtx index 8bf6edca2e..48c85b5498 100644 --- a/macros/latex/contrib/l3kernel/l3kernel-functions.dtx +++ b/macros/latex/contrib/l3kernel/l3kernel-functions.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3keys.dtx b/macros/latex/contrib/l3kernel/l3keys.dtx index dcf83e0d87..417837ce37 100644 --- a/macros/latex/contrib/l3kernel/l3keys.dtx +++ b/macros/latex/contrib/l3kernel/l3keys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % @@ -722,7 +722,7 @@ % (\cs{keys_set_known:nnnN}), the key--value entries are returned % relative to this point in the key tree. When it is absent, only the % key name and value are provided. The correct list is returned by -% nested calls. +% nested calls. % \end{function} % % \section{Selective key setting} @@ -891,7 +891,7 @@ % \end{verbatim} % are treated identically. % -% \begin{function}[updated = 2011-09-08]{\keyval_parse:NNn} +% \begin{function}[EXP,updated = 2020-02-20]{\keyval_parse:NNn} % \begin{syntax} % \cs{keyval_parse:NNn} \meta{function_1} \meta{function_2} \Arg{key--value list} % \end{syntax} @@ -920,6 +920,11 @@ % all). Spaces are trimmed from the ends of the \meta{key} and \meta{value}, % then one \emph{outer} set of braces is removed from the \meta{key} % and \meta{value} as part of the processing. +% \begin{texnote} +% The result is returned within \cs{exp_not:n}, which means that the +% converted input stream does not expand further when appearing in an +% \texttt{x}-type or \texttt{e}-type argument expansion. +% \end{texnote} % \end{function} % % \end{documentation} @@ -946,234 +951,312 @@ %<@@=keyval> % \end{macrocode} % -% \begin{variable}{\l_@@_key_tl, \l_@@_value_tl} -% The current key name and value. +% \begin{variable}{\s_@@_nil,\s_@@_mark,\s_@@_stop,\s_@@_tail} % \begin{macrocode} -\tl_new:N \l_@@_key_tl -\tl_new:N \l_@@_value_tl +\scan_new:N \s_@@_nil +\scan_new:N \s_@@_mark +\scan_new:N \s_@@_stop +\scan_new:N \s_@@_tail % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_sanitise_tl} -% A token list variable for dealing with awkward category codes in the -% input. +% This temporary macro will be used since some of the definitions will need an +% active comma or equals sign. Inside of this macro |#1| will be the active +% comma and |#2| will be the active equals sign. % \begin{macrocode} -\tl_new:N \l_@@_sanitise_tl +\group_begin: + \cs_set_protected:Npn \@@_tmp:NN #1#2 + { % \end{macrocode} -% \end{variable} % -% \begin{macro}{\keyval_parse:NNn} -% The main function starts off by normalising category codes in package mode. -% That's relatively \enquote{expensive} so is skipped (hopefully) in format -% mode. We then hand off to the parser. The use of \cs{q_mark} here prevents -% loss of braces from the key argument. Notice that by passing the two -% processor commands along the input stack we avoid the need to track these -% at all. +% \begin{macro}[EXP]{\keyval_parse:NNn} +% The main function starts the first of two input loops. The outer loop splits +% the key--value list at active commas, the inner loop will do so at other +% commas. The use of \cs{s_@@_mark} here prevents loss of braces from the key +% argument. % \begin{macrocode} -\cs_new_protected:Npn \keyval_parse:NNn #1#2#3 - { -%<*initex> - \@@_loop:NNw #1#2 \q_mark #3 , \q_recursion_tail , -%</initex> -%<*package> - \tl_set:Nn \l_@@_sanitise_tl {#3} - \@@_sanitise_equals: - \@@_sanitise_comma: - \exp_after:wN \@@_loop:NNw \exp_after:wN #1 \exp_after:wN #2 - \exp_after:wN \q_mark \l_@@_sanitise_tl , \q_recursion_tail , -%</package> - } + \cs_new:Npn \keyval_parse:NNn ##1 ##2 ##3 + { + \@@_loop_active:NNw ##1 ##2 \s_@@_mark ##3 #1 \s_@@_tail #1 + } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_sanitise_equals:, \@@_sanitise_comma:} -% \begin{macro} -% { -% \@@_sanitise_equals_auxi:w, \@@_sanitise_equals_auxii:w, -% \@@_sanitise_comma_auxi:w, \@@_sanitise_comma_auxii:w, -% \@@_sanitise_aux:w -% } -% A reasonably fast search and replace set up specifically for the active -% tokens. The nature of the input is known so everything is hard-coded. -% With only two tokens to cover, the speed gain from using dedicated -% functions is worth it. +% \begin{macro}[EXP]{\@@_loop_active:NNw} +% First a fast test for the end of the loop is done, it'll gobble everything +% up to an \cs{s_@@_mark} immediately followed by an \cs{s_@@_tail}. The loop +% ending macro will gobble everything to the last \cs{s_@@_mark} in this +% definition. +% If the end isn't reached yet, start the second loop splitting at other +% comments, and after that one iterate the current loop. % \begin{macrocode} -%<*package> -\group_begin: - \char_set_catcode_active:n { `\= } - \char_set_catcode_active:n { `\, } - \cs_new_protected:Npn \@@_sanitise_equals: - { - \exp_after:wN \@@_sanitise_equals_auxi:w \l_@@_sanitise_tl - \q_mark = \q_nil = - \exp_after:wN \@@_sanitise_aux:w \l_@@_sanitise_tl - } - \cs_new_protected:Npn \@@_sanitise_equals_auxi:w #1 = - { - \tl_set:Nn \l_@@_sanitise_tl {#1} - \@@_sanitise_equals_auxii:w - } - \cs_new_protected:Npn \@@_sanitise_equals_auxii:w #1 = - { - \if_meaning:w \q_nil #1 \scan_stop: - \else: - \tl_set:Nx \l_@@_sanitise_tl + \cs_new:Npn \@@_loop_active:NNw ##1 ##2 ##3 #1 + { + \@@_if_recursion_tail:w ##3 + \@@_end_loop_active:w \s_@@_mark \s_@@_tail + \@@_loop_other:NNw ##1 ##2 ##3 , \s_@@_tail , + \@@_loop_active:NNw ##1 ##2 \s_@@_mark + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_loop_other:NNw} +% The second loop uses the same test for its end as the first loop, next it +% tests whether there are other or active equals signs, throwing an error if +% there are both. If there are none, test whether the argument is blank or is +% a single key. If there are only active equals signs split at those, else +% split at others. Finally, iterate the loop. +% \begin{macrocode} + \cs_new:Npn \@@_loop_other:NNw ##1 ##2 ##3 , + { + \@@_if_recursion_tail:w ##3 + \@@_end_loop_other:w \s_@@_mark \s_@@_tail + \@@_if_has_equal_other:w ##3 = \s_@@_stop + \@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn { - \exp_not:o \l_@@_sanitise_tl - \token_to_str:N = - \exp_not:n {#1} + \@@_if_has_equal_active:w ##3 #2 \s_@@_stop + \@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn + \@@_misplaced_equal_error: + { \@@_split_other:w ##3 = \s_@@_stop ##2 } } - \exp_after:wN \@@_sanitise_equals_auxii:w - \fi: - } - \cs_new_protected:Npn \@@_sanitise_comma: - { - \exp_after:wN \@@_sanitise_comma_auxi:w \l_@@_sanitise_tl - \q_mark , \q_nil , - \exp_after:wN \@@_sanitise_aux:w \l_@@_sanitise_tl - } - \cs_new_protected:Npn \@@_sanitise_comma_auxi:w #1 , - { - \tl_set:Nn \l_@@_sanitise_tl {#1} - \@@_sanitise_comma_auxii:w - } - \cs_new_protected:Npn \@@_sanitise_comma_auxii:w #1 , - { - \if_meaning:w \q_nil #1 \scan_stop: - \else: - \tl_set:Nx \l_@@_sanitise_tl { - \exp_not:o \l_@@_sanitise_tl - \token_to_str:N , - \exp_not:n {#1} + \@@_if_has_equal_active:w ##3 #2 \s_@@_stop + \@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn + { \@@_split_active:w ##3 #2 \s_@@_stop ##2 } + { + \@@_if_blank:w ##3 \s_@@_nil \s_@@_stop + \@@_blank_true:w \s_@@_mark \s_@@_stop \use:n + { \@@_trim:nN { ##3 } \@@_key:nN ##1 } + } } - \exp_after:wN \@@_sanitise_comma_auxii:w - \fi: - } -\group_end: -\cs_new_protected:Npn \@@_sanitise_aux:w #1 \q_mark - { \tl_set:Nn \l_@@_sanitise_tl {#1} } -%</package> -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@@_loop:NNw} -% A fast test for the end of the loop, remembering to remove the leading -% quark first. Assuming that is not the case, look for a key and value then -% loop around, re-inserting a leading quark in front of the next position. -% \begin{macrocode} -\cs_new_protected:Npn \@@_loop:NNw #1#2#3 , - { - \exp_after:wN \if_meaning:w \exp_after:wN \q_recursion_tail - \use_none:n #3 \prg_do_nothing: - \else: - \@@_split:NNw #1#2#3 == \q_stop - \exp_after:wN \@@_loop:NNw \exp_after:wN #1 \exp_after:wN #2 - \exp_after:wN \q_mark - \fi: - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@_split:NNw, \@@_split_value:NNw} -% \begin{macro}{\@@_split_tidy:w} -% \begin{macro}{\@@_action:} -% The value is picked up separately from the key so there can be another -% quark inserted at the front, keeping braces and allowing both parts to -% share the same code paths. The key is found first then there's a check -% that there is something there: this is biased to the common case of there -% actually being a key. For the value, we first need to see if there is -% anything to do: if there is, extract it. The appropriate action is then -% inserted in front of the key and value. Doing this using an assignment is -% marginally faster than an expansion chain. -% \begin{macrocode} -\cs_new_protected:Npn \@@_split:NNw #1#2#3 = - { - \@@_def:Nn \l_@@_key_tl {#3} - \if_meaning:w \l_@@_key_tl \c_empty_tl - \exp_after:wN \@@_split_tidy:w - \else: - \exp_after:wN \@@_split_value:NNw - \exp_after:wN #1 - \exp_after:wN #2 - \exp_after:wN \q_mark - \fi: - } -\cs_new_protected:Npn \@@_split_value:NNw #1#2#3 = #4 \q_stop - { - \if:w \scan_stop: \tl_to_str:n {#4} \scan_stop: - \cs_set:Npx \@@_action: - { \exp_not:N #1 { \exp_not:o \l_@@_key_tl } } - \else: - \if:w - \scan_stop: - \__kernel_tl_to_str:w \exp_after:wN { \use_none:n #4 } - \scan_stop: - \@@_def:Nn \l_@@_value_tl {#3} - \cs_set:Npx \@@_action: - { - \exp_not:N #2 - { \exp_not:o \l_@@_key_tl } - { \exp_not:o \l_@@_value_tl } - } - \else: - \cs_set:Npn \@@_action: + \@@_loop_other:NNw ##1 ##2 \s_@@_mark + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_split_active:w} +% \begin{macro}[EXP]{\@@_split_active:nw} +% Splits at the first active equals sign and trims the key. Next test whether +% there are any more valid split points, if so throw an error and gobble the +% remaining \meta{function_2}, which will not yet be gobbled. If there was +% only one active equals sign start trimming the spaces off the value and give +% control to \cs[no-index]{@@_key_val:nnN}. +% \begin{macrocode} + \cs_new:Npn \@@_split_active:w ##1 #2 + { + \@@_trim:nN { ##1 } \@@_split_active:nw \s_@@_mark + } + \cs_new:Npn \@@_split_active:nw ##1 ##2 #2 ##3 \s_@@_stop { - \__kernel_msg_error:nn { kernel } - { misplaced-equals-sign } + \@@_if_empty:w \s_@@_mark ##3 \s_@@_stop + \@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn + { \@@_misplaced_equal_error: \use_none:n } + { \@@_trim:nN { ##2 } \@@_key_val:nnN { ##1 } } } - \fi: - \fi: - \@@_action: +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_if_has_equal_active:w} +% The test for an active equals sign just gobbles tokens until the first +% active equals sign and then runs the test for an empty argument. +% \begin{macrocode} + \cs_new:Npn \@@_if_has_equal_active:w ##1 #2 + { + \@@_if_empty:w \s_@@_mark + } +% \end{macrocode} +% \end{macro} +% +% We're done with the macros which need active equals signs or commas in their +% definition, so we can end that scope and call the temporary macro which will +% do the definitions. +% \begin{macrocode} + } + \char_set_catcode_active:n { `\, } + \char_set_catcode_active:n { `\= } + \@@_tmp:NN , = +\group_end: +% \end{macrocode} +% +% \begin{macro}[EXP]{\@@_end_loop_active:w,\@@_end_loop_other:w} +% Both of these macros just have to gobble a few tokens to remove the reminder +% of the loops current iteration. We do this in a pretty static manner, +% explicitly stating every token we know beforehand because this is slightly +% faster. +% \begin{macrocode} +\cs_new:Npn \@@_end_loop_active:w + \s_@@_mark \s_@@_tail + \@@_loop_other:NNw #1 , \s_@@_tail , + \@@_loop_active:NNw #2 \s_@@_mark + {} +\cs_new:Npn \@@_end_loop_other:w + \s_@@_mark \s_@@_tail + \@@_if_has_equal_other:w #1 = \s_@@_stop + \@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn + #2 + \@@_loop_other:NNw #3 \s_@@_mark + {} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_split_other:w} +% \begin{macro}[EXP]{\@@_split_other:nw} +% These work exactly as \cs[no-index]{@@_split_active:wN}, just for +% equals signs of category other. +% \begin{macrocode} +\cs_new:Npn \@@_split_other:w #1 = + { + \@@_trim:nN { #1 } \@@_split_other:nw \s_@@_mark } -\cs_new_protected:Npn \@@_split_tidy:w #1 \q_stop + \cs_new:Npn \@@_split_other:nw #1 #2 = #3 \s_@@_stop + { + \@@_if_empty:w \s_@@_mark #3 \s_@@_stop + \@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn + { \@@_misplaced_equal_error: \use_none:n } + { \@@_trim:nN { #2 } \@@_key_val:nnN { #1 } } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_key:nN} +% This will get the current key with spaces trimmed and \meta{function_1} as +% its arguments. All it has to do is put them in an \cs{exp_not:n} and reorder +% them. +% \begin{macrocode} +\cs_new:Npn \@@_key:nN #1 #2 { - \if:w - \scan_stop: - \__kernel_tl_to_str:w \exp_after:wN { \use_none:n #1 } - \scan_stop: - \else: - \exp_after:wN \@@_empty_key: - \fi: + \exp_not:n { #2 { #1 } } } -\cs_new:Npn \@@_action: { } -\cs_new_protected:Npn \@@_empty_key: - { \__kernel_msg_error:nn { kernel } { misplaced-equals-sign } } % \end{macrocode} % \end{macro} +% +% \begin{macro}[EXP]{\@@_key_val:nnN} +% This will get the key name and value with spaces trimmed. It has to +% assert that the key name isn't empty. Afterwards put them into an +% \cs{exp_not:n} together with \meta{function_2}. If the key is empty they are +% gobbled instead. +% \begin{macrocode} +\cs_new:Npn \@@_key_val:nnN #1 #2 #3 + { + \@@_if_empty:w \s_@@_mark #2 \s_@@_stop + \@@_empty_key:w \s_@@_mark \s_@@_stop + \exp_not:n { #3 { #2 } { #1 } } + } +% \end{macrocode} % \end{macro} +% +% \begin{macro}[EXP]{\@@_if_empty:w,\@@_if_blank:w,\@@_if_recursion_tail:w} +% All these tests work by gobbling tokens until a certain combination is met, +% which makes them pretty fast. The test for a blank argument should be called +% with an arbitrary token following the argument. Each of these utilize the +% fact that the argument will contain a leading \cs{s_@@_mark}. +% \begin{macrocode} +\cs_new:Npn \@@_if_empty:w #1 \s_@@_mark \s_@@_stop {} +\cs_new:Npn \@@_if_blank:w \s_@@_mark #1 { \@@_if_empty:w \s_@@_mark } +\cs_new:Npn \@@_if_recursion_tail:w #1 \s_@@_mark \s_@@_tail {} +% \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_def:Nn} -% \begin{macro}[EXP]{\@@_def_aux:n} -% \begin{macro}[EXP]{\@@_def_aux:w} -% First remove the leading quark, then trim spaces off, and finally remove -% a set of braces. +% \begin{macro}[EXP]{\@@_has_false:w,\@@_blank_true:w,\@@_empty_key:w} +% These macros will be called if the tests above didn't gobble them, they +% execute the branching. % \begin{macrocode} -\cs_new_protected:Npn \@@_def:Nn #1#2 +\cs_new:Npn \@@_has_false:w \s_@@_mark \s_@@_stop \use_i:nn #1 #2 { #2 } +\cs_new:Npn \@@_blank_true:w \s_@@_mark \s_@@_stop \use:n #1 {} +\cs_new:Npn \@@_empty_key:w \s_@@_mark \s_@@_stop \exp_not:n #1 { - \tl_set:Nx #1 - { \tl_trim_spaces_apply:oN { \use_none:n #2 } \@@_def_aux:n } + \@@_misplaced_equal_error: } -\cs_new:Npn \@@_def_aux:n #1 - { \@@_def_aux:w #1 \q_stop } -\cs_new:Npn \@@_def_aux:w #1 \q_stop { \exp_not:n {#1} } % \end{macrocode} % \end{macro} +% +% \begin{macro}[EXP]{\@@_if_has_equal_other:w} +% Another test that works by gobbling tokens until a specific one is hit. +% \begin{macrocode} +\cs_new:Npn \@@_if_has_equal_other:w #1 = + { + \@@_if_empty:w \s_@@_mark + } +% \end{macrocode} % \end{macro} +% +% \begin{macro}[EXP]{\@@_misplaced_equal_error:} +% Just throw an error expandably. This is hid inside a macro so that other +% macros don't have to gobble so many tokens, which increases speed for +% correct input. This will marginally slow down the error case, but that +% doesn't have to be fast anyway. +% \begin{macrocode} +\cs_new:Npn \@@_misplaced_equal_error: + { + \__kernel_msg_expandable_error:nn { kernel } { misplaced-equals-sign } + } +% \end{macrocode} % \end{macro} % % One message for the low level parsing system. % \begin{macrocode} -\__kernel_msg_new:nnnn { kernel } { misplaced-equals-sign } +\__kernel_msg_new:nnn { kernel } { misplaced-equals-sign } { Misplaced~equals~sign~in~key-value~input~\msg_line_context: } - { - LaTeX~is~attempting~to~parse~some~key-value~input~but~found~ - two~equals~signs~not~separated~by~a~comma. - } % \end{macrocode} % +% \begin{macro}[EXP]{\@@_trim:nN} +% \begin{macro}[EXP] +% {\@@_trim_auxi:w,\@@_trim_auxii:w,\@@_trim_auxiii:w,\@@_trim_auxiv:w} +% And an adapted version of \cs{__tl_trim_spaces:nn} which is a bit faster for +% our use case, as it can strip the braces at the end. This is pretty much the +% same concept, so I won't comment on it here. The speed gain by using this +% instead of \cs{tl_trim_spaces_apply:nN} is about 10\,\% of the total time for +% \cs{keyval_parse:NNn} with one key and one key--value pair, so I think it's +% worth it. +% \begin{macrocode} +\group_begin: + \cs_set_protected:Npn \@@_tmp:n #1 + { + \cs_new:Npn \@@_trim:nN ##1 + { + \@@_trim_auxi:w + ##1 + \s_@@_nil + \s_@@_mark #1 {} + \s_@@_mark \@@_trim_auxii:w + \@@_trim_auxiii:w + #1 \s_@@_nil + \@@_trim_auxiv:w + \s_@@_stop + } + \cs_new:Npn \@@_trim_auxi:w ##1 \s_@@_mark #1 ##2 \s_@@_mark ##3 + { + ##3 + \@@_trim_auxi:w + \s_@@_mark + ##2 + \s_@@_mark #1 {##1} + } + \cs_new:Npn \@@_trim_auxii:w \@@_trim_auxi:w \s_@@_mark \s_@@_mark ##1 + { + \@@_trim_auxiii:w + ##1 + } + \cs_new:Npn \@@_trim_auxiii:w ##1 #1 \s_@@_nil ##2 + { + ##2 + ##1 \s_@@_nil + \@@_trim_auxiii:w + } +% \end{macrocode} +% This is the one macro which differs from the original definition. +% \begin{macrocode} + \cs_new:Npn \@@_trim_auxiv:w \s_@@_mark ##1 \s_@@_nil ##2 \s_@@_stop ##3 + { ##3 { ##1 } } + } + \@@_tmp:n { ~ } +\group_end: +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \subsection{Constants and variables} % % \begin{macrocode} @@ -2670,7 +2753,7 @@ { \tl_set:Nx \l_@@_relative_tl { \exp_args:No \@@_trim_spaces:n \l_@@_relative_tl } - \use:x + \use:x { \cs_set_protected:Npn \@@_store_unused:w ####1 \l_@@_relative_tl / @@ -2772,7 +2855,6 @@ { \exp_after:wN \@@_trim_spaces_auxi:w \tl_to_str:n {#1} / \q_nil \q_stop - } \cs_new:Npn \@@_trim_spaces_auxi:w #1 / #2 \q_stop { diff --git a/macros/latex/contrib/l3kernel/l3legacy.dtx b/macros/latex/contrib/l3kernel/l3legacy.dtx index 58984c8ba0..af62b24dc3 100644 --- a/macros/latex/contrib/l3kernel/l3legacy.dtx +++ b/macros/latex/contrib/l3kernel/l3legacy.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3luatex.dtx b/macros/latex/contrib/l3kernel/l3luatex.dtx index e3d5f6d816..942ad266f6 100644 --- a/macros/latex/contrib/l3kernel/l3luatex.dtx +++ b/macros/latex/contrib/l3kernel/l3luatex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3msg.dtx b/macros/latex/contrib/l3kernel/l3msg.dtx index 4b2c06f526..42799793c3 100644 --- a/macros/latex/contrib/l3kernel/l3msg.dtx +++ b/macros/latex/contrib/l3kernel/l3msg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3names.dtx b/macros/latex/contrib/l3kernel/l3names.dtx index 129e6ed6a2..f86cc4cf62 100644 --- a/macros/latex/contrib/l3kernel/l3names.dtx +++ b/macros/latex/contrib/l3kernel/l3names.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % @@ -804,6 +804,8 @@ \@@_primitive:NN \dviextension \tex_dviextension:D \@@_primitive:NN \dvifeedback \tex_dvifeedback:D \@@_primitive:NN \dvivariable \tex_dvivariable:D + \@@_primitive:NN \eTeXglueshrinkorder \tex_eTeXglueshrinkorder:D + \@@_primitive:NN \eTeXgluestretchorder \tex_eTeXgluestretchorder:D \@@_primitive:NN \etoksapp \tex_etoksapp:D \@@_primitive:NN \etokspre \tex_etokspre:D \@@_primitive:NN \exceptionpenalty \tex_exceptionpenalty:D @@ -1124,9 +1126,11 @@ \@@_primitive:NN \hfi \tex_hfi:D \@@_primitive:NN \ifdbox \tex_ifdbox:D \@@_primitive:NN \ifddir \tex_ifddir:D + \@@_primitive:NN \ifjfont \tex_ifjfont:D \@@_primitive:NN \ifmbox \tex_ifmbox:D \@@_primitive:NN \ifmdir \tex_ifmdir:D \@@_primitive:NN \iftbox \tex_iftbox:D + \@@_primitive:NN \iftfont \tex_iftfont:D \@@_primitive:NN \iftdir \tex_iftdir:D \@@_primitive:NN \ifybox \tex_ifybox:D \@@_primitive:NN \ifydir \tex_ifydir:D @@ -1171,6 +1175,7 @@ % \end{macrocode} % Primitives from \upTeX{}. % \begin{macrocode} + \@@_primitive:NN \currentcjktoken \tex_currentcjktoken:D \@@_primitive:NN \disablecjktoken \tex_disablecjktoken:D \@@_primitive:NN \enablecjktoken \tex_enablecjktoken:D \@@_primitive:NN \forcecjktoken \tex_forcecjktoken:D diff --git a/macros/latex/contrib/l3kernel/l3news.pdf b/macros/latex/contrib/l3kernel/l3news.pdf Binary files differindex a06982d228..548fee9bed 100644 --- a/macros/latex/contrib/l3kernel/l3news.pdf +++ b/macros/latex/contrib/l3kernel/l3news.pdf diff --git a/macros/latex/contrib/l3kernel/l3news.tex b/macros/latex/contrib/l3kernel/l3news.tex index ba379538e8..8b12177a15 100644 --- a/macros/latex/contrib/l3kernel/l3news.tex +++ b/macros/latex/contrib/l3kernel/l3news.tex @@ -25,6 +25,14 @@ \hypersetup{colorlinks} \usepackage{bookmark} +\MakeOuterQuote{"} + +\pdfstringdefDisableCommands + {% + \RenewExpandableDocumentCommand \cs { O{} m } + {\textbackslash#2}% + } + \makeatletter \newcounter{issue} \renewcommand*{\theissue}{% @@ -155,6 +163,13 @@ }{% \clearpage }% + \def\MakeOuterQuote#1{% + \if\noexpand"\noexpand#1% + \else + \@latex@error{Unexpected \string\MakeOuterQuote + {\detokenize{#1}}\MessageBreak% + Check if output is valid in `l3news\theissue.tex'}% + \fi} \makeatother \loop \ifnum\value{issue}<\lastissue diff --git a/macros/latex/contrib/l3kernel/l3news01.pdf b/macros/latex/contrib/l3kernel/l3news01.pdf Binary files differindex 0fa9132de6..3ace4904a4 100644 --- a/macros/latex/contrib/l3kernel/l3news01.pdf +++ b/macros/latex/contrib/l3kernel/l3news01.pdf diff --git a/macros/latex/contrib/l3kernel/l3news02.pdf b/macros/latex/contrib/l3kernel/l3news02.pdf Binary files differindex 0110d5cdc0..9ed1645fcd 100644 --- a/macros/latex/contrib/l3kernel/l3news02.pdf +++ b/macros/latex/contrib/l3kernel/l3news02.pdf diff --git a/macros/latex/contrib/l3kernel/l3news03.pdf b/macros/latex/contrib/l3kernel/l3news03.pdf Binary files differindex 38f2707903..391475fcf6 100644 --- a/macros/latex/contrib/l3kernel/l3news03.pdf +++ b/macros/latex/contrib/l3kernel/l3news03.pdf diff --git a/macros/latex/contrib/l3kernel/l3news04.pdf b/macros/latex/contrib/l3kernel/l3news04.pdf Binary files differindex 7399a65d84..095d00c064 100644 --- a/macros/latex/contrib/l3kernel/l3news04.pdf +++ b/macros/latex/contrib/l3kernel/l3news04.pdf diff --git a/macros/latex/contrib/l3kernel/l3news05.pdf b/macros/latex/contrib/l3kernel/l3news05.pdf Binary files differindex d17c6e49dc..128147df68 100644 --- a/macros/latex/contrib/l3kernel/l3news05.pdf +++ b/macros/latex/contrib/l3kernel/l3news05.pdf diff --git a/macros/latex/contrib/l3kernel/l3news06.pdf b/macros/latex/contrib/l3kernel/l3news06.pdf Binary files differindex 9cfe26ccde..eb931c08db 100644 --- a/macros/latex/contrib/l3kernel/l3news06.pdf +++ b/macros/latex/contrib/l3kernel/l3news06.pdf diff --git a/macros/latex/contrib/l3kernel/l3news07.pdf b/macros/latex/contrib/l3kernel/l3news07.pdf Binary files differindex e0208fa696..0f0710fb54 100644 --- a/macros/latex/contrib/l3kernel/l3news07.pdf +++ b/macros/latex/contrib/l3kernel/l3news07.pdf diff --git a/macros/latex/contrib/l3kernel/l3news08.pdf b/macros/latex/contrib/l3kernel/l3news08.pdf Binary files differindex ae306f8536..1ac7b48fc0 100644 --- a/macros/latex/contrib/l3kernel/l3news08.pdf +++ b/macros/latex/contrib/l3kernel/l3news08.pdf diff --git a/macros/latex/contrib/l3kernel/l3news09.pdf b/macros/latex/contrib/l3kernel/l3news09.pdf Binary files differindex 0dd900517a..f0b9042c8a 100644 --- a/macros/latex/contrib/l3kernel/l3news09.pdf +++ b/macros/latex/contrib/l3kernel/l3news09.pdf diff --git a/macros/latex/contrib/l3kernel/l3news10.pdf b/macros/latex/contrib/l3kernel/l3news10.pdf Binary files differindex e96f6bb029..a28ad5fabf 100644 --- a/macros/latex/contrib/l3kernel/l3news10.pdf +++ b/macros/latex/contrib/l3kernel/l3news10.pdf diff --git a/macros/latex/contrib/l3kernel/l3news11.pdf b/macros/latex/contrib/l3kernel/l3news11.pdf Binary files differindex 3a4e17fd16..3df9be07b4 100644 --- a/macros/latex/contrib/l3kernel/l3news11.pdf +++ b/macros/latex/contrib/l3kernel/l3news11.pdf diff --git a/macros/latex/contrib/l3kernel/l3news12.pdf b/macros/latex/contrib/l3kernel/l3news12.pdf Binary files differindex 0f7aaf6285..9ffaf1e42f 100644 --- a/macros/latex/contrib/l3kernel/l3news12.pdf +++ b/macros/latex/contrib/l3kernel/l3news12.pdf diff --git a/macros/latex/contrib/l3kernel/l3prefixes.pdf b/macros/latex/contrib/l3kernel/l3prefixes.pdf Binary files differindex 7ff0a83c23..3e52f7b795 100644 --- a/macros/latex/contrib/l3kernel/l3prefixes.pdf +++ b/macros/latex/contrib/l3kernel/l3prefixes.pdf diff --git a/macros/latex/contrib/l3kernel/l3prg.dtx b/macros/latex/contrib/l3kernel/l3prg.dtx index cbe1ea8bd4..3cbb989db4 100644 --- a/macros/latex/contrib/l3kernel/l3prg.dtx +++ b/macros/latex/contrib/l3kernel/l3prg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3prop.dtx b/macros/latex/contrib/l3kernel/l3prop.dtx index 7b06d4de6d..0d21cdaa12 100644 --- a/macros/latex/contrib/l3kernel/l3prop.dtx +++ b/macros/latex/contrib/l3kernel/l3prop.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3quark.dtx b/macros/latex/contrib/l3kernel/l3quark.dtx index 279747cfda..bb7f8f94c4 100644 --- a/macros/latex/contrib/l3kernel/l3quark.dtx +++ b/macros/latex/contrib/l3kernel/l3quark.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3regex.dtx b/macros/latex/contrib/l3kernel/l3regex.dtx index 746ebde995..7901939530 100644 --- a/macros/latex/contrib/l3kernel/l3regex.dtx +++ b/macros/latex/contrib/l3kernel/l3regex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3seq.dtx b/macros/latex/contrib/l3kernel/l3seq.dtx index ccc96251db..9432890987 100644 --- a/macros/latex/contrib/l3kernel/l3seq.dtx +++ b/macros/latex/contrib/l3kernel/l3seq.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3skip.dtx b/macros/latex/contrib/l3kernel/l3skip.dtx index 0669b3b172..e15fa39a90 100644 --- a/macros/latex/contrib/l3kernel/l3skip.dtx +++ b/macros/latex/contrib/l3kernel/l3skip.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3sort.dtx b/macros/latex/contrib/l3kernel/l3sort.dtx index e95a16e715..e81bb56033 100644 --- a/macros/latex/contrib/l3kernel/l3sort.dtx +++ b/macros/latex/contrib/l3kernel/l3sort.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3str-convert.dtx b/macros/latex/contrib/l3kernel/l3str-convert.dtx index 3cf63e2768..b0e38274f5 100644 --- a/macros/latex/contrib/l3kernel/l3str-convert.dtx +++ b/macros/latex/contrib/l3kernel/l3str-convert.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3str.dtx b/macros/latex/contrib/l3kernel/l3str.dtx index 15a1378668..18880fe200 100644 --- a/macros/latex/contrib/l3kernel/l3str.dtx +++ b/macros/latex/contrib/l3kernel/l3str.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3styleguide.pdf b/macros/latex/contrib/l3kernel/l3styleguide.pdf Binary files differindex e61ce63c9d..af3ec49fc6 100644 --- a/macros/latex/contrib/l3kernel/l3styleguide.pdf +++ b/macros/latex/contrib/l3kernel/l3styleguide.pdf diff --git a/macros/latex/contrib/l3kernel/l3styleguide.tex b/macros/latex/contrib/l3kernel/l3styleguide.tex index 0a7686ae03..5efb9d47fc 100644 --- a/macros/latex/contrib/l3kernel/l3styleguide.tex +++ b/macros/latex/contrib/l3kernel/l3styleguide.tex @@ -32,7 +32,7 @@ The released version of this bundle is available from CTAN. {latex-team@latex-project.org}% }% } -\date{Released 2020-02-25} +\date{Released 2020-03-03} \begin{document} diff --git a/macros/latex/contrib/l3kernel/l3syntax-changes.pdf b/macros/latex/contrib/l3kernel/l3syntax-changes.pdf Binary files differindex 9663dbfa35..4acc2f2a2f 100644 --- a/macros/latex/contrib/l3kernel/l3syntax-changes.pdf +++ b/macros/latex/contrib/l3kernel/l3syntax-changes.pdf diff --git a/macros/latex/contrib/l3kernel/l3syntax-changes.tex b/macros/latex/contrib/l3kernel/l3syntax-changes.tex index f6b5382fe9..1ccd4dce5c 100644 --- a/macros/latex/contrib/l3kernel/l3syntax-changes.tex +++ b/macros/latex/contrib/l3kernel/l3syntax-changes.tex @@ -32,7 +32,7 @@ The released version of this bundle is available from CTAN. {latex-team@latex-project.org}% }% } -\date{Released 2020-02-25} +\date{Released 2020-03-03} \newcommand{\TF}{\textit{(TF)}} @@ -180,4 +180,11 @@ No change. function was \texttt{N}-type. \end{itemize} +\section{February 2020} + +\begin{itemize} + \item \cs{keyval_parse:NNn} now works by expansion, returning + the parsed list inside \cs{exp_not:n}. +\end{itemize} + \end{document} diff --git a/macros/latex/contrib/l3kernel/l3sys.dtx b/macros/latex/contrib/l3kernel/l3sys.dtx index d5b28d2f2b..1dbfca2d0e 100644 --- a/macros/latex/contrib/l3kernel/l3sys.dtx +++ b/macros/latex/contrib/l3kernel/l3sys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3term-glossary.pdf b/macros/latex/contrib/l3kernel/l3term-glossary.pdf Binary files differindex 8d83bef487..b23107625d 100644 --- a/macros/latex/contrib/l3kernel/l3term-glossary.pdf +++ b/macros/latex/contrib/l3kernel/l3term-glossary.pdf diff --git a/macros/latex/contrib/l3kernel/l3term-glossary.tex b/macros/latex/contrib/l3kernel/l3term-glossary.tex index 3504f898f5..9e1ee7818c 100644 --- a/macros/latex/contrib/l3kernel/l3term-glossary.tex +++ b/macros/latex/contrib/l3kernel/l3term-glossary.tex @@ -32,7 +32,7 @@ The released version of this bundle is available from CTAN. {latex-team@latex-project.org}% }% } -\date{Released 2020-02-25} +\date{Released 2020-03-03} \newcommand{\TF}{\textit{(TF)}} diff --git a/macros/latex/contrib/l3kernel/l3text-case.dtx b/macros/latex/contrib/l3kernel/l3text-case.dtx index 9cf8bff4ce..0a516e56fb 100644 --- a/macros/latex/contrib/l3kernel/l3text-case.dtx +++ b/macros/latex/contrib/l3kernel/l3text-case.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3text.dtx b/macros/latex/contrib/l3kernel/l3text.dtx index 837c1761d4..01af5e5c49 100644 --- a/macros/latex/contrib/l3kernel/l3text.dtx +++ b/macros/latex/contrib/l3kernel/l3text.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3tl-analysis.dtx b/macros/latex/contrib/l3kernel/l3tl-analysis.dtx index fe96c4ba2a..023bc13ab5 100644 --- a/macros/latex/contrib/l3kernel/l3tl-analysis.dtx +++ b/macros/latex/contrib/l3kernel/l3tl-analysis.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3tl.dtx b/macros/latex/contrib/l3kernel/l3tl.dtx index 229d5f8196..77fb21b753 100644 --- a/macros/latex/contrib/l3kernel/l3tl.dtx +++ b/macros/latex/contrib/l3kernel/l3tl.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3token.dtx b/macros/latex/contrib/l3kernel/l3token.dtx index 1d07b79af4..0a78a6401a 100644 --- a/macros/latex/contrib/l3kernel/l3token.dtx +++ b/macros/latex/contrib/l3kernel/l3token.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % @@ -1831,7 +1831,9 @@ { \tl_to_str:n {#2} } { \char_generate:nn {#1} { 12 } } } -\cs_if_exist:NF \tex_Uchar:D +\bool_lazy_or:nnF + { \cs_if_exist_p:N \tex_luatexversion:D } + { \cs_if_exist_p:N \tex_XeTeXversion:D } { \cs_set:Npn \@@_str_change_case:nN #1#2 { \tl_to_str:n {#2} } diff --git a/macros/latex/contrib/l3kernel/l3unicode.dtx b/macros/latex/contrib/l3kernel/l3unicode.dtx index 40c6775754..42f10d7ee9 100644 --- a/macros/latex/contrib/l3kernel/l3unicode.dtx +++ b/macros/latex/contrib/l3kernel/l3unicode.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/source3.pdf b/macros/latex/contrib/l3kernel/source3.pdf Binary files differindex d3419a584b..f70cc7def0 100644 --- a/macros/latex/contrib/l3kernel/source3.pdf +++ b/macros/latex/contrib/l3kernel/source3.pdf diff --git a/macros/latex/contrib/l3kernel/source3.tex b/macros/latex/contrib/l3kernel/source3.tex index b18a1fc90a..03b190192a 100644 --- a/macros/latex/contrib/l3kernel/source3.tex +++ b/macros/latex/contrib/l3kernel/source3.tex @@ -53,7 +53,7 @@ for those people who are interested. {latex-team@latex-project.org}% }% } -\date{Released 2020-02-25} +\date{Released 2020-03-03} \pagenumbering{roman} \maketitle diff --git a/macros/latex/contrib/l3packages/CHANGELOG.md b/macros/latex/contrib/l3packages/CHANGELOG.md index 2a56ece1a1..9b92b84018 100644 --- a/macros/latex/contrib/l3packages/CHANGELOG.md +++ b/macros/latex/contrib/l3packages/CHANGELOG.md @@ -7,6 +7,12 @@ this project uses date-based 'snapshot' version identifiers. ## [Unreleased] +## [2020-03-03] + +### Changed +- Delimited arguments (`DdRrEet`) now allow control sequence tokens + as delimiters (issues #367 and #368) + ## [2020-02-25] ### Changed @@ -81,7 +87,8 @@ this project uses date-based 'snapshot' version identifiers. - Switch to ISO date format - Improve cross-module use of internal functions -[Unreleased]: https://github.com/latex3/latex3/compare/2020-02-25...HEAD +[Unreleased]: https://github.com/latex3/latex3/compare/2020-03-03...HEAD +[2020-03-03]: https://github.com/latex3/latex3/compare/2020-02-25...2020-03-03 [2020-02-25]: https://github.com/latex3/latex3/compare/2020-02-14...2020-02-25 [2020-02-14]: https://github.com/latex3/latex3/compare/2020-02-08...2020-02-14 [2020-02-08]: https://github.com/latex3/latex3/compare/2020-02-03...2020-02-08 diff --git a/macros/latex/contrib/l3packages/README.md b/macros/latex/contrib/l3packages/README.md index b7712552ba..60647bde63 100644 --- a/macros/latex/contrib/l3packages/README.md +++ b/macros/latex/contrib/l3packages/README.md @@ -1,7 +1,7 @@ LaTeX3 High-Level Concepts ========================== -Release 2020-02-25 +Release 2020-03-03 Overview -------- diff --git a/macros/latex/contrib/l3packages/l3keys2e.dtx b/macros/latex/contrib/l3packages/l3keys2e.dtx index 2022b0ac00..3b648b7bdd 100644 --- a/macros/latex/contrib/l3packages/l3keys2e.dtx +++ b/macros/latex/contrib/l3packages/l3keys2e.dtx @@ -62,7 +62,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % @@ -139,7 +139,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{l3keys2e}{2020-02-25}{} +\ProvidesExplPackage{l3keys2e}{2020-03-03}{} {LaTeX2e option processing using LaTeX3 keys} % \end{macrocode} % diff --git a/macros/latex/contrib/l3packages/l3keys2e.pdf b/macros/latex/contrib/l3packages/l3keys2e.pdf Binary files differindex ac7a187f8e..2a1c8fedbd 100644 --- a/macros/latex/contrib/l3packages/l3keys2e.pdf +++ b/macros/latex/contrib/l3packages/l3keys2e.pdf diff --git a/macros/latex/contrib/l3packages/xfp.dtx b/macros/latex/contrib/l3packages/xfp.dtx index 6bd7eb53b2..023e0e2ed5 100644 --- a/macros/latex/contrib/l3packages/xfp.dtx +++ b/macros/latex/contrib/l3packages/xfp.dtx @@ -64,7 +64,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % @@ -167,7 +167,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xfp}{2020-02-25}{} +\ProvidesExplPackage{xfp}{2020-03-03}{} {L3 Floating point unit} % \end{macrocode} % diff --git a/macros/latex/contrib/l3packages/xfp.pdf b/macros/latex/contrib/l3packages/xfp.pdf Binary files differindex 74dc6b73c3..e5896aa5e8 100644 --- a/macros/latex/contrib/l3packages/xfp.pdf +++ b/macros/latex/contrib/l3packages/xfp.pdf diff --git a/macros/latex/contrib/l3packages/xfrac.dtx b/macros/latex/contrib/l3packages/xfrac.dtx index 287c27a744..abbce7d8d1 100644 --- a/macros/latex/contrib/l3packages/xfrac.dtx +++ b/macros/latex/contrib/l3packages/xfrac.dtx @@ -65,7 +65,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % @@ -535,7 +535,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xfrac}{2020-02-25}{} +\ProvidesExplPackage{xfrac}{2020-03-03}{} {L3 Experimental split-level fractions} % \end{macrocode} % diff --git a/macros/latex/contrib/l3packages/xfrac.pdf b/macros/latex/contrib/l3packages/xfrac.pdf Binary files differindex 4031e6c18e..4c26aa4286 100644 --- a/macros/latex/contrib/l3packages/xfrac.pdf +++ b/macros/latex/contrib/l3packages/xfrac.pdf diff --git a/macros/latex/contrib/l3packages/xparse.dtx b/macros/latex/contrib/l3packages/xparse.dtx index fc0164a8cd..279b2e58c0 100644 --- a/macros/latex/contrib/l3packages/xparse.dtx +++ b/macros/latex/contrib/l3packages/xparse.dtx @@ -67,7 +67,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % @@ -130,12 +130,12 @@ % Regardless of the input, the argument will be passed to the % internal code without the outer braces. This is the \pkg{xparse} % type specifier for a normal \TeX{} argument. -% \item[r] Given as \texttt{r}\meta{char1}\meta{char2}, this denotes a +% \item[r] Given as \texttt{r}\meta{token1}\meta{token2}, this denotes a % \enquote{required} delimited argument, where the delimiters are -% \meta{char1} and \meta{char2}. If the opening delimiter -% \meta{char1} is missing, the default marker |-NoValue-| will be +% \meta{token1} and \meta{token2}. If the opening delimiter +% \meta{token1} is missing, the default marker |-NoValue-| will be % inserted after a suitable error. -% \item[R] Given as \texttt{R}\meta{char1}\meta{char2}\marg{default}, +% \item[R] Given as \texttt{R}\meta{token1}\meta{token2}\marg{default}, % this is a \enquote{required} delimited argument as for~\texttt{r}, % but it has a user-definable recovery \meta{default} instead of % |-NoValue-|. @@ -158,30 +158,30 @@ % \item[o] A standard \LaTeX{} optional argument, surrounded with square % brackets, which will supply % the special |-NoValue-| marker if not given (as described later). -% \item[d] Given as \texttt{d}\meta{char1}\meta{char2}, an optional -% argument which is delimited by \meta{char1} and \meta{char2}. +% \item[d] Given as \texttt{d}\meta{token1}\meta{token2}, an optional +% argument which is delimited by \meta{token1} and \meta{token2}. % As with \texttt{o}, if no % value is given the special marker |-NoValue-| is returned. % \item[O] Given as \texttt{O}\marg{default}, is like \texttt{o}, but % returns \meta{default} if no value is given. -% \item[D] Given as \texttt{D}\meta{char1}\meta{char2}\marg{default}, +% \item[D] Given as \texttt{D}\meta{token1}\meta{token2}\marg{default}, % it is as for \texttt{d}, but returns \meta{default} if no value is given. % Internally, the \texttt{o}, \texttt{d} and \texttt{O} types are % short-cuts to an appropriated-constructed \texttt{D} type argument. % \item[s] An optional star, which will result in a value % \cs{BooleanTrue} if a star is present and \cs{BooleanFalse} % otherwise (as described later). -% \item[t] An optional \meta{char}, which will result in a value -% \cs{BooleanTrue} if \meta{char} is present and \cs{BooleanFalse} -% otherwise. Given as \texttt{t}\meta{char}. -% \item[e] Given as \texttt{e}\marg{chars}, a set of optional +% \item[t] An optional \meta{token}, which will result in a value +% \cs{BooleanTrue} if \meta{token} is present and \cs{BooleanFalse} +% otherwise. Given as \texttt{t}\meta{token}. +% \item[e] Given as \texttt{e}\marg{tokens}, a set of optional % \emph{embellishments}, each of which requires a \emph{value}. % If an embellishment is not present, |-NoValue-| is returned. Each % embellishment gives one argument, ordered as for the list of -% \meta{chars} in the argument specification. All \meta{chars} +% \meta{tokens} in the argument specification. All \meta{tokens} % must be distinct. \emph{This is an experimental type}. % \item[E] As for \texttt{e} but returns one or more \meta{defaults} -% if values are not given: \texttt{E}\marg{chars}\marg{defaults}. See +% if values are not given: \texttt{E}\marg{tokens}\marg{defaults}. See % Section~\ref{sec:embellishment} for more details. % \end{itemize} % @@ -213,7 +213,9 @@ % \foo[[] % Error: missing closing "]" % \end{verbatim} % Also note that |{| and |}| cannot be used as delimiters as they are used -% by \TeX{} as grouping tokens. Arguments to be grabbed inside these tokens +% by \TeX{} as grouping tokens. Implicit begin- or end-group tokens (\emph{e.g.}, +% |\bgroup| and |\egroup|) are not allowed for delimited argument tipes. +% Arguments to be grabbed inside these tokens % must be created as either \texttt{m}- or \texttt{g}-type arguments. % % Within delimited arguments, non-balanced or otherwise awkward tokens may @@ -371,13 +373,13 @@ % \subsection{Default values for \enquote{embellishments}} % \label{sec:embellishment} % -% The \texttt{E}-type argument allows one default value per test character. +% The \texttt{E}-type argument allows one default value per test token. % This is achieved by giving a list of defaults for each entry in the % list, for example: % \begin{verbatim} % E{^_}{{UP}{DOWN}} % \end{verbatim} -% If the list of default values is \emph{shorter} than the list of test characters, +% If the list of default values is \emph{shorter} than the list of test tokens, % the special |-NoValue-| marker will be returned (as for the \texttt{e}-type % argument). Thus for example % \begin{verbatim} @@ -487,6 +489,66 @@ % is given: \texttt{G}\marg{default}. % \end{itemize} % +% \subsection{Details about argument delimiters} +% +% In normal (non-expandable) commands, the delimited types look for the +% initial delimiter by peeking ahead (using \pkg{expl3}'s |\peek_...| +% functions) looking for the delimiter token. The token has to have the +% same meaning and \enquote{shape} of the token defined as delimiter. +% There are three possible cases of delimiters: character tokens, control +% sequence tokens, and active character tokens. For all practical purposes +% of this description, active character tokens will behave exactly as +% control sequence tokens. +% +% \subsubsection{Character tokens} +% +% A character token is characterised by its character code, and its meaning +% is the category code~(|\catcode|). When a command is defined, the meaning +% of the character token is fixed into the definition of the command and +% cannot change. A command will correctly see an argument delimiter if +% the open delimiter has the same character and category codes as at the +% time of the definition. For example in: +% \begin{verbatim} +% \NewDocumentCommand { \foobar } { D<>{default} } {(#1)} +% \foobar <hello> \par +% \char_set_catcode_letter:N < +% \foobar <hello> +% \end{verbatim} +% the output would be: +% \begin{verbatim} +% (hello) +% (default)<hello> +% \end{verbatim} +% as the open-delimter |<| changed in meaning between the two calls to +% |\foobar|, so the second one doesn't see the |<| as a valid delimiter. +% Commands assume that if a valid open-delimiter was found, a matching +% close-delimiter will also be there. If it is not (either by being +% omitted or by changing in meaning), a low-level \TeX{} error is raised +% and the command call is aborted. +% +% \subsubsection{Control sequence tokens} +% +% A control sequence (or control character) token is characterised by is +% its name, and its meaning is its definition. +% A token cannot have two different meanings at the same time. +% When a control sequence is defined as delimiter in a command, +% it will be detected as delimiter whenever the control sequence name +% is found in the document regardless of its current definition. +% For example in: +% \begin{verbatim} +% \cs_set:Npn \x { abc } +% \NewDocumentCommand { \foobar } { D\x\y{default} } {(#1)} +% \foobar \x hello\y \par +% \cs_set:Npn \x { def } +% \foobar \x hello\y +% \end{verbatim} +% the output would be: +% \begin{verbatim} +% (hello) +% (hello) +% \end{verbatim} +% with both calls to the command seeing the delimiter |\x|. +% % \section{Declaring commands and environments} % % With the concept of an argument specifier defined, it is now @@ -916,7 +978,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xparse}{2020-02-25}{} +\ProvidesExplPackage{xparse}{2020-03-03}{} {L3 Experimental document command parser} % \end{macrocode} % @@ -1906,8 +1968,8 @@ \cs_new_protected:Npn \@@_normalize_type_D:w #1#2#3 { \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn } - \@@_single_char_check:n {#1} - \@@_single_char_check:n {#2} + \@@_single_token_check:n {#1} \@@_allowed_token_check:N #1 + \@@_single_token_check:n {#2} \@@_add_arg_spec:n { D #1 #2 {#3} } \tl_put_right:Nn \l_@@_last_delimiters_tl {#1} \bool_set_false:N \l_@@_grab_expandably_bool @@ -1917,7 +1979,8 @@ { \quark_if_recursion_tail_stop_do:nn {#2} { \@@_bad_arg_spec:wn } \tl_if_blank:nT {#1} { \@@_bad_arg_spec:wn } - \tl_map_function:nN {#1} \@@_single_char_check:n + \tl_map_function:nN {#1} \@@_single_token_check:n + \tl_map_function:nN {#1} \@@_allowed_token_check:N \@@_normalize_E_unique_check:w #1 \q_nil \q_stop \int_compare:nNnT { \tl_count:n {#2} } > { \tl_count:n {#1} } { \@@_bad_arg_spec:wn } @@ -1946,7 +2009,7 @@ \cs_new_protected:Npn \@@_normalize_type_t:w #1 { \quark_if_recursion_tail_stop_do:Nn #1 { \@@_bad_arg_spec:wn } - \@@_single_char_check:n {#1} + \@@_single_token_check:n {#1} \@@_allowed_token_check:N #1 \tl_put_right:Nx \l_@@_arg_spec_tl { \bool_if:NT \l_@@_obey_spaces_bool { ! } @@ -1994,8 +2057,8 @@ \cs_new_protected:Npn \@@_normalize_type_R:w #1#2#3 { \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn } - \@@_single_char_check:n {#1} - \@@_single_char_check:n {#2} + \@@_single_token_check:n {#1} \@@_allowed_token_check:N #1 + \@@_single_token_check:n {#2} \@@_delimiter_check:nnn {#1} { R/r } { \tl_to_str:n {#1} } \bool_set_false:N \l_@@_grab_expandably_bool \@@_add_arg_spec_mandatory:n { R #1 #2 {#3} } @@ -2042,27 +2105,53 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_single_char_check:n} -% Checks that what should be single characters really are single -% characters (possibly surrounded by spaces). +% \begin{macro}{\@@_single_token_check:n} +% Checks that the argument is a single (non-space) token (possibly +% surrounded by spaces), and aborts the definition otherwise. % \begin{macrocode} -\cs_new_protected:Npn \@@_single_char_check:n #1 +\cs_new_protected:Npn \@@_single_token_check:n #1 { - \tl_trim_spaces_apply:nN {#1} \tl_if_single_token:nTF + \tl_trim_spaces_apply:nN {#1} \tl_if_single_token:nF { - \group_begin: - \tex_escapechar:D = 92 \scan_stop: - \exp_args:Nx \tl_if_single_token:nF - { \exp_args:No \tl_to_str:n { \use:nn #1 { } } } - { - \__kernel_msg_warning:nnxx { xparse } { not-single-char } - { \@@_environment_or_command: } { \tl_to_str:n {#1} } - } - \group_end: + \__kernel_msg_error:nnxx { xparse } { not-single-token } + { \@@_environment_or_command: } { \tl_to_str:n {#1} } + \@@_bad_def:wn } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_allowed_token_check:N} +% Some tokens are now allowed as delimiters for some argument types, +% notably implicit begin/end-group tokens (|\bgroup|/|\egroup|). +% The major problem with these tokens is that for |\peek_...| functions, +% a literal~|{|$_1$. is virtually indistinguishable from a |\bgroup| or +% other token which was |\let| to a~|{|$_1$, and the same goes +% for~|}|$_2$. All other tokens can be easily distingushed from their +% implicit counterparts by grabbing them and looking at the string +% length (see \cs{@@_token_if_cs:NTF}), but for begin/end group tokens +% that is not possible without the risk of mistakenly grabbing the +% entire brace group (potentially leading to a~\texttt{!~Runaway argument} +% error) or trying to grab a |}|$_2$, leading to a~\texttt{!~Argument +% of~\dots~has an extra~|}|}. +% \begin{macrocode} +\cs_new_protected:Npn \@@_allowed_token_check:N #1 + { + \token_if_eq_meaning:NNTF #1 \c_group_begin_token + { \use:n } + { + \token_if_eq_meaning:NNTF #1 \c_group_end_token + { \use:n } + { \use_none:n } + } { - \__kernel_msg_error:nnxx { xparse } { not-single-char } + \__kernel_msg_error:nnxxx + { xparse } { forbidden-implicit-group-token } { \@@_environment_or_command: } { \tl_to_str:n {#1} } + { + \token_if_eq_meaning:NNTF #1 \c_group_begin_token + { begin } { end } + } \@@_bad_def:wn } } @@ -2853,12 +2942,12 @@ \cs_new_protected:Npn \@@_grab_D_obey_spaces:w #1#2#3 \@@_run_code: { \@@_grab_D_aux:NNnNN #1 #2 {#3} \cs_set_protected_nopar:Npn - \peek_meaning_remove:NTF + \@@_peek_meaning_remove:NTF } \cs_new_protected:Npn \@@_grab_D_long_obey_spaces:w #1#2#3 \@@_run_code: { \@@_grab_D_aux:NNnNN #1 #2 {#3} \cs_set_protected:Npn - \peek_meaning_remove:NTF + \@@_peek_meaning_remove:NTF } % \end{macrocode} % \begin{macro}{\@@_grab_D_aux:NNnNN} @@ -2991,6 +3080,12 @@ % the grabber. (This assumes that the open and close delimiters are not the % same character with different category codes, but that really should not % happen in any sensible document-level syntax.) +% An exception is when |#1| is a control sequence token, in which case the +% character-token treatment is no good because if hit with \cs{token_to_str:N} +% it would add sputios tokens to the argument. In this case a different +% branch is taken. The token inserted is then the same \meta{csname} as |#1|, +% but with a space appended, so that the grabber don't see it as another +% of the same delimiter. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_grab_D_call:Nw #1 { @@ -3000,8 +3095,15 @@ \l_@@_fn_tl \char_generate:nn { `#1 } { 11 } } { - \exp_after:wN \l_@@_fn_tl - \token_to_str:N #1 + \@@_token_if_cs:NTF #1 + { + \exp_after:wN \l_@@_fn_tl + \cs:w \cs_to_str:N #1 ~ \cs_end: + } + { + \exp_after:wN \l_@@_fn_tl + \token_to_str:N #1 + } } } % \end{macrocode} @@ -3033,13 +3135,13 @@ { \@@_grab_E:nnNN {#1} {#2} \cs_set_protected_nopar:Npn - \peek_meaning_remove:NTF + \@@_peek_meaning_remove:NTF } \cs_new_protected:Npn \@@_grab_E_long_obey_spaces:w #1#2 \@@_run_code: { \@@_grab_E:nnNN {#1} {#2} \cs_set_protected:Npn - \peek_meaning_remove:NTF + \@@_peek_meaning_remove:NTF } % \end{macrocode} % A loop is needed here to allow a random ordering of keys. These are @@ -3294,7 +3396,7 @@ \cs_new_protected:Npn \@@_grab_t:w { \@@_grab_t_aux:NNw \@@_peek_nonspace_remove:NTF } \cs_new_protected:Npn \@@_grab_t_obey_spaces:w - { \@@_grab_t_aux:NNw \peek_meaning_remove:NTF } + { \@@_grab_t_aux:NNw \@@_peek_meaning_remove:NTF } \cs_new_protected:Npn \@@_grab_t_aux:NNw #1#2#3 \@@_run_code: { \tl_set:Nn \l_@@_signature_tl {#3} @@ -4282,6 +4384,28 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_token_if_cs:NTF} +% Based on the definition of \cs{@@_check_definable_aux:nN} above, but +% only checks for an actual control sequence (\emph{i.e.}, +% \cs[no-index]{\meta{anything}}). \cs{tex_escapechar:D} is +% temporarily changed to a known value and then it checks if +% |\string#1| contains more than one character: if it does, it's a +% control sequence. This test differs from \cs{token_if_cs:NTF} for +% example in \verb|\token_if_cs:NTF \c_group_begin_token {T}{F}|, +% where \cs{token_if_cs:NTF} returns false. +% \begin{macrocode} +\cs_new_protected:Npn \@@_token_if_cs:NTF #1 + { + \group_begin: + \int_set:Nn \tex_escapechar:D { 92 } + \exp_args:Nx \tl_if_empty:nTF + { \exp_args:No \str_tail:n { \token_to_str:N #1 } } + { \group_end: \use_ii:nn } + { \group_end: \use_i:nn } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_tl_mapthread_function:NNN, \@@_tl_mapthread_function:nnN} % \begin{macro}{\@@_tl_mapthread_loop:w} % Analogue of \cs{seq_mapthread_function:NNN} for token lists. @@ -4351,9 +4475,9 @@ % \cs{peek_meaning_remove:NTF}. % \begin{macrocode} \cs_new_protected:Npn \@@_peek_nonspace:NTF - { \@@_peek_nonspace_aux:nNNTF { } \peek_meaning:NTF } + { \@@_peek_nonspace_aux:nNNTF { } \@@_peek_meaning:NTF } \cs_new_protected:Npn \@@_peek_nonspace_remove:NTF - { \@@_peek_nonspace_aux:nNNTF { } \peek_meaning_remove:NTF } + { \@@_peek_nonspace_aux:nNNTF { } \@@_peek_meaning_remove:NTF } \cs_new_protected:Npn \@@_peek_nonspace_aux:nNNTF #1#2#3#4#5 { \peek_meaning_remove:NTF \c_space_token @@ -4363,6 +4487,55 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_peek_meaning:NTF, \@@_peek_meaning_remove:NTF} +% \begin{macro}{\@@_peek_cs_check_equal:NNN, \@@_peek_meaning_aux:NNTF, \@@_peek_true_remove:NNw} +% Peek ahead for a token with a given meaning. In case the search +% token is a control sequence, also check that the \meta{csname} is +% the same as the control sequence peeked at. This extra verification +% is necessary when the command is delimited by control sequence tokens +% (as opposed to character tokens), and we want the the exact same +% control sequence to match. +% \begin{macrocode} +\cs_new_protected:Npn \@@_peek_meaning:NTF + { \@@_peek_meaning_aux:NNTF \c_false_bool } +\cs_new_protected:Npn \@@_peek_meaning_remove:NTF + { \@@_peek_meaning_aux:NNTF \c_true_bool } +\cs_new_protected:Npn \@@_peek_meaning_aux:NNTF #1#2#3#4 + { + \tl_set:Nn \l_@@_tmpa_tl {#3} + \tl_set:Nn \l_@@_tmpb_tl {#4} + \peek_meaning:NTF #2 + { + \token_if_eq_meaning:NNTF #2 \c_group_begin_token + { \@@_peek_true_remove:Nw #1 } + { + \@@_token_if_cs:NTF #2 + { \@@_peek_cs_check_equal:NNN #1 #2 } + { \@@_peek_true_remove:Nw #1 } + } + } + { \l_@@_tmpb_tl } + } +\cs_new_protected:Npn \@@_peek_cs_check_equal:NNN #1#2#3 + { + \str_if_eq:nnTF {#2} {#3} + { \@@_peek_true_remove:Nw #1 } + { \l_@@_tmpb_tl } + #3 + } +\cs_new_protected:Npn \@@_peek_true_remove:Nw #1 + { + \bool_if:NTF #1 + { + \tex_afterassignment:D \l_@@_tmpa_tl + \cs_set_eq:NN \@@_tmp:w + } + { \l_@@_tmpa_tl } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \subsection{Messages} % % \begin{macro}{\@@_environment_or_command:} @@ -4493,14 +4666,21 @@ token.~Perhaps~a~backslash~is~missing? \c_@@_ignore_def_tl } -\__kernel_msg_new:nnnn { xparse } { not-single-char } +\__kernel_msg_new:nnnn { xparse } { not-single-token } { Argument~delimiter~'#2'~for~the~#1~should~be~ - a~single~character. + a~single~non-space~token. } { The~argument~specification~provided~was~not~valid:~in~a~place~ - where~a~single~character~is~required,~LaTeX~found~'#2'. + where~a~single~token~is~required,~LaTeX~found~'#2'. + \c_@@_ignore_def_tl + } +\__kernel_msg_new:nnnn { xparse } { forbidden-implicit-group-token } + { Argument~delimiter~'#2'~for~the~#1~is~not~allowed. } + { + The~argument~specification~provided~was~not~valid:~the~implicit~ + #3-group~token~'#2'~is~not~allowed~as~an~argument~delimiter. \c_@@_ignore_def_tl } \__kernel_msg_new:nnnn { xparse } { processor-in-expandable } diff --git a/macros/latex/contrib/l3packages/xparse.pdf b/macros/latex/contrib/l3packages/xparse.pdf Binary files differindex b9bf02a381..98e62db0e1 100644 --- a/macros/latex/contrib/l3packages/xparse.pdf +++ b/macros/latex/contrib/l3packages/xparse.pdf diff --git a/macros/latex/contrib/l3packages/xtemplate.dtx b/macros/latex/contrib/l3packages/xtemplate.dtx index 9a10fbca81..d0ced34962 100644 --- a/macros/latex/contrib/l3packages/xtemplate.dtx +++ b/macros/latex/contrib/l3packages/xtemplate.dtx @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2020-02-25} +% \date{Released 2020-03-03} % % \maketitle % @@ -682,7 +682,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xtemplate}{2020-02-25}{} +\ProvidesExplPackage{xtemplate}{2020-03-03}{} {L3 Experimental prototype document functions} % \end{macrocode} % diff --git a/macros/latex/contrib/l3packages/xtemplate.pdf b/macros/latex/contrib/l3packages/xtemplate.pdf Binary files differindex 40f55ded1a..20ae5c9d3f 100644 --- a/macros/latex/contrib/l3packages/xtemplate.pdf +++ b/macros/latex/contrib/l3packages/xtemplate.pdf |