diff options
Diffstat (limited to 'macros')
75 files changed, 2179 insertions, 634 deletions
diff --git a/macros/latex/contrib/codehigh/README b/macros/latex/contrib/codehigh/README.txt index 302880b5bd..302880b5bd 100644 --- a/macros/latex/contrib/codehigh/README +++ b/macros/latex/contrib/codehigh/README.txt diff --git a/macros/latex/contrib/codehigh/codehigh.pdf b/macros/latex/contrib/codehigh/codehigh.pdf Binary files differindex d1569be86d..354cc68425 100644 --- a/macros/latex/contrib/codehigh/codehigh.pdf +++ b/macros/latex/contrib/codehigh/codehigh.pdf diff --git a/macros/latex/contrib/codehigh/codehigh.sty b/macros/latex/contrib/codehigh/codehigh.sty index 8399f8d9f6..a075bd1b33 100644 --- a/macros/latex/contrib/codehigh/codehigh.sty +++ b/macros/latex/contrib/codehigh/codehigh.sty @@ -6,13 +6,13 @@ %%% License : The LaTeX Project Public License 1.3c %%% ---------------------------------------------------------------------------- -%~%% ------------------------------------------------------- -%~% \section{Variables and Functions} -%~%% ------------------------------------------------------- +%%% ------------------------------------------------------- +%%> \section{Variables and Functions} +%%% ------------------------------------------------------- \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\ProvidesExplPackage{codehigh}{2021-05-12}{2021C} +\ProvidesExplPackage{codehigh}{2022-02-07}{2022D} {Highlight codes and demos with l3regex and lpeg} %\RequirePackage{xparse} @@ -25,8 +25,6 @@ \RequirePackage{luatexbase} \fi -\ExplSyntaxOn - \int_new:N \l__codehigh_a_int \int_new:N \l__codehigh_b_int \tl_new:N \l__codehigh_a_tl @@ -40,7 +38,8 @@ \cs_generate_variant:Nn \str_remove_once:Nn {NV} \cs_generate_variant:Nn \tl_set_rescan:Nnn {NnV} -\prg_generate_conditional_variant:Nnn \regex_extract_once:NnN {cVN} {T, TF} +\prg_generate_conditional_variant:Nnn \str_if_eq:nn {en} {T, TF} +\prg_generate_conditional_variant:Nnn \regex_extract_once:NnN {NVN, cVN} {T, TF} \prg_generate_conditional_variant:Nnn \regex_split:NnN {cVN} {T, TF} \group_begin: @@ -49,9 +48,9 @@ \tl_gset:Nn \g__codehigh_eol_eol_tl {^^M^^M} \group_end: -%~%% ------------------------------------------------------- -%~% \section{Set CodeHign Options} -%~%% ------------------------------------------------------- +%%% ------------------------------------------------------- +%%> \section{Set CodeHigh Options} +%%% ------------------------------------------------------- \bool_new:N \l__codehigh_lite_bool \bool_new:N \l__codehigh_long_bool @@ -69,9 +68,9 @@ demo .bool_set:N = \l__codehigh_demo_bool, } -%~%% ------------------------------------------------------- -%~% \section{CodeHign Environments and Commands} -%~%% ------------------------------------------------------- +%%% ------------------------------------------------------- +%%> \section{CodeHigh Environments and Commands} +%%% ------------------------------------------------------- \NewDocumentCommand \NewCodeHighEnv {mm} { @@ -136,17 +135,50 @@ \seq_map_inline:Nn \l__codehigh_input_seq { \tl_gset:Nn \g__codehigh_code_tl {##1} - \__codehigh_typeset_code: - \par - \medskip + \__codehigh_typeset_comment:N \g__codehigh_code_tl + \tl_if_blank:VF \g__codehigh_code_tl + { + \__codehigh_typeset_code: + \par + \medskip + } + } + } + +\regex_const:Nn \l__codehigh_comment_regex { ^ \% \% ( [\%>] ) ( [^\r]+ ) [\r] } +\tl_new:N \l__codehigh_comment_tl % comment lines that need to be typeset +\bool_new:N \l__codehigh_comment_bool + +%% remove lines starting with %%%, and typeset lines starting with %%> +\cs_new_protected:Npn \__codehigh_typeset_comment:N #1 + { + \tl_set_eq:NN \l_tmpa_tl #1 + \tl_put_right:NV \l_tmpa_tl \g__codehigh_eol_tl + \tl_clear:N \l__codehigh_comment_tl + \bool_set_false:N \l__codehigh_comment_bool + \bool_do_until:Nn \l__codehigh_comment_bool + { + %% Unfortunately we need both \regex_extract_once and \regex_replace_once + \regex_extract_once:NVNTF \l__codehigh_comment_regex \l_tmpa_tl \l_tmpa_seq + { + \regex_replace_once:NnN \l__codehigh_comment_regex {} \l_tmpa_tl + \str_if_eq:enT { \seq_item:Nn \l_tmpa_seq {2} } {>} + { + \tl_put_right:Nx \l__codehigh_comment_tl + { \seq_item:Nn \l_tmpa_seq {3} } + } + } + { \bool_set_true:N \l__codehigh_comment_bool } } + \exp_args:NV \scantokens \l__codehigh_comment_tl + \tl_gset_eq:NN #1 \l_tmpa_tl } \NewCodeHighInput \dochighinput {long} -%~%% ------------------------------------------------------- -%~% \section{Typeset CodeHign Code} -%~%% ------------------------------------------------------- +%%% ------------------------------------------------------- +%%> \section{Typeset CodeHigh Code} +%%% ------------------------------------------------------- \dim_new:N \l__codehigh_main_boxsep_dim @@ -231,9 +263,9 @@ \group_end: } -%~%% ------------------------------------------------------- -%~% \section{Typeset CodeHign Demo} -%~%% ------------------------------------------------------- +%%% ------------------------------------------------------- +%%> \section{Typeset CodeHigh Demo} +%%% ------------------------------------------------------- \box_new:N \g__codehigh_demo_box @@ -302,9 +334,9 @@ } } -%~%% ------------------------------------------------------- -%~% \section{Add CodeHign Languages} -%~%% ------------------------------------------------------- +%%% ------------------------------------------------------- +%%> \section{Add CodeHigh Languages} +%%% ------------------------------------------------------- \keys_define:nn {codehigh} { @@ -372,9 +404,9 @@ \AddCodeHighRule[latex/latex3]{3}{Bracket} {[\[\]]} \AddCodeHighRule[latex/latex3]{9}{Comment} {\%.*?\r} -%~%% ------------------------------------------------------- -%~% \section{Add CodeHigh Themes} -%~%% ------------------------------------------------------- +%%% ------------------------------------------------------- +%%> \section{Add CodeHigh Themes} +%%% ------------------------------------------------------- \keys_define:nn {codehigh} { @@ -411,9 +443,9 @@ \SetCodeHighStyle[default]{8}{purple3} \SetCodeHighStyle[default]{9}{gray3} -%~%% ------------------------------------------------------- -%~% \section{Parse and Highlight Code} -%~%% ------------------------------------------------------- +%%% ------------------------------------------------------- +%%> \section{Parse and Highlight Code} +%%% ------------------------------------------------------- \int_new:N \l__codehigh_item_count_int \tl_new:N \l__codehigh_code_to_parse_tl @@ -517,9 +549,9 @@ } \cs_generate_variant:Nn \__codehigh_typeset_text:nN { VN, vc } -%~%% ------------------------------------------------------- -%~% \section{Don't Highlight Code} -%~%% ------------------------------------------------------- +%%% ------------------------------------------------------- +%%> \section{Don't Highlight Code} +%%% ------------------------------------------------------- \cs_new_protected:Npn \__codehigh_parse_code_lite:N #1 { @@ -528,5 +560,3 @@ \tl_use:N #1 } -\ExplSyntaxOff - diff --git a/macros/latex/contrib/codehigh/codehigh.tex b/macros/latex/contrib/codehigh/codehigh.tex index 950ad653c8..35f648dfe1 100644 --- a/macros/latex/contrib/codehigh/codehigh.tex +++ b/macros/latex/contrib/codehigh/codehigh.tex @@ -2,6 +2,13 @@ \documentclass[oneside]{book} \usepackage[a4paper,margin=2cm]{geometry} +\newcommand*{\myversion}{2022D} +\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)} +\newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi} + +\setlength{\parindent}{0pt} +\setlength{\parskip}{4pt plus 1pt minus 1pt} + \usepackage{codehigh} \usepackage{hyperref} \hypersetup{ @@ -10,10 +17,6 @@ linkcolor=green3, } -\newcommand*{\myversion}{2021C} -\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)} -\newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi} - \begin{document} \title{\textsf{\color{green3}Codehigh: Highlight Codes and Demos with l3RegEx and LPeg}} @@ -23,7 +26,7 @@ \tableofcontents -\chapter{Package Interface} +\chapter{Package Interfaces} \section{Introduction} @@ -35,9 +38,9 @@ Therefore in LuaTeX the package provides another way to highlight code: using \v \footnote{\url{http://www.inf.puc-rio.br/~roberto/lpeg/}}. \verb!LPeg! is much more powerful and faster than \verb!l3regex!. -At present, this package is in \underline{\color{red3}\textbf{experimental}} status. -Don’t use it in important documents, unless you have time -to update them for the newer versions of \verb!codehigh! package in the future. +%At present, this package is in \underline{\color{red3}\textbf{experimental}} status. +%Don’t use it in important documents, unless you have time +%to update them for the newer versions of \verb!codehigh! package in the future. \section{Highlighting Code} @@ -76,7 +79,7 @@ The following example is typeset by \verb!codehigh! environment with option \ver } \end{codehigh} This language is for highlighting LaTeX2 classes and packages. -Note that private commands and public commands are highlighted with different colors. +It highlights private commands and public commands with different colors. The following example is typeset by \verb!codehigh! environment with option \verb!language=latex/latex3!. \begin{codehigh}[language=latex/latex3] @@ -91,7 +94,7 @@ The following example is typeset by \verb!codehigh! environment with option \ver } \end{codehigh} This language is for highlighting LaTeX3 classes and packages. -Note that private commands/variables and public commands/variables are highlighted with different colors. +It highlights private commands/variables and public commands/variables with different colors. The following example is typeset by \verb!codehigh! environment with option \verb!language=latex/math!. \begin{codehigh}[language=latex/math] @@ -147,6 +150,9 @@ The last chapter of this manual is typeset with the following code line: \dochighinput[language=latex/latex3]{codehigh.sty} \end{codehigh} +In reading an input file, lines starting wtih \verb!%%%! will be omitted, +and lines starting with \verb!%%>! will be extracted and typeset as normal text. + \section{Customization} The following example changes default background colors with \verb!\CodeHigh! command: @@ -171,7 +177,7 @@ Note that \verb!codehigh! package will load \verb!ninecolors!% To modify or add languages and themes, please read the source files \verb!codehigh.sty! and \verb!codehigh.lua! for reference. -\chapter{Source Code} +\chapter{The Source Code} \dochighinput[language=latex/latex3]{codehigh.sty} diff --git a/macros/latex/contrib/l3backend/CHANGELOG.md b/macros/latex/contrib/l3backend/CHANGELOG.md index 6611281878..68a0f8e377 100644 --- a/macros/latex/contrib/l3backend/CHANGELOG.md +++ b/macros/latex/contrib/l3backend/CHANGELOG.md @@ -6,6 +6,11 @@ this project uses date-based 'snapshot' version identifiers. ## [Unreleased] +## [2022-02-07] + +### Fixed +- Use of color stack int in scope end for `(x)dvipdfmx` + ## [2022-01-12] ### Changed @@ -212,7 +217,8 @@ this project uses date-based 'snapshot' version identifiers. - Include `l3backend` in file names - Moved backend code to internal for each 'parent' module -[Unreleased]: https://github.com/latex3/latex3/compare/2022-01-12...HEAD +[Unreleased]: https://github.com/latex3/latex3/compare/2022-02-07...HEAD +[2022-02-07]: https://github.com/latex3/latex3/compare/2022-01-12...2022-02-07 [2022-01-12]: https://github.com/latex3/latex3/compare/2021-12-14...2022-01-12 [2021-12-14]: https://github.com/latex3/latex3/compare/2021-10-17...2021-12-14 [2021-10-17]: https://github.com/latex3/latex3/compare/2021-10-12...2021-10-17 diff --git a/macros/latex/contrib/l3backend/README.md b/macros/latex/contrib/l3backend/README.md index 686bcf7c21..31dccaaa60 100644 --- a/macros/latex/contrib/l3backend/README.md +++ b/macros/latex/contrib/l3backend/README.md @@ -1,7 +1,7 @@ LaTeX3 Backend Drivers ====================== -Release 2022-01-12 +Release 2022-02-07 This package forms parts of `expl3`, and contains the code used to interface with backends (drivers) across the `expl3` codebase. The functions here are diff --git a/macros/latex/contrib/l3backend/l3backend-basics.dtx b/macros/latex/contrib/l3backend/l3backend-basics.dtx index cc3ca4c925..d7c3c6e4c3 100644 --- a/macros/latex/contrib/l3backend/l3backend-basics.dtx +++ b/macros/latex/contrib/l3backend/l3backend-basics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-02-07} % % \maketitle % @@ -70,27 +70,27 @@ % \begin{macrocode} \ProvidesExplFile %<*dvipdfmx> - {l3backend-dvipdfmx.def}{2022-01-12}{} + {l3backend-dvipdfmx.def}{2022-02-07}{} {L3 backend support: dvipdfmx} %</dvipdfmx> %<*dvips> - {l3backend-dvips.def}{2022-01-12}{} + {l3backend-dvips.def}{2022-02-07}{} {L3 backend support: dvips} %</dvips> %<*dvisvgm> - {l3backend-dvisvgm.def}{2022-01-12}{} + {l3backend-dvisvgm.def}{2022-02-07}{} {L3 backend support: dvisvgm} %</dvisvgm> %<*luatex> - {l3backend-luatex.def}{2022-01-12}{} + {l3backend-luatex.def}{2022-02-07}{} {L3 backend support: PDF output (LuaTeX)} %</luatex> %<*pdftex> - {l3backend-pdftex.def}{2022-01-12}{} + {l3backend-pdftex.def}{2022-02-07}{} {L3 backend support: PDF output (pdfTeX)} %</pdftex> %<*xetex> - {l3backend-xetex.def}{2022-01-12}{} + {l3backend-xetex.def}{2022-02-07}{} {L3 backend support: XeTeX} %</xetex> % \end{macrocode} diff --git a/macros/latex/contrib/l3backend/l3backend-box.dtx b/macros/latex/contrib/l3backend/l3backend-box.dtx index 5dcafc8c88..1d3450c78c 100644 --- a/macros/latex/contrib/l3backend/l3backend-box.dtx +++ b/macros/latex/contrib/l3backend/l3backend-box.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-02-07} % % \maketitle % diff --git a/macros/latex/contrib/l3backend/l3backend-code.pdf b/macros/latex/contrib/l3backend/l3backend-code.pdf Binary files differindex 9860b3d626..a3f052df2c 100644 --- a/macros/latex/contrib/l3backend/l3backend-code.pdf +++ b/macros/latex/contrib/l3backend/l3backend-code.pdf diff --git a/macros/latex/contrib/l3backend/l3backend-color.dtx b/macros/latex/contrib/l3backend/l3backend-color.dtx index 6bf3a80976..064c55fa60 100644 --- a/macros/latex/contrib/l3backend/l3backend-color.dtx +++ b/macros/latex/contrib/l3backend/l3backend-color.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-02-07} % % \maketitle % @@ -246,8 +246,11 @@ \cs_gset_protected:Npn \__kernel_backend_scope_end: { \__kernel_backend_literal:n { x:grestore } - \__kernel_backend_literal:n - { pdfcolorstack ~ \g_@@_backend_stack_int current } + \__kernel_backend_literal:x + { + pdfcolorstack ~ + \int_use:N \g_@@_backend_stack_int \c_space_tl current + } } } % \end{macrocode} diff --git a/macros/latex/contrib/l3backend/l3backend-draw.dtx b/macros/latex/contrib/l3backend/l3backend-draw.dtx index 41466652e1..43da62e394 100644 --- a/macros/latex/contrib/l3backend/l3backend-draw.dtx +++ b/macros/latex/contrib/l3backend/l3backend-draw.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-02-07} % % \maketitle % diff --git a/macros/latex/contrib/l3backend/l3backend-graphics.dtx b/macros/latex/contrib/l3backend/l3backend-graphics.dtx index 63d01c70f3..37122b9a74 100644 --- a/macros/latex/contrib/l3backend/l3backend-graphics.dtx +++ b/macros/latex/contrib/l3backend/l3backend-graphics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-02-07} % % \maketitle % diff --git a/macros/latex/contrib/l3backend/l3backend-header.dtx b/macros/latex/contrib/l3backend/l3backend-header.dtx index 2e48498792..fe05e97760 100644 --- a/macros/latex/contrib/l3backend/l3backend-header.dtx +++ b/macros/latex/contrib/l3backend/l3backend-header.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-02-07} % % \maketitle % diff --git a/macros/latex/contrib/l3backend/l3backend-opacity.dtx b/macros/latex/contrib/l3backend/l3backend-opacity.dtx index d401e24735..a38736bc5a 100644 --- a/macros/latex/contrib/l3backend/l3backend-opacity.dtx +++ b/macros/latex/contrib/l3backend/l3backend-opacity.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-02-07} % % \maketitle % diff --git a/macros/latex/contrib/l3backend/l3backend-pdf.dtx b/macros/latex/contrib/l3backend/l3backend-pdf.dtx index f9d12695e4..7b642b1a46 100644 --- a/macros/latex/contrib/l3backend/l3backend-pdf.dtx +++ b/macros/latex/contrib/l3backend/l3backend-pdf.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-02-07} % % \maketitle % diff --git a/macros/latex/contrib/mathtools/empheq.pdf b/macros/latex/contrib/mathtools/empheq.pdf Binary files differindex 234fbb975c..47acd17426 100644 --- a/macros/latex/contrib/mathtools/empheq.pdf +++ b/macros/latex/contrib/mathtools/empheq.pdf diff --git a/macros/latex/contrib/mathtools/mathtools.dtx b/macros/latex/contrib/mathtools/mathtools.dtx index 15cf76b323..eb20187e89 100644 --- a/macros/latex/contrib/mathtools/mathtools.dtx +++ b/macros/latex/contrib/mathtools/mathtools.dtx @@ -133,7 +133,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{mathtools.drv}% - [2022/02/02 v1.28 mathematical typesetting tools] + [2022/02/07 v1.28a mathematical typesetting tools] \documentclass{ltxdoc} \IfFileExists{fourier.sty}{\usepackage{fourier}}{} @@ -3046,7 +3046,7 @@ colorlinks, % \begin{macrocode} %<*package> \ProvidesPackage{mathtools}% - [2021/02/02 v1.28 mathematical typesetting tools] + [2022/02/07 v1.28a mathematical typesetting tools] % \end{macrocode} % \changes{v1.10}{2011/02/12}{Might as well make sure that we need the % latest version of \texttt{mhsetup}} diff --git a/macros/latex/contrib/mathtools/mathtools.pdf b/macros/latex/contrib/mathtools/mathtools.pdf Binary files differindex 9a1ab1198a..67a7e32db0 100644 --- a/macros/latex/contrib/mathtools/mathtools.pdf +++ b/macros/latex/contrib/mathtools/mathtools.pdf diff --git a/macros/latex/contrib/mathtools/mhsetup.pdf b/macros/latex/contrib/mathtools/mhsetup.pdf Binary files differindex 796893b4b3..14008f4ebd 100644 --- a/macros/latex/contrib/mathtools/mhsetup.pdf +++ b/macros/latex/contrib/mathtools/mhsetup.pdf diff --git a/macros/latex/contrib/proof-at-the-end/README.md b/macros/latex/contrib/proof-at-the-end/README.md index 5e7a2f9b95..9f27306c59 100644 --- a/macros/latex/contrib/proof-at-the-end/README.md +++ b/macros/latex/contrib/proof-at-the-end/README.md @@ -7,17 +7,16 @@ WARNING: this package is definitely usable, but may not be as tested and stable This package aims to provide a way to easily move proofs in the appendix. You can: - Move proofs in different places/sections by giving different "categories" to the theorems -- Create links from theorem to proof, and from proof to theorem +- Create links from theorem to proof, and from proof to theorem (and configure the text) - Restate the theorem in appendix (or before) -- Keep the proof in the main body like normal theorems by just adding with just one keyword +- Choose what you want to keep in the main text or in appendix (you can put in appendix either everything, just the proof, the theorem and the proof by keeping (or not) a copy in the body of the article...) - Duplicate the proof in appendix and in the current section, practical to use synctex during the proof writting -- Add comments that would appear only in the appendix (or in both body and appendix) -- Move both the theorem and the proof completely in appendix +- Add text that would appear only in the appendix (or in both body and appendix) - Easily change the defaults, and create your own styles/environments - Include sketch of proof in the main text, and full proof in appendix - Change the text of the link, for example to translate into another language - Have a nice environment-based commands in order to mimic the usual theorem/proof structure. - +- Separate the main article and the body in two documents (some journals may ask for a separate file for the appendix) NB: This project is hosted on github at [https://github.com/leo-colisson/proof-at-the-end](https://github.com/leo-colisson/proof-at-the-end) . Feel free to contribute, report bugs, or read/copy-paste the documentation/examples from there. @@ -223,7 +222,7 @@ An older version of the package explicitely loaded `hyperref` with no option, an ### Configuration and how to use and create styles ### -You can very easily configure this package, and choose how each theorem/proof must be displayed by providing a value in `OPTIONS`. For example, if you would like to keep the proof of a theorem in the main text like any normal theorem, use the `normal` option: +You can very easily configure this package, and choose how each theorem/proof must be displayed by providing a value in `OPTIONS`. For example, if you would like to keep the proof of a theorem in the main text like any normal theorem, use the `normal` option. ```latex \begin{theoremEnd}[normal]{thm}[A title] @@ -234,6 +233,26 @@ You can very easily configure this package, and choose how each theorem/proof mu \end{proofEnd} ``` +If you loaded the package using `\usepackage[createShortEnv]{proof-at-the-end}` (starting from 2022/01/28), you also have preconfigured shortcuts for multiple environments, namely `proofE` (to replace `proof`), `thmE` (to replace `thm`), `theoremE` (to replace... ok you got the pattern), `lemmaE`, `propositionE`, `propertyE`, `factE` and `corollaryE`. This way, you can simplify the above as: +```latex +\begin{thmE}[A title][normal] + You can easily turn a theorem back into a normal theorem! +\end{thmE} +\begin{proofE} + And keep the proof with you! +\end{proofE} +``` + +(You can of course remove the `[...]` containing the options and the title, however if you want to add options without any title, **make sure to use empty brackets for the title**, like `\begin{thmE}[][normal]`. + +Since 2022/01/28, you can also create new theorem environment that directly come with a preconfigured style (you may also find `\pratendSetLocal` useful if you want to change the style in a whole section). For instance to create a `thmNormal` environment having the `normal` option and a `thmSpecial` environment having the `all end, category=mySpecial` options, just do: +``` +\newEndThm[normal]{thmNormal}{thm} % 'thm' is the name of the existing thm environment +\newEndThm[all end, category=mySpecial]{thmSpecial}{thm} +``` + +This way, you can simply use `\begin{thmSpecial}[Special title] ... \end{thmSpecial}` to create a theorem going in the special category (see below). (you also have `\newEndProof[options]{newProofEnv}` to define new proofs, but it is less useful as options are typically given in the theorem). + The options are in fact a set of keys/values, thanks to `pgfkeys`. So you can combine them with comma separated list like that (order matters, as the right-most values may overwrite configuration set by left-most values): ```latex @@ -274,6 +293,11 @@ Note however that for now it is *not* possible to use macros directly inside the } ``` +or, for short (needs version > 2022/02/04): +```latex +\pratendSetGlobal{one big link="blabla"} +``` + and for local configuration: ```latex \pgfkeys{/prAtEnd/local custom defaults/.style={ @@ -282,15 +306,11 @@ and for local configuration: } ``` -Finally, it can be practical to define custom environments to avoid typing always `theoremEnd` using something like that (`thmE` is the shortcut environment to create, and `thm` is the old one): - +for short (needs version > 2022/02/04): ```latex -\newEndThm[normal]{thmE}{thm} -\newEndProof{proofE} +\pratendSetLocal{category=greattheorem} ``` -By default, loading the package using the `createShortEnv` option automatically creates the shortcut environments `proofE` (to replace `proof`), `thmE` (to replace `thm`), `theoremE` (to replace... ok you got the pattern), `lemmaE` and `corollaryE`. - Then you can use like that: ```latex @@ -316,7 +336,7 @@ Then you can use like that: \end{proofE} ``` -Note also that it is also possible to give options to the `proofEnd` environment, but it is usually useless, as it will automatically pick the parameters from the last `theoremEnd` environment. However, if for some reasons you want to change the options of the proof only, you can do it, but do it as your own risks ;) +Note also that it is possible to give options to the `proofEnd` environment, but it is usually useless, as it will automatically pick the parameters from the last `theoremEnd` environment. However, if for some reasons you want to change the options of the proof only, you can do it, but do it as your own risks ;) ### Usual styles ### @@ -326,10 +346,10 @@ We predefined some pretty common styles/options. The full list is at the end of - `category=yourowncategory`: change the category of the theorem (see next sub-section) - `end`: put the proof in appendix - `all end`: put both the theorem and the proof in appendix -- `debug`: make sure the proof is written in the main text as well. Practical when you write the proof to be able to use synctex (if you use synctex with the proof in appendix, your will be unfortunately moved to a temporary file that this library is using... so **make sure you don't modify the files named like `prattheenddefaultcategory.tex` or all your changes will be lost at the next compilation**!). +- `debug`: make sure the proof is written in the main text as well. Practical when you write the proof to be able to use synctex (if you use synctex with the proof in appendix, your will be unfortunately moved to a temporary file that this library is using... so **make sure you don't modify the files named like `*prattheenddefaultcategory.tex` or all your changes will be lost at the next compilation**!). - `one big link`: if you prefer to have a single big link instead of two links (one for the proof, one for the page) - `one big link translated=Your translation`: to change/translate the text of the link easily -- `text link section`: put a link looking like "See proof in section XX." +- `text link section`: put a link looking like "See proof in section XX.". You can use `text link=` to remove this link. - `text link section full proof`: put a link looking like "See full proof in section XX." - `text proof translated=Your translation`: to change/translate the text of the proof at the end easily - `global custom defaults`: empty style that you can modify to change the configuration (globally) @@ -438,6 +458,27 @@ You can include a sketch of proof in the main text by simply adding a proof in b \end{proofEnd} ``` +### Split the article in two documents, one for the main body and one for the appendix ### + +Since 2022/02/04, it is possible to include the appendix in a separate file. Internally, this library creates a new file having the form `NAME_OF_FILE-pratendNAME_CATEGORY.tex` containing the proofs to include (then, `\printProofs` only input that file). You can input that file from other files if you want to separate the body from the proof, but it won't work if you have restate theorems. You should use the option `external appendix` (starting from version 2022/02/04) to restate appropriately the theorem: + +```latex +\usepackage[createShortEnv,conf={external appendix}]{proof-at-the-end} +``` + +Then, compile your main file and create a new file for the appendix, load the theorems environments as for the main file, in the preambule load the `xr` package to properly have references (otherwise you won't have the appropriate number for the theorems) using something like: +``` +\usepackage{xr} +\externaldocument{name_of_main_file_without_extension} +``` + +and in this new document just add the appendix wherever you want: +```latex +\includeExternalAppendix{name_of_main_file_without_extension} +``` + +You can see an exemple in the github repository, with the two files `demo_external_appendix.tex` and `demo_external_appendix_part2.tex`. Whenever your proofs change in the main paper, make sure to compile first the main document (so that the auxiliary file gets updated), and then compile the appendix document. Note that you can still use `\printProofs` in the main document if you like (while writting your paper, it is certainly easier to keep the proofs and theorems in the same document). + ## List of options ## Here is the list of fundamental options supported. Most options have a `no` version, with `no ` written before. Note that you may prefer to use directly the alias/styles (see next paragraph) as the options listed here are quite fundamental and atomic. @@ -455,6 +496,7 @@ Here is the list of fundamental options supported. Most options have a `no` vers - `restate command`: name of a unique macro (without backslash) that will be defined as an alias to restate the theorem wherever you want - `restated before`: if the theorems has been stated before (with `\theoremProofEndRestateBefore`), then we just need to put the restate command in place of the theorem, and enable this option - `both`/`no both`: only for `\textInAppendix`, specifies that the text must be present in both the main text and the appendix. +- `external appendix`: to ensure the appendix can be included in another file (see details above), starting from version 2022/02/04. Here are all the alias/styles (you can create you own as well), they are practical to quickly define a behaviours, but are made of the basic options listed above: @@ -473,6 +515,9 @@ Here are all the alias/styles (you can create you own as well), they are practic - `default text link`: default text for the link to the proof, equivalent of `text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}.}` - `default text proof`: default text for the proof in appendix, equivalent of `text proof={Proof of \string\pratendRef{thm:prAtEnd\pratendcountercurrent}}` - `text proof translated`: like `default text proof`, but takes one argument and use it instead of `Proof of`. Example: `text proof translated={Preuve du}` +- `text link external appendix`: style used to configure the text to display when the appendix is in an external file. Defaults to `text link={The proof is in the appendix.}`. +- `external appendix`: useful when the the proofs are moved in an external file (read more above). In particular, it will ensure that normal theorems are used instead of restate since restate does not work across files. This will also apply `text link external appendix` to change the text accordingly. +- `only external appendix`: like `external appendix`, but without changing the text. - `bare defaults`: default style that is loaded before anything else that configure by default a link to the proof, put the proof in appendix, use the category `defaultcategory`. It is an alias of `end, link to proof, no restate,category=defaultcategory, default text link,default text proof,restate command=pratenddummymacro`. - `configuration options`: style that contains the options used to load the package. It is called right after `bare defaults`. Note that you cannot insert macro in the options, overwrite `global custom defaults` instead - `global custom defaults`: empty style that you can overwrite to change the global defaults @@ -528,6 +573,13 @@ In anycase, there exists some workarounds, some of the are for instance give in ## Changelog +- 2022/02/07: + 1. [issue 2](https://github.com/leo-colisson/proof-at-the-end/issues/2) was not really solved in fact... Now, I use a more robust method to detect the current section: I write in an AUX file the label of the proof section. This way, I don't need anymore to use dirty tricks to recover the section label. + 2. Change the default text when the appendix is in an external file, and add options like `text link external appendix` to customize the text appearing when the appendix is in an external file. Of course, you can still change it using `text link` directly. +- 2022/02/04: + 1. Add a way to put theorems in different files. (see `external appendix`) + 2. Change the path for auxiliary files (should be transparent for the user) + 3. Add commands to change local/global configuration easily (see `\pratendSetLocal`,`\pratendSetGlobal`) - 2022/02/01: 1. Fix a typo when defining the shortcut for lemma 2. Add a shortcut for proposition diff --git a/macros/latex/contrib/proof-at-the-end/proof-at-the-end.dtx b/macros/latex/contrib/proof-at-the-end/proof-at-the-end.dtx index d5f6ac4646..8fee5c8ecd 100644 --- a/macros/latex/contrib/proof-at-the-end/proof-at-the-end.dtx +++ b/macros/latex/contrib/proof-at-the-end/proof-at-the-end.dtx @@ -1,12 +1,12 @@ %\iffalse % proof-at-the-end.dtx generated using makedtx version 1.2 (c) Nicola Talbot % Command line args: -% -author "Léo Colisson" +% -doc "../doc/proof-at-the-end_doc.tex" % -src "proof-at-the-end\.sty=>proof-at-the-end.sty" +% -author "Léo Colisson" % -dir "/home/leo/Documents/Informatique/Programmation/LaTeX/proof-at-the-end/" -% -doc "../doc/proof-at-the-end_doc.tex" % proof-at-the-end -% Created on 2022/2/1 17:07 +% Created on 2022/2/7 18:01 %\fi %\iffalse %<*package> @@ -169,20 +169,20 @@ % Move proofs in different places/sections by giving different % ``categories'' to the theorems %\item -% Create links from theorem to proof, and from proof to theorem +% Create links from theorem to proof, and from proof to theorem (and +% configure the text) %\item % Restate the theorem in appendix (or before) %\item -% Keep the proof in the main body like normal theorems by just adding -% with just one keyword +% Choose what you want to keep in the main text or in appendix (you can +% put in appendix either everything, just the proof, the theorem and the +% proof by keeping (or not) a copy in the body of the article\ldots) %\item % Duplicate the proof in appendix and in the current section, practical % to use synctex during the proof writting %\item -% Add comments that would appear only in the appendix (or in both body -% and appendix) -%\item -% Move both the theorem and the proof completely in appendix +% Add text that would appear only in the appendix (or in both body and +% appendix) %\item % Easily change the defaults, and create your own styles/environments %\item @@ -193,6 +193,9 @@ %\item % Have a nice environment-based commands in order to mimic the usual % theorem/proof structure. +%\item +% Separate the main article and the body in two documents (some journals +% may ask for a separate file for the appendix) %\end{itemize} % %NB: This project is hosted on github at @@ -529,7 +532,7 @@ %theorem/proof must be displayed by providing a value in %\texttt{OPTIONS}. For example, if you would like to keep the proof of a %theorem in the main text like any normal theorem, use the -%\texttt{normal} option: +%\texttt{normal} option. % %\begin{Shaded} %\begin{Highlighting}[] @@ -542,6 +545,52 @@ %\end{Highlighting} %\end{Shaded} % +%If you loaded the package using +%\texttt{\textbackslash{}usepackage{[}createShortEnv{]}\{proof-at-the-end\}} +%(starting from 2022/01/28), you also have preconfigured shortcuts for +%multiple environments, namely \texttt{proofE} (to replace +%\texttt{proof}), \texttt{thmE} (to replace \texttt{thm}), +%\texttt{theoremE} (to replace\ldots{} ok you got the pattern), +%\texttt{lemmaE}, \texttt{propositionE}, \texttt{propertyE}, +%\texttt{factE} and \texttt{corollaryE}. This way, you can simplify the +%above as: +% +%\begin{Shaded} +%\begin{Highlighting}[] +%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[A title][normal]} +%\NormalTok{ You can easily turn a theorem back into a normal theorem!} +%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} +%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} +%\NormalTok{ And keep the proof with you!} +%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} +%\end{Highlighting} +%\end{Shaded} +% +%(You can of course remove the \texttt{{[}...{]}} containing the options +%and the title, however if you want to add options without any title, +%\textbf{make sure to use empty brackets for the title}, like +%\texttt{\textbackslash{}begin\{thmE\}{[}{]}{[}normal{]}}. +% +%Since 2022/01/28, you can also create new theorem environment that +%directly come with a preconfigured style (you may also find +%\texttt{\textbackslash{}pratendSetLocal} useful if you want to change +%the style in a whole section). For instance to create a +%\texttt{thmNormal} environment having the \texttt{normal} option and a +%\texttt{thmSpecial} environment having the +%\texttt{all\ end,\ category=mySpecial} options, just do: +% +%\begin{verbatim} +%\newEndThm[normal]{thmNormal}{thm} % 'thm' is the name of the existing thm environment +%\newEndThm[all end, category=mySpecial]{thmSpecial}{thm} +%\end{verbatim} +% +%This way, you can simply use +%\texttt{\textbackslash{}begin\{thmSpecial\}{[}Special\ title{]}\ ...\ \textbackslash{}end\{thmSpecial\}} +%to create a theorem going in the special category (see below). (you also +%have \texttt{\textbackslash{}newEndProof{[}options{]}\{newProofEnv\}} to +%define new proofs, but it is less useful as options are typically given +%in the theorem). +% %The options are in fact a set of keys/values, thanks to %\texttt{pgfkeys}. So you can combine them with comma separated list like %that (order matters, as the right-most values may overwrite @@ -600,6 +649,14 @@ %\end{Highlighting} %\end{Shaded} % +%or, for short (needs version \textgreater{} 2022/02/04): +% +%\begin{Shaded} +%\begin{Highlighting}[] +%\FunctionTok{\textbackslash{}pratendSetGlobal}\NormalTok{\{one big link="blabla"\}} +%\end{Highlighting} +%\end{Shaded} +% %and for local configuration: % %\begin{Shaded} @@ -611,24 +668,14 @@ %\end{Highlighting} %\end{Shaded} % -%Finally, it can be practical to define custom environments to avoid -%typing always \texttt{theoremEnd} using something like that -%(\texttt{thmE} is the shortcut environment to create, and \texttt{thm} -%is the old one): +%for short (needs version \textgreater{} 2022/02/04): % %\begin{Shaded} %\begin{Highlighting}[] -%\FunctionTok{\textbackslash{}newEndThm}\NormalTok{[normal]\{thmE\}\{thm\}} -%\FunctionTok{\textbackslash{}newEndProof}\NormalTok{\{proofE\}} +%\FunctionTok{\textbackslash{}pratendSetLocal}\NormalTok{\{category=greattheorem\}} %\end{Highlighting} %\end{Shaded} % -%By default, loading the package using the \texttt{createShortEnv} option -%automatically creates the shortcut environments \texttt{proofE} (to -%replace \texttt{proof}), \texttt{thmE} (to replace \texttt{thm}), -%\texttt{theoremE} (to replace\ldots{} ok you got the pattern), -%\texttt{lemmaE} and \texttt{corollaryE}. -% %Then you can use like that: % %\begin{Shaded} @@ -656,11 +703,11 @@ %\end{Highlighting} %\end{Shaded} % -%Note also that it is also possible to give options to the -%\texttt{proofEnd} environment, but it is usually useless, as it will -%automatically pick the parameters from the last \texttt{theoremEnd} -%environment. However, if for some reasons you want to change the options -%of the proof only, you can do it, but do it as your own risks ;) +%Note also that it is possible to give options to the \texttt{proofEnd} +%environment, but it is usually useless, as it will automatically pick +%the parameters from the last \texttt{theoremEnd} environment. However, +%if for some reasons you want to change the options of the proof only, +%you can do it, but do it as your own risks ;) % %\hypertarget{usual-styles}{% %\subsection{Usual styles}\label{usual-styles}} @@ -686,7 +733,7 @@ % you use synctex with the proof in appendix, your will be unfortunately % moved to a temporary file that this library is using\ldots{} so % \textbf{make sure you don't modify the files named like -% \texttt{prattheenddefaultcategory.tex} or all your changes will be +% \texttt{*prattheenddefaultcategory.tex} or all your changes will be % lost at the next compilation}!). %\item % \texttt{one\ big\ link}: if you prefer to have a single big link @@ -696,7 +743,7 @@ % change/translate the text of the link easily %\item % \texttt{text\ link\ section}: put a link looking like ``See proof in -% section XX.'' +% section XX.''. You can use \texttt{text\ link=} to remove this link. %\item % \texttt{text\ link\ section\ full\ proof}: put a link looking like % ``See full proof in section XX.'' @@ -863,6 +910,55 @@ %\end{Highlighting} %\end{Shaded} % +%\hypertarget{split-the-article-in-two-documents-one-for-the-main-body-and-one-for-the-appendix}{% +%\subsection{Split the article in two documents, one for the main body +%and one for the +%appendix}\label{split-the-article-in-two-documents-one-for-the-main-body-and-one-for-the-appendix}} +% +%Since 2022/02/04, it is possible to include the appendix in a separate +%file. Internally, this library creates a new file having the form +%\texttt{NAME\_OF\_FILE-pratendNAME\_CATEGORY.tex} containing the proofs +%to include (then, \texttt{\textbackslash{}printProofs} only input that +%file). You can input that file from other files if you want to separate +%the body from the proof, but it won't work if you have restate theorems. +%You should use the option \texttt{external\ appendix} (starting from +%version 2022/02/04) to restate appropriately the theorem: +% +%\begin{Shaded} +%\begin{Highlighting}[] +%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[createShortEnv,conf=\{external appendix\}]\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}} +%\end{Highlighting} +%\end{Shaded} +% +%Then, compile your main file and create a new file for the appendix, +%load the theorems environments as for the main file, in the preambule +%load the \texttt{xr} package to properly have references (otherwise you +%won't have the appropriate number for the theorems) using something +%like: +% +%\begin{verbatim} +%\usepackage{xr} +%\externaldocument{name_of_main_file_without_extension} +%\end{verbatim} +% +%and in this new document just add the appendix wherever you want: +% +%\begin{Shaded} +%\begin{Highlighting}[] +%\FunctionTok{\textbackslash{}includeExternalAppendix}\NormalTok{\{name\_of\_main\_file\_without\_extension\}} +%\end{Highlighting} +%\end{Shaded} +% +%You can see an exemple in the github repository, with the two files +%\texttt{demo\_external\_appendix.tex} and +%\texttt{demo\_external\_appendix\_part2.tex}. Whenever your proofs +%change in the main paper, make sure to compile first the main document +%(so that the auxiliary file gets updated), and then compile the appendix +%document. Note that you can still use +%\texttt{\textbackslash{}printProofs} in the main document if you like +%(while writting your paper, it is certainly easier to keep the proofs +%and theorems in the same document). +% %\hypertarget{list-of-options}{% %\section{List of options}\label{list-of-options}} % @@ -911,6 +1007,9 @@ % \texttt{both}/\texttt{no\ both}: only for % \texttt{\textbackslash{}textInAppendix}, specifies that the text must % be present in both the main text and the appendix. +%\item +% \texttt{external\ appendix}: to ensure the appendix can be included in +% another file (see details above), starting from version 2022/02/04. %\end{itemize} % %Here are all the alias/styles (you can create you own as well), they are @@ -986,6 +1085,20 @@ % but takes one argument and use it instead of \texttt{Proof\ of}. % Example: \texttt{text\ proof\ translated=\{Preuve\ du\}} %\item +% \texttt{text\ link\ external\ appendix}: style used to configure the +% text to display when the appendix is in an external file. Defaults to +% \texttt{text\ link=\{The\ proof\ is\ in\ the\ appendix.\}}. +%\item +% \texttt{external\ appendix}: useful when the the proofs are moved in +% an external file (read more above). In particular, it will ensure that +% normal theorems are used instead of restate since restate does not +% work across files. This will also apply +% \texttt{text\ link\ external\ appendix} to change the text +% accordingly. +%\item +% \texttt{only\ external\ appendix}: like \texttt{external\ appendix}, +% but without changing the text. +%\item % \texttt{bare\ defaults}: default style that is loaded before anything % else that configure by default a link to the proof, put the proof in % appendix, use the category \texttt{defaultcategory}. It is an alias of @@ -1126,6 +1239,41 @@ %\begin{itemize} %\tightlist %\item +% 2022/02/07: +% +% \begin{enumerate} +% \def\labelenumi{\arabic{enumi}.} +% \tightlist +% \item +% \href{https://github.com/leo-colisson/proof-at-the-end/issues/2}{issue +% 2} was not really solved in fact\ldots{} Now, I use a more robust +% method to detect the current section: I write in an AUX file the +% label of the proof section. This way, I don't need anymore to use +% dirty tricks to recover the section label. +% \item +% Change the default text when the appendix is in an external file, +% and add options like \texttt{text\ link\ external\ appendix} to +% customize the text appearing when the appendix is in an external +% file. Of course, you can still change it using \texttt{text\ link} +% directly. +% \end{enumerate} +%\item +% 2022/02/04: +% +% \begin{enumerate} +% \def\labelenumi{\arabic{enumi}.} +% \tightlist +% \item +% Add a way to put theorems in different files. (see +% \texttt{external\ appendix}) +% \item +% Change the path for auxiliary files (should be transparent for the +% user) +% \item +% Add commands to change local/global configuration easily (see +% \texttt{\textbackslash{}pratendSetLocal},\texttt{\textbackslash{}pratendSetGlobal}) +% \end{enumerate} +%\item % 2022/02/01: % % \begin{enumerate} @@ -1208,7 +1356,7 @@ % \end{macrocode} %\fi \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{proof-at-the-end}[2022/02/01 A package to move proofs in appendix] +\ProvidesPackage{proof-at-the-end}[2022/02/07 A package to move proofs in appendix] \RequirePackage{etoolbox} \RequirePackage{thmtools} @@ -1281,10 +1429,16 @@ \endgroup } +%% Get the prefix of the file, given the jobname. +\NewDocumentCommand\pratendGeneratePrefixFile{m}{#1-pratend} + +\def\prefixPrAtEndFiles{\pratendGeneratePrefixFile{\jobname}} + + %% This functions takes one input: the category (without .tex), %% If it's the first time we write in this %% category file, it "blanks" it. -\def\prefixPrAtEndFiles{pratend} + \newcommand*\eraseIfNeeded[1]{% % A macro 'pratendmacrocat{category}' is created to check % if it's the first time we write in this category file. @@ -1301,6 +1455,7 @@ \newif\ifproofhere \newif\ifproofend \newif\ifrestatethm +\newif\ifexternalAppendix% True if the output file should me inputable in another file (using xr for crossref). Useful to remote restate. \newif\iflinktoproof \newif\ifboth \newif\ifallattheend @@ -1319,6 +1474,15 @@ proof end/.is if=proofend, no proof end/.style={proof end=false}, %% Restate the theorem when using \printProofs + only external appendix/.is if=externalAppendix, + text link external appendix/.style={ + text link={The proof is in the appendix.} + }, + external appendix/.style={ + only external appendix, + text link external appendix, + }, + %% Restate the theorem when using \printProofs restate/.is if=restatethm, no restate/.style={restate=false}, %% Put a link to the proof after the theorem @@ -1500,9 +1664,13 @@ %% Restate the theorem if needed in appendix. %% As explained in https://github.com/leo-colisson/proof-at-the-end/issues/8 %% No need to restate of there is no proof at the end. - \ifproofend % - \ifrestatethm % - \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\prAtEndRestate\pratendcountercurrent*}% + \ifproofend% + \ifrestatethm% + \ifexternalAppendix% We write the full theorem, useful to compile in a separate file (use xr for references) + \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\begingroup\string\renewcommand\string\the\detokenize{#2}{\string\ref{thm:prAtEnd\pratendcountercurrent}}\string\begin{\detokenize{#2}}[#3]\detokenize{#4}\string\end{\detokenize{#2}}\string\endgroup}% + \else% + \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\prAtEndRestate\pratendcountercurrent*}% + \fi% \fi% \fi% \fi% @@ -1540,13 +1708,41 @@ \fi% %% Write the proof at the end \ifproofend% + \appendtofile{\prefixPrAtEndFiles\category.tex}{% %% The label alone adds some space, see e.g. %% https://tex.stackexchange.com/questions/600118/selectlanguage-in-the-middle-of-text-causes-extra-vertical-space/600142#600142 %% and https://tex.stackexchange.com/questions/600577/adding-a-label-between-two-proofs-adds-unwanted-space %% The solution is to use \\Hy@SaveLastskip and \Hy@RestoreLastskip from hyperref %% See also %% https://tex.stackexchange.com/questions/553394/reliably-add-a-label-to-the-current-section-even-if-the-label-is-not-placed-rig/600847#600847 - \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\makeatletter\string\Hy@SaveLastskip\string\pratendChangeCurrentLabel\string\label{proofsection:prAtEnd\pratendcountercurrent}\string\Hy@RestoreLastskip\string\makeatother\string\begin{proof}[\pratendtextproof]\string\phantomsection\string\label{proof:prAtEnd\pratendcountercurrent}\detokenize{#2}\string\end{proof}}% + \string\makeatletter\string\Hy@SaveLastskip% + %% This tries to recover the label of the current section... But it is very bad. I keep it only for backward compatibility. I tried to fix it by changing the value of \@counter, but it's not always working + %% as cref is not using it apparently, and it turns Appendix A into appendix a after using phantomsection. + %% https://github.com/leo-colisson/proof-at-the-end/issues/2 + \string\label{proofsection:prAtEnd\pratendcountercurrent}% WARNING <-- do not use this label in new documents! + % the problem is that setting the \@currentlabel does not work for cref, and turns Appendix A + % into section A when a phantomsection lies in between (not sure why): + % https://github.com/leo-colisson/proof-at-the-end/issues/2 + %% Now, we prefer a different method: instead we generate a single label per section, and we generate + %% a new macro in the aux file that will save this label, by creating one such macro per theorem. + %% This is basically doing something like \pratend@section@for@proofiii{prAtEnd:sectionlike3} + %% Note that I need sometimes 3 \string because I write two times: the first time I write in the FILE-pratendCATEGORY.tex + %% file, and this file will be in charge of writting into the .aux file. + \string\ifdefined\string\pratend@current@sectionlike@label% But before, we check if the section was defined, or the code may fail if no section are defined. + \string\immediate\string\write\string\@auxout{% + \string\string\string\gdef\string\string\string\pratend@section@for@proof\pratendcountercurrent{\string\pratend@current@sectionlike@label}% + }% + \string\fi + % See above + \string\Hy@RestoreLastskip\string\makeatother% + % We start the proof + \string\begin{proof}[\pratendtextproof]% + % We add a label to have a reference to the section + \string\phantomsection\string\label{proof:prAtEnd\pratendcountercurrent}% + % We add the proof + \detokenize{#2}% + % We end the proof + \string\end{proof}}% \fi% }{} @@ -1594,7 +1790,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % We patch the \section, \subsection and \chapter commands to make sure that % the text "See proof in Section XX" points to the appropriate section/subsection. -% We basically maintain a counter counting how many time we saw a section/subsection/... and use it to label +% We basically maintain a counter counting how many times we saw a section/subsection/... and use it to label % directly the section afterwards. \newcounter{pratend@counter@sectionlike} %% Command to add after a label like "prAtEnd:sectionlike10". Useful to patch \section, \chapter... @@ -1602,17 +1798,21 @@ %% First, we get the label %% Cool explaination of expandafter, edef, noexpand: %%% https://www.tug.org/TUGboat/tb09-1/tb20bechtolsheim.pdf + %% The label \pratend@current@sectionlike@label is used later. \edef\pratend@current@sectionlike@label{prAtEnd:sectionlike\thepratend@counter@sectionlike}% \expandafter\label{\pratend@current@sectionlike@label}% - \let\pratend@sectionlike@stored@label\@currentlabel% + \stepcounter{pratend@counter@sectionlike}% }% -\NewDocumentCommand\pratendSectionlikeCref{}{% - \pratendRef{proofsection:prAtEnd\pratendcountercurrent}% -} -\NewDocumentCommand\pratendChangeCurrentLabel{}{% - \ifdefined\pratend@sectionlike@stored@label% - \let\@currentlabel\pratend@sectionlike@stored@label% +%% Returns the label of the section (in appendix) that contains the proof of the current theorem. +%% The first time, it will return an empty label. +\NewDocumentCommand\pratendLabelProofSection{}{% + \ifcsname pratend@section@for@proof\pratendcountercurrent\endcsname% + \csname pratend@section@for@proof\pratendcountercurrent\endcsname% \fi% +}% +\NewDocumentCommand\pratendSectionlikeCref{}{% + % \pratendRef{proofsection:prAtEnd\pratendcountercurrent}% This is not robust enough. Lets change strategy. + \expandafter\pratendRef{\pratendLabelProofSection} } \ifpratendOptdisablePatchSection% \else % @@ -1641,6 +1841,7 @@ \csname \pratendOptcommandRef\endcsname{#1}% } + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Create automatically wrapper %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1695,8 +1896,37 @@ \newEndThm{theoremE}{theorem} \newEndThm{corollaryE}{corollary} \newEndThm{propositionE}{proposition} + \newEndThm{propertyE}{proposition} + \newEndThm{factE}{proposition} \fi +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Create functions to easily overwrite defaults +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\NewDocumentCommand\pratendSetGlobal{m}{% + \pgfkeys{/prAtEnd/global custom defaults/.style={ + #1 + }% + }% +} + +\NewDocumentCommand\pratendSetLocal{m}{% + \pgfkeys{/prAtEnd/local custom defaults/.style={ + #1 + }% + }% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Create functions to load the category file in another file (external bibliography) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Takes an optional category, and the job name of the external file. +\NewDocumentCommand\includeExternalAppendix{O{defaultcategory}m}{% + \expandafter\input{\pratendGeneratePrefixFile{#2}#1} +} + \endinput %\iffalse % \begin{macrocode} diff --git a/macros/latex/contrib/proof-at-the-end/proof-at-the-end.ins b/macros/latex/contrib/proof-at-the-end/proof-at-the-end.ins index 3ebaf4fd46..d3508956ec 100644 --- a/macros/latex/contrib/proof-at-the-end/proof-at-the-end.ins +++ b/macros/latex/contrib/proof-at-the-end/proof-at-the-end.ins @@ -1,4 +1,4 @@ -% proof-at-the-end.ins generated using makedtx version 1.2 2022/2/1 17:07 +% proof-at-the-end.ins generated using makedtx version 1.2 2022/2/7 18:01 \input docstrip \preamble diff --git a/macros/latex/contrib/proof-at-the-end/proof-at-the-end.pdf b/macros/latex/contrib/proof-at-the-end/proof-at-the-end.pdf Binary files differindex 7672d46631..2ab8e9e067 100644 --- a/macros/latex/contrib/proof-at-the-end/proof-at-the-end.pdf +++ b/macros/latex/contrib/proof-at-the-end/proof-at-the-end.pdf diff --git a/macros/latex/contrib/proof-at-the-end/proof-at-the-end_demo.pdf b/macros/latex/contrib/proof-at-the-end/proof-at-the-end_demo.pdf Binary files differindex ac5ddf1d5c..81acbaf753 100644 --- a/macros/latex/contrib/proof-at-the-end/proof-at-the-end_demo.pdf +++ b/macros/latex/contrib/proof-at-the-end/proof-at-the-end_demo.pdf diff --git a/macros/latex/contrib/proof-at-the-end/proof-at-the-end_demo.tex b/macros/latex/contrib/proof-at-the-end/proof-at-the-end_demo.tex index d4f59616c9..26b087cbea 100644 --- a/macros/latex/contrib/proof-at-the-end/proof-at-the-end_demo.tex +++ b/macros/latex/contrib/proof-at-the-end/proof-at-the-end_demo.tex @@ -5,12 +5,15 @@ \usepackage{verbatim} % Load the package (put the proof-at-the-end.sty file in the working directory) -\usepackage{proof-at-the-end} % with default options... -% Or by putting in the 'conf' option the default configuration you want: -%\usepackage[conf={normal, one big link}]{proof-at-the-end} -%\usepackage[conf={normal, one big link=Goto proof}]{proof-at-the-end} -%\usepackage[conf={one big link translated=Aller à la preuve page}]{proof-at-the-end} -%\usepackage[conf={text link section}]{proof-at-the-end} +% with default options and shortcuts for thmE/... WARNING: this requires a version above 2022/01/28. +\usepackage[createShortEnv]{proof-at-the-end} +% If you use cref, use instead: +% \usepackage[createShortEnv,commandRef=Cref]{proof-at-the-end} +% You can change the default options in the 'conf' option: +%\usepackage[createShortEnv, conf={text link section}]{proof-at-the-end} +%\usepackage[createShortEnv, conf={normal, one big link}]{proof-at-the-end} +%\usepackage[createShortEnv, conf={normal, one big link=Goto proof}]{proof-at-the-end} +%\usepackage[createShortEnv, conf={one big link translated=Aller à la preuve page}]{proof-at-the-end} %%% If you want to use options with macros, you cannot % use directly the package options, so just modify @@ -40,16 +43,18 @@ \newtheorem*{lemma*}{Lemma} \providecommand*\lemmaautorefname{Lemma} -%% If you want you can define shortcuts: +%% If you want you can define shortcuts to create new theorem. +%% Since 2022/01/28, the option createShortEnv automatically defines +%% shortcuts for thmE, theoremE, lemmaE... +%% You can define new shortcuts using something like: +%% \newEndThm[normal]{thmE}{thm} +%% This is itself a shortcut for the rather length old way to define new theorem shorcuts, namely: % And to define new shortcuts, in order to avoid typing: % \NewDocumentEnvironment{thmE}{O{}O{}+b}{% % \begin{theoremEnd}[normal,#2]{thm}[#1]% % #3% % \end{theoremEnd}% % }{} -% you can just type: -\newEndThm[normal]{thmE}{thm} -\newEndProof{proofE} \usepackage{hyperref} \begin{document} @@ -132,6 +137,7 @@ You can also put comments that appear only in the appendix. And also you can put both the theorem and the proof at the end, like for \autoref{thm:mytheoremattheend}! + \begin{theoremEnd}[all end]{thm} \label{thm:mytheoremattheend} $\delta = b^2-4ac$ diff --git a/macros/latex/contrib/siunitx/CHANGELOG.md b/macros/latex/contrib/siunitx/CHANGELOG.md index ba5c3de075..836e95a0af 100644 --- a/macros/latex/contrib/siunitx/CHANGELOG.md +++ b/macros/latex/contrib/siunitx/CHANGELOG.md @@ -7,6 +7,15 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## [Unreleased] +## [v3.0.48] - 2022-02-07 + +### Added +- Polish locale + +### Fixed +- Printing blank entries in text mode (see issue + [\#5853](https://github.com/josephwright/siunitx/issues/585)) + ## [v3.0.47] - 2022-02-03 ### Changed @@ -1703,7 +1712,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ### Added - First public testing release (as `si`) -[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.47...HEAD +[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.48...HEAD +[v3.0.48]: https://github.com/josephwright/siunitx/compare/v3.0.47...v3.0.48 [v3.0.47]: https://github.com/josephwright/siunitx/compare/v3.0.46...v3.0.47 [v3.0.46]: https://github.com/josephwright/siunitx/compare/v3.0.45...v3.0.46 [v3.0.45]: https://github.com/josephwright/siunitx/compare/v3.0.44...v3.0.45 diff --git a/macros/latex/contrib/siunitx/siunitx-code.pdf b/macros/latex/contrib/siunitx/siunitx-code.pdf Binary files differindex d6d131b16c..f427b017c8 100644 --- a/macros/latex/contrib/siunitx/siunitx-code.pdf +++ b/macros/latex/contrib/siunitx/siunitx-code.pdf diff --git a/macros/latex/contrib/siunitx/siunitx-locale.dtx b/macros/latex/contrib/siunitx/siunitx-locale.dtx index 3bdb5c941e..36c83e034f 100644 --- a/macros/latex/contrib/siunitx/siunitx-locale.dtx +++ b/macros/latex/contrib/siunitx/siunitx-locale.dtx @@ -101,6 +101,12 @@ inter-unit-product = \, , output-decimal-marker = { , } } , + locale / PL .meta:n = + { + exponent-product = \cdot , + inter-unit-product = \cdot , + output-decimal-marker = { , } + } , locale / FR .meta:n = { exponent-product = \times , @@ -148,6 +154,7 @@ \DeclareTranslation { English } { to~(numerical~range) } { to } \DeclareTranslation { French } { to~(numerical~range) } { à } \DeclareTranslation { German } { to~(numerical~range) } { bis } + \DeclareTranslation { Polish } { to~(numerical~range) } { do } \DeclareTranslation { Slovene } { to~(numerical~range) } { do } \DeclareTranslation { Spanish } { to~(numerical~range) } { a } \keys_set:nn { siunitx } diff --git a/macros/latex/contrib/siunitx/siunitx-print.dtx b/macros/latex/contrib/siunitx/siunitx-print.dtx index 10a316da89..cb63a0e325 100644 --- a/macros/latex/contrib/siunitx/siunitx-print.dtx +++ b/macros/latex/contrib/siunitx/siunitx-print.dtx @@ -842,20 +842,23 @@ { \@@_text_replace:Nnnnn #1 } { \tl_set:Nn \l_@@_tmp_tl {#1} - \tl_if_empty:NF \l_siunitx_unit_font_tl - { \exp_after:wN \cs_set_eq:NN \l_siunitx_unit_font_tl \use:n } - \cs_set:Npn \mathord ##1 - { \@@_text_replace_first:N ##1 } - \cs_set:Npn \pm { \: \exp_not:N \textpm \: } - \tl_map_inline:nn - { \mp \ge \le \gg \ll } - { \cs_set:Npn ##1 { \exp_not:N \ensuremath { \exp_not:N ##1 } } } - \cs_set:Npn \cdot { \: \exp_not:N \textperiodcentered \: } - \cs_set:Npn \times { \: \exp_not:N \texttimes \: } - \protected@edef \l_@@_tmp_tl - { \exp_after:wN \@@_text_replace_first:N \l_@@_tmp_tl } - \@@_text_replace:N \l_@@_tmp_tl - \@@_text_replace_aux:n { \tl_use:N \l_@@_tmp_tl } + \tl_if_empty:NF \l_@@_tmp_tl + { + \tl_if_empty:NF \l_siunitx_unit_font_tl + { \exp_after:wN \cs_set_eq:NN \l_siunitx_unit_font_tl \use:n } + \cs_set:Npn \mathord ##1 + { \@@_text_replace_first:N ##1 } + \cs_set:Npn \pm { \: \exp_not:N \textpm \: } + \tl_map_inline:nn + { \mp \ge \le \gg \ll } + { \cs_set:Npn ##1 { \exp_not:N \ensuremath { \exp_not:N ##1 } } } + \cs_set:Npn \cdot { \: \exp_not:N \textperiodcentered \: } + \cs_set:Npn \times { \: \exp_not:N \texttimes \: } + \protected@edef \l_@@_tmp_tl + { \exp_after:wN \@@_text_replace_first:N \l_@@_tmp_tl } + \@@_text_replace:N \l_@@_tmp_tl + \@@_text_replace_aux:n { \tl_use:N \l_@@_tmp_tl } + } } \group_end: } diff --git a/macros/latex/contrib/siunitx/siunitx.dtx b/macros/latex/contrib/siunitx/siunitx.dtx index d1d4e125ab..61d45f9621 100644 --- a/macros/latex/contrib/siunitx/siunitx.dtx +++ b/macros/latex/contrib/siunitx/siunitx.dtx @@ -121,7 +121,7 @@ % % Identify the package and give the over all version information. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2022-02-03} {3.0.47} +\ProvidesExplPackage {siunitx} {2022-02-07} {3.0.48} {A comprehensive (SI) units package} % \end{macrocode} % diff --git a/macros/latex/contrib/siunitx/siunitx.pdf b/macros/latex/contrib/siunitx/siunitx.pdf Binary files differindex 5563799b59..70e9f7d7ac 100644 --- a/macros/latex/contrib/siunitx/siunitx.pdf +++ b/macros/latex/contrib/siunitx/siunitx.pdf diff --git a/macros/latex/contrib/siunitx/siunitx.tex b/macros/latex/contrib/siunitx/siunitx.tex index 1c8e8f62ab..62fa382f86 100644 --- a/macros/latex/contrib/siunitx/siunitx.tex +++ b/macros/latex/contrib/siunitx/siunitx.tex @@ -79,7 +79,7 @@ for those people who are interested. } % For demos -\usepackage[french,german,spanish,UKenglish]{babel} +\usepackage[french,german,polish,spanish,UKenglish]{babel} \AtBeginDocument{\shorthandoff{:<>}} \usepackage{translations} \usepackage{cancel} @@ -2860,7 +2860,7 @@ same value (one of \opt{center}, \opt{right} or \opt{left}). \pkg{siunitx} allows the user to switch between the typographic conventions of different (geographical) areas by using locales. Currently, the package is supplied with configurations for locales \opt{UK}, \opt{US}, \opt{DE} -(Germany), \opt{FR} (French), \opt{SI} (Slovene) and \opt{ZA} (South Africa). +(Germany), \opt{PL} (Poland), \opt{FR} (French), \opt{SI} (Slovene) and \opt{ZA} (South Africa). The \opt{locale} option is used to switch to a particular locale. \begin{LaTeXdemo} @@ -3033,7 +3033,7 @@ options to read: \end{LaTeXdemo} If the current language is known to the \pkg{translator} package then the result will be localised text. The preamble for this manual loads English, -French, German and Spanish as options, and also loads the \pkg{babel} package: +French, German, Polish and Spanish as options, and also loads the \pkg{babel} package: \begin{LaTeXdemo} % In English by default \numlist{1;2;3} \\ @@ -3044,6 +3044,9 @@ French, German and Spanish as options, and also loads the \pkg{babel} package: \selectlanguage{german}% \numlist{1;2;3} \\ \numrange{1}{10} \\ + \selectlanguage{polish}% + \numlist{1;2;3} \\ + \numrange{1}{10} \\ \selectlanguage{spanish}% \numlist{1;2;3} \\ \numrange{1}{10} diff --git a/macros/latex/contrib/tkz/tkz-base/README.md b/macros/latex/contrib/tkz/tkz-base/README.md index fee2751ccd..5926278cd1 100644 --- a/macros/latex/contrib/tkz/tkz-base/README.md +++ b/macros/latex/contrib/tkz/tkz-base/README.md @@ -1,6 +1,6 @@ # tkz-base — for Cartesian coordinate system -Release 4.01 b 2022/01/25 +Release 4.05b 2022/02/07 ## Description The package `tkz-base` provides some tools like a Cartesian (rectangular) coordinate system to other packages like `tkz-euclide` or `tkz-fct`. @@ -60,6 +60,8 @@ Other examples, in French, are on my site. The new version of `tkz-base` is *not* fully compatible with the version 3 but the differences are minor ## History +- 4.05b Correction of an option (tkzDrawY). + Removing axesmin.tex Move from \newif\iftkz@integer to base.sty - 4.01b add error message if tkz-base is loaded after tkz-euclide. Translation of some lines from French to English in the documentation - 4.00b now `tkz-euclide` is independent of `tkz-base`. Some geometry specific macros have been removed. diff --git a/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-main.tex b/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-main.tex index 65a1615c46..f6f74345e2 100644 --- a/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-main.tex +++ b/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-main.tex @@ -17,15 +17,15 @@ index = totoc, twoside, headings = small, - cadre + %cadre ]{tkz-doc} %\usepackage{etoc} \gdef\tkznameofpack{tkz-base} -\gdef\tkzversionofpack{4.01 b} -\gdef\tkzdateofpack{2022/01/25} +\gdef\tkzversionofpack{4.05b} +\gdef\tkzdateofpack{2022/02/07} \gdef\tkznameofdoc{doc-tkz-base} -\gdef\tkzversionofdoc{4.01 b} -\gdef\tkzdateofdoc{2022/01/25} +\gdef\tkzversionofdoc{4.05b} +\gdef\tkzdateofdoc{2022/02/07} \gdef\tkzauthorofpack{Alain Matthes} \gdef\tkzadressofauthor{} \gdef\tkznamecollection{AlterMundus} diff --git a/macros/latex/contrib/tkz/tkz-base/doc/tkz-base.pdf b/macros/latex/contrib/tkz/tkz-base/doc/tkz-base.pdf Binary files differindex 08a1d6120b..844c662889 100644 --- a/macros/latex/contrib/tkz/tkz-base/doc/tkz-base.pdf +++ b/macros/latex/contrib/tkz/tkz-base/doc/tkz-base.pdf diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.cfg b/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.cfg index 58082df758..eebdad9e19 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.cfg +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.cfg @@ -16,9 +16,9 @@ % and save the file in a directory part of your TEXINPUTS environment % variable. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-base.cfg} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-base.cfg} %<------ colors ---------------------------------------–> %<------ colors ---------------------------------------–> \def\tkz@backgroundcolor{white} diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.sty b/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.sty index 2b98fb4735..0d18c9bc83 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.sty +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.sty @@ -10,12 +10,12 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\typeout{2022/01/25 4.01 tkz-base.sty} +\def\fileversion{4.05 b} +\typeout{2022/01/28 4.05b tkz-base.sty} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tkz-base}[2022/01/25 4.01 tkz-base] +\ProvidesPackage{tkz-base}[2022/01/28 4.05b tkz-base] \@ifpackageloaded{tkz-euclide}{\typeout{tkz-base and tkz-fct must be loaded before tkz-euclide} -\PackageError{tkz-euclide}{tkz-base must be loaded before tkz-euclide}{tkz-base must be loaded before tkz-euclide}% +\PackageError{tkz-base}{tkz-base must be loaded before tkz-euclide}{tkz-base must be loaded before tkz-euclide}% \endinput}{} \RequirePackage{tikz} \usetikzlibrary{% @@ -83,6 +83,7 @@ \newif\iftkz@np \newif\iftkz@swap \newif\iftkz@init@NO +\newif\iftkz@integer \newif\iftkz@Rep@orig%--------------------- Rep \newif\iftkzLengthIncm%--------------------- Math \newif\iftkz@sop@show%--------------------- marks diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-marks.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-marks.tex index 39d765c856..51f61ecafa 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-marks.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-marks.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-lib-marks.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-lib-marks.tex} \makeatletter %<--------------------------------------------------------------------------–> % Création des symboles diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-shape.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-shape.tex index fc14c3d486..119457a009 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-shape.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-shape.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-lib-shape.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-lib-shape.tex} \makeatletter %<--------------------------------------------------------------------------–> % Création des symboles diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-axes.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-axes.tex index 1f8e33a5c8..050d8a766f 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-axes.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-axes.tex @@ -10,22 +10,21 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-obj-axes} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-obj-axes} -\newif\ifinteger \makeatletter \def\removedot#1.{#1} \newcommand\tkzgetinteger[1]{\expandafter\tkz@getinteger#1.\@nil} \def\tkz@getinteger#1.#2\@nil{% \ifx\empty#2\empty - \integertrue + \tkz@integertrue \else \ifnum\removedot#2=0 - \integertrue + \tkz@integertrue \else - \integerfalse + \tkz@integerfalse \fi \fi } @@ -34,7 +33,7 @@ %<--------------------------------------------------------------------------–> \def\tkz@showgrad#1{% \tkzgetinteger{#1} -\ifinteger\edef\tkz@result{\fpeval{trunc(#1,0)}}\else\edef\tkz@result{#1}\fi}% +\iftkz@integer\edef\tkz@result{\fpeval{trunc(#1,0)}}\else\edef\tkz@result{#1}\fi}% \def\tkz@Xresult{% \tkz@showgrad{\tkz@xgrad}% @@ -226,7 +225,7 @@ $\numprint{\tkz@result}$ down space = \tkz@init@downspace, noticks/.is if = tkz@Y@noticks, noticks/.default = true, - noticks = true, + noticks = false, tickwd/.store in = \tkz@Y@tickwd, ticklt/.store in = \tkz@Y@ticklt, tickrt/.store in = \tkz@Y@tickrt, diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-axesmin.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-axesmin.tex deleted file mode 100644 index ed33ec7aea..0000000000 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-axesmin.tex +++ /dev/null @@ -1,171 +0,0 @@ -% tkz-obj-axesmin -% Copyright 2022 Alain Matthes -% This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3 -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% This work has the LPPL maintenance status “maintained”. -% The Current Maintainer of this work is Alain Matthes. - -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-obj-axesmin} - -\makeatletter -\newif\ifinteger -\def\removedot#1.{#1} -\newcommand\tkzgetinteger[1]{\expandafter\tkz@getinteger#1.\@nil} -\def\tkz@getinteger#1.#2\@nil{% - \ifx\empty#2\empty - \integertrue - \else - \ifnum\removedot#2=0 - \integertrue - \else - \integerfalse - \fi - \fi -} - -%<--------------------------------------------------------------------------–> -% Setup axe -%<--------------------------------------------------------------------------–> -\pgfkeys{tkzaxis/.cd, - line width/.code = \xdef\tkz@sua@lw{#1}, - color/.code = \xdef\tkz@sua@color{#1}, - tickwd/.code = \xdef\tkz@sua@tickwd{#1}, - ticka/.code = \xdef\tkz@sua@ticka{#1}, - tickb/.code = \xdef\tkz@sua@tickb{#1}, - line width = \tkz@init@lw, - color = \tkz@init@color, - tickwd = \tkz@init@tickwd, - ticka = \tkz@init@ticka, - tickb = \tkz@init@tickb -} - -\def\tkzSetUpAxis{\pgfutil@ifnextchar[{\tkz@SetUpAxis}{\tkz@SetUpAxis[]}} -\def\tkz@SetUpAxis[#1]{% -\begingroup -\pgfqkeys{/tkzaxis}{#1} -\global\let\tkz@init@lw\tkz@sua@lw -\global\let\tkz@init@gradsize\tkz@sua@gradsize -\global\let\tkz@init@color\tkz@sua@color -\global\let\tkz@init@tickwd\tkz@sua@tickwd -\global\let\tkz@init@ticka\tkz@sua@ticka -\global\let\tkz@init@tickb\tkz@sua@tickb -\endgroup -} -%<--------------------------------------------------------------------------–> -% tkzDrawX todo améliorer les unités -% sans doute à revoir loop from 0 to i then calcul dans la boucle de la position -% et de l'affichage -%<--------------------------------------------------------------------------–> -\pgfkeys{% - /tkzdrawX/.cd, - color/.store in = \tkz@X@color, - label/.store in = \tkz@X@label, - right space/.store in = \tkz@axe@rxspace, - left space/.store in = \tkz@axe@lxspace, - step/.code = {\edef\tkz@posnext{\fpeval{#1}}}, - color = \tkz@init@color, - label = \tkz@init@xlabel, - step = \tkz@init@xstep, - right space = \tkz@init@rightspace, %??? - left space = \tkz@init@leftspace, - noticks/.is if = tkz@X@noticks, - noticks/.default = true, - noticks = true, - tickwd/.store in = \tkz@X@tickwd, - tickup/.store in = \tkz@X@tickup, - tickdn/.store in = \tkz@X@tickdn, - tickwd = \tkz@init@tickwd, - tickup = \tkz@init@ticka, - tickdn = \tkz@init@tickb, - /tkzdrawX/.search also={/tikz}, - } - -\def\tkzDrawX{\pgfutil@ifnextchar[{\tkz@DrawX}{\tkz@DrawX[]}} -\def\tkz@DrawX[#1]{ -\begingroup% -\pgfqkeys{/tkzdrawX}{#1} -\edef\tkz@posmax{\fpeval{trunc(\tkz@xb,\tkz@init@xdec)}} -\edef\tkz@posmin{\fpeval{trunc(\tkz@xa,\tkz@init@xdec)}} -\edef\tkz@xbsup{\fpeval{\tkz@xb+\tkz@axe@rxspace}} -\edef\tkz@xainf{\fpeval{\tkz@xa-\tkz@axe@lxspace}} -\path (\tkz@xainf,0)--(\tkz@xbsup,0) node(tkz@xline){}; -\draw[xaxe style, - color = \tkz@X@color, - /tkzdrawX/.cd, #1] (\tkz@xainf,0)--(\tkz@xbsup,0) - node[ xlabel style, - /tkzdrawX/.cd, - #1]{\tkz@X@label}; - \iftkz@X@noticks - \else - \edef\tkz@posmax{\fpeval{trunc(\tkz@posmax,\tkz@init@xdec)}} - \edef\tkz@posnext{\fpeval{\tkz@posnext/\tkz@init@xstep+\tkz@posmin}} - \foreach \pos in {\tkz@posmin,...,\tkz@posmax}{% - \edef\tkz@pos{\fpeval{\pos*1}}% ??? - \draw[ color = \tkz@X@color, line width = \tkz@X@tickwd, - shift = {(\tkz@pos,0)}]% - (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn); - } - \fi -\endgroup -} -%<--------------------------------------------------------------------------–> -% tkzDrawY todo améliorer les unités -%<--------------------------------------------------------------------------–> -\pgfkeys{% - /tkzdrawY/.cd, - color/.store in = \tkz@Y@color, - label/.store in = \tkz@Y@label, - up space/.store in = \tkz@axe@uyspace, - down space/.store in = \tkz@axe@dyspace, - step/.code = {\edef\tkz@posnext{\fpeval{#1}}}, - color = \tkz@init@color, - label = \tkz@init@ylabel, - step = \tkz@init@ystep, - up space = \tkz@init@upspace, - down space = \tkz@init@downspace, - noticks/.is if = tkz@Y@noticks, - noticks/.default = true, - noticks = true, - tickwd/.store in = \tkz@Y@tickwd, - ticklt/.store in = \tkz@Y@ticklt, - tickrt/.store in = \tkz@Y@tickrt, - tickwd = \tkz@init@tickwd, - ticklt = \tkz@init@tickb, - tickrt = \tkz@init@ticka, - /tkzdrawY/.search also={/tikz}, - } - -\def\tkzDrawY{\pgfutil@ifnextchar[{\tkz@DrawY}{\tkz@DrawY[]}} -\def\tkz@DrawY[#1]{% -\begingroup -\pgfkeys{/tkzdrawY/.cd,step = \tkz@init@ystep} -\pgfqkeys{/tkzdrawY}{#1} -\edef\tkz@posmax{\fpeval{trunc(\tkz@yb,\tkz@init@ydec)}} -\edef\tkz@posmin{\fpeval{trunc(\tkz@ya,\tkz@init@ydec)}} -\edef\tkz@ybsup{\fpeval{\tkz@yb+\tkz@axe@uyspace}} -\edef\tkz@yainf{\fpeval{\tkz@ya-\tkz@axe@dyspace}} -\path (0,\tkz@yainf)--(0,\tkz@ybsup) node(tkz@yline){}; -\draw[color = \tkz@Y@color, - yaxe style,/tkzdrawY/.cd,#1] (0,\tkz@yainf)--(0,\tkz@ybsup) - node[ylabel style,/tkzdrawY/.cd,#1]{\tkz@Y@label}; - \iftkz@Y@noticks - \else - \edef\tkz@posmax{\fpeval{trunc(\tkz@posmax,\tkz@init@ydec)}} - \edef\tkz@posnext{\fpeval{\tkz@posnext/\tkz@init@ystep+\tkz@posmin}} - \foreach \tkz@pos in {\tkz@posmin,\tkz@posnext,...,\tkz@posmax}{% - \draw[color = \tkz@Y@color, - line width = \tkz@Y@tickwd, - shift = {(0,\tkz@pos)}]% - (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt);} - - \fi -\endgroup} -\makeatother -\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex index d013b85ff6..c4b5f381b4 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-obj-grids.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-obj-grids.tex} \makeatletter %<--------------------------------------------------------------------------–> % Setup Grid diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-marks.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-marks.tex index ba23a6230d..abe6f77459 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-marks.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-marks.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-obj-marks.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-obj-marks.tex} \makeatletter %<-------------------------------------------------------------------------–> % Setup Marks diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-points.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-points.tex index 7ec998a282..7645cf523a 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-points.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-points.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-obj-eu-points.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-obj-eu-points.tex} \makeatletter %<---------------------------------------------------------------------------> % init def point diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-rep.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-rep.tex index 1891617cc4..fe984ffb62 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-rep.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-rep.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-obj-rep.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28} +\typeout{2022/01/28 4.05b tkz-obj-rep.tex} \makeatletter %<--------------------------------------------------------------------------–> % repère diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-BB.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-BB.tex index 27242b0284..b09c8b5608 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-BB.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-BB.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-obj-BB.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-obj-BB.tex} \makeatletter %<--------------------------------------------------------------------------–> \def\tkzShowBB{\pgfutil@ifnextchar[{\tkz@ShowBB}{\tkz@ShowBB[]}} diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-arith.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-arith.tex index b2185cb223..84d2336613 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-arith.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-arith.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-tools-arith.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-tools-arith.tex} % 1.161 test if "isfactor" is already defined % now with pgf 3.0 gcd isprime isodd iseven are defined %<--------------------------------------------------------------------------–> diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-base.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-base.tex index d7adb3f2cf..207df8e92e 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-base.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-base.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-tools-base.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-tools-base.tex} \makeatletter %<--------------------------------------------------------------------------–> \global\let\tkz@tmp@xa\tkz@init@xmin% modif 2016 diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-colors.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-colors.tex index 5a27919887..d24a49add8 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-colors.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-colors.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-tools-colors} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-tools-colors} \makeatletter %<------ Initialisation of the colors with tkzSetUpColors -----------------> diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-misc.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-misc.tex index ac49a52285..580dabf51f 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-misc.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-misc.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-tools-misc.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-tools-misc.tex} \makeatletter %<--------------------------------------------------------------------------–> % hline pb avec line diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-modules.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-modules.tex index 4e98b39bfc..a6467a428d 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-modules.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-modules.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-tools-modules.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-tools-modules.tex} \makeatletter %<------------- % chargement des modules ----------------------------------> \def\tkz@obj@all{angles,arcs,compass,defcircles,deflines,defpoints,defpointsby,defpointsrnd,defpointswith,polygons,protractor,sectors,show,triangles}% diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-print.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-print.tex index 79eac1cf14..a727e2fb39 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-print.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-print.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-tools-print} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-tools-print} \makeatletter %<------------- tkzPrintFrac ----------------------------------> \def\tkzPrintFrac#1#2{% diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-text.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-text.tex index 639de47d69..819505a99c 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-text.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-text.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-tools-text.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-tools-text.tex} \makeatletter %<--------------------------------------------------------------------------–> % tkzText diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-utilities.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-utilities.tex index 992e5da0c7..c304cee394 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-utilities.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-utilities.tex @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.00} -\def\filedate{2022/01/25 } -\typeout{2022/01/25 4.01 tkz-tools-utilities.tex} +\def\fileversion{4.05b} +\def\filedate{2022/01/28 } +\typeout{2022/01/28 4.05b tkz-tools-utilities.tex} \makeatletter \pgfkeys{/tkzClip/.cd, space/.store in = {\tkz@CLI@space}, diff --git a/macros/latex/contrib/zref-clever/CHANGELOG.md b/macros/latex/contrib/zref-clever/CHANGELOG.md index 74fdc04b4e..66d7e69c3d 100644 --- a/macros/latex/contrib/zref-clever/CHANGELOG.md +++ b/macros/latex/contrib/zref-clever/CHANGELOG.md @@ -1,6 +1,16 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.2.0-alpha...HEAD) +## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.2.1-alpha...HEAD) + +## [v0.2.1-alpha](https://github.com/gusbrs/zref-clever/compare/v0.2.0-alpha...v0.2.1-alpha) (2022-02-07) + +### Added +- Option `endrange` for typesetting terse ranges. +- Option `rangetopair` to control behavior of `range` option when a pair + results from building a range. +- Option `vario` to load package `zref-vario`. +- Reference property `subeq` for the `amsmath` and `breqn` compatibility + modules. ## [v0.2.0-alpha](https://github.com/gusbrs/zref-clever/compare/v0.1.2-alpha...v0.2.0-alpha) (2022-01-28) diff --git a/macros/latex/contrib/zref-clever/MANIFEST.md b/macros/latex/contrib/zref-clever/MANIFEST.md index 0c7f6e4af5..50b246d870 100644 --- a/macros/latex/contrib/zref-clever/MANIFEST.md +++ b/macros/latex/contrib/zref-clever/MANIFEST.md @@ -66,8 +66,10 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.). * zc-LanguageSetup01.lvt * zc-LanguageSetup02.lvt +* zc-LanguageSetup03.lvt * zc-RefTypeSetup01.lvt * zc-RefTypeSetup02.lvt +* zc-RefTypeSetup03.lvt * zc-class-article01.lvt * zc-class-book01.lvt * zc-class-memoir01.lvt @@ -98,6 +100,7 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.). * zc-howto-newtheorem02.lvt * zc-howto-newtheorem03.lvt * zc-howto-newtheorem04.lvt +* zc-howto-zref-vario01.lvt * zc-howto-zref-xr01.lvt * zc-label-options01.lvt * zc-langfile-dutch01.lvt @@ -127,12 +130,14 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.). * zc-opt-ref01.lvt * zc-opt-ref02.lvt * zc-opt-titleref01.lvt +* zc-opt-vario01.lvt * zc-precedence-rules01.lvt * zc-sort01.lvt * zc-typeset01.lvt * zc-workaround-breqn01.lvt * zc-zcref-options01.lvt * zc-zcref-options02.lvt +* zc-zcref-options03.lvt * zc-LanguageSetup01.luatex.tlg * zc-LanguageSetup01.luatexdev.tlg * zc-LanguageSetup01.tlg @@ -143,6 +148,11 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.). * zc-LanguageSetup02.tlg * zc-LanguageSetup02.xetex.tlg * zc-LanguageSetup02.xetexdev.tlg +* zc-LanguageSetup03.luatex.tlg +* zc-LanguageSetup03.luatexdev.tlg +* zc-LanguageSetup03.tlg +* zc-LanguageSetup03.xetex.tlg +* zc-LanguageSetup03.xetexdev.tlg * zc-RefTypeSetup01.luatex.tlg * zc-RefTypeSetup01.luatexdev.tlg * zc-RefTypeSetup01.tlg @@ -153,6 +163,11 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.). * zc-RefTypeSetup02.tlg * zc-RefTypeSetup02.xetex.tlg * zc-RefTypeSetup02.xetexdev.tlg +* zc-RefTypeSetup03.luatex.tlg +* zc-RefTypeSetup03.luatexdev.tlg +* zc-RefTypeSetup03.tlg +* zc-RefTypeSetup03.xetex.tlg +* zc-RefTypeSetup03.xetexdev.tlg * zc-class-article01.luatex.tlg * zc-class-article01.luatexdev.tlg * zc-class-article01.tlg @@ -303,6 +318,11 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.). * zc-howto-newtheorem04.tlg * zc-howto-newtheorem04.xetex.tlg * zc-howto-newtheorem04.xetexdev.tlg +* zc-howto-zref-vario01.luatex.tlg +* zc-howto-zref-vario01.luatexdev.tlg +* zc-howto-zref-vario01.tlg +* zc-howto-zref-vario01.xetex.tlg +* zc-howto-zref-vario01.xetexdev.tlg * zc-howto-zref-xr01.luatex.tlg * zc-howto-zref-xr01.luatexdev.tlg * zc-howto-zref-xr01.tlg @@ -408,6 +428,11 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.). * zc-opt-titleref01.tlg * zc-opt-titleref01.xetex.tlg * zc-opt-titleref01.xetexdev.tlg +* zc-opt-vario01.luatex.tlg +* zc-opt-vario01.luatexdev.tlg +* zc-opt-vario01.tlg +* zc-opt-vario01.xetex.tlg +* zc-opt-vario01.xetexdev.tlg * zc-precedence-rules01.luatex.tlg * zc-precedence-rules01.luatexdev.tlg * zc-precedence-rules01.tlg @@ -434,6 +459,11 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.). * zc-zcref-options02.tlg * zc-zcref-options02.xetex.tlg * zc-zcref-options02.xetexdev.tlg +* zc-zcref-options03.luatex.tlg +* zc-zcref-options03.luatexdev.tlg +* zc-zcref-options03.tlg +* zc-zcref-options03.xetex.tlg +* zc-zcref-options03.xetexdev.tlg ## TDS manifest diff --git a/macros/latex/contrib/zref-clever/zref-clever-code.pdf b/macros/latex/contrib/zref-clever/zref-clever-code.pdf Binary files differindex 033edad2dc..9e8212f083 100644 --- a/macros/latex/contrib/zref-clever/zref-clever-code.pdf +++ b/macros/latex/contrib/zref-clever/zref-clever-code.pdf diff --git a/macros/latex/contrib/zref-clever/zref-clever.dtx b/macros/latex/contrib/zref-clever/zref-clever.dtx index d850476b4c..e6c175d33f 100644 --- a/macros/latex/contrib/zref-clever/zref-clever.dtx +++ b/macros/latex/contrib/zref-clever/zref-clever.dtx @@ -162,7 +162,7 @@ % % Identify the package. % \begin{macrocode} -\ProvidesExplPackage {zref-clever} {2022-01-28} {0.2.0-alpha} +\ProvidesExplPackage {zref-clever} {2022-02-07} {0.2.1-alpha} {Clever LaTeX cross-references based on zref} % \end{macrocode} % @@ -607,6 +607,11 @@ Option~'ref=#1'~requested~\msg_line_context:.~ But~the~property~'#1'~is~not~declared,~falling-back~to~'default'. } +\msg_new:nnn { zref-clever } { endrange-property-undefined } + { + Option~'endrange=#1'~requested~\msg_line_context:.~ + But~the~property~'#1'~is~not~declared,~'endrange'~not~set. + } \msg_new:nnn { zref-clever } { hyperref-preamble-only } { Option~'hyperref'~only~available~in~the~preamble~\msg_line_context:.~ @@ -667,7 +672,7 @@ % exactly twice, but no further to retrieve the proper value. In case the % property is not found, set \meta{tl var} with \meta{default}. % \begin{syntax} -% \cs{@@_extract_default:Nnnn} \Arg{tl val} +% \cs{@@_extract_default:Nnnn} \Arg{tl var} % ~~\Arg{label} \Arg{prop} \Arg{default} % \end{syntax} % \begin{macrocode} @@ -676,7 +681,7 @@ \exp_args:NNNo \exp_args:NNo \tl_set:Nn #1 { \zref@extractdefault {#2} {#3} {#4} } } -\cs_generate_variant:Nn \@@_extract_default:Nnnn { NVnn } +\cs_generate_variant:Nn \@@_extract_default:Nnnn { NVnn , Nnvn } % \end{macrocode} % \end{macro} % @@ -1103,16 +1108,22 @@ % \contributor{Jonathan P.\ Spratte}, aka `Skillmon', and some discussion % about it, including further insights by \contributor{Phelype Oleinik}, see % \url{https://tex.stackexchange.com/q/614690} and -% \url{https://github.com/latex3/latex3/pull/988}. For booleans, the -% situation is different, since they cannot meaningfully receive an empty -% value and the ``key with no value'' is a handy and expected shorthand for +% \url{https://github.com/latex3/latex3/pull/988}. However, Joseph Wright +% seems to particularly dislike this use and the general idea of a ``key with +% no value'' being somehow meaningful for \pkg{l3keys} (e.g. his comments on +% the previous question, and +% \url{https://tex.stackexchange.com/q/632157/#comment1576404_632157}), which +% does make it somewhat risky to rely on this. For booleans, the situation is +% different, since they cannot meaningfully receive an empty value and the +% ``key with no value'' is a handy and expected shorthand for % \texttt{key=true}. Therefore, for reference format option booleans, we use -% a third value ``\texttt{unset}'' for this purpose. In the language files -% the ``unsetting'' behavior is less meaningful, since they only change any -% variable if it is unset to start with, so that unsetting an unset variable -% would be redundant. However, for UI symmetry also in the language files -% keys with no value should not be considered ``empty'' and boolean -% \texttt{unset} values should exist. They are just no-op. +% a third value ``\texttt{unset}'' for this purpose. And similarly for +% ``choice'' options. In the language files the ``unsetting'' behavior is +% less meaningful, since they only change any variable if it is unset to start +% with, so that unsetting an unset variable would be redundant. However, for +% UI symmetry also in the language files keys with no value should not be +% considered ``empty'' and boolean \texttt{unset} values should exist. They +% are just no-op. % % % \begin{macro} @@ -1191,6 +1202,7 @@ { cap , abbrev , + rangetopair , } % \end{macrocode} % Only ``type names'' are ``necessarily type-specific'', which makes them @@ -1880,6 +1892,225 @@ } , } } +\keys_define:nn { zref-clever/langfile } + { + endrange .code:n = + { + \str_case:nnF {#1} + { + { ref } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangefunc } { tl } + } + { } + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangeprop } { tl } + } + { } + } + { + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangefunc } { tl } + } + { } + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangeprop } { tl } + } + { } + } + } + + { stripprefix } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_stripprefix } + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangeprop } { tl } + } + { } + } + { + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_stripprefix } + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangeprop } { tl } + } + { } + } + } + + { pagecomp } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_pagecomp } + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangeprop } { tl } + } + { } + } + { + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_pagecomp } + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangeprop } { tl } + } + { } + } + } + + { pagecomp2 } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_pagecomptwo } + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangeprop } { tl } + } + { } + } + { + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_pagecomptwo } + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangeprop } { tl } + } + { } + } + } + + { unset } + { } + } + { + \tl_if_empty:nTF {#1} + { + \msg_info:nnn { zref-clever } + { endrange-property-undefined } {#1} + } + { + \zref@ifpropundefined {#1} + { + \msg_info:nnn { zref-clever } + { endrange-property-undefined } {#1} + } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_property } + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangeprop } { tl } + } + {#1} + } + { + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_property } + \@@_opt_tl_gset_if_new:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangeprop } { tl } + } + {#1} + } + } + } + } + } , + endrange .value_required:n = true , + } \seq_map_inline:Nn \c_@@_rf_opts_tl_type_names_seq { @@ -2167,7 +2398,9 @@ % branch if it is not (insightful comments by \contributor{Ulrike Fischer} at % \url{https://github.com/ho-tex/zref/issues/13}). Therefore, before adding % anything to \cs{l_@@_ref_property_tl}, check if first here with -% \cs{zref@ifpropundefined}: close it at the door. +% \cs{zref@ifpropundefined}: close it at the door. We must also control for +% an empty value, since ``empty'' passes both \cs{zref@ifpropundefined} and +% \cs{zref@ifrefcontainsprop}. % % % \begin{macrocode} @@ -2176,12 +2409,21 @@ { ref .code:n = { - \zref@ifpropundefined {#1} + \tl_if_empty:nTF {#1} { - \msg_warning:nnn { zref-clever } { zref-property-undefined } {#1} + \msg_warning:nnn { zref-clever } + { zref-property-undefined } {#1} \tl_set:Nn \l_@@_ref_property_tl { default } } - { \tl_set:Nn \l_@@_ref_property_tl {#1} } + { + \zref@ifpropundefined {#1} + { + \msg_warning:nnn { zref-clever } + { zref-property-undefined } {#1} + \tl_set:Nn \l_@@_ref_property_tl { default } + } + { \tl_set:Nn \l_@@_ref_property_tl {#1} } + } } , ref .initial:n = default , ref .value_required:n = true , @@ -2286,7 +2528,443 @@ % % % -% \subsubsection*{\opt{range} option} +% \subsubsection*{\opt{endrange} option} +% +% The working of \opt{endrange} option depends on two underlying option values +% / variables: \texttt{endrangefunc} and \texttt{endrangeprop}. +% \texttt{endrangefunc} is the more general one, and \texttt{endrangeprop} is +% used when the first is set to \cs{@@_get_endrange_property:VVN}, which is +% the case when the user is setting \opt{endrange} to an arbitrary \pkg{zref} +% property, instead of one of the \cs{str_case:nn} matches. +% +% \texttt{endrangefunc} \emph{must} receive three arguments and, more +% specifically, its signature \emph{must} be \texttt{VVN}. For this reason, +% \texttt{endrangefunc} should be stored without the signature, which is +% added, and hard-coded, at the calling place. The first argument is +% \meta{beg range label}, the second \meta{end range label}, and the last +% \meta{tl var to set}. Of course, \meta{tl var to set} must be set to a +% proper value, and that's the main task of the function. +% \texttt{endrangefunc} must also handle the case where +% \cs{zref@ifrefcontainsprop} is false, since \cs{@@_get_ref_endrange:nnN} +% cannot take care of that. For this purpose, it may set \meta{tl var to set} +% to the special value \texttt{zc@missingproperty}, to signal a missing +% property for \cs{@@_get_ref_endrange:nnN}. +% +% An empty \texttt{endrangefunc} signals that no processing is to be made to +% the end range reference, that is, that it should be treated like any other +% one, as defined by the \opt{ref} option. This may happen either because +% \opt{endrange} was never set for the reference type, and empty is the value +% ``returned'' by \cs{@@_get_rf_opt_tl:nnnN} for options not set, or because +% \opt{endrange} was set to \texttt{ref} at some scope which happens to get +% precedence. +% +% One thing I was divided about in this functionality was whether to +% (x-)expand the references before processing them, when such processing is +% required. At first sight, it makes sense to do so, since we are aiming at +% ``removing common parts'' as close as possible to the printed representation +% of the references (\pkg{cleveref} does expand them in \cs{crefstripprefix}). +% On the other hand, this brings some new challenges: if a fragile command +% gets there, we are in trouble; also, if a protected one gets there, though +% things won't break as badly, we may ``strip'' the macro and stay with +% different arguments, which will then end up in the input stream. I think +% \pkg{biblatex} is a good reference here, and it offers \cs{NumCheckSetup}, +% \cs{NumsCheckSetup}, and \cs{PagesCheckSetup} aimed at locally redefining +% some commands which may interfere with the processing. This is a good idea, +% thus we offer a similar hook for the same purpose: \texttt{endrange-setup}. +% +% \begin{macrocode} +\NewHook { zref-clever/endrange-setup } +% \end{macrocode} +% +% +% \begin{macrocode} +\keys_define:nn { zref-clever/reference } + { + endrange .code:n = + { + \str_case:nnF {#1} + { + { ref } + { + \tl_clear:c + { + \@@_opt_varname_general:nn + { endrangefunc } { tl } + } + \tl_clear:c + { + \@@_opt_varname_general:nn + { endrangeprop } { tl } + } + } + + { stripprefix } + { + \tl_set:cn + { + \@@_opt_varname_general:nn + { endrangefunc } { tl } + } + { @@_get_endrange_stripprefix } + \tl_clear:c + { + \@@_opt_varname_general:nn + { endrangeprop } { tl } + } + } + + { pagecomp } + { + \tl_set:cn + { + \@@_opt_varname_general:nn + { endrangefunc } { tl } + } + { @@_get_endrange_pagecomp } + \tl_clear:c + { + \@@_opt_varname_general:nn + { endrangeprop } { tl } + } + } + + { pagecomp2 } + { + \tl_set:cn + { + \@@_opt_varname_general:nn + { endrangefunc } { tl } + } + { @@_get_endrange_pagecomptwo } + \tl_clear:c + { + \@@_opt_varname_general:nn + { endrangeprop } { tl } + } + } + + { unset } + { + \@@_opt_tl_unset:c + { + \@@_opt_varname_general:nn + { endrangefunc } { tl } + } + \@@_opt_tl_unset:c + { + \@@_opt_varname_general:nn + { endrangeprop } { tl } + } + } + } + { + \tl_if_empty:nTF {#1} + { + \msg_warning:nnn { zref-clever } + { endrange-property-undefined } {#1} + } + { + \zref@ifpropundefined {#1} + { + \msg_warning:nnn { zref-clever } + { endrange-property-undefined } {#1} + } + { + \tl_set:cn + { + \@@_opt_varname_general:nn + { endrangefunc } { tl } + } + { @@_get_endrange_property } + \tl_set:cn + { + \@@_opt_varname_general:nn + { endrangeprop } { tl } + } + {#1} + } + } + } + } , + endrange .value_required:n = true , + } +% \end{macrocode} +% +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_get_endrange_property:nnN #1#2#3 + { + \tl_if_empty:NTF \l_@@_endrangeprop_tl + { + \zref@ifrefcontainsprop {#2} { \l_@@_ref_property_tl } + { + \@@_extract_default:Nnvn #3 + {#2} { l_@@_ref_property_tl } { } + } + { \tl_set:Nn #3 { zc@missingproperty } } + } + { + \zref@ifrefcontainsprop {#2} { \l_@@_endrangeprop_tl } + { +% \end{macrocode} +% If the range came about by normal compression, we already know the beginning +% and the end references share the same ``form'' and ``prefix'' (this is +% ensured at \cs{@@_labels_in_sequence:nn}), but the same is not true if the +% \opt{range} option is being used, in which case, we have to check the +% replacement \cs{l_@@_ref_property_tl} by \cs{l_@@_endrangeprop_tl} is really +% granted. +% \begin{macrocode} + \bool_if:NTF \l_@@_typeset_range_bool + { + \group_begin: + \bool_set_false:N \l_tmpa_bool + \exp_args:Nxx \tl_if_eq:nnT + { + \@@_extract_unexp:nnn + {#1} { externaldocument } { } + } + { + \@@_extract_unexp:nnn + {#2} { externaldocument } { } + } + { + \tl_if_eq:NnTF \l_@@_ref_property_tl { page } + { + \exp_args:Nxx \tl_if_eq:nnT + { + \@@_extract_unexp:nnn + {#1} { zc@pgfmt } { } + } + { + \@@_extract_unexp:nnn + {#2} { zc@pgfmt } { } + } + { \bool_set_true:N \l_tmpa_bool } + } + { + \exp_args:Nxx \tl_if_eq:nnT + { + \@@_extract_unexp:nnn + {#1} { zc@counter } { } + } + { + \@@_extract_unexp:nnn + {#2} { zc@counter } { } + } + { + \exp_args:Nxx \tl_if_eq:nnT + { + \@@_extract_unexp:nnn + {#1} { zc@enclval } { } + } + { + \@@_extract_unexp:nnn + {#2} { zc@enclval } { } + } + { \bool_set_true:N \l_tmpa_bool } + } + } + } + \bool_if:NTF \l_tmpa_bool + { + \@@_extract_default:Nnvn \l_tmpb_tl + {#2} { l_@@_endrangeprop_tl } { } + } + { + \zref@ifrefcontainsprop + {#2} { \l_@@_ref_property_tl } + { + \@@_extract_default:Nnvn \l_tmpb_tl + {#2} { l_@@_ref_property_tl } { } + } + { \tl_set:Nn \l_tmpb_tl { zc@missingproperty } } + } + \exp_args:NNNV + \group_end: + \tl_set:Nn #3 \l_tmpb_tl + } + { + \@@_extract_default:Nnvn #3 + {#2} { l_@@_endrangeprop_tl } { } + } + } + { + \zref@ifrefcontainsprop {#2} { \l_@@_ref_property_tl } + { + \@@_extract_default:Nnvn #3 + {#2} { l_@@_ref_property_tl } { } + } + { \tl_set:Nn #3 { zc@missingproperty } } + } + } + } +\cs_generate_variant:Nn \@@_get_endrange_property:nnN { VVN } +% \end{macrocode} +% +% +% +% For the technique for smuggling the assignment out of the group, see +% \contributor{Enrico Gregorio}'s answer at +% \url{https://tex.stackexchange.com/a/56314}. +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_get_endrange_stripprefix:nnN #1#2#3 + { + \zref@ifrefcontainsprop {#2} { \l_@@_ref_property_tl } + { + \group_begin: + \UseHook { zref-clever/endrange-setup } + \tl_set:Nx \l_tmpa_tl + { + \@@_extract:nnn + {#1} { \l_@@_ref_property_tl } { } + } + \tl_set:Nx \l_tmpb_tl + { + \@@_extract:nnn + {#2} { \l_@@_ref_property_tl } { } + } + \bool_set_false:N \l_tmpa_bool + \bool_until_do:Nn \l_tmpa_bool + { + \exp_args:Nxx \tl_if_eq:nnTF + { \tl_head:V \l_tmpa_tl } { \tl_head:V \l_tmpb_tl } + { + \tl_set:Nx \l_tmpa_tl { \tl_tail:V \l_tmpa_tl } + \tl_set:Nx \l_tmpb_tl { \tl_tail:V \l_tmpb_tl } + \tl_if_empty:NT \l_tmpb_tl + { \bool_set_true:N \l_tmpa_bool } + } + { \bool_set_true:N \l_tmpa_bool } + } + \exp_args:NNNV + \group_end: + \tl_set:Nn #3 \l_tmpb_tl + } + { \tl_set:Nn #3 { zc@missingproperty } } + } +\cs_generate_variant:Nn \@@_get_endrange_stripprefix:nnN { VVN } +% \end{macrocode} +% +% +% \begin{macro}{\@@_is_integer_rgx:n} +% Test if argument is composed only of digits (adapted from +% \url{https://tex.stackexchange.com/a/427559}). +% \begin{macrocode} +\prg_new_protected_conditional:Npnn + \@@_is_integer_rgx:n #1 { F , TF } + { + \regex_match:nnTF { \A\d+\Z } {#1} + { \prg_return_true: } + { \prg_return_false: } + } +\prg_generate_conditional_variant:Nnn + \@@_is_integer_rgx:n { V } { F , TF } +% \end{macrocode} +% \end{macro} +% +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_get_endrange_pagecomp:nnN #1#2#3 + { + \zref@ifrefcontainsprop {#2} { \l_@@_ref_property_tl } + { + \group_begin: + \UseHook { zref-clever/endrange-setup } + \tl_set:Nx \l_tmpa_tl + { + \@@_extract:nnn + {#1} { \l_@@_ref_property_tl } { } + } + \tl_set:Nx \l_tmpb_tl + { + \@@_extract:nnn + {#2} { \l_@@_ref_property_tl } { } + } + \bool_set_false:N \l_tmpa_bool + \@@_is_integer_rgx:VTF \l_tmpa_tl + { + \@@_is_integer_rgx:VF \l_tmpb_tl + { \bool_set_true:N \l_tmpa_bool } + } + { \bool_set_true:N \l_tmpa_bool } + \bool_until_do:Nn \l_tmpa_bool + { + \exp_args:Nxx \tl_if_eq:nnTF + { \tl_head:V \l_tmpa_tl } { \tl_head:V \l_tmpb_tl } + { + \tl_set:Nx \l_tmpa_tl { \tl_tail:V \l_tmpa_tl } + \tl_set:Nx \l_tmpb_tl { \tl_tail:V \l_tmpb_tl } + \tl_if_empty:NT \l_tmpb_tl + { \bool_set_true:N \l_tmpa_bool } + } + { \bool_set_true:N \l_tmpa_bool } + } + \exp_args:NNNV + \group_end: + \tl_set:Nn #3 \l_tmpb_tl + } + { \tl_set:Nn #3 { zc@missingproperty } } + } +\cs_generate_variant:Nn \@@_get_endrange_pagecomp:nnN { VVN } +% \end{macrocode} +% +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_get_endrange_pagecomptwo:nnN #1#2#3 + { + \zref@ifrefcontainsprop {#2} { \l_@@_ref_property_tl } + { + \group_begin: + \UseHook { zref-clever/endrange-setup } + \tl_set:Nx \l_tmpa_tl + { + \@@_extract:nnn + {#1} { \l_@@_ref_property_tl } { } + } + \tl_set:Nx \l_tmpb_tl + { + \@@_extract:nnn + {#2} { \l_@@_ref_property_tl } { } + } + \bool_set_false:N \l_tmpa_bool + \@@_is_integer_rgx:VTF \l_tmpa_tl + { + \@@_is_integer_rgx:VF \l_tmpb_tl + { \bool_set_true:N \l_tmpa_bool } + } + { \bool_set_true:N \l_tmpa_bool } + \bool_until_do:Nn \l_tmpa_bool + { + \exp_args:Nxx \tl_if_eq:nnTF + { \tl_head:V \l_tmpa_tl } { \tl_head:V \l_tmpb_tl } + { + \bool_lazy_or:nnTF + { \int_compare_p:nNn { \l_tmpb_tl } > { 99 } } + { \int_compare_p:nNn { \tl_head:V \l_tmpb_tl } = { 0 } } + { + \tl_set:Nx \l_tmpa_tl { \tl_tail:V \l_tmpa_tl } + \tl_set:Nx \l_tmpb_tl { \tl_tail:V \l_tmpb_tl } + } + { \bool_set_true:N \l_tmpa_bool } + } + { \bool_set_true:N \l_tmpa_bool } + } + \exp_args:NNNV + \group_end: + \tl_set:Nn #3 \l_tmpb_tl + } + { \tl_set:Nn #3 { zc@missingproperty } } + } +\cs_generate_variant:Nn \@@_get_endrange_pagecomptwo:nnN { VVN } +% \end{macrocode} +% +% +% +% \subsubsection*{\opt{range} and \opt{rangetopair} options} +% +% The \opt{rangetopair} option is being handled with other reference format +% option booleans at \cs{c_@@_rf_opts_bool_maybe_type_specific_seq}. % % \begin{macrocode} \bool_new:N \l_@@_typeset_range_bool @@ -2753,6 +3431,28 @@ % \end{macrocode} % % +% \subsubsection*{\opt{vario} option} +% +% \begin{macrocode} +\keys_define:nn { zref-clever/reference } + { + vario .code:n = { \RequirePackage { zref-vario } } , + vario .value_forbidden:n = true , + } +\AddToHook { begindocument } + { + \keys_define:nn { zref-clever/reference } + { + vario .code:n = + { + \msg_warning:nnn { zref-clever } + { option-preamble-only } { vario } + } + } + } +% \end{macrocode} +% +% % \subsubsection*{\opt{note} option} % % \begin{macrocode} @@ -3244,6 +3944,7 @@ { \tl_set:Nn \l_@@_setup_type_tl {#1} \keys_set:nn { zref-clever/typesetup } {#2} + \tl_clear:N \l_@@_setup_type_tl } % \end{macrocode} % \end{macro} @@ -3292,6 +3993,118 @@ } \keys_define:nn { zref-clever/typesetup } { + endrange .code:n = + { + \str_case:nnF {#1} + { + { ref } + { + \tl_clear:c + { + \@@_opt_varname_type:enn + { \l_@@_setup_type_tl } { endrangefunc } { tl } + } + \tl_clear:c + { + \@@_opt_varname_type:enn + { \l_@@_setup_type_tl } { endrangeprop } { tl } + } + } + + { stripprefix } + { + \tl_set:cn + { + \@@_opt_varname_type:enn + { \l_@@_setup_type_tl } { endrangefunc } { tl } + } + { @@_get_endrange_stripprefix } + \tl_clear:c + { + \@@_opt_varname_type:enn + { \l_@@_setup_type_tl } { endrangeprop } { tl } + } + } + + { pagecomp } + { + \tl_set:cn + { + \@@_opt_varname_type:enn + { \l_@@_setup_type_tl } { endrangefunc } { tl } + } + { @@_get_endrange_pagecomp } + \tl_clear:c + { + \@@_opt_varname_type:enn + { \l_@@_setup_type_tl } { endrangeprop } { tl } + } + } + + { pagecomp2 } + { + \tl_set:cn + { + \@@_opt_varname_type:enn + { \l_@@_setup_type_tl } { endrangefunc } { tl } + } + { @@_get_endrange_pagecomptwo } + \tl_clear:c + { + \@@_opt_varname_type:enn + { \l_@@_setup_type_tl } { endrangeprop } { tl } + } + } + + { unset } + { + \@@_opt_tl_unset:c + { + \@@_opt_varname_type:enn + { \l_@@_setup_type_tl } { endrangefunc } { tl } + } + \@@_opt_tl_unset:c + { + \@@_opt_varname_type:enn + { \l_@@_setup_type_tl } { endrangeprop } { tl } + } + } + } + { + \tl_if_empty:nTF {#1} + { + \msg_warning:nnn { zref-clever } + { endrange-property-undefined } {#1} + } + { + \zref@ifpropundefined {#1} + { + \msg_warning:nnn { zref-clever } + { endrange-property-undefined } {#1} + } + { + \tl_set:cn + { + \@@_opt_varname_type:enn + { \l_@@_setup_type_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_property } + \tl_set:cn + { + \@@_opt_varname_type:enn + { \l_@@_setup_type_tl } + { endrangeprop } { tl } + } + {#1} + } + } + } + } , + endrange .value_required:n = true , + } +\keys_define:nn { zref-clever/typesetup } + { refpre .code:n = { % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. @@ -3627,6 +4440,247 @@ } \keys_define:nn { zref-clever/langsetup } { + endrange .code:n = + { + \str_case:nnF {#1} + { + { ref } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \tl_gclear:c + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangefunc } { tl } + } + \tl_gclear:c + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangeprop } { tl } + } + } + { + \tl_gclear:c + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangefunc } { tl } + } + \tl_gclear:c + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangeprop } { tl } + } + } + } + + { stripprefix } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \tl_gset:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_stripprefix } + \tl_gclear:c + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangeprop } { tl } + } + } + { + \tl_gset:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_stripprefix } + \tl_gclear:c + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangeprop } { tl } + } + } + } + + { pagecomp } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \tl_gset:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_pagecomp } + \tl_gclear:c + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangeprop } { tl } + } + } + { + \tl_gset:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_pagecomp } + \tl_gclear:c + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangeprop } { tl } + } + } + } + + { pagecomp2 } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \tl_gset:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_pagecomptwo } + \tl_gclear:c + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangeprop } { tl } + } + } + { + \tl_gset:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_pagecomptwo } + \tl_gclear:c + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangeprop } { tl } + } + } + } + + { unset } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \@@_opt_tl_gunset:c + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangefunc } { tl } + } + \@@_opt_tl_gunset:c + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangeprop } { tl } + } + } + { + \@@_opt_tl_gunset:c + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangefunc } { tl } + } + \@@_opt_tl_gunset:c + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangeprop } { tl } + } + } + } + } + { + \tl_if_empty:nTF {#1} + { + \msg_warning:nnn { zref-clever } + { endrange-property-undefined } {#1} + } + { + \zref@ifpropundefined {#1} + { + \msg_warning:nnn { zref-clever } + { endrange-property-undefined } {#1} + } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \tl_gset:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_property } + \tl_gset:cn + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + { endrangeprop } { tl } + } + {#1} + } + { + \tl_gset:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangefunc } { tl } + } + { @@_get_endrange_property } + \tl_gset:cn + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { endrangeprop } { tl } + } + {#1} + } + } + } + } + } , + endrange .value_required:n = true , + } +\keys_define:nn { zref-clever/langsetup } + { refpre .code:n = { % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. @@ -4207,7 +5261,7 @@ \bool_set_false:N \l_@@_sort_decided_bool % First we check if there's any "external document" difference (coming - % from 'zref-xr') and, if so, sort based on that. + % from `zref-xr') and, if so, sort based on that. \tl_if_eq:NNF \l_@@_label_extdoc_a_tl \l_@@_label_extdoc_b_tl @@ -4589,6 +5643,8 @@ % \l_@@_range_count_int , % \l_@@_range_same_count_int , % \l_@@_range_beg_label_tl , +% \l_@@_range_beg_is_first_bool , +% \l_@@_range_end_ref_tl , % \l_@@_next_maybe_range_bool , % \l_@@_next_is_same_bool , % } @@ -4597,6 +5653,8 @@ \int_new:N \l_@@_range_count_int \int_new:N \l_@@_range_same_count_int \tl_new:N \l_@@_range_beg_label_tl +\bool_new:N \l_@@_range_beg_is_first_bool +\tl_new:N \l_@@_range_end_ref_tl \bool_new:N \l_@@_next_maybe_range_bool \bool_new:N \l_@@_next_is_same_bool % \end{macrocode} @@ -4614,8 +5672,11 @@ % \l_@@_rangesep_tl , % \l_@@_namefont_tl , % \l_@@_reffont_tl , +% \l_@@_endrangefunc_tl , +% \l_@@_endrangeprop_tl , % \l_@@_cap_bool , % \l_@@_abbrev_bool , +% \l_@@_rangetopair_bool , % } % Auxiliary variables for \cs{@@_typeset_refs:} separators, and font and % other options. @@ -4630,8 +5691,11 @@ \tl_new:N \l_@@_rangesep_tl \tl_new:N \l_@@_namefont_tl \tl_new:N \l_@@_reffont_tl +\tl_new:N \l_@@_endrangefunc_tl +\tl_new:N \l_@@_endrangeprop_tl \bool_new:N \l_@@_cap_bool \bool_new:N \l_@@_abbrev_bool +\bool_new:N \l_@@_rangetopair_bool % \end{macrocode} % \end{macro} % @@ -4692,11 +5756,13 @@ \tl_clear:N \l_@@_type_first_label_tl \tl_clear:N \l_@@_type_first_label_type_tl \tl_clear:N \l_@@_range_beg_label_tl + \tl_clear:N \l_@@_range_end_ref_tl \int_zero:N \l_@@_label_count_int \int_zero:N \l_@@_type_count_int \int_zero:N \l_@@_ref_count_int \int_zero:N \l_@@_range_count_int \int_zero:N \l_@@_range_same_count_int + \bool_set_false:N \l_@@_range_beg_is_first_bool \bool_set_false:N \l_@@_type_first_refbounds_set_bool % Get type block options (not type-specific). @@ -4771,9 +5837,9 @@ } % Handle warnings in case of reference or type undefined. - % Test: 'zc-typeset01.lvt': "Typeset refs: warn ref undefined" + % Test: `zc-typeset01.lvt': "Typeset refs: warn ref undefined" \zref@refused { \l_@@_label_a_tl } - % Test: 'zc-typeset01.lvt': "Typeset refs: warn missing type" + % Test: `zc-typeset01.lvt': "Typeset refs: warn missing type" \zref@ifrefundefined { \l_@@_label_a_tl } {} { @@ -4825,6 +5891,14 @@ { \l_@@_label_type_a_tl } { \l_@@_ref_language_tl } \l_@@_reffont_tl + \@@_get_rf_opt_tl:nxxN { endrangefunc } + { \l_@@_label_type_a_tl } + { \l_@@_ref_language_tl } + \l_@@_endrangefunc_tl + \@@_get_rf_opt_tl:nxxN { endrangeprop } + { \l_@@_label_type_a_tl } + { \l_@@_ref_language_tl } + \l_@@_endrangeprop_tl \@@_get_rf_opt_bool:nnxxN { cap } { false } { \l_@@_label_type_a_tl } { \l_@@_ref_language_tl } @@ -4833,6 +5907,10 @@ { \l_@@_label_type_a_tl } { \l_@@_ref_language_tl } \l_@@_abbrev_bool + \@@_get_rf_opt_bool:nnxxN { rangetopair } { true } + { \l_@@_label_type_a_tl } + { \l_@@_ref_language_tl } + \l_@@_rangetopair_bool \@@_get_rf_opt_seq:nxxN { refbounds-first } { \l_@@_label_type_a_tl } { \l_@@_ref_language_tl } @@ -4910,7 +5988,7 @@ { % It is the last label of its type, but also the first one, and that's % what matters here: just store it. - % Test: 'zc-typeset01.lvt': "Last of type: single" + % Test: `zc-typeset01.lvt': "Last of type: single" { 0 } { \tl_set:NV \l_@@_type_first_label_tl @@ -4923,7 +6001,7 @@ } % The last is the second: we have a pair (if not repeated). - % Test: 'zc-typeset01.lvt': "Last of type: pair" + % Test: `zc-typeset01.lvt': "Last of type: pair" { 1 } { \int_compare:nNnTF { \l_@@_range_same_count_int } = { 1 } @@ -4951,7 +6029,7 @@ \int_case:nnF { \l_@@_range_count_int } { % There was no range going on. - % Test: 'zc-typeset01.lvt': "Last of type: not range" + % Test: `zc-typeset01.lvt': "Last of type: not range" { 0 } { \int_compare:nNnTF { \l_@@_ref_count_int } < { 2 } @@ -4973,15 +6051,15 @@ } } % Last in the range is also the second in it. - % Test: 'zc-typeset01.lvt': "Last of type: pair in sequence" + % Test: `zc-typeset01.lvt': "Last of type: pair in sequence" { 1 } { \int_compare:nNnTF { \l_@@_range_same_count_int } = { 1 } { - % We know `range_beg_label' is not empty, since this is the - % second element in the range, but the third or more in the - % type list. + % We know `range_beg_is_first_bool' is false, since this is + % the second element in the range, but the third or more in + % the type list. \tl_put_right:Nx \l_@@_typeset_queue_curr_tl { \exp_not:V \l_@@_pairsep_tl @@ -5017,13 +6095,13 @@ } { % Repetition, not a range. - % Test: 'zc-typeset01.lvt': "Last of type: range to one" + % Test: `zc-typeset01.lvt': "Last of type: range to one" { 0 } { - % If `range_beg_label' is empty, it means it was also the - % first of the type, and hence its typesetting was already - % handled, and we just have to set refbounds. - \tl_if_empty:VTF \l_@@_range_beg_label_tl + % If `range_beg_is_first_bool' is true, it means it was also + % the first of the type, and hence its typesetting was + % already handled, and we just have to set refbounds. + \bool_if:NTF \l_@@_range_beg_is_first_bool { \seq_set_eq:NN \l_@@_type_first_refbounds_seq \l_@@_refbounds_first_sg_seq @@ -5055,11 +6133,11 @@ } % A `range', but with no skipped value, treat as pair if range % started with first of type, otherwise as list. - % Test: 'zc-typeset01.lvt': "Last of type: range to pair" + % Test: `zc-typeset01.lvt': "Last of type: range to pair" { 1 } { % Ditto. - \tl_if_empty:VTF \l_@@_range_beg_label_tl + \bool_if:NTF \l_@@_range_beg_is_first_bool { \seq_set_eq:NN \l_@@_type_first_refbounds_seq \l_@@_refbounds_first_pb_seq @@ -5091,9 +6169,9 @@ } { % An actual range. - % Test: 'zc-typeset01.lvt': "Last of type: range" + % Test: `zc-typeset01.lvt': "Last of type: range" % Ditto. - \tl_if_empty:VTF \l_@@_range_beg_label_tl + \bool_if:NTF \l_@@_range_beg_is_first_bool { \seq_set_eq:NN \l_@@_type_first_refbounds_seq \l_@@_refbounds_first_rb_seq @@ -5127,11 +6205,30 @@ } } } - \tl_put_right:Nx \l_@@_typeset_queue_curr_tl + \bool_lazy_and:nnTF + { ! \tl_if_empty_p:N \l_@@_endrangefunc_tl } + { \cs_if_exist_p:c { \l_@@_endrangefunc_tl :VVN } } { - \exp_not:V \l_@@_rangesep_tl - \@@_get_ref:VN \l_@@_label_a_tl - \l_@@_refbounds_last_re_seq + \use:c { \l_@@_endrangefunc_tl :VVN } + \l_@@_range_beg_label_tl + \l_@@_label_a_tl + \l_@@_range_end_ref_tl + \tl_put_right:Nx \l_@@_typeset_queue_curr_tl + { + \exp_not:V \l_@@_rangesep_tl + \@@_get_ref_endrange:VVN + \l_@@_label_a_tl + \l_@@_range_end_ref_tl + \l_@@_refbounds_last_re_seq + } + } + { + \tl_put_right:Nx \l_@@_typeset_queue_curr_tl + { + \exp_not:V \l_@@_rangesep_tl + \@@_get_ref:VN \l_@@_label_a_tl + \l_@@_refbounds_last_re_seq + } } } } @@ -5154,15 +6251,18 @@ } { \bool_set_false:N \l_@@_next_maybe_range_bool - \zref@ifrefundefined { \l_@@_type_first_label_tl } - { } + \bool_if:NT \l_@@_rangetopair_bool { - \@@_labels_in_sequence:nn - { \l_@@_type_first_label_tl } - { \l_@@_label_a_tl } + \zref@ifrefundefined { \l_@@_type_first_label_tl } + { } + { + \@@_labels_in_sequence:nn + { \l_@@_type_first_label_tl } + { \l_@@_label_a_tl } + } } - % Test: 'zc-typeset01.lvt': "Last of type: option range" - % Test: 'zc-typeset01.lvt': "Last of type: option range to pair" + % Test: `zc-typeset01.lvt': "Last of type: option range" + % Test: `zc-typeset01.lvt': "Last of type: option range to pair" \bool_if:NTF \l_@@_next_maybe_range_bool { \tl_set:Nx \l_@@_typeset_queue_curr_tl @@ -5176,11 +6276,34 @@ \bool_set_true:N \l_@@_type_first_refbounds_set_bool } { - \tl_set:Nx \l_@@_typeset_queue_curr_tl + \bool_lazy_and:nnTF + { ! \tl_if_empty_p:N \l_@@_endrangefunc_tl } + { \cs_if_exist_p:c { \l_@@_endrangefunc_tl :VVN } } { - \exp_not:V \l_@@_rangesep_tl - \@@_get_ref:VN \l_@@_label_a_tl - \l_@@_refbounds_last_re_seq + % We must get `type_first_label_tl' instead of + % `range_beg_label_tl' here, since it is not necessary + % that the first of type was actually starting a range for + % the `range' option to be used. + \use:c { \l_@@_endrangefunc_tl :VVN } + \l_@@_type_first_label_tl + \l_@@_label_a_tl + \l_@@_range_end_ref_tl + \tl_set:Nx \l_@@_typeset_queue_curr_tl + { + \exp_not:V \l_@@_rangesep_tl + \@@_get_ref_endrange:VVN + \l_@@_label_a_tl + \l_@@_range_end_ref_tl + \l_@@_refbounds_last_re_seq + } + } + { + \tl_set:Nx \l_@@_typeset_queue_curr_tl + { + \exp_not:V \l_@@_rangesep_tl + \@@_get_ref:VN \l_@@_label_a_tl + \l_@@_refbounds_last_re_seq + } } \seq_set_eq:NN \l_@@_type_first_refbounds_seq \l_@@_refbounds_first_rb_seq @@ -5210,7 +6333,7 @@ { \bool_if:NTF \l_@@_typeset_ref_bool { - % Test: 'zc-typeset01.lvt': "Last of type: option typeset ref" + % Test: `zc-typeset01.lvt': "Last of type: option typeset ref" \tl_put_left:Nx \l_@@_typeset_queue_curr_tl { \@@_get_ref:VN \l_@@_type_first_label_tl @@ -5220,14 +6343,14 @@ { \bool_if:NTF \l_@@_typeset_name_bool { - % Test: 'zc-typeset01.lvt': "Last of type: option typeset name" + % Test: `zc-typeset01.lvt': "Last of type: option typeset name" \tl_set:Nx \l_@@_typeset_queue_curr_tl { \bool_if:NTF \l_@@_name_in_link_bool { \exp_not:N \group_begin: \exp_not:V \l_@@_namefont_tl - % It's two '@s', but escaped for DocStrip. + % It's two `@s', but escaped for DocStrip. \exp_not:N \hyper@@@@link { \@@_extract_url_unexp:V @@ -5254,7 +6377,7 @@ % it should not occur, given that the options are set up to % typeset either "ref" or "name". Still, leave here a % sensible fallback, equal to the behavior of "both". - % Test: 'zc-typeset01.lvt': "Last of type: option typeset none" + % Test: `zc-typeset01.lvt': "Last of type: option typeset none" \tl_put_left:Nx \l_@@_typeset_queue_curr_tl { \@@_get_ref_first: } } @@ -5280,11 +6403,11 @@ \int_case:nnF { \l_@@_type_count_int } { % Single type. - % Test: 'zc-typeset01.lvt': "Last of type: single type" + % Test: `zc-typeset01.lvt': "Last of type: single type" { 0 } { \l_@@_typeset_queue_curr_tl } % Pair of types. - % Test: 'zc-typeset01.lvt': "Last of type: pair of types" + % Test: `zc-typeset01.lvt': "Last of type: pair of types" { 1 } { \l_@@_tpairsep_tl @@ -5293,7 +6416,7 @@ } { % Last in list of types. - % Test: 'zc-typeset01.lvt': "Last of type: list of types" + % Test: `zc-typeset01.lvt': "Last of type: list of types" \l_@@_tlastsep_tl \l_@@_typeset_queue_curr_tl } @@ -5314,11 +6437,13 @@ \tl_clear:N \l_@@_type_first_label_tl \tl_clear:N \l_@@_type_first_label_type_tl \tl_clear:N \l_@@_range_beg_label_tl + \tl_clear:N \l_@@_range_end_ref_tl \int_zero:N \l_@@_label_count_int \int_zero:N \l_@@_ref_count_int \int_incr:N \l_@@_type_count_int \int_zero:N \l_@@_range_count_int \int_zero:N \l_@@_range_same_count_int + \bool_set_false:N \l_@@_range_beg_is_first_bool \bool_set_false:N \l_@@_type_first_refbounds_set_bool } } @@ -5356,13 +6481,16 @@ \l_@@_label_type_a_tl \int_incr:N \l_@@_ref_count_int - % If the next label may be part of a range, we set `range_beg_label' - % to "empty" (we deal with it as the "first", and must do it there, to - % handle hyperlinking), but also step the range counters. - % Test: 'zc-typeset01.lvt': "Not last of type: first is range" + % If the next label may be part of a range, signal it (we deal with it + % as the "first", and must do it there, to handle hyperlinking), but + % also step the range counters. + % Test: `zc-typeset01.lvt': "Not last of type: first is range" \bool_if:NT \l_@@_next_maybe_range_bool { - \tl_clear:N \l_@@_range_beg_label_tl + \bool_set_true:N \l_@@_range_beg_is_first_bool + \tl_set:NV \l_@@_range_beg_label_tl + \l_@@_label_a_tl + \tl_clear:N \l_@@_range_end_ref_tl \int_incr:N \l_@@_range_count_int \bool_if:NT \l_@@_next_is_same_bool { \int_incr:N \l_@@_range_same_count_int } @@ -5379,6 +6507,7 @@ % There was no range going, we are starting one. \tl_set:NV \l_@@_range_beg_label_tl \l_@@_label_a_tl + \tl_clear:N \l_@@_range_end_ref_tl \int_incr:N \l_@@_range_count_int \bool_if:NT \l_@@_next_is_same_bool { \int_incr:N \l_@@_range_same_count_int } @@ -5396,7 +6525,7 @@ \int_case:nnF { \l_@@_range_count_int } { % There was no range going on. - % Test: 'zc-typeset01.lvt': "Not last of type: no range" + % Test: `zc-typeset01.lvt': "Not last of type: no range" { 0 } { \int_incr:N \l_@@_ref_count_int @@ -5410,11 +6539,11 @@ % Last is second in the range: if `range_same_count' is also % `1', it's a repetition (drop it), otherwise, it's a "pair % within a list", treat as list. - % Test: 'zc-typeset01.lvt': "Not last of type: range pair to one" - % Test: 'zc-typeset01.lvt': "Not last of type: range pair" + % Test: `zc-typeset01.lvt': "Not last of type: range pair to one" + % Test: `zc-typeset01.lvt': "Not last of type: range pair" { 1 } { - \tl_if_empty:VTF \l_@@_range_beg_label_tl + \bool_if:NTF \l_@@_range_beg_is_first_bool { \seq_set_eq:NN \l_@@_type_first_refbounds_seq \l_@@_refbounds_first_seq @@ -5456,10 +6585,10 @@ \l_@@_range_same_count_int } { - % Test: 'zc-typeset01.lvt': "Not last of type: range to one" + % Test: `zc-typeset01.lvt': "Not last of type: range to one" { 0 } { - \tl_if_empty:VTF \l_@@_range_beg_label_tl + \bool_if:NTF \l_@@_range_beg_is_first_bool { \seq_set_eq:NN \l_@@_type_first_refbounds_seq @@ -5478,10 +6607,10 @@ } } } - % Test: 'zc-typeset01.lvt': "Not last of type: range to pair" + % Test: `zc-typeset01.lvt': "Not last of type: range to pair" { 1 } { - \tl_if_empty:VTF \l_@@_range_beg_label_tl + \bool_if:NTF \l_@@_range_beg_is_first_bool { \seq_set_eq:NN \l_@@_type_first_refbounds_seq @@ -5509,8 +6638,8 @@ } } { - % Test: 'zc-typeset01.lvt': "Not last of type: range" - \tl_if_empty:VTF \l_@@_range_beg_label_tl + % Test: `zc-typeset01.lvt': "Not last of type: range" + \bool_if:NTF \l_@@_range_beg_is_first_bool { \seq_set_eq:NN \l_@@_type_first_refbounds_seq @@ -5529,15 +6658,34 @@ } } % For the purposes of the serial comma, and thus for the - % distinction of 'lastsep' and 'pairsep', a "range" counts - % as one. Since 'range_beg' has already been counted + % distinction of `lastsep' and `pairsep', a "range" counts + % as one. Since `range_beg' has already been counted % (here or with the first of type), we refrain from - % incrementing 'ref_count_int'. - \tl_put_right:Nx \l_@@_typeset_queue_curr_tl + % incrementing `ref_count_int'. + \bool_lazy_and:nnTF + { ! \tl_if_empty_p:N \l_@@_endrangefunc_tl } + { \cs_if_exist_p:c { \l_@@_endrangefunc_tl :VVN } } { - \exp_not:V \l_@@_rangesep_tl - \@@_get_ref:VN \l_@@_label_a_tl - \l_@@_refbounds_mid_re_seq + \use:c { \l_@@_endrangefunc_tl :VVN } + \l_@@_range_beg_label_tl + \l_@@_label_a_tl + \l_@@_range_end_ref_tl + \tl_put_right:Nx \l_@@_typeset_queue_curr_tl + { + \exp_not:V \l_@@_rangesep_tl + \@@_get_ref_endrange:VVN + \l_@@_label_a_tl + \l_@@_range_end_ref_tl + \l_@@_refbounds_mid_re_seq + } + } + { + \tl_put_right:Nx \l_@@_typeset_queue_curr_tl + { + \exp_not:V \l_@@_rangesep_tl + \@@_get_ref:VN \l_@@_label_a_tl + \l_@@_refbounds_mid_re_seq + } } } } @@ -5599,7 +6747,8 @@ % \begin{macro}{\@@_get_ref:nN} % Handles a complete reference block to be accumulated in the ``queue'', % including refbounds, and hyperlinking. For use with all labels, except -% the first of its type, which is done by \cs{@@_get_ref_first:}. +% the first of its type, which is done by \cs{@@_get_ref_first:}, and the +% last of a range, which is done by \cs{@@_get_ref_endrange:nnN}. % \begin{syntax} % \cs{@@_get_ref:nN} \Arg{label} \Arg{refbounds} % \end{syntax} @@ -5648,6 +6797,53 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_get_ref_endrange:nnN} +% \begin{syntax} +% \cs{@@_get_ref_endrange:nnN} \Arg{label} \Arg{reference} \Arg{refbounds} +% \end{syntax} +% \begin{macrocode} +\cs_new:Npn \@@_get_ref_endrange:nnN #1#2#3 + { + \str_if_eq:nnTF {#2} { zc@missingproperty } + { \@@_ref_default: } + { + \bool_if:nTF + { + \l_@@_hyperlink_bool && + ! \l_@@_link_star_bool + } + { + \exp_not:N \group_begin: + \exp_not:V \l_@@_reffont_tl + \seq_item:Nn #3 { 1 } + % It's two `@s', but escaped for DocStrip. + \exp_not:N \hyper@@@@link + { \@@_extract_url_unexp:n {#1} } + { \@@_extract_unexp:nnn {#1} { anchor } { } } + { + \seq_item:Nn #3 { 2 } + \exp_not:n {#2} + \seq_item:Nn #3 { 3 } + } + \seq_item:Nn #3 { 4 } + \exp_not:N \group_end: + } + { + \exp_not:N \group_begin: + \exp_not:V \l_@@_reffont_tl + \seq_item:Nn #3 { 1 } + \seq_item:Nn #3 { 2 } + \exp_not:n {#2} + \seq_item:Nn #3 { 3 } + \seq_item:Nn #3 { 4 } + \exp_not:N \group_end: + } + } + } +\cs_generate_variant:Nn \@@_get_ref_endrange:nnN { VVN } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_get_ref_first:} % Handles a complete reference block for the first label of its type to be % accumulated in the ``queue'', including ``pre'' and ``pos'' elements, @@ -5738,7 +6934,7 @@ \exp_not:V \l_@@_reffont_tl \seq_item:Nn \l_@@_type_first_refbounds_seq { 1 } - % It's two '@s', but escaped for DocStrip. + % It's two `@s', but escaped for DocStrip. \exp_not:N \hyper@@@@link { \@@_extract_url_unexp:V @@ -6071,14 +7267,9 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_labels_in_sequence:nn #1#2 { - \@@_extract_default:Nnnn \l_@@_label_extdoc_a_tl - {#1} { externaldocument } { } - \@@_extract_default:Nnnn \l_@@_label_extdoc_b_tl - {#2} { externaldocument } { } - - \tl_if_eq:NNT - \l_@@_label_extdoc_a_tl - \l_@@_label_extdoc_b_tl + \exp_args:Nxx \tl_if_eq:nnT + { \@@_extract_unexp:nnn {#1} { externaldocument } { } } + { \@@_extract_unexp:nnn {#2} { externaldocument } { } } { \tl_if_eq:NnTF \l_@@_ref_property_tl { page } { @@ -6123,8 +7314,14 @@ = { \@@_extract:nnn {#2} { zc@cntval } { -1 } } { - \bool_set_true:N - \l_@@_next_maybe_range_bool +% \end{macrocode} +% If \texttt{zc@counter}s are equal, \texttt{zc@enclval}s are equal, and +% \texttt{zc@enclval}s are equal, but the references themselves are different, +% this means that \cs{@currentlabel} has somehow been set manually (e.g. by an +% \pkg{amsmath}'s \cs{tag}), in which case we have no idea what's in there, +% and we should not even consider this is still a range. If they are equal, +% though, of course it is a range, and it is the same. +% \begin{macrocode} \exp_args:Nxx \tl_if_eq:nnT { \@@_extract_unexp:nvn {#1} @@ -6136,6 +7333,8 @@ } { \bool_set_true:N + \l_@@_next_maybe_range_bool + \bool_set_true:N \l_@@_next_is_same_bool } } @@ -6720,9 +7919,10 @@ % and subsequent discussion. So, for \env{subequations}, we really must % specify manually \opt{currentcounter} and the resetting. Note that, for % \env{subequations}, \cs{zlabel} works just fine (that is, if given -% immediately after \texttt{\\begin\{subequations\}}, to refer to the -% parent equation). +% immediately after \texttt{\textbackslash{}begin\{subequations\}}, to refer +% to the parent equation). % \begin{macrocode} + \bool_new:N \l_@@_amsmath_subequations_bool \AddToHook { env / subequations / begin } { \@@_zcsetup:x @@ -6736,6 +7936,7 @@ currentcounter = parentequation , countertype = { parentequation = equation } , } + \bool_set_true:N \l_@@_amsmath_subequations_bool } % \end{macrocode} % \pkg{amsmath} does use \cs{refstepcounter} for the \texttt{equation} counter @@ -6750,8 +7951,12 @@ % environments ``must appear within an enclosing math environment''. Same % logic applies to other environments defined or redefined by the package, % like \env{array}, \env{matrix} and variations. Finally, \env{split} too can -% only be used as part of another environment. +% only be used as part of another environment. We also arrange, at this +% point, for the provision of the \texttt{subeq} property, for the convenience +% of referring to them directly or to build terse ranges with the +% \opt{endrange} option. % \begin{macrocode} + \zref@newprop { subeq } { \alph { equation } } \clist_map_inline:nn { equation , @@ -6771,7 +7976,11 @@ } { \AddToHook { env / #1 / begin } - { \@@_zcsetup:n { currentcounter = equation } } + { + \@@_zcsetup:n { currentcounter = equation } + \bool_if:NT \l_@@_amsmath_subequations_bool + { \zref@localaddprop \ZREF@mainlist { subeq } } + } } % \end{macrocode} % And a last touch of care for \pkg{amsmath}'s refinements: make the equation @@ -6867,6 +8076,7 @@ % for incrementing the equation counters (see % \url{https://tex.stackexchange.com/a/241150}). % \begin{macrocode} + \bool_new:N \l_@@_breqn_dgroup_bool \AddToHook { env / dgroup / begin } { \@@_zcsetup:x @@ -6880,7 +8090,11 @@ currentcounter = parentequation , countertype = { parentequation = equation } , } + \bool_set_true:N \l_@@_breqn_dgroup_bool } + \zref@ifpropundefined { subeq } + { \zref@newprop { subeq } { \alph { equation } } } + { } \clist_map_inline:nn { dmath , @@ -6889,7 +8103,11 @@ } { \AddToHook { env / #1 / begin } - { \@@_zcsetup:n { currentcounter = equation } } + { + \@@_zcsetup:n { currentcounter = equation } + \bool_if:NT \l_@@_breqn_dgroup_bool + { \zref@localaddprop \ZREF@mainlist { subeq } } + } } \msg_info:nnn { zref-clever } { compat-package } { breqn } } @@ -7154,6 +8372,7 @@ type = page , Name-pl = Pages , name-pl = pages , rangesep = {\textendash} , + rangetopair = false , type = line , Name-sg = Line , @@ -7436,6 +8655,7 @@ type = page , Name-sg = Seite , Name-pl = Seiten , rangesep = {\textendash} , + rangetopair = false , type = line , gender = f , @@ -7853,6 +9073,7 @@ type = page , Name-pl = Pages , name-pl = pages , rangesep = {-} , + rangetopair = false , type = line , gender = f , @@ -8094,6 +9315,7 @@ type = page , Name-pl = Páginas , name-pl = páginas , rangesep = {\textendash} , + rangetopair = false , type = line , gender = f , @@ -8333,6 +9555,7 @@ type = page , Name-pl = Páginas , name-pl = páginas , rangesep = {\textendash} , + rangetopair = false , type = line , gender = f , @@ -8566,6 +9789,7 @@ type = page , Name-pl = Pagina's , name-pl = pagina's , rangesep = {\textendash} , + rangetopair = false , type = line , gender = m , diff --git a/macros/latex/contrib/zref-clever/zref-clever.pdf b/macros/latex/contrib/zref-clever/zref-clever.pdf Binary files differindex 99292b0570..f623839df6 100644 --- a/macros/latex/contrib/zref-clever/zref-clever.pdf +++ b/macros/latex/contrib/zref-clever/zref-clever.pdf diff --git a/macros/latex/contrib/zref-clever/zref-clever.tex b/macros/latex/contrib/zref-clever/zref-clever.tex index 64d5028f62..3079e6384a 100644 --- a/macros/latex/contrib/zref-clever/zref-clever.tex +++ b/macros/latex/contrib/zref-clever/zref-clever.tex @@ -105,6 +105,11 @@ zcLanguageSetup, zcRefTypeSetup, zcheck, + zvref, + zvpageref, + zvrefrange, + zvpagerefrange, + zfullref, } } \lstset{ @@ -266,14 +271,14 @@ as the main entrance for reference making, whose behavior can be modulated by local options. Considering that \pkg{zref} itself offers the \pkg{zref-titleref} module, and -that the integration with \pkg{zref-check} allows \pkg{zref-clever} to make -context sensitive references, a significant part of the most prominent -automation features available to the standard referencing system is thus -brought to \pkg{zref}, working under a single consistent underlying -infrastructure and user interface. There are some limitations, of course (see -\zcref{sec:limitations}), and it may be your cup of tea or not. Still, all in -all, hopefully \pkg{zref-clever} can make \pkg{zref} more accessible, and -interesting, to the average user. +that \pkg{zref-vario} offers integration of \pkg{zref-clever} with +\pkg{varioref}, a significant part of the most prominent automation features +available to the standard referencing system is thus brought to \pkg{zref}, +working under a single consistent underlying infrastructure and user +interface. Alas, there are some limitations (see \zcref{sec:limitations}), +and it may be your cup of tea or not. Still, all in all, hopefully +\pkg{zref-clever} can make \pkg{zref} more accessible to the average user, and +more interesting to users in general. \section{Warning} @@ -501,7 +506,43 @@ and defaults to \texttt{true}. The \opt{nocomp} option is a convenience alias for \texttt{comp=false}. Of course, for better compression results the \opt{sort} is recommended, but the two options are technically independent. +\DescribeOption{endrange} % +The \opt{endrange} option provides additional control over how the end +reference of a range is typeset, so as to achieve terse ranges. The option +can operate in two technically different ways. It may receive one of a number +of predefined values, which can process the end reference of the range, +comparing it with the beginning reference, to achieve a given end +result.\footnote{For the \TeX{}nically inclined: those values that perform + some processing -- namely \texttt{stripprefix}, \texttt{pagecomp}, and + \texttt{pagecomp2} -- fully expand the references (\texttt{x}-type + expansion) before comparing them, since it makes sense to perform this task + as close as possible to the printed representation of the references. I + don't expect this to be a problem in normal use cases, but it does represent + a limitation on what the references can contain. In case some control over + this is needed, check the \texttt{zref-clever/endrange-setup} hook in the + code documentation.} Or, it can specify a label property to be used +directly, without any processing. The available predefined values are: +\texttt{ref}, \texttt{stripprefix}, \texttt{pagecomp}, and \texttt{pagecomp2}. +\texttt{ref} corresponds to the default behavior, and instructs \cs{zcref} to +use whatever property was set at the \opt{ref} option for the end of range +reference. \texttt{stripprefix} strips the common part at the start of each +reference from the end one. \texttt{pagecomp} is the equivalent of +\texttt{stripprefix} for page numbers, it does the same thing, but only if the +references are comprised exclusively of Arabic numerals. \texttt{pagecomp2} +is a variant of \texttt{pagecomp} that leaves at least two digits at the end +reference (except for a leading zero). If values other than the predefined +ones are given to \opt{endrange} they are considered as label properties, as +long as they are declared. This property is used to typeset the end of range +reference if the label contains it, and if both references would be +``compressible'' according to the \opt{comp} option, otherwise the property +specified by the \opt{ref} option is used. This is useful for things like +sub-elements for which we can build a proper abbreviated sub-reference and +populate the label with it (some compatibility modules already provide a +number of such properties, but other ones can be built with \pkg{zref}, as +needed). + \DescribeOption{range} % +\DescribeOption{rangetopair} % By default (that is, when the \opt{range} option is not given), \cs{zcref} typesets a complete list of references according to the \meta{labels} it received as argument, and only compresses some of them into ranges if the @@ -510,12 +551,14 @@ immediate sequence. The \opt{range} option makes \cs{zcref} behave differently. Sorting is implied by this option (the \opt{sort} option is disregarded) and, for each reference type group in \meta{labels}, \cs{zcref} builds a range from the first to the last reference in it, even if references -in between do not occur in immediate sequence. \cs{zcref} is smart enough, -though, to recognize when the first and last references of a type do happen to -be contiguous, in which case it typesets a ``pair'', instead of a ``range''. -It is a boolean option, and the package's default is \texttt{range=false}. -The option given without a value is equivalent to \texttt{range=true} (in the -\pkg{l3keys}' jargon, the \emph{option}'s default is \texttt{true}). +in between do not occur in immediate sequence. It is a boolean option, and +the package's default is \texttt{range=false}. The option given without a +value is equivalent to \texttt{range=true} (in the \pkg{l3keys}' jargon, the +\emph{option}'s default is \texttt{true}). \cs{zcref} is smart enough to +recognize when the first and last references of a type do happen to be +contiguous, in which case it typesets a ``pair'', instead of a ``range''. But +this behavior can be disabled by setting the \opt{rangetopair} option to +\texttt{false}. \DescribeOption{cap} % \DescribeOption{nocap} % @@ -666,8 +709,14 @@ means this option \emph{can't} be set at load time, as a package option. If you want to set it globally, use \cs{zcsetup} instead. \DescribeOption{titleref} % +\DescribeOption{vario} % The \opt{titleref} option receives no value and, when given, loads -\pkg{zref}'s \pkg{zref-titleref} module. This is a preamble only option. +\pkg{zref}'s \pkg{zref-titleref} module. Similarly, the \opt{vario} option +loads the \pkg{zref-vario} package. These are a preamble only options. Note +that \pkg{zref-vario} loads \pkg{varioref}, which has known load order +interaction with other packages, prominently with \pkg{hyperref}. Hence, +depending on your document, you may wish to load \pkg{zref-vario} separately, +instead of through the option. \DescribeOption{note} % The \opt{note} option receives as value some text to be typeset at the end of @@ -847,7 +896,7 @@ the \cs{appendix}. One more observation about ``reference types'' is due here. A \emph{type} is not really ``defined'' in the sense a variable or a function is. It is more -of a ``string'' which \pkg{zref-clever} uses to look for a whole set of +of a ``name'' which \pkg{zref-clever} uses to look for a whole set of type-specific reference format options (see \zcref{sec:reference-format}). Each of these options individually may be ``set'' or not, ``defined'' or not. And, depending on the setup and the relevant precedence rules for this, some @@ -908,42 +957,44 @@ more detail soon, and lists the scopes in which each is available. \centering \begin{tabular}{l>{\ttfamily}lcccc} \toprule - & & General & Type & \multicolumn{2}{c}{Language} \\ - \cmidrule(lr){5-6} - & & & & Type & Default \\ - & & (i) & (ii) & (iii) & (iv) \\ + & & General & Type & \multicolumn{2}{c}{Language} \\ + \cmidrule(lr){5-6} + & & & & Type & Default \\ + & & (i) & (ii) & (iii) & (iv) \\ \midrule - Typesetting & tpairsep & $\bullet$ & & & $\bullet$ \\ - (necessarily not & tlistsep & $\bullet$ & & & $\bullet$ \\ - type-specific) & tlastsep & $\bullet$ & & & $\bullet$ \\ - & notesep & $\bullet$ & & & $\bullet$ \\ + Typesetting & tpairsep & $\bullet$ & & & $\bullet$ \\ + (necessarily not & tlistsep & $\bullet$ & & & $\bullet$ \\ + type-specific) & tlastsep & $\bullet$ & & & $\bullet$ \\ + & notesep & $\bullet$ & & & $\bullet$ \\ \addlinespace - Typesetting & namesep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - (possibly & pairsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - type-specific) & listsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - & lastsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - & rangesep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - & refbounds & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + Typesetting & namesep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + (possibly & pairsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + type-specific) & listsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + & lastsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + & rangesep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + & refbounds & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ \addlinespace - Typesetting & Name-sg & & $\bullet$ & $\bullet$ & \\ - (necessarily & name-sg & & $\bullet$ & $\bullet$ & \\ - type-specific) & Name-pl & & $\bullet$ & $\bullet$ & \\ - & name-pl & & $\bullet$ & $\bullet$ & \\ - & Name-sg-ab & & $\bullet$ & $\bullet$ & \\ - & name-sg-ab & & $\bullet$ & $\bullet$ & \\ - & Name-pl-ab & & $\bullet$ & $\bullet$ & \\ - & name-pl-ab & & $\bullet$ & $\bullet$ & \\ + Typesetting & Name-sg & & $\bullet$ & $\bullet$ & \\ + (necessarily & name-sg & & $\bullet$ & $\bullet$ & \\ + type-specific) & Name-pl & & $\bullet$ & $\bullet$ & \\ + & name-pl & & $\bullet$ & $\bullet$ & \\ + & Name-sg-ab & & $\bullet$ & $\bullet$ & \\ + & name-sg-ab & & $\bullet$ & $\bullet$ & \\ + & Name-pl-ab & & $\bullet$ & $\bullet$ & \\ + & name-pl-ab & & $\bullet$ & $\bullet$ & \\ \addlinespace - Font & namefont & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - & reffont & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + Font & namefont & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + & reffont & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ \addlinespace - Other & cap & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - & abbrev & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + Other & cap & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + & abbrev & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + & endrange & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + & rangetopair & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ \bottomrule \end{tabular} \caption{Reference format options and their scopes} @@ -1490,71 +1541,40 @@ set around a cross-reference ``task'' we'd like to perform with \pkg{zref-clever}. -\subsection{Context sensitive page references} +\subsection{Extended page references (\pkg{varioref})} \zctask{Make cross-references to pages which are sensitive to the relative - position between the reference and the label being referred to.} - -It is frequently useful to make a reference to both a document element and its -page. For example: -\begin{zcexample} -\zcref{fig:1} on \zcpageref{fig:1} -\end{zcexample} - -However, while this works well when the object and the reference are somewhat -distant, we may want to adjust this to something different when the label and -the reference are close to each other. If both are on the same page, we may -want to drop the \cs{zcpageref}, or replace it with ``above'' or ``below''. -And, if both are on contiguous pages, then something like ``on the following -page'' or ``on the preceding page'' may be preferred. Since we don't usually -know the relative position of the reference to the label, particularly for -floats, making these kinds of adjustments manually is an uphill battle, and -error prone, in the absence of some support for it. - -\pkg{zref-clever}'s integration with \pkg{zref-check} offers some assistance -in making these kinds of references, by providing checks for the relation -between the reference and the label. For example, you may use: -\begin{zcexample} -\zcref[check=nextpage,note={on the following page}]{fig:1} -\end{zcexample} -and if \texttt{fig:1} is not on the next page relative to the reference, a -compilation warning can be issued by \pkg{zref-check} (according to the -package's options), so that the problem can be easily identified and -corrected. Evidently, this does not fully automate the typeset results, but -it does automate the checking that the reference context is the intended one. - -And to make use of this feature, one does not need to rely on compiling the -document, make the reference according to the current state of things, and -then adjusting it over and over, as the document gets edited. This feature is -best used within a certain workflow, which starts by making a standard -reference with a page reference, but adding the \texttt{pagegap} check to it: -\begin{zcexample} -\zcref{fig:1} on \zcpageref[check=pagegap]{fig:1} -\end{zcexample} + position between the reference and the label being referred to using + \pkg{varioref}.} -During the initial editing of the document, this reference will be formally -correct, even if less than ideal in certain cases. At a certain point, when -you choose to give finishing touches to your document, then you can cater for -\pkg{zref-check}'s warnings (the package has options to control them, for -example, enabling warnings only when the \opt{draft} option is not in use). -The \texttt{pagegap} check will pass if there's one or more pages between the -reference and the label, in which case, that reference is already what we -want. However, if the referenced object lies in the previous page, the same -page, or the next page, the \texttt{pagegap} check will issue a warning. Thus -telling us if there's an opportunity, or need, to adjust the context -information of the reference. Then we can go with one of the below, according -to the situation: -\begin{zcexample} -\zcref[check=thispage]{fig:1} -\zcref[check=above,note={above}]{fig:1} -\zcref[check=below,note={below}]{fig:1} -\zcref[check=nextpage,note={on the following page}]{fig:1} -\zcref[check=prevpage,note={on the preceding page}]{fig:1} -\zcref[check=facing,note={on the facing page}]{fig:1} -\end{zcexample} +\pkg{zref-vario}, which can be enabled with package option \opt{vario}, offers +a layer of compatibility with \pkg{varioref} and provides +\texttt{\textbackslash{}z}\dots{} counterparts for the latter's main reference +commands. -See \pkg{zref-check}'s documentation for details, and further available -checks. +\begin{zchowto}[caption={\pkg{zref-vario}}] +\documentclass{article} +\usepackage[vario]{zref-clever} +\begin{document} +\section{Section 1} +\zlabel{sec:section-1} +\begin{figure} + A figure. + \caption{Figure 1} + \zlabel{fig:figure-1} +\end{figure} +\begin{figure} + Another figure. + \caption{Figure 2} + \zlabel{fig:figure-2} +\end{figure} +\zvref[S]{sec:section-1} +\zvpageref{fig:figure-1} +\zvrefrange{fig:figure-1}{fig:figure-2} +\zvpagerefrange{fig:figure-1}{fig:figure-2} +\zfullref{fig:figure-1} +\end{document} +\end{zchowto} \subsection{\cs{newtheorem}} @@ -2087,16 +2107,20 @@ refer to the main equation number, that is, right after usage example. The module also ensures proper \opt{currentcounter} values are in place for the display math environments, for which it uses environment hooks, and sets the font of equation references to \cs{upshape}, following -\pkg{amsmath}'s \cs{eqref}. Note, however, that \pkg{zref-clever} is not the -only package to redefine \cs{ltx@label}, and compatibility problems may arise -if this module is used with such packages or with document classes that do the -same. In case of trouble, you can load \pkg{zref-clever} with option -\texttt{nocompat=amsmath} and either use the standard referencing system's -facilities to refer to \pkg{amsmath}'s equations or check the code -documentation for the technique used for this (which is pretty standard) and -adapt it to your case. Given that any trouble that may arise here is one of -the proper ``timing'' of the redefinition, it should not be particularly -complicated to make such adjustments. +\pkg{amsmath}'s \cs{eqref}. Finally, the module also provides a +\texttt{subeq} property, for display math environments used inside the +\env{subequations} environment, which can be used to refer to them directly +with the \opt{ref} option, or to build terse ranges with the \opt{endrange} +option. Note that \pkg{zref-clever} is not the only package to redefine +\cs{ltx@label}, and compatibility problems may arise if this module is used +with such packages or with document classes that do the same. In case of +trouble, you can load \pkg{zref-clever} with option \texttt{nocompat=amsmath} +and either use the standard referencing system's facilities to refer to +\pkg{amsmath}'s equations or check the code documentation for the technique +used for this (which is pretty standard) and adapt it to your case. Given +that any trouble that may arise here is one of the proper ``timing'' of the +redefinition, it should not be particularly complicated to make such +adjustments. \DescribeOption{mathtools} % \pkg{mathtools} has a feature to show the numbers only for those equations diff --git a/macros/luatex/generic/luatexja/COPYING b/macros/luatex/generic/luatexja/COPYING index 3049f8374b..39c166b6fa 100644 --- a/macros/luatex/generic/luatexja/COPYING +++ b/macros/luatex/generic/luatexja/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2011--2016 The LuaTeX-ja project, All rights reserved. +Copyright (c) 2011--2022 The LuaTeX-ja project, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/macros/luatex/generic/luatexja/README b/macros/luatex/generic/luatexja/README index 6d7fe60543..eb5320238d 100644 --- a/macros/luatex/generic/luatexja/README +++ b/macros/luatex/generic/luatexja/README @@ -1,6 +1,6 @@ -The LuaTeX-ja Package 20220103.0 +The LuaTeX-ja Package 20220207.0 -------------------------------- -Copyright (c) 2011--2021 The LuaTeX-ja project +Copyright (c) 2011--2022 The LuaTeX-ja project License: modified BSD (see COPYING) LuaTeX-ja is a macro package for typesetting Japanese documents with LuaTeX. @@ -42,9 +42,9 @@ Installation 2. If you must/want to install manually: a. Download the source archive from CTAN, - or tagged as 20220103.0 in the Git repository by + or tagged as 20220207.0 in the Git repository by <http://git.osdn.jp/view?p=luatex-ja/luatexja.git - ;a=snapshot;h=refs/tags/20220103.0;sf=tgz> + ;a=snapshot;h=refs/tags/20220207.0;sf=tgz> b. Extract the archive and process following three files by LuaLaTeX to generate classes for Japanese typesetting: @@ -93,4 +93,4 @@ Notes This file and ltj-kinsoku.lua are not used anymore. (Do not remove ltj-kinsoku.tex.) -Last commit date: Mon Jan 3 12:19:51 2022 +0900 +Last commit date: Mon Feb 7 13:14:19 2022 +0900 diff --git a/macros/luatex/generic/luatexja/doc/luatexja-en.pdf b/macros/luatex/generic/luatexja/doc/luatexja-en.pdf Binary files differindex dcb0a086ee..c97ff3a934 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja-en.pdf +++ b/macros/luatex/generic/luatexja/doc/luatexja-en.pdf diff --git a/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf b/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf Binary files differindex f91aac1df4..32da85ec15 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf +++ b/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf diff --git a/macros/luatex/generic/luatexja/doc/luatexja.dtx b/macros/luatex/generic/luatexja/doc/luatexja.dtx index 4d553f38ec..24c31e1932 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja.dtx +++ b/macros/luatex/generic/luatexja/doc/luatexja.dtx @@ -7837,6 +7837,21 @@ stretch_priority={kanjiskip=-35,xkanjiskip=-25,others=50} 負数を指定すると,その絶対値が指定されたかのように扱われる. 初期値は1(つまり\cs{lineskip}(の自然長))である. \end{cslist} + +さらに,バージョン20220207.0以降では次の命令が提供される: +\begin{cslist} + \item[\cs{ltjghostjachar}] + \LuaTeX-ja本体が提供している\cs{ltjfakeparbegin}, \cs{ltjfakeboxbdd}と類似の命令である. + 実行された箇所が(限定・非限定を問わず)水平モードであった場合に,実行された箇所は + 「文字クラス0の\textbf{JAchar}」の直前かつ直後であると,\LuaTeX-jaの和文処理グルー挿入処理に認識させる. + + 主な仕様用途は和文ゴーストでの使用である.\Pkg{BXghost}パッケージ(\cite{bxghost})などでは + 伝統的に全角空白(\texttt{U+3000})と\verb+\kern-1\zw+を組み合わせた方法が使われてきたが, + \LuaTeX-jaでは全角空白を使っただけではうまくいかない可能性があるため,新たに命令が用意された. + + なお,本命令は将来的に\LuaTeX-ja本体に組み込む可能性もある. +\end{cslist} + %</ja> \subsection{\Pkg{luatexja-ruby}} @@ -11922,6 +11937,7 @@ ISO 32000-1:2008, \textit{Document management -- Portable document format -- Par \url{http://www.iso.org/iso/iso\_catalogue/catalogue_tc/catalogue\_detail.htm?csnumber=51502} \bibitem{tc18ltja} 北川弘典.「\LuaTeX-jaの近況」,\TeX Conf~2018. \url{https://osdn.net/projects/luatex-ja/wiki/Documentation/attach/tc18ltja.pdf} +\bibitem{bxghost} Takuto ASAKURA. \newblock The \textsf{BXghost} Package. \url{https://github.com/wtsnjp/BXghost} \end{thebibliography} \end{document} diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-adjust.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-adjust.sty index d325df7dc6..5d37eb6258 100644 --- a/macros/luatex/generic/luatexja/src/addons/luatexja-adjust.sty +++ b/macros/luatex/generic/luatexja/src/addons/luatexja-adjust.sty @@ -64,7 +64,7 @@ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname \csname iftrue\endcsname \NeedsTeXFormat{LaTeX2e} - \ProvidesPackage{luatexja-adjust}[2022-01-03] + \ProvidesPackage{luatexja-adjust}[2022-02-07] \fi %</LaTeX> % Load core module if not yet. @@ -137,6 +137,14 @@ \define@key[ltj]{japaram}{profile_hgap_factor}{% \directlua{luatexja.adjust.profile_hgap_factor = math.abs(#1)}\relax} +\newluafunction\ltj@@ghost@jachar@inner +\typeout{\the\ltj@@ghost@jachar@inner.} +\directlua{ + local t = lua.get_functions_table(); local cgj = luatexja.adjust.create_ghost_jachar_node; + t[\the\ltj@@ghost@jachar@inner] = function() cgj(0) end +}% +\protected\def\ltjghostjachar{\ifhmode\relax\luafunction\ltj@@ghost@jachar@inner\fi} + %%------------------ all done \ltj@adjust@AtEnd diff --git a/macros/luatex/generic/luatexja/src/ltj-adjust.lua b/macros/luatex/generic/luatexja/src/ltj-adjust.lua index 76a1a68ec4..87c85dd07a 100644 --- a/macros/luatex/generic/luatexja/src/ltj-adjust.lua +++ b/macros/luatex/generic/luatexja/src/ltj-adjust.lua @@ -551,4 +551,40 @@ do end end - +do + local ltja = luatexja.adjust + local sid_user = node.subtype 'user_defined' + local node_remove = node.direct.remove + local node_write = node.direct.write + local GHOST_JACHAR = luatexbase.newuserwhatsitid('ghost of a jachar', 'luatexja') + luatexja.userid_table.GHOST_JACHAR = GHOST_JACHAR + function ltja.create_ghost_jachar_node(cl) + local tn = node_new(id_whatsit, sid_user) + setfield(tn, 'user_id', GHOST_JACHAR) + setfield(tn, 'type', 100) + setfield(tn, 'value', cl) + node_write(tn) + end + local function whatsit_callback(Np, lp, Nq) + if Np and Np.nuc then return Np + elseif Np and getfield(lp, 'user_id') == GHOST_JACHAR then + Np.first = lp; Np.nuc = lp; Np.last = lp; Np.class = getfield(lp,'value') + if Nq then Np.met = Nq.met; Np.pre = 0; Np.post = 0; Np.xspc = 3 end + Np.auto_kspc, Np.auto_xspc = (has_attr(lp, attr_autospc)==1), (has_attr(lp, attr_autoxspc)==1) + return Np + else return Np end + end + local function whatsit_after_callback(s, Nq, Np, head) + if not s and getfield(Nq.nuc, 'user_id') == GHOST_JACHAR then + local x, y = node_prev(Nq.nuc), Nq.nuc + Nq.first, Nq.nuc, Nq.last = x, x, x + if Np then Nq.met = Np.met end + s = node_remove(head, y); node_free(y) + end + return s + end + luatexbase.add_to_callback("luatexja.jfmglue.whatsit_getinfo", whatsit_callback, + "ghost of a JACHAR", 1) + luatexbase.add_to_callback("luatexja.jfmglue.whatsit_after", whatsit_after_callback, + "ghost of a JACHAR", 1) +end diff --git a/macros/luatex/generic/luatexja/src/ltj-direction.lua b/macros/luatex/generic/luatexja/src/ltj-direction.lua index d7cdbd9364..db320509d1 100644 --- a/macros/luatex/generic/luatexja/src/ltj-direction.lua +++ b/macros/luatex/generic/luatexja/src/ltj-direction.lua @@ -924,6 +924,11 @@ end -- adjust do local id_adjust = node.id 'adjust' + local scan_keyword = token.scan_keyword + function luatexja.direction.adjust_begin() + if scan_keyword 'pre' then tex.sprint(cat_lp, '\\ltj@@vadjust@pre') + else tex.sprint(cat_lp, '\\ltj@@vadjust@post') end + end function luatexja.direction.check_adjust_direction() start_time_measure 'box_primitive_hook' local list_dir = get_adjust_dir_count() diff --git a/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua b/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua index a2bede6442..7ada76335b 100644 --- a/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua +++ b/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfmglue', - date = '2022-01-02', + date = '2022-02-03', description = 'Insertion process of JFM glues, [x]kanjiskip and others', }) luatexja.jfmglue = luatexja.jfmglue or {} @@ -1104,7 +1104,9 @@ do luatexbase.call_callback("luatexja.jfmglue.special_jaglue_after", Nq.nuc) end, [id_pbox_w]= function() - luatexbase.call_callback("luatexja.jfmglue.whatsit_after", false, Nq, Np) + local hh = luatexbase.call_callback("luatexja.jfmglue.whatsit_after", false, Nq, Np, head) + -- hh: new head of false (nott processed) + if hh then head = hh end end, } @@ -1323,7 +1325,7 @@ do end end - local function whatsit_after_callback(s, Nq, Np) + local function whatsit_after_callback(s, Nq, Np, head) if not s and getfield(Nq.nuc, 'user_id') == BPAR then local x, y = node_prev(Nq.nuc), Nq.nuc Nq.first, Nq.nuc, Nq.last = x, x, x @@ -1334,7 +1336,7 @@ do Nq.met = Np.met; Nq.pre = 0; Nq.post = 0; Nq.xspc = 0 Nq.auto_xspc, Nq.auto_kspc = 0, 0 end - head = node_remove(head, y) + s = node_remove(head, y) node_free(y) elseif not s and getfield(Nq.nuc, 'user_id') == BOXB then local x, y = node_prev(Nq.nuc), Nq.nuc @@ -1346,7 +1348,7 @@ do Nq.met = Np.met; Nq.pre = 0; Nq.post = 0; Nq.xspc = 0 Nq.auto_xspc, Nq.auto_kspc = 0, 0 end - head = node_remove(head, y) + s = node_remove(head, y) node_free(y) end return s diff --git a/macros/luatex/generic/luatexja/src/ltj-plain.sty b/macros/luatex/generic/luatexja/src/ltj-plain.sty index c6f976767f..5268cc1dcd 100644 --- a/macros/luatex/generic/luatexja/src/ltj-plain.sty +++ b/macros/luatex/generic/luatexja/src/ltj-plain.sty @@ -88,14 +88,14 @@ \ltjdefcharrange{4}{% "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF, "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A95F, "A980-"ABFF, "E000-"F8FF, - "FB00-"FE0F, "FE20-"FE2F, "FE70-"FEFF, "10000-"1AFFF, "1B170-"1F0FF, + "FB00-"FE0F, "FE20-"FE2F, "FE70-"FEFF, "10000-"1AFEF, "1B170-"1F0FF, "1F300-"1FFFF, "2000-"206F } % non-Japanese \ltjdefcharrange{5}{"D800-"DFFF, "E0000-"E00FF, "E01F0-"10FFFF} \ltjdefcharrange{6}{% "2460-"24FF, "2E80-"2EFF, "3000-"30FF, "3190-"319F, "31F0-"4DBF, "4E00-"9FFF, "F900-"FAFF, "FE10-"FE1F, "FE30-"FE6F, "FF00-"FFEF, - "1B000-"1B16F, "1F100-"1F2FF, "20000-"3FFFF, "E0100-"E01EF + "1AFF0-"1B16F, "1F100-"1F2FF, "20000-"3FFFF, "E0100-"E01EF } \ltjdefcharrange{7}{% "1100-"11FF, "2F00-"2FFF, "3100-"318F, "31A0-"31EF, "A000-"A4CF, diff --git a/macros/luatex/generic/luatexja/src/ltj-ruby.lua b/macros/luatex/generic/luatexja/src/ltj-ruby.lua index d5bc393963..320b7307f0 100644 --- a/macros/luatex/generic/luatexja/src/ltj-ruby.lua +++ b/macros/luatex/generic/luatexja/src/ltj-ruby.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.ruby', - date = '2021-05-04', + date = '2022-02-03', description = 'Ruby annotation', }) luatexja.ruby = {} @@ -764,7 +764,7 @@ do end local RIPOST = luatexja.stack_table_index.RIPOST local abs = math.abs - local function whatsit_after_callback(s, Nq, Np) + local function whatsit_after_callback(s, Nq, Np, head) if not s and getfield(Nq.nuc, 'user_id') == RUBY_PRE then if Np then local last_glue = node_new(id_glue) @@ -802,7 +802,7 @@ do rst.post = 0 end end - return true + return head else return s end diff --git a/macros/luatex/generic/luatexja/src/luatexja-core.sty b/macros/luatex/generic/luatexja/src/luatexja-core.sty index fb58eaf31d..cc49fbd479 100644 --- a/macros/luatex/generic/luatexja/src/luatexja-core.sty +++ b/macros/luatex/generic/luatexja/src/luatexja-core.sty @@ -65,7 +65,7 @@ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname \csname iftrue\endcsname \NeedsTeXFormat{LaTeX2e} - \ProvidesPackage{luatexja-core}[2021-05-21 Core of LuaTeX-ja] + \ProvidesPackage{luatexja-core}[2022-01-12 Core of LuaTeX-ja] \fi %</LaTeX> %% Load prerequisite packages. @@ -623,19 +623,22 @@ %%%% vadjust \let\ltj@@orig@vadjust\vadjust +\newluafunction\ltj@@vadjust@begin@inner \newluafunction\ltj@@vadjust@dirhook@inner \newluafunction\ltj@@vadjust@check@dir@inner \directlua{ local t = lua.get_functions_table() + t[\the\ltj@@vadjust@begin@inner] = luatexja.direction.adjust_begin t[\the\ltj@@vadjust@dirhook@inner] = function () luatexja.direction.set_list_direction_hook('adj') end - t[\the\ltj@@vadjust@check@dir@inner] - = luatexja.direction.check_adjust_direction + t[\the\ltj@@vadjust@check@dir@inner] = luatexja.direction.check_adjust_direction } +\protected\luadef\ltj@@vadjust\ltj@@vadjust@begin@inner \luadef\ltj@@vadjust@dirhook\ltj@@vadjust@dirhook@inner \protected\luadef\ltj@@vadjust@check@dir\ltj@@vadjust@check@dir@inner -\protected\def\ltj@@vadjust{% - \ltj@@orig@vadjust\bgroup\ltj@@vadjust@dirhook +\def\ltj@@vadjust@pre{\ltj@@orig@vadjust pre\bgroup\ltj@@vadjust@dirhook + \aftergroup\ltj@@vadjust@check@dir\let\ltj@@next} +\def\ltj@@vadjust@post{\ltj@@orig@vadjust\bgroup\ltj@@vadjust@dirhook \aftergroup\ltj@@vadjust@check@dir\let\ltj@@next} \let\vadjust\ltj@@vadjust %% PRIMITIVE diff --git a/macros/luatex/generic/luatexja/src/luatexja.sty b/macros/luatex/generic/luatexja/src/luatexja.sty index 48db2624ec..ae389af99b 100644 --- a/macros/luatex/generic/luatexja/src/luatexja.sty +++ b/macros/luatex/generic/luatexja/src/luatexja.sty @@ -27,7 +27,7 @@ \newif\ifltj@disablejfam %%%% VERSION -\def\LuaTeXjaversion{20220103.0} +\def\LuaTeXjaversion{20220207.0} %% Check if LaTeX is used. \begingroup\expandafter\expandafter\expandafter\endgroup diff --git a/macros/luatex/generic/luatexja/src/patches/lltjcore.sty b/macros/luatex/generic/luatexja/src/patches/lltjcore.sty index 19b365ad48..086771a200 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjcore.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjcore.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjcore}[2021-03-25 Patch to LaTeX2e Kernel for LuaTeX-ja] +\ProvidesPackage{lltjcore}[2022-01-17 Patch to LaTeX2e Kernel for LuaTeX-ja] \RequirePackage{etoolbox} %%% expl3 @@ -208,7 +208,7 @@ \else\hbox{\yoko \@textsuperscript{\normalfont\@thefnmark}}\fi} \begingroup \@ifpackageloaded{hyperref} - {\def\ltj@setrefprefix{real}} + {\ifdefined\real@setref\def\ltj@setrefprefix{real}\else\def\ltj@setrefprefix{}\fi} {\def\ltj@setrefprefix{}} \expandafter\gdef\csname \ltj@setrefprefix @setref\endcsname#1#2#3{% \ifx#1\relax diff --git a/macros/luatex/generic/luatexja/src/patches/lltjdefs.sty b/macros/luatex/generic/luatexja/src/patches/lltjdefs.sty index b76a3957a0..c330c0ea57 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjdefs.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjdefs.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjdefs}[2021-04-29 Default font settings of LuaTeX-ja] +\ProvidesPackage{lltjdefs}[2022-01-23 Default font settings of LuaTeX-ja] \ifdefined\ltj@stdmcfont\else\def\ltj@stdmcfont{file:HaranoAjiMincho-Regular.otf}\fi \ifdefined\ltj@stdgtfont\else\def\ltj@stdgtfont{file:HaranoAjiGothic-Medium.otf}\fi @@ -151,14 +151,14 @@ \ltjdefcharrange{4}{% "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF, "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A95F, "A980-"ABFF, "E000-"F8FF, - "FB00-"FE0F, "FE20-"FE2F, "FE70-"FEFF, "10000-"1AFFF, "1B170-"1F0FF, + "FB00-"FE0F, "FE20-"FE2F, "FE70-"FEFF, "10000-"1AFEF, "1B170-"1F0FF, "1F300-"1FFFF, "2000-"206F } % non-Japanese \ltjdefcharrange{5}{"D800-"DFFF, "E0000-"E00FF, "E01F0-"10FFFF} \ltjdefcharrange{6}{% "2460-"24FF, "2E80-"2EFF, "3000-"30FF, "3190-"319F, "31F0-"4DBF, "4E00-"9FFF, "F900-"FAFF, "FE10-"FE1F, "FE30-"FE6F, "FF00-"FFEF, - "1B000-"1B16F, "1F100-"1F2FF, "20000-"3FFFF, "E0100-"E01EF + "1AFF0-"1B16F, "1F100-"1F2FF, "20000-"3FFFF, "E0100-"E01EF } \ltjdefcharrange{7}{% "1100-"11FF, "2F00-"2FFF, "3100-"318F, "31A0-"31EF, "A000-"A4CF, |