diff options
author | Norbert Preining <norbert@preining.info> | 2022-07-08 03:02:08 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-07-08 03:02:08 +0000 |
commit | c600912bde983d6a04c7ce42321d50d4c7c1a50b (patch) | |
tree | 77d96e38d7a6f78e62a322188625aae9b5846f3a /macros | |
parent | c925207bc17a56bf94a6e3d156db27042965136d (diff) |
CTAN sync 202207080302
Diffstat (limited to 'macros')
19 files changed, 699 insertions, 111 deletions
diff --git a/macros/latex/contrib/inlinelabel/README.md b/macros/latex/contrib/inlinelabel/README.md index 14e2879a9f..ea7e66799c 100644 --- a/macros/latex/contrib/inlinelabel/README.md +++ b/macros/latex/contrib/inlinelabel/README.md @@ -17,12 +17,15 @@ This package released under [the MIT license](https://ctan.org/license/mit). ## Revision History ++ Version 1.2 2022-07-08 + + Add the \equationreset. + + Improve the documentation. + Version 1.1 2022-07-07 - + Rewrite README. - + Add the document (inlinelabel.pdf). - + Add the [luacircled] option. + + Rewrite README. + + Add the document (inlinelabel.pdf). + + Add the [luacircled] option. + Version 1.0 2022-06-28 - + The first public version. + + The first public version. --- diff --git a/macros/latex/contrib/inlinelabel/inlinelabel.pdf b/macros/latex/contrib/inlinelabel/inlinelabel.pdf Binary files differindex 67544ad66c..4aef9a8f7d 100644 --- a/macros/latex/contrib/inlinelabel/inlinelabel.pdf +++ b/macros/latex/contrib/inlinelabel/inlinelabel.pdf diff --git a/macros/latex/contrib/inlinelabel/inlinelabel.sty b/macros/latex/contrib/inlinelabel/inlinelabel.sty index 54f35259ff..d249d60ad3 100644 --- a/macros/latex/contrib/inlinelabel/inlinelabel.sty +++ b/macros/latex/contrib/inlinelabel/inlinelabel.sty @@ -10,7 +10,7 @@ %% % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{inlinelabel}[2022/07/07 v1.1] +\ProvidesPackage{inlinelabel}[2022/07/08 v1.2] % % When you meet ''Package pxufont Error: You must load this package % after 'otf'.'', move \usepackage{otf} to a forward row. @@ -96,4 +96,7 @@ % \fi % +%% \equationreset +\DeclareRobustCommand{\equationreset}{\setcounter{equation}{0}} +% %% EOF
\ No newline at end of file diff --git a/macros/latex/contrib/precattl/README b/macros/latex/contrib/precattl/README new file mode 100644 index 0000000000..8a18de3628 --- /dev/null +++ b/macros/latex/contrib/precattl/README @@ -0,0 +1,24 @@ +precattl -- Prepare special catcodes from token list +Allow users to write code that contains tokens with unusual catcodes. + +Released under the LaTeX Project Public License v1.3c or later +See http://www.latex-project.org/lppl.txt + +Report bugs at https://github.com/user202729/TeXlib + +======== + +Copyright 2022 user202729 + +This work may be distributed and/or modified under the conditions of the +LaTeX Project Public License (LPPL), either version 1.3c of this license or +(at your option) any later version. The latest version of this license is in +the file: + + http://www.latex-project.org/lppl.txt + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is user202729. + +This work consists of the files precattl.sty. diff --git a/macros/latex/contrib/precattl/precattl.pdf b/macros/latex/contrib/precattl/precattl.pdf Binary files differnew file mode 100644 index 0000000000..a38be7a3f6 --- /dev/null +++ b/macros/latex/contrib/precattl/precattl.pdf diff --git a/macros/latex/contrib/precattl/precattl.sty b/macros/latex/contrib/precattl/precattl.sty new file mode 100644 index 0000000000..da5d3faf60 --- /dev/null +++ b/macros/latex/contrib/precattl/precattl.sty @@ -0,0 +1,424 @@ +% File: precattl.sty +% Copyright 2022 user202729 +% +% This work may be distributed and/or modified under the conditions of the +% LaTeX Project Public License (LPPL), either version 1.3c of this license or +% (at your option) any later version. The latest version of this license is in +% the file: +% +% http://www.latex-project.org/lppl.txt +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is user202729. + +\ProvidesExplPackage{precattl}{2022/07/07}{0.0.0}{Prepare special catcodes from token list} + + +% ======== this part is inlined from execinside.sty. It's a bit messy yes, maybe will fix when the 2 LaTeX3 bugs on \peek_analysis_map_inline are fixed +% + +\cs_generate_variant:Nn \EI_append:n {x} +\cs_generate_variant:Nn \int_compare:nNnTF {VNnTF} +\cs_generate_variant:Nn \tl_set:Nn {Nx} +\cs_generate_variant:Nn \int_compare:nNnT {VNnT} +\cs_generate_variant:Nn \cs_if_exist_use:NT {cT} + +% ======== define handler functions. +% a few things it can do: +% • \tl_build_gput_right:Nn to \_EIresult (content being put there must be wrapped in \unexpanded i.e. x-expand to the desired result + +\cs_set_protected:Npn \EI_append_raw:n #1 { + \tl_build_gput_right:Nn \_EIresult {#1} +} + +\cs_set_protected:Npn \EI_append:n #1 { + \EI_append_raw:n {\exp_not:n {#1}} +} + +\int_new:N \_EIbalance_level +\int_new:N \_EIcollecting_balanced + +% handler can call this to collect following tokens in the input stream as argument. +% #1: the function to pass argument in. (arguments are passed as brace-hack-included) +% #2: number of arguments +\cs_set_protected:Npn \EI_collect_arg:Nn #1 #2 { + \int_set:Nn \_EIcollecting_balanced {#2} + \int_zero:N \_EIbalance_level + \tl_build_gbegin:N \_EIbalanced_content + \tl_build_gput_right:Nn \_EIbalanced_content {\noexpand #1} +} + +\cs_set_protected:Npn \EIhandler_EIexpand { + \EI_collect_arg:Nn \EI_append:x {1} +} + +\cs_set_protected:Npn \EIhandler_EIexecute { + \EI_collect_arg:Nn \use:n {1} +} + +\cs_set_protected:Npn \execinsideprepare:n #1 { + \tl_build_gbegin:N \_EIresult + \int_zero:N \_EIcollecting_balanced + + \tl_analysis_map_inline:nn {#1} { + % reminder: ##1: token, ##2: char code (int), ##3: cat code (hex digit) + + \int_compare:nNnTF \_EIcollecting_balanced > 0 { + % collecting content. + + \tl_build_gput_right:Nn \_EIbalanced_content {##1} + \int_case:nn {"##3} { + {1} { \int_incr:N \_EIbalance_level } + {2} { \int_decr:N \_EIbalance_level } + } + + % we check this every time instead of only after egroup tokens... + % so that if there's exactly one token to be collected it's still correctly passed through + % disadvantage: function might get a space + \int_compare:nNnT \_EIbalance_level = 0 { + % done, call handler function and revert to normal mode. + + \int_decr:N \_EIcollecting_balanced + \int_compare:nNnT \_EIcollecting_balanced = 0 { + \tl_build_gend:N \_EIbalanced_content + \tl_set:Nx \_EIbalanced_content {\_EIbalanced_content} + %\pretty:V \_EIbalanced_content + \_EIbalanced_content % ← the handler function is embedded in here + %\pretty:n {done} + } + } + } { + \let \_EIprocessed \c_false_bool + + % check for \EIexecute etc. and handle accordingly. + \int_compare:nNnT {##2} = {-1} { + \cs_if_exist_use:cT { + EIhandler_ \expandafter \cs_to_str:N ##1 + } { + \let \_EIprocessed \c_true_bool + } + } + + % if not, just append to result. + \bool_if:NF \_EIprocessed { + \tl_build_gput_right:Nn \_EIresult {##1} + } + } + } + + \tl_build_gend:N \_EIresult + \tl_set:Nx \_EIresult {\_EIresult} +} + +\cs_set_protected:Npn \execinside:n #1 { + \execinsideprepare:n {#1} + \_EIresult +} +\let\execinside\execinside:n % normal-catcode alias + +\cs_set_protected:Npn \execinside_set:Nn #1 #2 { + \execinsideprepare:n {#2} + \let #1 \_EIresult +} +\let\execinsideSet\execinside_set:Nn + +\cs_set_protected:Npn \execinside_gset:Nn #1 #2 { + \execinsideprepare:n {#2} + \global \let #1 \_EIresult +} +\let\execinsideGset\execinside_gset:Nn + + +%% ======== temporary patch for expl3 bug https://github.com/latex3/latex3/issues/1109 +%% okay maybe no need, still use old \tl_analysis implementation +% +%% #1: some explicit char with char 32 and cat X +%% #2: the original explicit char +%\cs_new_protected:Npn \__broken_tl_peek_analysis_char:nN #1#2 +% { +% \cs_set_protected:Npn \__tl_tmp:w ##1 #1 ##2 ##3 \scan_stop: +% { \exp_args:No \l__tl_peek_code_tl { \int_value:w `#2 } ##2 } +% \exp_after:wN \__tl_tmp:w \c__tl_peek_catcodes_tl \scan_stop: +% } +% +%% only patch in this particular condition. +%\ifx \__tl_peek_analysis_char:nN \__broken_tl_peek_analysis_char:nN +% \cs_set_protected:Npn \__tl_peek_analysis_char:nN #1#2 +% { +% \pretty:n {#1, #2} +% \token_if_parameter:NTF #1 { +% \exp_args:No \l__tl_peek_code_tl { \int_value:w `#2 } 6 +% } { +% \cs_set_protected:Npn \__tl_tmp:w ##1 #1 ##2 ##3 \scan_stop: +% { \exp_args:No \l__tl_peek_code_tl { \int_value:w `#2 } ##2 } +% \exp_after:wN \__tl_tmp:w \c__tl_peek_catcodes_tl \scan_stop: +% } +% } +%\fi + +% ======== + + +\cs_generate_variant:Nn \exp_args:NN {Nc} +\cs_generate_variant:Nn \EI_append:n {x} +\cs_generate_variant:Nn \exp_args:Nn {No} +\cs_generate_variant:Nn \EI_append:n {o} +\cs_generate_variant:Nn \tl_put_right:Nn {Nx} +\cs_generate_variant:Nn \use:nn {nV} +\cs_generate_variant:Nn \execinside_set:Nn {NV} + + +\def \_precattlappend_space #1 { + \begingroup + \lccode `\ =#1 + \lowercase{ + \endgroup \EI_append:n {~} + } +} +\def \_precattlappend_begin #1 { + \begingroup + \lccode `\{=#1 + \lowercase{\endgroup \EI_append_raw:n { \iftrue { \else } \fi }} +} +\def \_precattlappend_end #1 { + \begingroup + \lccode `\}=#1 + \lowercase{\endgroup \EI_append_raw:n { \iffalse { \else } \fi }} +} + +%\def \_precattldo_special_cC #1 { \exp_args:Nc \EI_append:n {#1} } +\def \_precattldo_special_cC #1 { \EI_append_raw:n {\exp_not:c {#1}} } % do this to handle \outer tokens. but in the x-expansion step below need to wrap in a group level to avoid defining control sequences as \relax. + +\def \_precattldo_special_cB #1 { \str_map_inline:nn {#1} { \_precattlappend_begin {`##1} } } +\def \_precattldo_special_cE #1 { \str_map_inline:nn {#1} { \_precattlappend_end {`##1} } } +\def \_precattldo_special_cM #1 { \str_map_inline:nn {#1} { \EI_append:x {\char_generate:nn {`##1} {3}} } } +\def \_precattldo_special_cT #1 { \str_map_inline:nn {#1} { \EI_append:x {\char_generate:nn {`##1} {4}} } } +\def \_precattldo_special_cP #1 { \str_map_inline:nn {#1} { \exp_args:No \EI_append:o {\char_generate:nn {`##1} {6}} } } +\def \_precattldo_special_cU #1 { \str_map_inline:nn {#1} { \EI_append:x {\char_generate:nn {`##1} {7}} } } +\def \_precattldo_special_cD #1 { \str_map_inline:nn {#1} { \EI_append:x {\char_generate:nn {`##1} {8}} } } +\def \_precattldo_special_cS #1 { \str_map_inline:nn {#1} { \_precattlappend_space {`##1} } } +\def \_precattldo_special_cL #1 { \str_map_inline:nn {#1} { \EI_append:x {\char_generate:nn {`##1} {11}} } } +\def \_precattldo_special_cO #1 { \str_map_inline:nn {#1} { \EI_append:x {\char_generate:nn {`##1} {12}} } } +\def \_precattldo_special_cA #1 { \str_map_inline:nn {#1} { + %\exp_args:No \EI_append:o {\char_generate:nn {`##1} {13}} + \EI_append_raw:n {\expandafter \expandafter \expandafter \noexpand \char_generate:nn {`##1} {13}} % handle outer token +} } + + + +\def \_precattldo_special #1 #2 { + % given #1 e.g. \cO, #2 e.g. {abc}, append <abc> in detokenized catcode to EI. + \begingroup + \escapechar=-1 + + % let \_precattltmp be the concatenation of \string of all tokens within #2. + \def \_precattltmp {} + \tl_analysis_map_inline:nn {#2} { + \tl_put_right:Nx \_precattltmp {\expandafter \string ##1} + } + + % then pass it to the specific handler. + \exp_args:NNV + \endgroup + #1 \_precattltmp +} + + +\def \_precattldo_special_cC_outer { \_precattldo_special\_precattldo_special_cC } +\def \_precattldo_special_cB_outer { \_precattldo_special\_precattldo_special_cB } +\def \_precattldo_special_cE_outer { \_precattldo_special\_precattldo_special_cE } +\def \_precattldo_special_cM_outer { \_precattldo_special\_precattldo_special_cM } +\def \_precattldo_special_cT_outer { \_precattldo_special\_precattldo_special_cT } +\def \_precattldo_special_cP_outer { \_precattldo_special\_precattldo_special_cP } +\def \_precattldo_special_cU_outer { \_precattldo_special\_precattldo_special_cU } +\def \_precattldo_special_cD_outer { \_precattldo_special\_precattldo_special_cD } +\def \_precattldo_special_cS_outer { \_precattldo_special\_precattldo_special_cS } +\def \_precattldo_special_cL_outer { \_precattldo_special\_precattldo_special_cL } +\def \_precattldo_special_cO_outer { \_precattldo_special\_precattldo_special_cO } +\def \_precattldo_special_cA_outer { \_precattldo_special\_precattldo_special_cA } + +\def \_precattl_tmp_help #1 { + \def \_precattl_do_frozen_relax { \EI_append:n {#1} } + % #1 here will be substituted by the frozen relax +} +\expandafter \_precattl_tmp_help \ifnum0=0\fi +\let \_precattl_tmp_help \undefined + + + +\def \precattl_prepare:n #1 { + \begingroup + \let \EIhandler_EIexpand \undefined + \let \EIhandler_EIexecute \undefined + \def \EIhandler_cC { \EI_collect_arg:Nn \_precattldo_special_cC_outer 1 } + \def \EIhandler_cB { \EI_collect_arg:Nn \_precattldo_special_cB_outer 1 } + \def \EIhandler_cE { \EI_collect_arg:Nn \_precattldo_special_cE_outer 1 } + \def \EIhandler_cM { \EI_collect_arg:Nn \_precattldo_special_cM_outer 1 } + \def \EIhandler_cT { \EI_collect_arg:Nn \_precattldo_special_cT_outer 1 } + \def \EIhandler_cP { \EI_collect_arg:Nn \_precattldo_special_cP_outer 1 } + \def \EIhandler_cU { \EI_collect_arg:Nn \_precattldo_special_cU_outer 1 } + \def \EIhandler_cD { \EI_collect_arg:Nn \_precattldo_special_cD_outer 1 } + \def \EIhandler_cS { \EI_collect_arg:Nn \_precattldo_special_cS_outer 1 } + \def \EIhandler_cL { \EI_collect_arg:Nn \_precattldo_special_cL_outer 1 } + \def \EIhandler_cO { \EI_collect_arg:Nn \_precattldo_special_cO_outer 1 } + \def \EIhandler_cA { \EI_collect_arg:Nn \_precattldo_special_cA_outer 1 } + \let \EIhandler_cFrozenRelax \_precattl_do_frozen_relax + \execinside_gset:Nn \_precattlvalueg {#1} + \endgroup +} + +\def \precattl_set:Nn #1 #2 { + \precattl_prepare:n {#2} + \tl_set_eq:NN #1 \_precattlvalueg +} + + + + + + +\cs_new_protected:Npn \__resume_peek: { + \peek_analysis_map_inline:n { + \__process {##1} {##2} {##3} + } +} + +\def \__help:NN #1 #2 { + \def #1 { \peek_analysis_map_break:n { \_precattldo_special #2 } } +} +\cs_generate_variant:Nn \__help:NN {cc} +\str_map_inline:nn {CBEMTPUDSLOA} { + \__help:cc {__special c #1} {__special c #1 _continue: } +} + +\def \__help:NN #1 #2 { + \def #1 { \peek_analysis_map_break:n { #2 } } +} + +\str_map_inline:nn {BEMTPUDSLOA} { + \__help:cc {__special c #1} {__special c #1 _continue: } +} + + +\def \__help:n #1 { + \def \__specialcFrozenRelax { + \tl_build_gput_right:Nn \__result { #1 } + } + % #1 here will be substituted by the frozen relax +} +\expandafter \__help:n \ifnum0=0\fi +\let \__help:n \undefined + + + +% ======== define \__specialcB_continue:, etc. + +\def \__help:Nn #1 #2 { + \def #1 ##1 { + \tl_analysis_map_inline:nn {##1} { + \str_map_inline:xn {\expandafter\string####1} { + \tl_build_gput_right:Nn \__result { + \char_generate:nn {`########1} {#2} + } + } + } + \__resume_peek: + } +} +\__help:Nn \__specialcB_continue: {1} +\__help:Nn \__specialcE_continue: {2} +\__help:Nn \__specialcM_continue: {3} +\__help:Nn \__specialcT_continue: {4} +\__help:Nn \__specialcU_continue: {7} +\__help:Nn \__specialcD_continue: {8} +\__help:Nn \__specialcS_continue: {10} +\__help:Nn \__specialcL_continue: {11} +\__help:Nn \__specialcO_continue: {12} + + +\def \__specialcC_continue: #1 { + \begingroup + \exp_args:NNo \tl_build_gput_right:Nn \__result {\expandafter \noexpand \csname #1 \endcsname} + \endgroup + \__resume_peek: +} +\def \__specialcA_continue: #1 { + \tl_analysis_map_inline:nn {#1} { + \str_map_inline:xn {\expandafter\string##1} { + \tl_build_gput_right:Nn \__result { + \expandafter \expandafter \expandafter \noexpand \char_generate:nn {`####1} {13} + } + } + } + \__resume_peek: +} +\def \__specialcP_continue: #1 { + \tl_analysis_map_inline:nn {#1} { + \str_map_inline:xn {\expandafter\string##1} { + \tl_build_gput_right:Nn \__result { + ######## \char_generate:nn {`####1} {6} + %## \char_generate:nn {`#1} {6} + } + } + } + \__resume_peek: +} + +% ======== + +\cs_new_protected:Npn \__process #1 #2 #3 { + \token_if_eq_meaning:NNTF #3 0 { + + %\ifcsname __special \expandafter \cs_to_str:N #1 \endcsname + % \csname __special \expandafter \cs_to_str:N #1 \expandafter \endcsname + %\else + % \tl_build_gput_right:Nn \__result {#1} + %\fi + + \ifcsname __special \expandafter \cs_to_str:N #1 \endcsname + \expandafter \use_i:nn + \else + \expandafter \use_ii:nn + \fi + {\csname __special \expandafter \cs_to_str:N #1 \endcsname} + {\tl_build_gput_right:Nn \__result {#1}} + } + { + \tl_build_gput_right:Nn \__result {#1} + } +} + + + +\def \_precattl_tmp_help #1 { + \def \_precattl_do_frozen_relax { \EI_append:n {#1} } + % #1 here will be substituted by the frozen relax +} +\expandafter \_precattl_tmp_help \ifnum0=0\fi +\let \_precattl_tmp_help \undefined + + +\def \precattl_setx:Nn #1 #2 { + \begingroup + \escapechar=-1~ + \tl_build_gbegin:N \__result + \cs_set_protected:Npn \__special__stop { + \tl_build_gend:N \__result + \endgroup + \tl_set:Nx #1 {\__result} + \peek_analysis_map_break: + } + \__resume_peek: + #2 + \__stop +} +\let\precattlSet\precattl_set:Nn + +\def \precattl_exec:n #1 { + \precattl_prepare:n {#1} + \_precattlvalueg + %\precattl_set:Nn \__tmp {#1} + %\__tmp +} +\let\precattlExec\precattl_exec:n diff --git a/macros/latex/contrib/precattl/precattl.tex b/macros/latex/contrib/precattl/precattl.tex new file mode 100644 index 0000000000..a9af2a7125 --- /dev/null +++ b/macros/latex/contrib/precattl/precattl.tex @@ -0,0 +1,146 @@ +%%! TEX program = lualatex +\ProvidesFile{precattl.tex} [2022/07/07 v0.0.0 ] +\documentclass{l3doc} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\fvset{gobble=0,tabsize=4,frame=single,numbers=left,numbersep=3pt} +\usepackage{hyperref} +\usepackage{csquotes} + +%\MakeOuterQuote{"} +\begin{document} +\GetFileInfo{\jobname.tex} + +\title{\textsf{precattl} --- Prepare special catcodes from token list +\thanks{This file describes version \fileversion, last revised \filedate.} +} +\author{user202729% +%\thanks{E-mail: (not set)} +} +\date{Released \filedate} + +\maketitle + +\begin{abstract} +Allow users to write code that contains tokens with unusual catcodes. +\end{abstract} + +\section{Motivation} + +This package allows developers to quickly prototype writing code by specifying the exact token list to be executed. + +For example, classically if you want to define a space gobbler you would do this +\begin{verbatim} +\lowercase{\def\spacegobbler} {} +\end{verbatim} +which is equivalent to the token list |\def\spacegobbler|\meta{explicit space token}\verb+{}+. + +In such simple cases there's negligible benefit in using this package; nevertheless in some more complex cases such as the following... +\begin{verbatim} +\begingroup +\lccode `?=`_ +\lowercase{ + \endgroup + \peek_analysis_map_inline:n { + \expandafter \string #1 + \peek_analysis_map_break: + } + \c_begin_group_token ? +} + +\lowercase{\lowercase{\def\twospacegobbler} } {} + +\catcode`\^^M\active +\edef^^M{\string^^M} +\end{verbatim} +it would be beneficial to have simpler construct to express the code. + +A side benefit is that there's no need to do explicit |\begingroup| ... |\endgroup| (and keep track of when |\endgroup| should be executed), +and no risk of accidentally pretokenizing the token list/it can be used inside argument of anything. + +\section{Limitation} + +\begin{itemize} + \item There's some performance hit. I think it's about 5 times slower than |\tl_analysis_map_inline:nn| on the same token list. + + Nevertheless this is not a big problem, as it's possible to precompile the token list and include it in the generated \texttt{.sty} file. + \item It's not allowed to pass |\outer| tokens into the macro directly; however, generating |\outer| tokens with |\cC| and |\cA| is supported. +\end{itemize} + + +\section{Syntax} + + +\begin{function}{\precattl_exec:n} + \begin{syntax} + \cs{precattl_exec:n} \Arg{token list} + \end{syntax} + Executes the \Arg{token list} after preprocessing it in the following manner: + + \begin{itemize} + \item |\cC|\Arg{control sequence name} is replaced by that control sequence. + \item |\cFrozenRelax| is replaced with the frozen relax control sequence. + \item |\cA|\Arg{tokens}, |\cO|\Arg{tokens}, etc. are replaced with sequence of tokens with catcode active/other respectively. + \end{itemize} +\end{function} + In particular, \Arg{tokens} or \Arg{control sequence name} might consist of normal \enquote{characters} or control sequences. + Control sequences will have its csname appended. (nevertheless don't use the null control sequence here) + + The full list of supported catcodes is the same as \pkg{l3regex} package: + |\cB|, |\cE|, |\cM|, |\cT|, |\cP|, |\cU|, |\cD|, |\cS|, |\cL|, |\cO|, |\cA|. + + As an example, the examples above can be executed as following: +\begin{verbatim} +\precattl_exec:n { + \def\spacegobbler\cS\ {} + + \peek_analysis_map_inline:n { + \expandafter \string #1 + \peek_analysis_map_break: + } + \c_begin_group_token \cO\_ + + \def\twospacegobbler\cS\ \cS\ {} + + \def \cA\^^M {\cO\^^M} +} +\end{verbatim} +More details: the token list following one of the |\c|\meta{character} token might either be a single token, or a braced group. In the latter case their string representation without any |\escapechar| will be concatenated together. + +For example: + +\begin{itemize} + \item |\cL{12~34}| in |\ExplSyntaxOn| mode results in the 5 tokens with catcode letter and char code 1, 2, \meta{space}, 3, 4 respectively. + \item |\cO\abc| results in 3 tokens |abc| with catcode other. + \item |\cO{\ab\cd\ef}| results in 6 tokens |abcdef|. Note that this is different from the |\detokenized| value (that is, the spaces are removed) even when |\escapechar=-1|. + \item |\cC{\ab\cd\ef}| results in the control sequence |\abcdef|. + \item |\cO\\| results in a single token with char code |\| and catcode other. + \item |\cA\^^M| results in a single token with catcode active and char code 13. (because normal \TeX\ processing rules transform the token |\^^M| to a control sequence with name length = 1 before passing it to the function \cs{precattl_exec:n}) +\end{itemize} + +Remark: don't put explicit space token right after a |\cO| or similar. (nevertheless this is nontrivial to trigger because of how \TeX\ works normally) + +Warning: a \verb*|\ | at the end of a line will be interpreted as an escape sequence containing the |\endlinechar|. + + +\begin{function}{\precattlExec} +\LaTeX2-style synonym for the function above. +\end{function} + +\begin{function}{\precattl_set:Nn} + \begin{syntax} + \cs{precattl_set:Nn} \meta{tl var} \Arg{token list} + \end{syntax} + Same as above, but instead of executing the processed \Arg{token list}, the result is stored into \meta{tl var}. + + Mostly equivalent to |\precattl_exec:n {\tl_set:Nn| \meta{tl var} \Arg{token list}|}|. +\end{function} + +\StopEventually{% + \PrintChanges + \PrintIndex +} +\Finale +\end{document} + diff --git a/macros/latex/contrib/zref-check/CHANGELOG.md b/macros/latex/contrib/zref-check/CHANGELOG.md index 58bbedaf72..f812c8b76c 100644 --- a/macros/latex/contrib/zref-check/CHANGELOG.md +++ b/macros/latex/contrib/zref-check/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/zref-check/compare/v0.3.1...HEAD) +## [Unreleased](https://github.com/gusbrs/zref-check/compare/v0.3.2...HEAD) + +## [v0.3.2](https://github.com/gusbrs/zref-check/compare/v0.3.1...v0.3.2) (2022-07-07) + +### Fixed +- Recompiled documentation with workaround for upstream `l3doc` bug. ## [v0.3.1](https://github.com/gusbrs/zref-check/compare/v0.3.0...v0.3.1) (2022-07-05) diff --git a/macros/latex/contrib/zref-check/zref-check-code.pdf b/macros/latex/contrib/zref-check/zref-check-code.pdf Binary files differindex 2868afd617..24e4f653b9 100644 --- a/macros/latex/contrib/zref-check/zref-check-code.pdf +++ b/macros/latex/contrib/zref-check/zref-check-code.pdf diff --git a/macros/latex/contrib/zref-check/zref-check.dtx b/macros/latex/contrib/zref-check/zref-check.dtx index 4417cb7ead..9bc53031c7 100644 --- a/macros/latex/contrib/zref-check/zref-check.dtx +++ b/macros/latex/contrib/zref-check/zref-check.dtx @@ -516,7 +516,7 @@ % % Identify the package. % \begin{macrocode} -\ProvidesExplPackage {zref-check} {2022-07-05} {0.3.1} +\ProvidesExplPackage {zref-check} {2022-07-07} {0.3.2} {Flexible cross-references with contextual checks based on zref} % \end{macrocode} % diff --git a/macros/latex/contrib/zref-check/zref-check.pdf b/macros/latex/contrib/zref-check/zref-check.pdf Binary files differindex 8f94754f00..b3d67a8f98 100644 --- a/macros/latex/contrib/zref-check/zref-check.pdf +++ b/macros/latex/contrib/zref-check/zref-check.pdf diff --git a/macros/latex/contrib/zref-check/zref-check.tex b/macros/latex/contrib/zref-check/zref-check.tex index bed532befc..de1cdb8225 100644 --- a/macros/latex/contrib/zref-check/zref-check.tex +++ b/macros/latex/contrib/zref-check/zref-check.tex @@ -46,6 +46,13 @@ \usepackage{zref-check} \NewDocumentCommand\opt{m}{\texttt{#1}} +% Temporary workaround for 'l3doc' bug. +% https://github.com/latex3/latex3/issues/1111 +% FIXME Remove when fixed upstream. +\NewDocElement[ + macrolike = false , + printtype = \textit{opt.} , +]{Option}{optiondesc} \begin{document} diff --git a/macros/xetex/latex/bidi/README b/macros/xetex/latex/bidi/README index 7bce2d35ed..899f18ab23 100644 --- a/macros/xetex/latex/bidi/README +++ b/macros/xetex/latex/bidi/README @@ -1,6 +1,6 @@ ___________________ The bidi package -v38.7 +v38.8 This package provides a convenient interface for typesetting bidirectional texts in Plain TeX and LaTeX, using XeTeX engine. @@ -25,7 +25,7 @@ The announcements for the new releases of the package will also appear in the Discussions space under the Announcements category. -Current version release date: 2022/07/04 +Current version release date: 2022/07/07 ___________________________________________ Vafa Khalighi diff --git a/macros/xetex/latex/bidi/bidi-doc-intro.ltx b/macros/xetex/latex/bidi/bidi-doc-intro.ltx index afc292f9e6..60e0298195 100644 --- a/macros/xetex/latex/bidi/bidi-doc-intro.ltx +++ b/macros/xetex/latex/bidi/bidi-doc-intro.ltx @@ -20,7 +20,7 @@ If you use \textsf{bidi} package to write any input \TeX\ document, and then run * Copyright (c) 2007--2022 Vafa Khalighi * Copyright (c) 2018--2020 bidi-tex GitHub Organization * -* v38.7, 2022/07/04 +* v38.8, 2022/07/07 * * License: LaTeX Project Public License, version * 1.3c or higher (your choice) diff --git a/macros/xetex/latex/bidi/bidi-doc-title.ltx b/macros/xetex/latex/bidi/bidi-doc-title.ltx index 8783dcade9..a41639564c 100644 --- a/macros/xetex/latex/bidi/bidi-doc-title.ltx +++ b/macros/xetex/latex/bidi/bidi-doc-title.ltx @@ -3,7 +3,7 @@ \begin{document} \title{\textcolor{blue!65!black}{\Huge The \textsf{bidi} \textit{Package}}\\ \LARGE Bidirectional typesetting in plain \TeX{} and \LaTeX, using \XeTeX{} engine\\[5pt] -\large User documentation for \textcolor{blue!65!black}{version 38.7}} +\large User documentation for \textcolor{blue!65!black}{version 38.8}} \author{Vafa Khalighi\thanks{Thanks to the bidi-tex GitHub organization consisted of David Carlisle and other members of the {\LaTeX} team to maintain the package in the period 2018--2020.}} \setcounter{page}{0} \thispagestyle{empty} @@ -13,7 +13,7 @@ \textcolor{blue!65!black}{\Huge The \textsf{bidi} \textit{Package}} \Large -User documentation for \textcolor{blue!65!black}{version 38.7}} +User documentation for \textcolor{blue!65!black}{version 38.8}} \vskip 0pt plus 3fill \textit{\large to my Master, \textbf{Ferdowsi The Great}} diff --git a/macros/xetex/latex/bidi/bidi-doc.ltx b/macros/xetex/latex/bidi/bidi-doc.ltx index 3bbc08440b..62c0367b6b 100644 --- a/macros/xetex/latex/bidi/bidi-doc.ltx +++ b/macros/xetex/latex/bidi/bidi-doc.ltx @@ -1,7 +1,7 @@ \documentclass{ltxdoc} \input{bidi-doc-preamble.ltx} \hypersetup{% - pdftitle={User documentation for version 38.7 of the bidi + pdftitle={User documentation for version 38.8 of the bidi package}% } \begin{document} diff --git a/macros/xetex/latex/bidi/bidi-doc.pdf b/macros/xetex/latex/bidi/bidi-doc.pdf Binary files differindex 1aa5827fd6..f11d351eb2 100644 --- a/macros/xetex/latex/bidi/bidi-doc.pdf +++ b/macros/xetex/latex/bidi/bidi-doc.pdf diff --git a/macros/xetex/latex/bidi/bidi.dtx b/macros/xetex/latex/bidi/bidi.dtx index 1b925de8c3..fb51918f19 100644 --- a/macros/xetex/latex/bidi/bidi.dtx +++ b/macros/xetex/latex/bidi/bidi.dtx @@ -5,7 +5,7 @@ %<*readme> ___________________ The bidi package -v38.7 +v38.8 This package provides a convenient interface for typesetting bidirectional texts in Plain TeX and LaTeX, using XeTeX engine. @@ -30,7 +30,7 @@ The announcements for the new releases of the package will also appear in the Discussions space under the Announcements category. -Current version release date: 2022/07/04 +Current version release date: 2022/07/07 ___________________________________________ Vafa Khalighi @@ -267,7 +267,7 @@ by Vafa Khalighi. \documentclass{ltxdoc} \input{bidi-doc-preamble.ltx} \hypersetup{% - pdftitle={Source documentation for version 38.7 of the bidi + pdftitle={Source documentation for version 38.8 of the bidi package}% } \EnableCrossrefs @@ -286,7 +286,7 @@ by Vafa Khalighi. % \GetFileInfo{\jobname.dtx} % \title{\textcolor{blue!65!black}{\Huge The \textsf{bidi} \textit{Package}}\\ %\LARGE Bidirectional typesetting in plain \TeX{} and \LaTeX, using \XeTeX{} engine\\[5pt] -%\large Source documentation for \textcolor{blue!65!black}{version 38.7}} +%\large Source documentation for \textcolor{blue!65!black}{version 38.8}} % \author{Vafa Khalighi\thanks{Thanks to the bidi-tex GitHub organization consisted of David Carlisle and other members of the {\LaTeX} team to maintain the package in the period 2018--2020.}} %\setcounter{page}{0} %\thispagestyle{empty} @@ -296,7 +296,7 @@ by Vafa Khalighi. %\textcolor{blue!65!black}{\Huge The \textsf{bidi} \textit{Package}} % %\Large -%Source documentation for \textcolor{blue!65!black}{version 38.7}} +%Source documentation for \textcolor{blue!65!black}{version 38.8}} % %\vskip 0pt plus 3fill %\textit{\large to my Master, \textbf{Ferdowsi The Great}} @@ -345,7 +345,7 @@ by Vafa Khalighi. %\iffalse %<*table> %\fi -%% \CheckSum{55533} +%% \CheckSum{55450} %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -4589,8 +4589,8 @@ by Vafa Khalighi. % \section{File \texttt{bidi.sty}} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\def\bididate{2022/07/04} -\def\bidi@version{38.7} +\def\bididate{2022/07/07} +\def\bidi@version{38.8} \ProvidesPackage{bidi}[\bididate\space v\bidi@version\space Bidirectional typesetting in plain TeX and LaTeX] \edef\@bidi@info{****************************************************^^J% @@ -4677,7 +4677,7 @@ Bidirectional typesetting in plain TeX and LaTeX] } \newcommand*{\@bidi@pdfcustomproperties}{% This is the bidi package, Version \bidi@version, - Released July 4, 2022. + Released July 7, 2022. } \newcommand*{\bidi@beamer@ragged}{} \@RTLmainfalse @@ -4921,9 +4921,9 @@ Bidirectional typesetting in plain TeX and LaTeX] %\fi % \section{File \texttt{bidi.tex}} % \begin{macrocode} -\def\bididate{2022/07/04} +\def\bididate{2022/07/07} \catcode`@=11 -\def\bidi@version{38.7} +\def\bidi@version{38.8} \let \protect \relax \newlinechar`\^^J \edef\@bidi@info{****************************************************^^J% @@ -5025,7 +5025,7 @@ Bidirectional typesetting in plain TeX and LaTeX] } \def\@bidi@pdfcustomproperties{% This is the bidi package, Version \bidi@version, - Released July 4, 2022. + Released July 7, 2022. } \def\bidi@pdfm@mark{% \special{pdf:% @@ -12541,7 +12541,11 @@ bidi implementation of tufte title] %\fi % \section{File \texttt{extrafootnotefeatures-xetex-bidi.def}} % \begin{macrocode} -\ProvidesFile{extrafootnotefeatures-xetex-bidi.def}[2022/07/02 v1.9 bidi extra footnote features for XeTeX engine] +\ProvidesFile{extrafootnotefeatures-xetex-bidi.def}[2022/07/07 v2.0 bidi extra footnote features for XeTeX engine] +\newdimen\bidi@columnwidth +\def\bidi@floathook{% + \bidi@columnwidth\columnwidth +} \newif\if@bidi@void@footins \newif\if@bidi@void@@mpfootins \newcommand*{\@bidi@before@Hy@hyperfootnotes}{% @@ -12754,10 +12758,10 @@ bidi implementation of tufte title] \LTRfootmarkstyle{\textsuperscript{#1}} \RTLfootmarkstyle{\textsuperscript{#1}} \newcommand*{\bidi@normal@footmarkwidth}{% - \setlength{\footmarkwidth}{1em plus.4em minus.4em}% + \setlength{\footmarkwidth}{1em plus.3em minus.3em}% } \newcommand*{\bidi@star@footmarkwidth}{% - \setlength{\footmarkwidth}{0em plus.4em minus.4em}% + \setlength{\footmarkwidth}{0em plus.3em minus.3em}% } \bidi@normal@footmarkwidth \bidi@ensure@newcommand{\m@mdoextrafeet}{\extrafeetins} @@ -12881,23 +12885,14 @@ bidi implementation of tufte title] \newinsert\@mpfootinsv@l \bidi@ensure@newcommand{\mp@footgroupv@r}{} \newcount\m@m@k \newdimen\m@m@h -\@ifpackageloaded{multicol}{% -\bidi@ensure@newcommand*{\m@mrigidbalance}[3]{\setbox0=\box#1 \m@m@k=#2 \m@m@h=#3 - \hsize\textwidth - \@@line{\beginR\splittopskip=\m@m@h \vbadness=\@M \hfilneg - \valign{##\vfill\cr\m@mdosplits}\endR}} -\newcommand*{\bidi@LTRrigidbalance}[3]{\setbox0=\box#1 \m@m@k=#2 \m@m@h=#3 - \hsize\textwidth - \@@line{\splittopskip=\m@m@h \vbadness=\@M \hfilneg - \valign{##\vfill\cr\m@mdosplits}}} -}{% \bidi@ensure@newcommand*{\m@mrigidbalance}[3]{\setbox0=\box#1 \m@m@k=#2 \m@m@h=#3 + \hsize\bidi@columnwidth \@@line{\beginR\splittopskip=\m@m@h \vbadness=\@M \hfilneg \valign{##\vfill\cr\m@mdosplits}\endR}} \newcommand*{\bidi@LTRrigidbalance}[3]{\setbox0=\box#1 \m@m@k=#2 \m@m@h=#3 + \hsize\bidi@columnwidth \@@line{\splittopskip=\m@m@h \vbadness=\@M \hfilneg \valign{##\vfill\cr\m@mdosplits}}} -} \bidi@ensure@newcommand*{\m@mdosplits}{\ifnum\m@m@k>0 \noalign{\hfil}\m@msplitoff \global\advance\m@m@k-1\cr\m@mdosplits\fi} \bidi@ensure@newcommand*{\m@msplitoff}{\dimen0=\ht0 @@ -14193,10 +14188,8 @@ bidi implementation of tufte title] \newskip\m@mipn@skip \bidi@ensure@newcommand*{\m@minterparanoteglue}[1]{% {\foottextfont\global\m@mipn@skip=#1\relax}} -\m@minterparanoteglue{1em plus.4em minus.4em} -\@ifpackageloaded{multicol}{% +\m@minterparanoteglue{1em plus.3em minus.3em} \bidi@ensure@newcommand*{\m@mmakehboxofhboxes}{% - \hsize\textwidth% \setbox0=\hbox{}% \loop \unpenalty @@ -14204,28 +14197,14 @@ bidi implementation of tufte title] \ifhbox2 \setbox0=\hbox{\box2\unhbox0} \repeat} -}{% -\bidi@ensure@newcommand*{\m@mmakehboxofhboxes}{% - \setbox0=\hbox{}% - \loop - \unpenalty - \setbox2=\lastbox - \ifhbox2 - \setbox0=\hbox{\box2\unhbox0} - \repeat}} \bidi@ensure@newcommand*{\m@mremovehboxes}{\setbox0=\lastbox \ifhbox0{\m@mremovehboxes}\unhbox0 \fi} \newcommand*\AddExtraParaSkip[1]{% - \if@bidi@csdef{footfudgefactor}{% - \PackageError{bidi}{% - The control sequence `\string\AddExtraParaSkip` - must be used before the control sequence - `\string\paragraphfootnotes' in the preamble% - }\@ehc - }{% \def\bidi@xparaskip{\advance\@tempdima#1\relax}% - }% } +\let\bidi@xparaskip\relax +\@onlypreamble\AddExtraParaSkip +\@onlypreamble\bidi@xparaskip \bidi@ensure@newcommand{\paragraphfootnotes}{% \@namedef{foottextfontv@r}{\foottextfont}% % [RS] \@bidi@before@Hy@hyperfootnotes @@ -14254,30 +14233,27 @@ bidi implementation of tufte title] \bidi@make@mppara@LTRfootgroup{v@l}% \let\mp@footgroupv@r\@mppara@footgroupv@r \let\mp@LTRfootgroupv@l\@mppara@LTRfootgroupv@l - \begingroup - \def\baselinestretch{\m@m@footnote@spacing}% - \foottextfont - \@tempdima\footnotesep - \advance\@tempdima -\ht\strutbox - \ifdim\@tempdima<\z@ \@tempdima\z@ \fi - \advance\@tempdima.5\normalbaselineskip - \bidi@xparaskip - \xdef\bidi@paraskip{\the\@tempdima\relax}% - \ifdim\skip\footinsv@r>\bigskipamount - \else - \global\advance\skip\footinsv@r\bidi@paraskip - \fi - \ifdim\skip\footinsv@l>\bigskipamount - \else - \global\advance\skip\footinsv@l\bidi@paraskip - \fi - \@tempdima\normalbaselineskip - \multiply \@tempdima \@cclvi - \@tempdimb \columnwidth - \divide \@tempdimb \@cclvi - \divide \@tempdima \@tempdimb - \xdef\footfudgefactor{\strip@pt\@tempdima}% - \endgroup + \g@addto@macro\bidi@floathook{% + \begingroup + \foottextfont \@tempdima\normalbaselineskip + \multiply \@tempdima \@cclvi + \@tempdimb \columnwidth + \divide \@tempdimb \@cclvi + \divide \@tempdima \@tempdimb + \xdef\footfudgefactor{\strip@pt\@tempdima}% + \endgroup + } + \AtBeginDocument{% + \begingroup + \foottextfont + \@tempdima\footnotesep + \advance\@tempdima -\ht\strutbox + \ifdim\@tempdima<\z@ \@tempdima\z@ \fi + \advance\@tempdima.5\normalbaselineskip + \bidi@xparaskip + \xdef\bidi@paraskip{\the\@tempdima\relax}% + \endgroup + } \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth } \newcommand{\normalRTLparaLTRfootnotes}{% @@ -14316,34 +14292,29 @@ bidi implementation of tufte title] \bidi@make@mppara@LTRfootgroup{v@l}% \let\mp@footgroupv@r\@mppara@footgroupv@r \let\mp@LTRfootgroupv@l\@mppara@LTRfootgroupv@l - \begingroup - \def\baselinestretch{\m@m@footnote@spacing}% - \foottextfont - \@tempdima\footnotesep - \advance\@tempdima -\ht\strutbox - \ifdim\@tempdima<\z@ \@tempdima\z@ \fi - \advance\@tempdima.5\normalbaselineskip - \bidi@xparaskip - \xdef\bidi@paraskip{\the\@tempdima\relax}% - \ifdim\skip\footinsv@r>\bigskipamount - \else - \global\advance\skip\footinsv@r\bidi@paraskip - \fi - \ifdim\skip\footinsv@l>\bigskipamount - \else - \global\advance\skip\footinsv@l\bidi@paraskip - \fi - \@tempdima\normalbaselineskip - \multiply \@tempdima \@cclvi - \@tempdimb \columnwidth - \divide \@tempdimb \@cclvi - \divide \@tempdima \@tempdimb - \xdef\footfudgefactor{\strip@pt\@tempdima}% - \endgroup + \g@addto@macro\bidi@floathook{% + \begingroup + \LTRfoottextfont \@tempdima\normalbaselineskip + \multiply \@tempdima \@cclvi + \@tempdimb \columnwidth + \divide \@tempdimb \@cclvi + \divide \@tempdima \@tempdimb + \xdef\footfudgefactor{\strip@pt\@tempdima}% + \endgroup + } + \AtBeginDocument{% + \begingroup + \LTRfoottextfont + \@tempdima\footnotesep + \advance\@tempdima -\ht\strutbox + \ifdim\@tempdima<\z@ \@tempdima\z@ \fi + \advance\@tempdima.5\normalbaselineskip + \bidi@xparaskip + \xdef\bidi@paraskip{\the\@tempdima\relax}% + \endgroup + } \@ifstar\bidi@star@footmarkwidth\bidi@normal@footmarkwidth } -\let\bidi@xparaskip\relax -\@onlypreamble\AddExtraParaSkip \bidi@ensure@newcommand{\@parafootnotetext}[1]{\insert \if@RTL@footnote \footinsv@r @@ -14457,7 +14428,8 @@ bidi implementation of tufte title] \@RTLtrue \m@mmakehboxofhboxes \setbox0=\hbox{\unhbox0 \m@mremovehboxes}% - \@parboxrestore% + \hsize\bidi@columnwidth + \@parboxrestore \def\baselinestretch{\m@m@footnote@spacing}% \@nameuse{foottextfont#1}% \noindent\unhbox0\par}} @@ -14467,7 +14439,8 @@ bidi implementation of tufte title] \@RTLfalse \m@mmakehboxofhboxes \setbox0=\hbox{\unhbox0 \m@mremovehboxes}% - \@parboxrestore% + \hsize\bidi@columnwidth + \@parboxrestore \def\baselinestretch{\m@m@footnote@spacing}% \@nameuse{foottextfont#1}% \noindent\unhbox0\par}} @@ -14582,6 +14555,9 @@ bidi implementation of tufte title] \newcommand\FeetBelowRagged{\let\bidi@mopfn@bottom\relax} \FeetAboveFloat \FeetBelowRagged +\AtBeginDocument{% + \bidi@floathook +} % \end{macrocode} % \iffalse %</extrafootnotefeatures-xetex-bidi.def> diff --git a/macros/xetex/latex/bidi/bidi.pdf b/macros/xetex/latex/bidi/bidi.pdf Binary files differindex 4ae38bc289..5e02b38f3e 100644 --- a/macros/xetex/latex/bidi/bidi.pdf +++ b/macros/xetex/latex/bidi/bidi.pdf |