diff options
author | Norbert Preining <norbert@preining.info> | 2023-05-21 03:01:40 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-05-21 03:01:40 +0000 |
commit | acbf029eb7f81c05b715461ab1ce2ab7e4f6ce09 (patch) | |
tree | 1b2e5899af7b651ddc4cb4ff54c08b182cd344e7 /macros/latex/contrib | |
parent | 9cdcfcf8d9333b1d9b34b61ddc21910bbcc04491 (diff) |
CTAN sync 202305210301
Diffstat (limited to 'macros/latex/contrib')
20 files changed, 467 insertions, 197 deletions
diff --git a/macros/latex/contrib/huawei/DEPENDS.txt b/macros/latex/contrib/huawei/DEPENDS.txt index 6c82ab8212..c2b072d36c 100644 --- a/macros/latex/contrib/huawei/DEPENDS.txt +++ b/macros/latex/contrib/huawei/DEPENDS.txt @@ -1,36 +1,33 @@ -hard pgfopts -hard geometry hard anyfontsize -hard ragged2e +hard biblatex +hard catchfile +hard changepage +hard currfile hard datetime -hard libertine -hard paralist -hard makecell +hard enumitem +hard environ +hard fancyhdr +hard ffcode +hard filehook +hard fmtcount +hard fontsize hard footmisc -hard graphicx +hard geometry hard hyperref -hard currfile -hard enumitem -hard microtype -hard wrapfig hard lastpage -hard setspace -hard biblatex -hard xcolor +hard libertine +hard makecell +hard microtype +hard pagecolor +hard paralist hard pgf -hard tabularx -hard titling +hard pgfopts +hard ragged2e +hard setspace hard svg hard textpos -hard fancyhdr -hard changepage -hard pagecolor -hard fmtcount -hard filehook -hard scrbase -hard trimspaces -hard catchfile +hard titling hard transparent -hard fontsize -hard ffcode -hard environ
\ No newline at end of file +hard trimspaces +hard wrapfig +hard xcolor
\ No newline at end of file diff --git a/macros/latex/contrib/huawei/LICENSE.txt b/macros/latex/contrib/huawei/LICENSE.txt index bd949ffdab..5744f745f0 100644 --- a/macros/latex/contrib/huawei/LICENSE.txt +++ b/macros/latex/contrib/huawei/LICENSE.txt @@ -1,6 +1,6 @@ (The MIT License) -Copyright (c) 2021-2022 Yegor Bugayenko +Copyright (c) 2021-2023 Yegor Bugayenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal diff --git a/macros/latex/contrib/huawei/huawei.dtx b/macros/latex/contrib/huawei/huawei.dtx index 1810de09da..8c502d0f38 100644 --- a/macros/latex/contrib/huawei/huawei.dtx +++ b/macros/latex/contrib/huawei/huawei.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % (The MIT License) % -% Copyright (c) 2021-2022 Yegor Bugayenko +% Copyright (c) 2021-2023 Yegor Bugayenko % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associated documentation files (the 'Software'), to deal @@ -50,7 +50,7 @@ %<class>\NeedsTeXFormat{LaTeX2e} %<class>\ProvidesClass{huawei} %<*class> -[2022-12-13 0.15.0 Template for Huawei Documents] +[2023-05-20 0.16.0 Template for Huawei Documents] %</class> %<*driver> \documentclass{ltxdoc} @@ -438,9 +438,10 @@ $pdflatex = 'pdflatex %O --shell-escape %S'; % \end{macrocode} % Then, we configure |biblatex|: +% \changes{v0.16.0}{2023/05/20}{The \texttt{doi} tag enabled for \texttt{biblatex}.} % \begin{macrocode} \RequirePackage[maxnames=1,minnames=1,natbib=true, - citestyle=numeric,bibstyle=numeric,doi=false, + citestyle=numeric,bibstyle=numeric, url=false,isbn=false,isbn=false]{biblatex} % \end{macrocode} diff --git a/macros/latex/contrib/huawei/huawei.ins b/macros/latex/contrib/huawei/huawei.ins index 676c69d8e5..daa75a374e 100644 --- a/macros/latex/contrib/huawei/huawei.ins +++ b/macros/latex/contrib/huawei/huawei.ins @@ -1,6 +1,6 @@ %% (The MIT License) %% -%% Copyright (c) 2021-2022 Yegor Bugayenko +%% Copyright (c) 2021-2023 Yegor Bugayenko %% %% Permission is hereby granted, free of charge, to any person obtaining a copy %% of this software and associated documentation files (the 'Software'), to deal @@ -26,7 +26,7 @@ \preamble (The MIT License) -Copyright (c) 2021-2022 Yegor Bugayenko +Copyright (c) 2021-2023 Yegor Bugayenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal diff --git a/macros/latex/contrib/huawei/huawei.pdf b/macros/latex/contrib/huawei/huawei.pdf Binary files differindex a933486021..a84233c475 100644 --- a/macros/latex/contrib/huawei/huawei.pdf +++ b/macros/latex/contrib/huawei/huawei.pdf diff --git a/macros/latex/contrib/lineno/README.md b/macros/latex/contrib/lineno/README.md index 085d59f247..ea4747ea13 100644 --- a/macros/latex/contrib/lineno/README.md +++ b/macros/latex/contrib/lineno/README.md @@ -1,6 +1,6 @@ -# lineno.sty v5.2, fnlineno.sty v0.55 +# lineno.sty v5.3, fnlineno.sty v0.55 -2023-05-19 +2023-05-20 The LaTeX package lineno.sty provides line numbers on paragraphs. After TeX has broken a paragraph into lines there will be line numbers attached to them, with diff --git a/macros/latex/contrib/lineno/doc/CHANGEs.txt b/macros/latex/contrib/lineno/doc/CHANGEs.txt index 0612c8ffc4..b61ae6560d 100644 --- a/macros/latex/contrib/lineno/doc/CHANGEs.txt +++ b/macros/latex/contrib/lineno/doc/CHANGEs.txt @@ -1,3 +1,13 @@ +CHANGES for lineno pkg v5.3 2023/05/20: + +1. Handle special value of \prevdepth=-1000pt; + thanks to Yukai Chou and Frank Mittelbach. +2. Add package options `sep' and `width' for + setting line number separation and width. +3. Add `twocolumn` support for `bframe` env; + thanks to Yukai Chou. + + CHANGES for lineno pkg v5.2 2023/05/19: 1. Support `amsmath` option `\allowdisplaybreaks`. diff --git a/macros/latex/contrib/lineno/doc/SRCFILEs.txt b/macros/latex/contrib/lineno/doc/SRCFILEs.txt index ead01626f4..d25688616e 100644 --- a/macros/latex/contrib/lineno/doc/SRCFILEs.txt +++ b/macros/latex/contrib/lineno/doc/SRCFILEs.txt @@ -1,10 +1,10 @@ ednmath0.sty 2005/01/10 v0.2b math support for lineno/ednotes (ul) edtable.sty 2005/10/03 v1.3c arrays with lineno + ednotes (ul) fnlineno.sty 2011/01/07 v0.55 numbers to footnote lines (UL) -lineno.sty 2023/05/19 line numbers on paragraphs v5.2 +lineno.sty 2023/05/20 line numbers on paragraphs v5.3 vplref.sty 2005/04/25 v0.2a page-line cross-refs fnlineno.tex 2011/02/14 documenting fnlineno.sty (UL) -lineno.tex 2023/05/19 line numbers on paragraphs v5.2 +lineno.tex 2023/05/20 line numbers on paragraphs v5.3 lnosuppl.tex 2011/02/16 documenting supplementary files ulineno.tex 2001/08/03 lineno.sty users manual linenoamsmathdemo.tex 2021/09/30 Make amsmath work with lineno diff --git a/macros/latex/contrib/lineno/doc/fnlineno.pdf b/macros/latex/contrib/lineno/doc/fnlineno.pdf Binary files differindex 0760d0ecc0..b875e16366 100644 --- a/macros/latex/contrib/lineno/doc/fnlineno.pdf +++ b/macros/latex/contrib/lineno/doc/fnlineno.pdf diff --git a/macros/latex/contrib/lineno/doc/lineno.pdf b/macros/latex/contrib/lineno/doc/lineno.pdf Binary files differindex 7cbf50f5b4..3c1178359d 100644 --- a/macros/latex/contrib/lineno/doc/lineno.pdf +++ b/macros/latex/contrib/lineno/doc/lineno.pdf diff --git a/macros/latex/contrib/lineno/doc/linenoamsmathdemo.pdf b/macros/latex/contrib/lineno/doc/linenoamsmathdemo.pdf Binary files differindex 68e32b823e..e311cec61a 100644 --- a/macros/latex/contrib/lineno/doc/linenoamsmathdemo.pdf +++ b/macros/latex/contrib/lineno/doc/linenoamsmathdemo.pdf diff --git a/macros/latex/contrib/lineno/doc/lnosuppl.pdf b/macros/latex/contrib/lineno/doc/lnosuppl.pdf Binary files differindex c2f5c3fd6d..2d04f767b4 100644 --- a/macros/latex/contrib/lineno/doc/lnosuppl.pdf +++ b/macros/latex/contrib/lineno/doc/lnosuppl.pdf diff --git a/macros/latex/contrib/lineno/doc/ulineno.pdf b/macros/latex/contrib/lineno/doc/ulineno.pdf Binary files differindex efe87de8ab..6db5ce14d5 100644 --- a/macros/latex/contrib/lineno/doc/ulineno.pdf +++ b/macros/latex/contrib/lineno/doc/ulineno.pdf diff --git a/macros/latex/contrib/lineno/source/lineno.tex b/macros/latex/contrib/lineno/source/lineno.tex index 1e2457202c..0957f1e5f0 100644 --- a/macros/latex/contrib/lineno/source/lineno.tex +++ b/macros/latex/contrib/lineno/source/lineno.tex @@ -1,4 +1,4 @@ -\def\fileversion{v5.2} \def\filedate{2023/05/19} +\def\fileversion{v5.3} \def\filedate{2023/05/20} \title{\texttt{\itshape lineno.sty \ \fileversion\ \filedate @@ -214,6 +214,8 @@ available since December 1994. \NeedsTeXFormat{LaTeX2e}[1994/12/01] \ProvidesPackage{lineno} [\filedate\space line numbers on paragraphs \fileversion] +\RequirePackage{etoolbox} +\RequirePackage{kvoptions} \end{verbatim} \end{code} @@ -414,7 +416,7 @@ we get doubled line numbers on every float placed in horizontal mode, e.g, from ~\linelabel~. Sorry, neither a ~\linelabel~ nor a ~\marginpar~ should -insert a penalty, else the following linenumber +insert a penalty, else the following line number could go to the next page. Nor should any other float. So let us suppress the ~\interlinepenalty~ altogether with the ~\@nobreak~ switch. @@ -718,10 +720,18 @@ For reason, see use above. (/New v4.00) (New v4.4) The depth preserving trick is drawn here from ~\MakeLineNo~ because it will be used again in section_\ref{ss:calls}. +(v5.3) Handle special value of ~\prevdepth=-1000pt~. (/v5.3) \begin{code}\begin{verbatim} \def\@LN@depthbox{% - \dp\@tempboxa=\@tempdima - \nointerlineskip \kern-\@tempdima \box\@tempboxa} + \ifdim\@tempdima=-1000pt + % \nointerlineskip is already set so we don't need set it again + % (and we shouldn't back up) + \else + \dp\@tempboxa=\@tempdima + \nointerlineskip + \kern-\@tempdima + \fi + \box\@tempboxa} \end{verbatim} \end{code} (/New v4.4) @@ -1347,8 +1357,8 @@ right of the text, or . . . \newdimen\linenumbersep \newdimen\linenumberwidth -\linenumberwidth=10pt \linenumbersep=10pt +\linenumberwidth=10pt \end{verbatim} \end{code} Margin switching requires ~pagewise~ numbering mode, but @@ -1588,7 +1598,7 @@ themselves in an ~\xdef~ \begin{code}\begin{verbatim} \let\lastLN\relax % compare to last line on this page \let\firstLN\relax % compare to first line on this page -\let\pageLN\relax % get the page number, compute the linenumber +\let\pageLN\relax % get the page number, compute the line number \let\nextLN\relax % move to the next page \end{verbatim} \end{code} @@ -1707,8 +1717,7 @@ If there is another page, we iterate the search. \def\testNextNumberedPage#1{\ifx#1\relax \global\def\NumberedPageCache{\gotNumberedPage0000}% \PackageWarningNoLine{lineno}% - {Linenumber reference failed, - \MessageBreak rerun to get it right}% + {Line number reference failed, re-run to get it right}% \else \global\let\NumberedPageCache#1% \fi @@ -2125,7 +2134,7 @@ this case. ~addpageno~ is due to a suggestion by Sergei Mariev. \begin{code}\begin{verbatim} -\DeclareOption{addpageno}{% +\DeclareVoidOption{addpageno}{% \AtEndOfPackage{\RequirePackage{vplref}[2005/04/25]}} \end{verbatim} \end{code} @@ -2149,7 +2158,7 @@ allowing ~ednotes.sty~ commands in math mode. Loading the package is postponed to ~\AtBeginDocument~ when we know whether these adjustments are needed. \begin{code}\begin{verbatim} -\DeclareOption{mathrefs}{\AtBeginDocument +\DeclareVoidOption{mathrefs}{\AtBeginDocument {\RequirePackage{ednmath0}[2004/08/20]}} \end{verbatim} \end{code} @@ -2216,12 +2225,12 @@ at one place only.) \begin{code}\begin{verbatim} \let\if@LN@edtable\iffalse -\DeclareOption{edtable}{\let\if@LN@edtable\iftrue} +\DeclareVoidOption{edtable}{\let\if@LN@edtable\iftrue} -\DeclareOption{longtable}{\let\if@LN@edtable\iftrue +\DeclareVoidOption{longtable}{\let\if@LN@edtable\iftrue \PassOptionsToPackage{longtable}{edtable}} -\DeclareOption{nolongtablepatch}{% +\DeclareVoidOption{nolongtablepatch}{% \PassOptionsToPackage{nolongtablepatch}{edtable}} \end{verbatim} \end{code} @@ -2238,9 +2247,9 @@ Options ~left~ (~right~) put the line numbers on the left (right) margin. This works in all modes. ~left~ is the default. \begin{code}\begin{verbatim} -\DeclareOption{left}{\leftlinenumbers*} +\DeclareVoidOption{left}{\leftlinenumbers*} -\DeclareOption{right}{\rightlinenumbers*} +\DeclareVoidOption{right}{\rightlinenumbers*} \end{verbatim} \end{code} Option ~switch~ (~switch*~) puts the line numbers on the @@ -2249,13 +2258,13 @@ the pagewise mode, but we turn off the page offset subtraction, getting sort of running numbers again. The ~pagewise~ option may restore true pagewise mode later. \begin{code}\begin{verbatim} -\DeclareOption{switch}{\setpagewiselinenumbers - \switchlinenumbers - \runningpagewiselinenumbers} +\DeclareVoidOption{switch}{\setpagewiselinenumbers + \switchlinenumbers + \runningpagewiselinenumbers} -\DeclareOption{switch*}{\setpagewiselinenumbers - \switchlinenumbers*% - \runningpagewiselinenumbers} +\DeclareVoidOption{switch*}{\setpagewiselinenumbers + \switchlinenumbers*% + \runningpagewiselinenumbers} \end{verbatim} \end{code} In twocolumn mode, we can switch the line numbers to @@ -2263,13 +2272,13 @@ the outer margin, and/or start with number 1 in each column. Margin switching is covered by the ~switch~ options. \begin{code}\begin{verbatim} -\DeclareOption{columnwise}{\setpagewiselinenumbers - \columnwiselinenumberstrue - \realpagewiselinenumbers} +\DeclareVoidOption{columnwise}{\setpagewiselinenumbers + \columnwiselinenumberstrue + \realpagewiselinenumbers} \end{verbatim} \end{code} The options ~pagewise~ and ~running~ select the major -linenumber mechanism. ~running~ line numbers refer to a real +line number mechanism. ~running~ line numbers refer to a real counter value, which can be reset for any paragraph, even getting multiple paragraphs on one page starting with line number one. ~pagewise~ line numbers get a @@ -2291,22 +2300,22 @@ result is almost nothing, but if you later say real pagewise line numbers. \begin{code}\begin{verbatim} -\DeclareOption{pagewise}{\setpagewiselinenumbers - \realpagewiselinenumbers} +\DeclareVoidOption{pagewise}{\setpagewiselinenumbers + \realpagewiselinenumbers} -\DeclareOption{running}{\setrunninglinenumbers} +\DeclareVoidOption{running}{\setrunninglinenumbers} \end{verbatim} \end{code} The option ~modulo~ causes only those linenumbers to be printed which are multiples of five. \begin{code}\begin{verbatim} -\DeclareOption{modulo}{\modulolinenumbers\relax} +\DeclareVoidOption{modulo}{\modulolinenumbers\relax} \end{verbatim} \end{code} Option ~modulo*~ modifies ~modulo~ in working like ~\modulolinenumbers*~---see section_\ref{s:UserCmds}. \begin{code}\begin{verbatim} -\DeclareOption{modulo*}{\modulolinenumbers*\relax} +\DeclareVoidOption{modulo*}{\modulolinenumbers*\relax} \end{verbatim} \end{code} The package option ~mathlines~ switches the behavior of @@ -2316,7 +2325,7 @@ not number the lines of the display, while the star-form does. With this option, its just the opposite. \begin{code}\begin{verbatim} -\DeclareOption{mathlines}{\linenumberdisplaymath} +\DeclareVoidOption{mathlines}{\linenumberdisplaymath} \end{verbatim} \end{code} ~displaymath~ now calls for wrappers of the standard @@ -2330,12 +2339,26 @@ number above ~\begin{linenomath}~ (subsection_\ref{ss:DM}). ~\endlinenomath~ provides ~\ignorespaces~, so what could go wrong now? \begin{code}\begin{verbatim} -\DeclareOption{displaymath}{\PackageWarningNoLine{lineno}{% - Option [displaymath] is obsolete -- default now!}} +\DeclareVoidOption{displaymath}{% + \PackageWarningNoLine{lineno}{Option [displaymath] is obsolete}} \end{verbatim} \end{code} (/New v4.3) +(New v5.3) Options `sep' and `width' set ~\linenumbersep~ (the separation of +the line number to the text) and ~\linenumberwidth~ (the width of the line +number box on the right margin) respectively; see section_\ref{s:CustHooks}. +\begin{code}\begin{verbatim} +\DeclareStringOption[\linenumbersep]{sep} +\DeclareStringOption[\linenumberwidth]{width} +\AtBeginDocument{% + \linenumbersep=\lineno@sep% + \linenumberwidth=\lineno@width% +} +\end{verbatim} +\end{code} +(/New v5.3) + \subsection{% Compatibility with \texttt{hyperref} %% own subsec. v4.3. \unskip} @@ -2356,9 +2379,8 @@ now, since ~\@LN@linelabel~ may change its meaning after the first ~\linenumbers~ and before a next one (if there is some). (/New v4.3) \begin{code}\begin{verbatim} -\DeclareOption{hyperref}{\PackageWarningNoLine{lineno}{% - Option [hyperref] is obsolete. - \MessageBreak The hyperref package is detected automatically.}} +\DeclareVoidOption{hyperref}{% + \PackageWarningNoLine{lineno}{Option [hyperref] is obsolete}} \AtBeginDocument{% \@ifpackageloaded{nameref}{% @@ -2413,7 +2435,7 @@ Execute options We stop declaring options and execute the ones that are called by the user. (/New v4.1) \begin{code}\begin{verbatim} -\ProcessOptions +\ProcessKeyvalOptions* \end{verbatim} \end{code} (New v4.1) Now we know whether ~edtable.sty~ is wanted @@ -2538,10 +2560,16 @@ And I use ~\newcommand~.) (v4.22) \begingroup \c@internallinenumbers\prevgraf \setbox\@tempboxa\hbox{\vbox{\makeinternalLinenumbers}}% - \dp\@tempboxa\prevdepth \ht\@tempboxa\z@ - \nobreak\vskip-\prevdepth - \nointerlineskip\box\@tempboxa + \ifdim\prevdepth=-1000pt + % \nointerlineskip is already set so we don't need set it again + % (and we shouldn't back up) + \else + \dp\@tempboxa\prevdepth + \nobreak\vskip-\prevdepth + \nointerlineskip + \fi + \box\@tempboxa \endgroup \fi\fi } @@ -2662,9 +2690,9 @@ without special height lines. All lines must be \begin{code}\begin{verbatim} \newenvironment{bframe} {\par - \@tempdima\textwidth + \@tempdima\columnwidth \advance\@tempdima 2\bframesep - \setbox\bframebox\hb@xt@\textwidth{% + \setbox\bframebox\hb@xt@\columnwidth{% \hskip-\bframesep \vrule\@width\bframerule\@height\baselineskip\@depth\bframesep \advance\@tempdima-2\bframerule @@ -2682,10 +2710,12 @@ without special height lines. All lines must be \def\makeLineNumber{\copy\bframebox\hss}% } {\par - \kern-\prevdepth + \ifdim\prevdepth=-1000pt \else + \kern-\prevdepth + \fi \kern\bframesep \nointerlineskip - \@tempdima\textwidth + \@tempdima\columnwidth \advance\@tempdima 2\bframesep \hbox{\hskip-\bframesep \vrule\@width\@tempdima\@height\bframerule\@depth\z@}% @@ -2710,7 +2740,7 @@ supplied by the ~linenoamsmath~ package. See ~linenoamsmathdemo.pdf~ for a demonstration. (/New v5.0) -(/New v5.1) ~lineno~ tries to use \LaTeX's hook management system to patch +(New v5.1) ~lineno~ tries to use \LaTeX's hook management system to patch ~amsmath~, so that the two packages may be loaded independently. This requires the October 2020 release of \LaTeX. As a fallback for older releases, ~lineno~ tests whether ~amsmath~ had already been loaded (by testing for the presence @@ -2718,7 +2748,7 @@ of the ~gather~ command) and if so applies the patches; otherwise if ~amsmath~ has not been loaded, no patches are applied, and a warning is issued. (/New v5.1) -(/New v5.2) Fix ~lineno~ to work with ~amsmath~'s ~\allowdisplaybreaks~ +(New v5.2) Fix ~lineno~ to work with ~amsmath~'s ~\allowdisplaybreaks~ option. A side effect is that now ~\\*~ suppresses a line number on that line. This is because ~\\*~ prohibits a page break after a given line, and ~lineno~ basically works by hijacking page breaks. It's probably not possible @@ -2726,16 +2756,14 @@ to fix this without losing the behaviour of ~\\*~. (/New v5.2) \begin{code}\begin{verbatim} -\RequirePackage{etoolbox} - \ifdefined\AddToHook \def\linenoamsmath@patches#1{\AddToHook{package/amsmath/after}{#1}} \else \ifdefined\endgather \def\linenoamsmath@patches#1{#1} \else - \PackageWarning{lineno}{% - `amsmath' must be loaded before `lineno' for patches to be applied} + \PackageWarningNoLine{lineno}% + {`amsmath' must be loaded before `lineno' for patches to be applied} \def\linenoamsmath@patches#1{\relax} \fi \fi @@ -3000,8 +3028,8 @@ Reminder on obsoleteness \unskip} (New v4.1) We have completed inclusion of the earlier -extension packages ~linenox0.sty~, ~linenox1.sty~, and -~lnopatch.sty~. If one of them is loaded, though, +extension packages ~linenox0.sty~, ~linenox1.sty~, ~lnopatch.sty~, +and ~linenoamsmath~. If one of them is loaded, though, we produce an error message before something weird happens. We avoid ~\newif~ because the switchings occur so rarely. \begin{code}\begin{verbatim} @@ -3010,10 +3038,12 @@ We avoid ~\newif~ because the switchings occur so rarely. \@ifpackageloaded{linenox0}{\let\if@LN@obsolete\iftrue}\relax \@ifpackageloaded{linenox1}{\let\if@LN@obsolete\iftrue}\relax \@ifpackageloaded{lnopatch}{\let\if@LN@obsolete\iftrue}\relax + \@ifpackageloaded{linenoamsmath}{\let\if@LN@obsolete\iftrue}\relax \if@LN@obsolete \PackageError{lineno}{Obsolete extension package(s)}{% - With lineno.sty version 4.00 or later,\MessageBreak - linenox0/linenox1/lnopatch.sty must no longer be loaded.}% + As of \fileversion, `lineno' includes the functionality of \MessageBreak + `linenox0', `linenox1', `lnopatch', and `linenoamsmath'; \MessageBreak + these packages are therefore obsolete and must not be loaded.}% \fi } \end{verbatim} @@ -3191,7 +3221,7 @@ and ~{linenomath*}~. \subsection{% Customization hooks -\unskip} +\unskip}\label{s:CustHooks} There are several hooks to customize the appearance of the line numbers, and some low level hooks for special @@ -3219,7 +3249,7 @@ Like ~\makeLineNumberLeft~, but for line numbers on the right margin. The default definition is \par$\qquad$ -~\linenumberfont\hskip\linenumbersep\hskip\textwidth~ \par$\qquad$ +~\linenumberfont\hskip\linenumbersep\hskip\columnwidth~ \par$\qquad$ ~\hbox to\linenumberwidth{\hss\LineNumber}\hss~ \item [|\linenumberfont] \ \par @@ -3228,7 +3258,7 @@ This macro is initialized to \par$\qquad$ \item [|\linenumbersep] \ \par This dimension register sets the separation of the -linenumber to the text. Default value is ~10pt~. +line number to the text. Default value is ~10pt~. \item [|\linenumberwidth] \ \par This dimension register sets the width of the line diff --git a/macros/latex/contrib/lineno/source/linenoamsmathdemo.tex b/macros/latex/contrib/lineno/source/linenoamsmathdemo.tex index 045e251a62..f3c51ba1c6 100644 --- a/macros/latex/contrib/lineno/source/linenoamsmathdemo.tex +++ b/macros/latex/contrib/lineno/source/linenoamsmathdemo.tex @@ -19,12 +19,12 @@ \ifdefined\AddToHook \newcommand{\loadorder}{\textsf{lineno} is loaded first, and then patches \textsf{amsmath} using \texttt{\textbackslash AddToHook}} - \usepackage[mathlines]{lineno} + \usepackage[mathlines,sep=11pt,width=11pt]{lineno} \usepackage[leqno]{amsmath} \else \newcommand{\loadorder}{\textsf{amsmath} is loaded first, and then patched directly by \textsf{lineno}} \usepackage[leqno]{amsmath} - \usepackage[mathlines]{lineno} + \usepackage[mathlines,sep=11pt,width=11pt]{lineno} \fi \usepackage{lipsum} \usepackage{hyperref} diff --git a/macros/latex/contrib/lineno/tex/lineno.sty b/macros/latex/contrib/lineno/tex/lineno.sty index 03958a8589..440cd7bf86 100644 --- a/macros/latex/contrib/lineno/tex/lineno.sty +++ b/macros/latex/contrib/lineno/tex/lineno.sty @@ -3,7 +3,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. \fi -\def\fileversion{v5.2} \def\filedate{2023/05/19} %VERSION +\def\fileversion{v5.3} \def\filedate{2023/05/20} %VERSION %%% Copyright 1995--2003 Stephan I. Böttcher %%% Copyright 2002--2005 Uwe Lück for versions 4.x and code from former Ednotes @@ -262,6 +262,8 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. \ProvidesPackage{lineno} [\filedate\space line numbers on paragraphs \fileversion] %% +\RequirePackage{etoolbox} +\RequirePackage{kvoptions} %% History of versions: %% v1.00 1995/03/31 SIB: first release for Petra's interview transcriptions %% v1.01 1995/10/28 SIB: added ~pagewise~ mode @@ -388,6 +390,10 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. %% v5.0 2022/07/30 KW: Merge in `linenoamsmath' patches %% v5.1 2023/01/19 KW: Patch `amsmath` with \AddToHook if possible. %% v5.2 2023/05/19 KW: Support `amsmath` option `\allowdisplaybreaks`. +%% v5.3 2023/05/20 KW: Handle special value of \prevdepth=-1000pt. +%% Add package options `sep' and `width' for +%% setting line number separation and width. +%% Add `twocolumn` support for `bframe` env. %% %% Acknowledgements: %% v3.06: Donald Arseneau, pointed to mparhack.sty. @@ -404,6 +410,9 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. %% Saravanan M.'s and David Josef Dev. %% v4.4: David Josef Dev points out that \kern\z@ after a paragraph %% tends to place its final baseline wrongly. +%% v5.3: Yukai Chou and Frank Mittelbach for patches to handle special +%% value of \prevdepth=-1000pt, and add `twocolumn` support for +%% `bframe` env. % % % \section{% @@ -602,7 +611,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % horizontal mode, e.g, from ~\linelabel~. % % Sorry, neither a ~\linelabel~ nor a ~\marginpar~ should -% insert a penalty, else the following linenumber +% insert a penalty, else the following line number % could go to the next page. Nor should any other % float. So let us suppress the ~\interlinepenalty~ % altogether with the ~\@nobreak~ switch. @@ -914,10 +923,18 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % (New v4.4) The depth preserving trick is drawn here from % ~\MakeLineNo~ because it will be used again in % section_\ref{ss:calls}. +% (v5.3) Handle special value of ~\prevdepth=-1000pt~. (/v5.3) \def\@LN@depthbox{% - \dp\@tempboxa=\@tempdima - \nointerlineskip \kern-\@tempdima \box\@tempboxa} + \ifdim\@tempdima=-1000pt + % \nointerlineskip is already set so we don't need set it again + % (and we shouldn't back up) + \else + \dp\@tempboxa=\@tempdima + \nointerlineskip + \kern-\@tempdima + \fi + \box\@tempboxa} % (/New v4.4) % @@ -1531,8 +1548,8 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. \newdimen\linenumbersep \newdimen\linenumberwidth -\linenumberwidth=10pt \linenumbersep=10pt +\linenumberwidth=10pt % Margin switching requires ~pagewise~ numbering mode, but % choosing the left or right margin for the numbers always @@ -1778,7 +1795,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. \let\lastLN\relax % compare to last line on this page \let\firstLN\relax % compare to first line on this page -\let\pageLN\relax % get the page number, compute the linenumber +\let\pageLN\relax % get the page number, compute the line number \let\nextLN\relax % move to the next page % During the end-document run through the aux-files, we @@ -1889,8 +1906,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. \def\testNextNumberedPage#1{\ifx#1\relax \global\def\NumberedPageCache{\gotNumberedPage0000}% \PackageWarningNoLine{lineno}% - {Linenumber reference failed, - \MessageBreak rerun to get it right}% + {Line number reference failed, re-run to get it right}% \else \global\let\NumberedPageCache#1% \fi @@ -2312,7 +2328,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % % ~addpageno~ is due to a suggestion by Sergei Mariev. -\DeclareOption{addpageno}{% +\DeclareVoidOption{addpageno}{% \AtEndOfPackage{\RequirePackage{vplref}[2005/04/25]}} % \subsection{% @@ -2335,7 +2351,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % is postponed to ~\AtBeginDocument~ when we know whether these % adjustments are needed. -\DeclareOption{mathrefs}{\AtBeginDocument +\DeclareVoidOption{mathrefs}{\AtBeginDocument {\RequirePackage{ednmath0}[2004/08/20]}} % @@ -2401,12 +2417,12 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. \let\if@LN@edtable\iffalse -\DeclareOption{edtable}{\let\if@LN@edtable\iftrue} +\DeclareVoidOption{edtable}{\let\if@LN@edtable\iftrue} -\DeclareOption{longtable}{\let\if@LN@edtable\iftrue +\DeclareVoidOption{longtable}{\let\if@LN@edtable\iftrue \PassOptionsToPackage{longtable}{edtable}} -\DeclareOption{nolongtablepatch}{% +\DeclareVoidOption{nolongtablepatch}{% \PassOptionsToPackage{nolongtablepatch}{edtable}} % (/New v4.1) @@ -2424,9 +2440,9 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % (right) margin. This works in all modes. ~left~ is the % default. -\DeclareOption{left}{\leftlinenumbers*} +\DeclareVoidOption{left}{\leftlinenumbers*} -\DeclareOption{right}{\rightlinenumbers*} +\DeclareVoidOption{right}{\rightlinenumbers*} % Option ~switch~ (~switch*~) puts the line numbers on the % outer (inner) margin of the text. This requires running @@ -2434,25 +2450,25 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % subtraction, getting sort of running numbers again. The % ~pagewise~ option may restore true pagewise mode later. -\DeclareOption{switch}{\setpagewiselinenumbers - \switchlinenumbers - \runningpagewiselinenumbers} +\DeclareVoidOption{switch}{\setpagewiselinenumbers + \switchlinenumbers + \runningpagewiselinenumbers} -\DeclareOption{switch*}{\setpagewiselinenumbers - \switchlinenumbers*% - \runningpagewiselinenumbers} +\DeclareVoidOption{switch*}{\setpagewiselinenumbers + \switchlinenumbers*% + \runningpagewiselinenumbers} % In twocolumn mode, we can switch the line numbers to % the outer margin, and/or start with number 1 in each % column. Margin switching is covered by the ~switch~ % options. -\DeclareOption{columnwise}{\setpagewiselinenumbers - \columnwiselinenumberstrue - \realpagewiselinenumbers} +\DeclareVoidOption{columnwise}{\setpagewiselinenumbers + \columnwiselinenumberstrue + \realpagewiselinenumbers} % The options ~pagewise~ and ~running~ select the major -% linenumber mechanism. ~running~ line numbers refer to a real +% line number mechanism. ~running~ line numbers refer to a real % counter value, which can be reset for any paragraph, % even getting multiple paragraphs on one page starting % with line number one. ~pagewise~ line numbers get a @@ -2473,20 +2489,20 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % ~\pagewiselinenumbers~, you get margin switching, with % real pagewise line numbers. % -\DeclareOption{pagewise}{\setpagewiselinenumbers - \realpagewiselinenumbers} +\DeclareVoidOption{pagewise}{\setpagewiselinenumbers + \realpagewiselinenumbers} -\DeclareOption{running}{\setrunninglinenumbers} +\DeclareVoidOption{running}{\setrunninglinenumbers} % The option ~modulo~ causes only those linenumbers to be % printed which are multiples of five. -\DeclareOption{modulo}{\modulolinenumbers\relax} +\DeclareVoidOption{modulo}{\modulolinenumbers\relax} % Option ~modulo*~ modifies ~modulo~ in working like % ~\modulolinenumbers*~---see section_\ref{s:UserCmds}. -\DeclareOption{modulo*}{\modulolinenumbers*\relax} +\DeclareVoidOption{modulo*}{\modulolinenumbers*\relax} % The package option ~mathlines~ switches the behavior of % the ~{linenomath}~ environment with its star-form. @@ -2496,7 +2512,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % %%% 1999-06-10: renamed ~displaymath~ to ~mathlines~. -\DeclareOption{mathlines}{\linenumberdisplaymath} +\DeclareVoidOption{mathlines}{\linenumberdisplaymath} % ~displaymath~ now calls for wrappers of the standard % \LaTeX\ display math environment. This was previously @@ -2509,13 +2525,26 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % ~\endlinenomath~ provides ~\ignorespaces~, so what could go % wrong now? -\DeclareOption{displaymath}{\PackageWarningNoLine{lineno}{% - Option [displaymath] is obsolete -- default now!}} -%% +\DeclareVoidOption{displaymath}{% + \PackageWarningNoLine{lineno}{Option [displaymath] is obsolete}} + %%\let\do@mlineno\relax %%\DeclareOption{displaymath}{\let\do@mlineno\@empty} % (/New v4.3) % +% (New v5.3) Options `sep' and `width' set ~\linenumbersep~ (the separation of +% the line number to the text) and ~\linenumberwidth~ (the width of the line +% number box on the right margin) respectively; see section_\ref{s:CustHooks}. + +\DeclareStringOption[\linenumbersep]{sep} +\DeclareStringOption[\linenumberwidth]{width} +\AtBeginDocument{% + \linenumbersep=\lineno@sep% + \linenumberwidth=\lineno@width% +} + +% (/New v5.3) +% % \subsection{% % Compatibility with \texttt{hyperref} %% own subsec. v4.3. % \unskip} @@ -2536,9 +2565,8 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % first ~\linenumbers~ and before a next one (if there is some). % (/New v4.3) -\DeclareOption{hyperref}{\PackageWarningNoLine{lineno}{% - Option [hyperref] is obsolete. - \MessageBreak The hyperref package is detected automatically.}} +\DeclareVoidOption{hyperref}{% + \PackageWarningNoLine{lineno}{Option [hyperref] is obsolete}} \AtBeginDocument{% \@ifpackageloaded{nameref}{% @@ -2589,7 +2617,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % We stop declaring options and execute the ones that are % called by the user. (/New v4.1) -\ProcessOptions +\ProcessKeyvalOptions* % (New v4.1) Now we know whether ~edtable.sty~ is wanted % and (if it is) with which options it is to be called. @@ -2717,10 +2745,16 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. \begingroup \c@internallinenumbers\prevgraf \setbox\@tempboxa\hbox{\vbox{\makeinternalLinenumbers}}% - \dp\@tempboxa\prevdepth \ht\@tempboxa\z@ - \nobreak\vskip-\prevdepth - \nointerlineskip\box\@tempboxa + \ifdim\prevdepth=-1000pt + % \nointerlineskip is already set so we don't need set it again + % (and we shouldn't back up) + \else + \dp\@tempboxa\prevdepth + \nobreak\vskip-\prevdepth + \nointerlineskip + \fi + \box\@tempboxa \endgroup \fi\fi } @@ -2838,9 +2872,9 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. \newenvironment{bframe} {\par - \@tempdima\textwidth + \@tempdima\columnwidth \advance\@tempdima 2\bframesep - \setbox\bframebox\hb@xt@\textwidth{% + \setbox\bframebox\hb@xt@\columnwidth{% \hskip-\bframesep \vrule\@width\bframerule\@height\baselineskip\@depth\bframesep \advance\@tempdima-2\bframerule @@ -2858,10 +2892,12 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. \def\makeLineNumber{\copy\bframebox\hss}% } {\par - \kern-\prevdepth + \ifdim\prevdepth=-1000pt \else + \kern-\prevdepth + \fi \kern\bframesep \nointerlineskip - \@tempdima\textwidth + \@tempdima\columnwidth \advance\@tempdima 2\bframesep \hbox{\hskip-\bframesep \vrule\@width\@tempdima\@height\bframerule\@depth\z@}% @@ -2885,7 +2921,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % demonstration. % (/New v5.0) % -% (/New v5.1) ~lineno~ tries to use \LaTeX's hook management system to patch +% (New v5.1) ~lineno~ tries to use \LaTeX's hook management system to patch % ~amsmath~, so that the two packages may be loaded independently. This requires % the October 2020 release of \LaTeX. As a fallback for older releases, ~lineno~ % tests whether ~amsmath~ had already been loaded (by testing for the presence @@ -2893,7 +2929,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % has not been loaded, no patches are applied, and a warning is issued. % (/New v5.1) % -% (/New v5.2) Fix ~lineno~ to work with ~amsmath~'s ~\allowdisplaybreaks~ +% (New v5.2) Fix ~lineno~ to work with ~amsmath~'s ~\allowdisplaybreaks~ % option. A side effect is that now ~\\*~ suppresses a line number on that % line. This is because ~\\*~ prohibits a page break after a given line, and % ~lineno~ basically works by hijacking page breaks. It's probably not possible @@ -2901,16 +2937,14 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % (/New v5.2) % -\RequirePackage{etoolbox} - \ifdefined\AddToHook \def\linenoamsmath@patches#1{\AddToHook{package/amsmath/after}{#1}} \else \ifdefined\endgather \def\linenoamsmath@patches#1{#1} \else - \PackageWarning{lineno}{% - `amsmath' must be loaded before `lineno' for patches to be applied} + \PackageWarningNoLine{lineno}% + {`amsmath' must be loaded before `lineno' for patches to be applied} \def\linenoamsmath@patches#1{\relax} \fi \fi @@ -3181,8 +3215,8 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % \unskip} % % (New v4.1) We have completed inclusion of the earlier -% extension packages ~linenox0.sty~, ~linenox1.sty~, and -% ~lnopatch.sty~. If one of them is loaded, though, +% extension packages ~linenox0.sty~, ~linenox1.sty~, ~lnopatch.sty~, +% and ~linenoamsmath~. If one of them is loaded, though, % we produce an error message before something weird happens. % We avoid ~\newif~ because the switchings occur so rarely. @@ -3191,10 +3225,12 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. \@ifpackageloaded{linenox0}{\let\if@LN@obsolete\iftrue}\relax \@ifpackageloaded{linenox1}{\let\if@LN@obsolete\iftrue}\relax \@ifpackageloaded{lnopatch}{\let\if@LN@obsolete\iftrue}\relax + \@ifpackageloaded{linenoamsmath}{\let\if@LN@obsolete\iftrue}\relax \if@LN@obsolete \PackageError{lineno}{Obsolete extension package(s)}{% - With lineno.sty version 4.00 or later,\MessageBreak - linenox0/linenox1/lnopatch.sty must no longer be loaded.}% + As of \fileversion, `lineno' includes the functionality of \MessageBreak + `linenox0', `linenox1', `lnopatch', and `linenoamsmath'; \MessageBreak + these packages are therefore obsolete and must not be loaded.}% \fi } @@ -3384,7 +3420,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % % \subsection{% % Customization hooks -% \unskip} +% \unskip}\label{s:CustHooks} % % There are several hooks to customize the appearance of the % line numbers, and some low level hooks for special @@ -3412,7 +3448,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % the right margin. % % The default definition is \par$\qquad$ -% ~\linenumberfont\hskip\linenumbersep\hskip\textwidth~ \par$\qquad$ +% ~\linenumberfont\hskip\linenumbersep\hskip\columnwidth~ \par$\qquad$ % ~\hbox to\linenumberwidth{\hss\LineNumber}\hss~ % \item % [|\linenumberfont] \ \par @@ -3421,7 +3457,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % \item % [|\linenumbersep] \ \par % This dimension register sets the separation of the -% linenumber to the text. Default value is ~10pt~. +% line number to the text. Default value is ~10pt~. % \item % [|\linenumberwidth] \ \par % This dimension register sets the width of the line diff --git a/macros/latex/contrib/starray/README.md b/macros/latex/contrib/starray/README.md index d783c91e1e..3e5aec2fea 100644 --- a/macros/latex/contrib/starray/README.md +++ b/macros/latex/contrib/starray/README.md @@ -73,6 +73,11 @@ The Current Maintainer of this work is Alceu Frigeri ## Changelog +* Version 1.2 (this) + - Issues #3 + - added expandable versions of some commands (see manual) + - documentation + * Version 1.1 - Issues #1/#2 - most/all commands are protected now diff --git a/macros/latex/contrib/starray/doc/starray.pdf b/macros/latex/contrib/starray/doc/starray.pdf Binary files differindex 01eb376434..5fef74c731 100644 --- a/macros/latex/contrib/starray/doc/starray.pdf +++ b/macros/latex/contrib/starray/doc/starray.pdf diff --git a/macros/latex/contrib/starray/doc/starray.tex b/macros/latex/contrib/starray/doc/starray.tex index a18117ac37..d52e6ec101 100644 --- a/macros/latex/contrib/starray/doc/starray.tex +++ b/macros/latex/contrib/starray/doc/starray.tex @@ -15,7 +15,7 @@ %% %% The Current Maintainer of this work is Alceu Frigeri %% -%% This is version 1.1 (2023/05/16) +%% This is version 1.2 (2023/05/20) %% %% The list of files that compose this work can be found in the README.md file at %% https://ctan.org/pkg/starray @@ -29,7 +29,7 @@ \RequirePackage[inline]{enumitem} \SetEnumitemKey{miditemsep}{parsep=0ex,itemsep=0.4ex} - +\RequirePackage[hidelinks,hypertexnames=false]{hyperref} \begin{document} \tstitle{ author={Alceu Frigeri\footnote{\tsverb{https://github.com/alceu-frigeri/starray}}}, @@ -62,9 +62,8 @@ The current implementation, albeit also complex, tries to reach a balance betwee \end{tsremark} \begin{tsremark}[\color{red}Important:] - \textsl{Expandability}, unfortunately most/all defined functions are not ''fully expandable'', in particular, the conditional/branching functions aren't. This means, among other things, one can't have a 'predicated variant' of any conditional defined in this (for instance, to be used in a boolean expression). + \textsl{Expandability}, unfortunately most/all defined functions are not ''fully expandable'', in particular, most conditional/branching functions aren't, with just a few exceptions (marked with a star \ding{72}, as per \tsobj[pkg]{expl3} documentation convention). - For what it's worth, all user visible functions are 'protected'. \end{tsremark} @@ -100,12 +99,27 @@ By default, the \tsobj[pkg]{starray} package only generates ''warnings'', with \ \tsmacro{\starray_new:n}{starray} \tsmacro{\starray_new:nTF}{starray,if-true,if-false} \end{codesyntax} -\end{codedescribe} Creates a new \tsobj[marg]{starray} or raises a warning if the name is already taken. The declaration (and associated property lists) is global. The given name is referred (in this text) as the \tsobj[marg]{starray-root} or just \tsobj[marg]{root}. +\end{codedescribe} \begin{tsremark} A warning is raised (see \ref{pack:options}) if the name is already taken. The branching version doesn't raise any warning. \end{tsremark} +\subsection{Conditionals}\label{conditionals:exist} +\begin{codedescribe}[code,EXP,new=2023/05/20]{\starray_if_exist_p:n,\starray_if_exist:nTF,\starray_if_valid_p:n,\starray_if_valid:nTF} +\begin{codesyntax}% +\tsmacro{\starray_if_exist_p:n}{starray} +\tsmacro{\starray_if_exist:nTF}{starray,if-true,if-false} +\tsmacro{\starray_if_valid_p:n}{starray} +\tsmacro{\starray_if_valid:nTF}{starray,if-true,if-false} +\end{codesyntax} +\tsobj{\starray_if_exist:nTF} only tests if \tsobj[marg]{starray} (the base property) is defined. It doesn't verifies if it really is a \tsobj[pkg]{starray}. +\tsobj{\starray_if_valid:nTF} further tests if an internal boolean (\tsobj[key]{is\_starray}) is also defined. This doesn't necessary mean it is a \tsobj[pkg]{starray} or if it's a really valid one (chances are that it is, but...), see \tsobj{\starray_term_syntax:nTF}, section \ref{conditionals:terms}, for a more reliable validity test. +\end{codedescribe} +\begin{tsremark} +The predicate versions, \tsobj{_p}, expand to either \tsobj{\prg_return_true:} or \tsobj{\prg_return_false:}. +\end{tsremark} + \section{Defining and initialising a starray structure}\label{pack:def} \begin{codedescribe}{\starray_def_prop:nnn,\starray_def_prop:nnnTF} @@ -448,6 +462,17 @@ Before the reset \tsobj[marg]{st-root.subY.subYYY} was equivalent to \tsobj[marg A warning is raised (see \ref{pack:options}) in case of a \tsobj[marg]{starray-ref} syntax error. The branching version doesn't raise any warning. \end{tsremark} +\begin{codedescribe}[code,EXP,new=2023/05/20]{\starray_parsed_get_iter:} +\begin{codesyntax}% +\tsobj{\starray_parsed_get_iter:}{} +\end{codesyntax} +\tsobj{\starray_parsed_get_iter:} will place in the current iterator's value, using \tsobj{\int_use:N}, of the last parsed term in the input stream. +\end{codedescribe} +\begin{tsremark}[\color{red}Warning:] +This can be used after any command which 'parses a term', for instance \tsobj{\starray_term_syntax:n}, see section \ref{conditionals:terms}, but it only makes sense (and returns a reliable/meaningful result) IF the last parser operation was successfully executed. +\end{tsremark} + + \begin{codedescribe}{\starray_get_cnt:n,\starray_get_cnt:nN,\starray_get_cnt:nNTF} \begin{codesyntax}% \tsmacro{\starray_get_cnt:n}{starray-ref} @@ -460,6 +485,17 @@ A warning is raised (see \ref{pack:options}) in case of a \tsobj[marg]{starray-r A warning is raised (see \ref{pack:options}) in case of a \tsobj[marg]{starray-ref} syntax error. The branching version doesn't raise any warning. \end{tsremark} +\begin{codedescribe}[code,EXP,new=2023/05/20]{\starray_parsed_get_cnt:} +\begin{codesyntax}% +\tsobj{\starray_parsed_get_cnt:}{} +\end{codesyntax} +\tsobj{\starray_parsed_get_cnt:} will place the current number of terms, using \tsobj{\int_use:N}, of the last parsed term, in the input stream. +\end{codedescribe} +\begin{tsremark}[\color{red}Warning:] +This can be used after any command which 'parses a term', for instance \tsobj{\starray_term_syntax:n}, see section \ref{conditionals:terms}, but it only makes sense (and returns a reliable/meaningful result) IF the last parser operation was successfully executed. +\end{tsremark} + + \section{Changing and recovering starray properties}\label{pack:get/set} \begin{codedescribe}{\starray_set_prop:nnn,\starray_set_prop:nnV,\starray_set_prop:nnnTF,\starray_set_prop:nnVTF,\starray_gset_prop:nnn,\starray_gset_prop:nnV,\starray_gset_prop:nnnTF,\starray_gset_prop:nnVTF} @@ -537,17 +573,68 @@ Also note that the above example is fully equivalent to: \tscode*[codeprefix=~]{keyval.demo9} +\begin{codedescribe}{\starray_get_prop:nn,\starray_get_prop:nnN,\starray_get_prop:nnNTF} +\begin{codesyntax}% +\tsmacro{\starray_get_prop:nn}{starray-ref,key} +\tsmacro{\starray_get_prop:nnN}{starray-ref,key,tl-var} +\tsmacro{\starray_get_prop:nnNTF}{starray-ref,key,tl-var,if-true,if-false} +\end{codesyntax} +\tsmacro{\starray_get_prop:nn}{starray-ref,key} places the value of \tsobj[marg]{key} in the input stream. +\tsmacro{\starray_get_prop:nnN}{starray-ref,key,tl-var} recovers the value of \tsobj[marg]{key} and places it in \tsobj[marg]{tl-var} (a token list variable), this is specially useful in conjunction with \tsobj{\starray_set_prop:nnV}, whilst the \tsobj{\starray_get_prop:nnNTF} version branches accordly. +\end{codedescribe} +\begin{tsremark} +In case of a syntax error, or \tsobj[marg]{key} doesn't exist, an empty value is left in the stream (or \tsobj[marg]{tl-var}). +\end{tsremark} +\begin{tsremark} +A warning is raised (see \ref{pack:options}) in case of a \tsobj[marg]{starray-ref} syntax error. The branching version doesn't raise any warning. +\end{tsremark} + + +\begin{codedescribe}[code,EXP,new=2023/05/20]{\starray_parsed_get_prop:n} +\begin{codesyntax}% +\tsmacro{\starray_parsed_get_prop:nn}{key} +\end{codesyntax} +\tsmacro{\starray_parsed_get_prop:n}{key} places the value of \tsobj[marg]{key}, if it exists, from the last parsed term, in the input stream. +\end{codedescribe} +\begin{tsremark}[\color{red}Warning:] +This can be used after any command which 'parses a term', for instance \tsobj{\starray_term_syntax:n}, see section \ref{conditionals:terms}, but it only makes sense (and returns a reliable/meaningful result) IF the last parser operation was successfully executed. +\end{tsremark} + -\section{Additional Conditionals}\label{pack:extra} +\section{Additional Commands and Conditionals}\label{conditionals:terms} \begin{codedescribe}{\starray_if_in:nnTF,\starray_term_syntax:nTF} \begin{codesyntax}% \tsmacro{\starray_if_in:nnTF}{starray-ref,key,if-true,if-false} \tsmacro{\starray_term_syntax:nTF}{starray-ref,if-true,if-false} \end{codesyntax} +The \tsmacro{\starray_if_in:nnTF}{starray-ref,key,\ldots,\ldots} tests if a given \tsobj[marg]{key} is present, whilst \tsmacro{\starray_term_syntax:nTF}{starray-ref,if-true,if-false} just verifies if the \tsobj[marg]{starray-ref} syntax is valid or not, branching accordly. \end{codedescribe} -The \tsmacro{\starray_if_in:nnTF}{starray-ref,key,\ldots,\ldots} tests if a given \tsobj[marg]{key} is present, whilst \tsmacro{\starray_term_syntax:nTF}{starray-ref,\ldots,\ldots} just verifies if the \tsobj[marg]{starray-ref} syntax is valid or not, branching accordly. +\begin{codedescribe}{\starray_term_syntax:n} +\begin{codesyntax}% +\tsmacro{\starray_term_syntax:n}{starray-ref} +\end{codesyntax} +This will just parse a \tsobj[marg]{starray-ref} reference, and set interval variables so that commands like \tsobj{\starray_parsed_} can be used. +\end{codedescribe} +\begin{tsremark}[\color{red}Warning:] +The main idea is to allow some expandable commands, but be aware that all \tsobj{\starray_} commands that use a \tsobj[marg]{starray-ref} use the very same parser variables. +\end{tsremark} + + +\begin{codedescribe}[code,EXP,new=2023/05/20]{\starray_parsed_if_in_p:n,\starray_parsed_if_in:nTF} +\begin{codesyntax}% +\tsmacro{\starray_parsed_if_in_p:nTF}{key} +\tsmacro{\starray_parsed_if_in:nTF}{key,if-true,if-false} +\end{codesyntax} +This will test if the given \tsobj[key]{key} is present in the "last parsed term". +\end{codedescribe} +\begin{tsremark} +The predicate version, \tsobj{_p}, expands to either \tsobj{\prg_return_true:} or \tsobj{\prg_return_false:}. +\end{tsremark} +\begin{tsremark}[\color{red}Warning:] +This can be used after any command which 'parses a term', for instance \tsobj{\starray_term_syntax:n}, but it only makes sense (and returns a reliable/meaningful result) IF the last parser operation was successfully executed. +\end{tsremark} \section{Showing (debugging) starrays }\label{pack:show} diff --git a/macros/latex/contrib/starray/latex/starray.sty b/macros/latex/contrib/starray/latex/starray.sty index c94304d0b1..a475c3d098 100644 --- a/macros/latex/contrib/starray/latex/starray.sty +++ b/macros/latex/contrib/starray/latex/starray.sty @@ -12,7 +12,7 @@ %% %% The Current Maintainer of this work is Alceu Frigeri %% -%% This is version 1.1 (2023/05/16) +%% This is version 1.2 (2023/05/20) %% %% The list of files that compose this work can be found in the README.md file at %% https://ctan.org/pkg/starray @@ -24,8 +24,8 @@ \ProvidesExplPackage {starray} - {2023/05/16} - {1.0} + {2023/05/20} + {1.2} {A structured array/hash of properties} %%%%%%% @@ -38,8 +38,8 @@ { name .code:n = starray , prefix .code:n = starray , - date .code:n = 2023/05/16 , - version .code:n = 1.1 , + date .code:n = 2023/05/20 , + version .code:n = 1.2 , description .code:n = A~structured~array/hash~of~properties } \cs_if_exist:NF \__codedesc_pkg_info:nn @@ -129,7 +129,7 @@ \cs_generate_variant:Nn \tl_put_right:Nn {Ne} \cs_generate_variant:Nn \tl_gput_right:Nn {Ne} \cs_generate_variant:Nn \tl_set:Nn {Ne , ce} -\cs_generate_variant:Nn \tl_gset:Nn {Ne , ce} +\cs_generate_variant:Nn \tl_gset:Nn {Ne , ce} \cs_generate_variant:Nn \seq_put_right:Nn {ce} \cs_generate_variant:Nn \seq_gput_right:Nn {ce} @@ -139,9 +139,9 @@ \cs_generate_variant:Nn \prop_put:Nnn {Nee , cee} \cs_generate_variant:Nn \prop_gput:Nnn {Nee , cee} -\cs_generate_variant:Nn \prop_get:NnN {Nnc , cnc , Nec , cec} +\cs_generate_variant:Nn \prop_get:NnN { cnc , cec } -\prg_generate_conditional_variant:Nnn \prop_get:NnN {Nnc , cnc , Nec , cec} { F , T , TF} +\prg_generate_conditional_variant:Nnn \prop_get:NnN { Nec } { F , T , TF} \prg_generate_conditional_variant:Nnn \seq_if_in:Nn {ce} {TF} \prg_generate_conditional_variant:Nnn \prop_if_in:Nn {ce} {TF} @@ -326,9 +326,11 @@ %%%% %%%% recursive/reentrant aware tmp variables. +%%%% this is clumsy and utterly ugly... +%%%% a set of variables for each recursing level... %%%% -\int_set:Nn \l_tmpa_int {7} +\int_set:Nn \l_tmpa_int {9} \tl_clear:N \l_tmpa_tl \int_do_while:nNnn {\l_tmpa_int} > {0} { @@ -371,6 +373,7 @@ \tl_new:N \l__starray_parsed_ref_tl \tl_new:N \l__starray_parsed_base_ref_tl \tl_new:N \l__starray_parsed_root_ref_tl +\tl_new:N \l__starray_parsed_ref_no_idx_ending_tl \tl_new:N \l__starray_parsing_term_tl @@ -404,25 +407,42 @@ %%%%%%%%%%%%%%% %%%%%%%%%%%%%%% -% probably EXP -\prg_new_protected_conditional:Npnn \__starray_if_free:n #1 {T, F, TF} +% +% +\prg_new_conditional:Npnn \__starray_if_free:n #1 {p, T, F, TF} { \prop_if_exist:cTF {#1} { \prg_return_false: } { \prg_return_true: } } -\prg_generate_conditional_variant:Nnn \__starray_if_free:n {e} {T, F, TF} +\prg_generate_conditional_variant:Nnn \__starray_if_free:n {e} {p, T, F, TF} -% possible rEXP -\prg_new_protected_conditional:Npnn \__starray_if_valid:n #1 {T, F, TF} + +\prg_new_conditional:Npnn \starray_if_exist:n #1 {p, T, F, TF} + { + \__starray_if_free:nTF {\l__starray_prefix_tl #1 _def_prop} + { \prg_return_false: } + { \prg_return_true: } + } + + +\prg_new_conditional:Npnn \__starray_if_valid:n #1 {p, T, F, TF} { \bool_lazy_and:nnTF {\prop_if_exist_p:c {#1}} {\prop_item:cn {#1} {is_starray}} { \prg_return_true: } { \prg_return_false: } } -\prg_generate_conditional_variant:Nnn \__starray_if_valid:n {e} {T, F, TF} +\prg_generate_conditional_variant:Nnn \__starray_if_valid:n {e} {p, T, F, TF} + +\prg_new_conditional:Npnn \starray_if_valid:n #1 {p, T, F, TF} + { + \__starray_if_valid:nTF {\l__starray_prefix_tl #1 _def_prop} + { \prg_return_true: } + { \prg_return_false: } + } + %%%%%%%%%%%%%%% %%%%%%%%%%%%%%% @@ -756,15 +776,17 @@ %%%%%%%%%%%%%%% -\prg_new_protected_conditional:Npnn \__starray_def_from_keyval_testdot_aux:w #1 . \q_nil { TF} +\prg_new_conditional:Npnn \__starray_def_from_keyval_testdot_aux:w #1 . \q_nil { TF} { \str_compare:nNnTF {#1} = {struct} { \prg_return_true: } { \prg_return_false: } } - -\prg_new_protected_conditional:Npnn \__starray_def_from_keyval_testdot:w #1 . #2 \q_stop { TF} +% +% This should be protected (\tl_set:Ne isn't expandable) but only the TF form matters. +% +\prg_new_conditional:Npnn \__starray_def_from_keyval_testdot:w #1 . #2 \q_stop { TF} { \quark_if_nil:nTF {#2} { @@ -777,7 +799,6 @@ \prg_return_true: } % dot struct, OK { -% \bool_gset_false:N \l__starray_rtn_bool \prg_return_false: } %% possible syntax ERR (dot, but no struct!) } @@ -1180,7 +1201,7 @@ %%%%%%%%%%%%%%% -\cs_new_protected:Npn \__starray_get_prop:nn #1#2 +\cs_new:Npn \__starray_get_prop:nn #1#2 { \prop_item:cn {\l__starray_prefix_tl #1 _term_prop}{#2} } @@ -1205,6 +1226,17 @@ \msg_warning:nnnn {starray} {syntax / prop} {get:1} {#1} } % returns nothing by default } + + +%%%%%%%%%%%%%%%% +%%% +%%% WARNING: This is uses the 'last parsed term'. +%%% +%%%%%%%%%%%%%%%% +\cs_new:Npn \starray_parsed_get_prop:n #1 + { + \__starray_get_prop:ee {\l__starray_parsed_ref_tl}{#1} + } \cs_new_protected:Npn \starray_get_prop:nnN #1#2#3 { @@ -1228,7 +1260,9 @@ \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1} { \prop_get:cnNTF - {\l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop} {#2} #3 + {\l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop} + {#2} + #3 { \prg_return_true: } @@ -1245,18 +1279,16 @@ } + \prg_new_protected_conditional:Npnn \starray_if_in:nn #1#2 {T, F, TF} { - \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1} + \__starray_parser:nnTF {\c__starray_idx_ending_bool} {#1} { \prop_if_in:cnTF - {\l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop} {#2} - { - \prg_return_true: - } - { - \prg_return_false: - } + { \l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop } + {#2} + { \prg_return_true: } + { \prg_return_false: } } { \seq_clear:N \l__starray_msg_seq @@ -1264,6 +1296,20 @@ } % returns nothing by default } +%%%%%%%%%%%%%%%% +%%% +%%% WARNING: This is uses the 'last parsed term'. +%%% +%%%%%%%%%%%%%%%% +\prg_new_conditional:Npnn \starray_parsed_if_in:n #1 {p, T, F, TF} + { + \prop_if_in:cnTF + { \l__starray_prefix_tl \l__starray_parsed_ref_tl _term_prop } + {#1} + { \prg_return_true: } + { \prg_return_false: } + } + \cs_new_protected:Npn \starray_get_cnt:n #1 { @@ -1278,6 +1324,19 @@ } % returns nothing by default } + +%%%%%%%%%%%%%%%% +%%% +%%% WARNING: This uses the 'last parsed term'. +%%% It will leave cnt directly in the input stream +%%%%%%%%%%%%%%%% +\cs_new:Npn \starray_parsed_get_cnt: + { + \int_use:N + \prop_item:cn { \l__starray_prefix_tl \l__starray_parsed_ref_no_idx_ending_tl _base_prop } {cnt} + } + + \cs_new_protected:Npn \starray_get_cnt:nN #1#2 { \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1} @@ -1323,6 +1382,18 @@ } +%%%%%%%%%%%%%%%% +%%% +%%% WARNING: This uses the 'last parsed term'. +%%% It will leave current iter directly in the input stream +%%%%%%%%%%%%%%%% +\cs_new:Npn \starray_parsed_get_iter: + { + \int_use:N + \prop_item:cn { \l__starray_prefix_tl \l__starray_parsed_ref_no_idx_ending_tl _base_prop } {iter} + } + + \cs_new_protected:Npn \starray_get_iter:nN #1#2 { \__starray_parser:nnTF {\c__starray_no_idx_ending_bool}{#1} @@ -1445,8 +1516,11 @@ %%%%%%%%%%%%%%% %%%%%%%%%%%%%%% - -\prg_new_protected_conditional:Npnn \__starray_set_parse_end:w #1#2 ] #3 \q_stop { TF} +% +% Not expandable. DO NOT generate a predicate version! +% but, already a :w conditional anyway (internal) +% +\prg_new_conditional:Npnn \__starray_set_parse_end:w #1#2 ] #3 \q_stop { TF} { \quark_if_nil:nTF {#3} { \prg_return_false: } %% syntax ERR @@ -1457,7 +1531,11 @@ } -\prg_new_protected_conditional:Npnn \__starray_set_parse_aux:w #1#2 [ \q_nil \q_stop { TF} +% +% Not expandable. DO NOT generate a predicate version! +% but, already a :w conditional anyway (internal) +% +\prg_new_conditional:Npnn \__starray_set_parse_aux:w #1#2 [ \q_nil \q_stop { TF} { \__starray_set_parse_end:wTF {#1}#2 ] \q_nil\q_stop {\prg_return_true:} @@ -1465,7 +1543,11 @@ } -\prg_new_protected_conditional:Npnn \__starray_set_parse_begin:w #1#2 [ #3 \q_stop { TF} +% +% Not expandable. DO NOT generate a predicate version! +% but, already a :w conditional anyway (internal) +% +\prg_new_conditional:Npnn \__starray_set_parse_begin:w #1#2 [ #3 \q_stop { TF} { \quark_if_nil:nTF {#3} { % no 'term' ref, just array_name (current/iter term) @@ -1703,7 +1785,11 @@ %%%%%%%%%%%%%%% %%%%%%%%%%%%%%% -\prg_new_protected_conditional:Npnn \__starray_term_parse_end:w #1 ] #2 \q_stop { TF} +%%% +%%% \tl_set: isn't expandable... but (internal) and only the TF variant is needed. +%%% :w macro anyway... +%%% +\prg_new_conditional:Npnn \__starray_term_parse_end:w #1 ] #2 \q_stop { TF} { \quark_if_nil:nTF {#2} { \prg_return_false: } %% syntax ERR @@ -1714,7 +1800,11 @@ } -\prg_new_protected_conditional:Npnn \__starray_term_parse_aux:w #1 [ \q_nil \q_stop { TF} +%%% +%%% \tl_set: isn't expandable (see above)... but (internal) and only the TF variant is needed. +%%% :w macro anyway... +%%% +\prg_new_conditional:Npnn \__starray_term_parse_aux:w #1 [ \q_nil \q_stop { TF} { \__starray_term_parse_end:wTF #1 ] \q_nil\q_stop {\prg_return_true:} @@ -1722,7 +1812,11 @@ } -\prg_new_protected_conditional:Npnn \__starray_term_parse_begin:w #1 [ #2 \q_stop { TF} +%%% +%%% \tl_set: isn't expandable (see above)... but (internal) and only the TF variant is needed. +%%% :w macro anyway... +%%% +\prg_new_conditional:Npnn \__starray_term_parse_begin:w #1 [ #2 \q_stop { TF} { \tl_set:Nn \l__starray_parsed_term_tl {#1} @@ -1787,6 +1881,9 @@ { \quark_if_nil:nTF {#2} { % this is the last one + \tl_set:Ne + \l__starray_parsed_ref_no_idx_ending_tl + {\l__starray_parsed_ref_tl} \bool_if:NTF \l__starray_parser_no_idx_ending_bool { % assuming it is to add a term... \tl_if_empty:NTF \l__starray_parsed_idx_tl @@ -1910,6 +2007,13 @@ \prg_return_false: } } + +\cs_new:Npn \starray_term_syntax:n #1 + { + \__starray_parser:nnTF {\c__starray_idx_ending_bool}{#1} + {} + {} + } %%%%%%%%%%%%%%% %%%%%%%%%%%%%%% |