summaryrefslogtreecommitdiff
path: root/macros/latex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-01-29 03:00:41 +0000
committerNorbert Preining <norbert@preining.info>2022-01-29 03:00:41 +0000
commit2df1fd0d0099108f6d3d3e58dce35a3d2e185d4f (patch)
treef7e5765a88db1ee36ffdbebfbc2ea73336a1fb86 /macros/latex
parentaef84c3078da1ba1bad9754ea0555ac9bc1c0aac (diff)
CTAN sync 202201290300
Diffstat (limited to 'macros/latex')
-rw-r--r--macros/latex/contrib/bangorcsthesis/README2
-rw-r--r--macros/latex/contrib/bangorcsthesis/bangorcsthesis.dtx9
-rw-r--r--macros/latex/contrib/bangorcsthesis/bangorcsthesis.pdfbin298583 -> 298298 bytes
-rw-r--r--macros/latex/contrib/codebox/codebox-doc-en.pdfbin71350 -> 71369 bytes
-rw-r--r--macros/latex/contrib/codebox/codebox-doc-en.tex6
-rw-r--r--macros/latex/contrib/codebox/codebox.dtx53
-rw-r--r--macros/latex/contrib/codebox/codebox.pdfbin300058 -> 302033 bytes
-rw-r--r--macros/latex/contrib/datax/README.md22
-rw-r--r--macros/latex/contrib/datax/datax.dtx16
-rw-r--r--macros/latex/contrib/datax/datax.pdfbin189196 -> 202889 bytes
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx43
-rw-r--r--macros/latex/contrib/easybook/easybook.pdfbin575309 -> 575298 bytes
-rw-r--r--macros/latex/contrib/easybook/easybook.tex6
-rw-r--r--macros/latex/contrib/pascaltriangle/pascaltriangle.pdfbin165670 -> 165740 bytes
-rw-r--r--macros/latex/contrib/pascaltriangle/pascaltriangle.sty4
-rw-r--r--macros/latex/contrib/pascaltriangle/pascaltriangle.tex2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/CHANGELOG.md11
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/README.md2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/color-ltx.sty27
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx7
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.pdfbin953379 -> 953495 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.dtx73
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.pdfbin676300 -> 678500 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.dtx7
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.pdfbin577785 -> 577968 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.dtx7
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.pdfbin505418 -> 505748 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.dtx5
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.pdfbin546853 -> 547004 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.dtx5
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.pdfbin529883 -> 530048 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.dtx5
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.pdfbin533076 -> 533242 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.dtx5
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.pdfbin525259 -> 525438 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.dtx5
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.pdfbin575283 -> 575459 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.dtx5
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.pdfbin504512 -> 504678 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield.dtx7
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield.pdfbin739053 -> 739166 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffile.dtx7
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffile.pdfbin552088 -> 552450 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.dtx7
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.pdfbin648865 -> 649022 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx7
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.pdfbin664425 -> 664573 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdftools.dtx7
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdftools.pdfbin517264 -> 517424 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.dtx7
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.pdfbin417279 -> 417490 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/ltdocinit.dtx7
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/ltdocinit.pdfbin572674 -> 572871 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/output-patches-tmp-ltx.pdfbin383080 -> 382883 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/pdflscape-ltx.sty2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx7
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.pdfbin424541 -> 424940 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.dtx9
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.pdfbin446113 -> 446303 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/transparent-ltx.sty2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/xcolor-patches-tmp-ltx.sty9
-rw-r--r--macros/latex/contrib/proof-at-the-end/README.md204
-rw-r--r--macros/latex/contrib/proof-at-the-end/proof-at-the-end.dtx707
-rw-r--r--macros/latex/contrib/proof-at-the-end/proof-at-the-end.ins4
-rw-r--r--macros/latex/contrib/proof-at-the-end/proof-at-the-end.pdfbin248763 -> 347459 bytes
-rw-r--r--macros/latex/contrib/proof-at-the-end/proof-at-the-end_demo.pdfbin116402 -> 121561 bytes
-rw-r--r--macros/latex/contrib/proof-at-the-end/proof-at-the-end_demo.tex91
-rw-r--r--macros/latex/contrib/spbmark/spbmark.pdfbin71793 -> 74237 bytes
-rw-r--r--macros/latex/contrib/spbmark/spbmark.sty4
-rw-r--r--macros/latex/contrib/spbmark/spbmark.tex43
-rw-r--r--macros/latex/contrib/zref-clever/CHANGELOG.md26
-rw-r--r--macros/latex/contrib/zref-clever/MANIFEST.md48
-rw-r--r--macros/latex/contrib/zref-clever/zref-clever-code.pdfbin1069860 -> 1175713 bytes
-rw-r--r--macros/latex/contrib/zref-clever/zref-clever.dtx3350
-rw-r--r--macros/latex/contrib/zref-clever/zref-clever.pdfbin306402 -> 310423 bytes
-rw-r--r--macros/latex/contrib/zref-clever/zref-clever.tex133
77 files changed, 3414 insertions, 1603 deletions
diff --git a/macros/latex/contrib/bangorcsthesis/README b/macros/latex/contrib/bangorcsthesis/README
index 78f3da354c..fd7a4f3b0e 100644
--- a/macros/latex/contrib/bangorcsthesis/README
+++ b/macros/latex/contrib/bangorcsthesis/README
@@ -1,6 +1,6 @@
Bangor University Computer Science Department Thesis Document Class
-Cameron Gray <c.gray@bangor.ac.uk> November 12, 2021
+Cameron Gray <c.gray@bangor.ac.uk> January 28, 2022
Abstract
diff --git a/macros/latex/contrib/bangorcsthesis/bangorcsthesis.dtx b/macros/latex/contrib/bangorcsthesis/bangorcsthesis.dtx
index c5234e4ed0..f6e8e18259 100644
--- a/macros/latex/contrib/bangorcsthesis/bangorcsthesis.dtx
+++ b/macros/latex/contrib/bangorcsthesis/bangorcsthesis.dtx
@@ -52,10 +52,11 @@
%\changes{v1.5.2}{2017/08/10}{Altered heading handling for the references section.}
%\changes{v1.5.3}{2018/10/05}{Altered School and College names.}
%\changes{v1.5.4}{2021/11/12}{Added more Engineering degree types.}
+%\changes{v1.5.5}{2022/01/28}{Fixed a typo in degree scheme.}
%\pagestyle{fancy}
%\title{Bangor University Computer Science and Electronic Engineering Department\\ Thesis Document Class}
%\author{Cameron Gray \texttt{<c.gray@bangor.ac.uk>}}
-%\date{November 12, 2021}
+%\date{January 28, 2022}
%\maketitle
%
%\begin{abstract}
@@ -266,11 +267,11 @@
% \end{macrocode}
%\fi
% \begin{macrocode}
-\def\version{1.5.4}
+\def\version{1.5.5}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{bangorcsthesis}[2021/11/12 \version C. Gray]
+\ProvidesClass{bangorcsthesis}[2022/01/28 \version C. Gray]
% Originally inspired by Clean Thesis
% - http://cleanthesis.der-ric.de/
@@ -307,7 +308,7 @@
\newcommand{\degree}{Master of Science}
}
\DeclareOption{meng}{
- \newcommand{\degree}{Moster of Engineering}
+ \newcommand{\degree}{Master of Engineering}
}
\DeclareOption{mscres}{
\newcommand{\degree}{Master of Science by Research}
diff --git a/macros/latex/contrib/bangorcsthesis/bangorcsthesis.pdf b/macros/latex/contrib/bangorcsthesis/bangorcsthesis.pdf
index c67e163222..708cc73132 100644
--- a/macros/latex/contrib/bangorcsthesis/bangorcsthesis.pdf
+++ b/macros/latex/contrib/bangorcsthesis/bangorcsthesis.pdf
Binary files differ
diff --git a/macros/latex/contrib/codebox/codebox-doc-en.pdf b/macros/latex/contrib/codebox/codebox-doc-en.pdf
index f8edd671df..119a64183a 100644
--- a/macros/latex/contrib/codebox/codebox-doc-en.pdf
+++ b/macros/latex/contrib/codebox/codebox-doc-en.pdf
Binary files differ
diff --git a/macros/latex/contrib/codebox/codebox-doc-en.tex b/macros/latex/contrib/codebox/codebox-doc-en.tex
index 3ad34985de..7fe079a045 100644
--- a/macros/latex/contrib/codebox/codebox-doc-en.tex
+++ b/macros/latex/contrib/codebox/codebox-doc-en.tex
@@ -14,7 +14,7 @@
\title{\bfseries\pkg{codebox}:programming code box}
\author{Nan Geng\\ \url{nangeng@nwafu.edu.cn}}
-\date{2022/01/04\qquad v1.0.3\thanks{\url{https://github.com/registor/codebox}}
+\date{2022/01/28\qquad v1.0.4\thanks{\url{https://github.com/registor/codebox}}
\thanks{\url{https://gitee.com/nwafu_nan/codebox}}}
\begin{document}
@@ -312,9 +312,9 @@ or command's \oarg{options}.
\subsection{seperation between line number and code}
-\begin{function}[added=2021-12-26,updated=2021-12-26]{linenumsep}
+\begin{function}[added=2021-12-26,updated=2022-1-28]{linenumsep}
\begin{syntax}
- linenumsep = \Arg{float number} \init{3.0}
+ linenumsep = \Arg{float number} \init{1.80}
\end{syntax}
\opt{linenumsep} is used to set the seperation between line number and code,
valid only for \pkg{minted} engine.
diff --git a/macros/latex/contrib/codebox/codebox.dtx b/macros/latex/contrib/codebox/codebox.dtx
index 8365020d9f..c1923d450e 100644
--- a/macros/latex/contrib/codebox/codebox.dtx
+++ b/macros/latex/contrib/codebox/codebox.dtx
@@ -148,7 +148,7 @@ Copyright and Licence
%</internal>
%<package>\NeedsTeXFormat{LaTeX2e}[2020/10/01]
%<package>\RequirePackage{expl3}
-%<+package>\GetIdInfo$Id: codebox.dtx 1.0.3 2022-01-04 08:00:00 +0800 Nan Geng <nangeng@nwafu.edu.cn> $
+%<+package>\GetIdInfo$Id: codebox.dtx 1.0.4 2022-01-28 08:00:00 +0800 Nan Geng <nangeng@nwafu.edu.cn> $
%<package> {Code Box with tcolorbox and minted/listings.}
%<package>\ProvidesExplPackage{\ExplFileName}
%<package> {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
@@ -477,9 +477,9 @@ Copyright and Licence
%
% \subsection{行号间距}
%
-% \begin{function}[added=2021-12-26,updated=2021-12-26]{linenumsep}
+% \begin{function}[added=2021-12-26,updated=2022-1-28]{linenumsep}
% \begin{syntax}
-% linenumsep = \Arg{浮点数} \init{3.0}
+% linenumsep = \Arg{浮点数} \init{1.80}
% \end{syntax}
% \opt{linenumsep} 用于设置代码盒子行号与代码的间距,仅对\textbf{minted}
% 引擎有效,取浮点数,单位是mm。默认值为\textbf{3.0}。
@@ -723,6 +723,8 @@ Copyright and Licence
}%
% \end{macrocode}
%
+% \changes{v1.0.4}{2022/1/28}{修订分页代码盒子无行号底色问题}
+%
% 代码盒子cv样式
%
% \begin{macrocode}
@@ -748,7 +750,19 @@ Copyright and Licence
\begin{tcbclipinterior}
\fill[cvblue] (frame.south~west) rectangle ([xshift=5.0mm,yshift=0mm]frame.north~west);
\end{tcbclipinterior}
- }
+ },
+ underlay~middle = {
+ \begin{tcbclipinterior}
+ \fill[cvblue] (frame.south~west) rectangle
+ ([xshift=5.0mm,yshift=0mm]frame.north~west);
+ \end{tcbclipinterior}
+ },
+ underlay~last = {
+ \begin{tcbclipinterior}
+ \fill[cvblue] (frame.south~west) rectangle
+ ([xshift=5.0mm,yshift=0mm]frame.north~west);
+ \end{tcbclipinterior}
+ },
}
}%
% \end{macrocode}
@@ -787,6 +801,8 @@ Copyright and Licence
% \end{macrocode}
% \end{variable}
%
+% \changes{v1.0.4}{2022/1/28}{修正linenumsep为默认值1.80以避免3位行号溢出边界}
+%
% \subsection{选项处理}
%
% 定义 |codebox| 键值类。
@@ -865,7 +881,7 @@ Copyright and Licence
% 行号与文本之间的距离(单位:mm)
% \begin{macrocode}
linenumsep .fp_set:N = \l_@@_linenumber_sep_fp,
- linenumsep .initial:n = 3.00,
+ linenumsep .initial:n = 1.80,
% \end{macrocode}
% \end{macro}
%
@@ -1021,6 +1037,7 @@ Copyright and Licence
% \end{macro}
%
% \changes{v1.0.1}{2021/12/27}{修订代码盒子前多一个逗号的问题}
+% \changes{v1.0.4}{2022/1/28}{修改用户接口的{group_begin}到开始位置}
%
% \subsection{不计数代码盒子用户接口}
%
@@ -1029,9 +1046,9 @@ Copyright and Licence
% \begin{macrocode}
\NewDocumentEnvironment{ codebox }{O{} m }
{
- \bool_set_false:N \l_@@_comment_bool
\group_begin:
- \IfNoValueF{#1}{ \keys_set:nn { codebox } { #1 } }
+ \bool_set_false:N \l_@@_comment_bool
+ \keys_set:nn { codebox } { #1 }
\@@_code_engine_tcbset:
\@@_comment_tcbset:
\tcbset{lang, title={#2} }%
@@ -1047,9 +1064,9 @@ Copyright and Licence
% \begin{macrocode}
\NewDocumentEnvironment{ codebox* }{O{} m }
{
- \bool_set_false:N \l_@@_comment_bool
\group_begin:
- \IfNoValueF{#1}{ \keys_set:nn { codebox } { #1 } }
+ \bool_set_false:N \l_@@_comment_bool
+ \keys_set:nn { codebox } { #1 }
\@@_code_engine_tcbset:
\@@_comment_tcbset:
\tcbset{lang, title={#2} }%
@@ -1065,15 +1082,14 @@ Copyright and Licence
% \begin{macrocode}
\NewDocumentCommand \codefile { s O{} m m }
{
+ \group_begin:
\IfBooleanTF{#1}
{
\bool_set_true:N \l_@@_comment_bool
}{
\bool_set_false:N \l_@@_comment_bool
}
-
- \group_begin:
- \IfNoValueF{#2}{ \keys_set:nn { codebox } { #2 } }
+ \keys_set:nn { codebox } { #2 }
\@@_code_engine_tcbset:
\@@_comment_tcbset:
\tcbset{
@@ -1106,9 +1122,9 @@ Copyright and Licence
}
\NewDocumentEnvironment{ codeview }{O{} m }
{
- \bool_set_false:N \l_@@_comment_bool
\group_begin:
- \IfNoValueF{#1}{ \keys_set:nn { codebox } { #1 } }
+ \bool_set_false:N \l_@@_comment_bool
+ \keys_set:nn { codebox } { #1 }
\@@_code_engine_tcbset:
\@@_comment_tcbset:
\tl_if_empty:NF \l_@@_label_name_tl
@@ -1142,9 +1158,9 @@ Copyright and Licence
% \begin{macrocode}
\NewDocumentEnvironment{ codeview* }{O{} m }
{
- \bool_set_true:N \l_@@_comment_bool
\group_begin:
- \IfNoValueF{#1}{ \keys_set:nn { codebox } { #1 } }
+ \bool_set_true:N \l_@@_comment_bool
+ \keys_set:nn { codebox } { #1 }
\@@_code_engine_tcbset:
\@@_comment_tcbset:
\tl_if_empty:NF \l_@@_label_name_tl
@@ -1181,15 +1197,14 @@ Copyright and Licence
}
\NewDocumentCommand \cvfile { s O{} m m }
{
+ \group_begin:
\IfBooleanTF{#1}
{
\bool_set_true:N \l_@@_comment_bool
}{
\bool_set_false:N \l_@@_comment_bool
}
-
- \group_begin:
- \IfNoValueF{#2}{ \keys_set:nn { codebox } { #2 } }
+ \keys_set:nn { codebox } { #2 }
\@@_code_engine_tcbset:
\@@_comment_tcbset:
\tl_if_empty:NF \l_@@_label_name_tl
diff --git a/macros/latex/contrib/codebox/codebox.pdf b/macros/latex/contrib/codebox/codebox.pdf
index b82446cb1c..84addcda66 100644
--- a/macros/latex/contrib/codebox/codebox.pdf
+++ b/macros/latex/contrib/codebox/codebox.pdf
Binary files differ
diff --git a/macros/latex/contrib/datax/README.md b/macros/latex/contrib/datax/README.md
index 1471c9a39d..ce8d63cb24 100644
--- a/macros/latex/contrib/datax/README.md
+++ b/macros/latex/contrib/datax/README.md
@@ -1,5 +1,7 @@
# The datax package
-A LaTeX package to insert data from a script in a document. Interacting plugins available at [Github, Datax-package](https://github.com/Datax-package).
+
+A LaTeX package to insert data from a script in a document. Interacting plugins
+available at [Github, Datax-package](https://github.com/Datax-package).
## Example usage
Julia script:
@@ -29,17 +31,19 @@ Julia | [LaTeXDatax.jl](https://github.com/Datax-package/LaTeXDatax.jl) | David
MATLAB | [LaTeXDatax.m](https://github.com/Datax-package/Datax.m) | David Gustavsson
Python | [LaTeXDatax.py](https://github.com/Datax-package/LaTeXDatax.py) | David Gustavsson
-If your language isn't listed above, check [the super-repo](https://github.com/Datax-package).
-Extending it to your language of choice should be fairly simple, just make it so your script can write `\pgfkeyssetvalue{/datax/<tag>}{<value>}` to a file.
-If you end up writing a plugin for a language, or if you want to request one, please make a feature request or send me an e-mail.
+If your language isn't listed above, check [the
+super-repo](https://github.com/Datax-package). Extending it to your language of
+choice should be fairly simple, just make it so your script can write
+`\pgfkeyssetvalue{/datax/<tag>}{<value>}` to a file. If you end up writing a
+plugin for a language, or if you want to request one, please make a feature
+request or send me an e-mail.
## Copyright and license
-Copyright 2020 David Gustavsson (david.e.gustavsson@gmail.com)
+Copyright 2020 − 2022 David Gustavsson (david.e.gustavsson@gmail.com)
-This package 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:
+This package 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
diff --git a/macros/latex/contrib/datax/datax.dtx b/macros/latex/contrib/datax/datax.dtx
index d1f9e5c996..81b5c7f64c 100644
--- a/macros/latex/contrib/datax/datax.dtx
+++ b/macros/latex/contrib/datax/datax.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2020 by David Gustavsson
+% Copyright (C) 2020-2021 by David Gustavsson
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -17,7 +17,7 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[2020/02/02]
%<package>\ProvidesPackage{datax}
-%<package> [2021-09-22 v1.1.2 data import into LaTeX]
+%<package> [2022-01-27 v1.2.0 data import into LaTeX]
%<package>\RequirePackage{pgfkeys}
%<package>\RequirePackage{pgfopts}
%
@@ -60,7 +60,7 @@
%</driver>
% \fi
%
-%\CheckSum{29}
+%\CheckSum{21}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -82,6 +82,7 @@
% \changes{v1.1}{2020/11/17}{Polishing for release}
% \changes{v1.1.1}{2020/11/29}{Renaming the plugins, adding Python support}
% \changes{v1.1.2}{2021-09-22}{Removing excessive spaces}
+% \changes{v1.2.0}{2022-01-27}{Removing package wide siunitx options}
%
% \GetFileInfo{datax.sty}
% \DoNotIndex{}
@@ -181,7 +182,6 @@
% Default data file name: \texttt{data.tex}
% \begin{macrocode}
\pgfkeys{ /packageoptions/dataxfile/.initial=data.tex, }
-\pgfkeys{ /packageoptions/siunitxoptions/.initial={}, }
% \end{macrocode}
% Read any given options into family \texttt{/packageoptions/}. Then introduce
% family \texttt{/datax/} where all the variables will be stored.
@@ -204,8 +204,6 @@
}{}{
\PackageWarning{datax}{Cannot read file `\dataxfile'}
}
-\newif\ifhassiunitx
-\@ifpackageloaded{siunitx}{\hassiunitxtrue}{\hassiunitxfalse}
% \end{macrocode}
% \begin{macro}{\datax}
% Include datum. If the supplied tag is unused, print bold question marks (like
@@ -214,9 +212,9 @@
\newcommand{\datax}[2][]{%
\pgfkeysifdefined{/datax/#2}{%
{%
- \ifhassiunitx%
- \sisetup{\pgfkeysvalueof{/packageoptions/siunitxoptions},#1}%
- \fi%
+ \@ifpackageloaded{siunitx}{%
+ \sisetup{#1}%
+ }{}%
\pgfkeysvalueof{/datax/#2}%
}%
}{%
diff --git a/macros/latex/contrib/datax/datax.pdf b/macros/latex/contrib/datax/datax.pdf
index 0c266b995d..65e79fdba7 100644
--- a/macros/latex/contrib/datax/datax.pdf
+++ b/macros/latex/contrib/datax/datax.pdf
Binary files differ
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index 36103ea8c1..81156d1337 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -15,7 +15,7 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2022/01/25}{1.53}
+\ProvidesExplClass{easybook}{2022/01/28}{1.54}
{Typeset Chinese theses or books}
\bool_set_false:N \l__eb_compile_draft_bool
@@ -305,7 +305,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplPackage{easybase}{2022/01/25}{1.53}
+\ProvidesExplPackage{easybase}{2022/01/28}{1.54}
{Typeset Chinese theses or books}
\cs_generate_variant:Nn \dim_set:Nn { NV }
@@ -382,12 +382,12 @@
}
\msg_new:nnn { easybase } { package-repeat-load-i }
{
- The~macro~package~#1~has~been~loaded~repeatedly. \\
+ The~macro~package~'#1'~has~been~loaded~repeatedly. \\
Please~pass~the~arguments~by \\
the~\string\PassOptionsToPackage{#2}{#1}\ command.
}
\msg_new:nnn { easybase } { package-repeat-load-ii }
- { The~macro~package~#1~has~been~loaded~repeatedly. }
+ { The~macro~package~'#1'~has~been~loaded~repeatedly. }
\cs_set_eq:NN \eb@usepackage@save \usepackage
\RenewDocumentCommand{\usepackage}{O{}m}
{
@@ -469,14 +469,14 @@
\eb_seq_map_inline:nn
{ style,subfont,spread,bibset,thmset,hdrset,tocset }
{
- \msg_new:nnn { easybase } { abandon-#1 }
+ \msg_new:nnn { easybase } { deprecated-#1 }
{
- ##1~is~an~abandoned~option~of~#1~module. \\
+ The~option~'##1'~of~module~'#1'~is~deprecated~or~non-existent. \\
Please~browse~the~user~manual~for~the~new~options.
}
}
-\cs_new_protected:Npn \eb_msg_abandon_option:n #1
- { \msg_warning:nnV { easybase } { abandon-#1 } \l_keys_key_str }
+\cs_new_protected:Npn \eb_msg_deprecated_option:n #1
+ { \msg_warning:nnV { easybase } { deprecated-#1 } \l_keys_key_str }
\cs_if_exist:NF \chapter
{
\newcounter{chapter}
@@ -498,7 +498,7 @@
}
\msg_new:nnn { easybase } { no-chapter }
{
- Your~document~class~is~in~article~mode. \\
+ Your~document~class~is~in~'article'~mode. \\
The~\string\chapter\ command~will~not~be~used.
}
@@ -522,7 +522,7 @@
}
\msg_new:nnn { easybase } { package-old }
{
- Package~#1~has~been~out~of~date. \\
+ Package~'#1'~has~been~out~of~date. \\
Some~problems~or~errors~may~occur \\
if~you~continue~compiling. \\\\
Please~update~your~macro~package~from~CTAN.
@@ -919,7 +919,7 @@
fntext-num/unknown .code:n = \eb_fnmate_short_label_set:Nn \thefootnote {#1},
fnmate-num .meta:n = { fntext-num = #1,fnmark-num = #1 },
fnmate-num .initial:n = plain,
- unknown .code:n = \eb_msg_abandon_option:n { hdrset }
+ unknown .code:n = \eb_msg_deprecated_option:n { hdrset }
}
\eb_at_end_preamble:n
@@ -1046,7 +1046,7 @@
{
It~is~not~recommended~that~you~use~the \\
hang,~symbol,~marginal,~flushmargin~or~bottom \\
- options~of~the~footmisc~package.
+ options~of~the~'footmisc'~package.
}
\cs_set_protected:Npn \footref #1
@@ -1301,7 +1301,7 @@
hang .initial:n = false,
pagenumwd .code:n = \contentsmargin{#1},
pagenumwd .initial:n = 1.55em,
- unknown .code:n = \eb_msg_abandon_option:n { tocset }
+ unknown .code:n = \eb_msg_deprecated_option:n { tocset }
}
\NewDocumentCommand{\tocrule}{st-O{0.7pc}D(){1.2}mO{}}
{
@@ -1499,7 +1499,7 @@
hyphen-listing = #1,hyphen-equation = #1
},
hyphen-every .initial:n = .,
- unknown .code:n = \eb_msg_abandon_option:n { style }
+ unknown .code:n = \eb_msg_deprecated_option:n { style }
}
\eb_seq_map_inline:nn
{ figure,table,lstlisting,equation }
@@ -1730,7 +1730,7 @@
footnote .tl_set:N = \l__eb_subfont_footnote_tl,
marginpar .tl_set:N = \l__eb_subfont_marginpar_tl,
marginpar .initial:n = \footnotesize,
- unknown .code:n = \eb_msg_abandon_option:n { subfont }
+ unknown .code:n = \eb_msg_deprecated_option:n { subfont }
}
\cs_new_protected:Npn \addtosubfont #1#2
{
@@ -1775,7 +1775,7 @@
line = #1,table = #1,math = #1,
caption-every = #1,footnote = #1
},
- unknown .code:n = \eb_msg_abandon_option:n { spread }
+ unknown .code:n = \eb_msg_deprecated_option:n { spread }
}
\tl_gset:Nn \marginfont { \l__eb_subfont_marginpar_tl }
@@ -1821,10 +1821,9 @@
}
\dim_zero_new:N \mathindent
\skip_set:Nn \parskip { 0pt plus 2pt minus 1pt }
-\skip_set:Nn \intextsep { 14pt plus 2pt minus 2pt }
-\skip_set:Nn \textfloatsep { 16pt plus 2pt minus 4pt }
+\skip_set:Nn \textfloatsep { 12pt plus 2pt minus 4pt }
+\skip_set:Nn \dbltextfloatsep { 12pt plus 2pt minus 4pt }
\skip_set:Nn \multicolsep { 12pt plus 4pt minus 3pt }
-\skip_set:Nn \dbltextfloatsep { 16pt plus 2pt minus 4pt }
\int_gset:Nn \vbadness { 10000 }
\int_gset:Nn \hbadness { 10000 }
\setcounter{topnumber}{4}
@@ -1961,7 +1960,7 @@
\ctex_define:nn { thmset }
{
tcbwrap .code:n = { },
- unknown .code:n = \eb_msg_abandon_option:n { thmset }
+ unknown .code:n = \eb_msg_deprecated_option:n { thmset }
}
\cs_undefine:N \proof
\declaretheoremstyle{fancy}[
@@ -2043,7 +2042,7 @@
datafile .clist_set:N = \l__eb_bib_datafile_clist,
bititle .tl_set:N = \eb@bib@bitoc@title,
bititle .initial:n = Bibliography,
- unknown .code:n = \eb_msg_abandon_option:n { bibset }
+ unknown .code:n = \eb_msg_deprecated_option:n { bibset }
}
\cs_new_protected:Npn \eb_bibtex_natbib_set:
@@ -2344,7 +2343,7 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2022/01/25}{1.53}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2022/01/28}{1.54}
{Customization of tcolorbox for easybook}
\cs_set_protected:Npn \addtotcbstyle #1#2
diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf
index ae5595cfa2..bd4402b691 100644
--- a/macros/latex/contrib/easybook/easybook.pdf
+++ b/macros/latex/contrib/easybook/easybook.pdf
Binary files differ
diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex
index 5a46413dc1..f6323022a7 100644
--- a/macros/latex/contrib/easybook/easybook.tex
+++ b/macros/latex/contrib/easybook/easybook.tex
@@ -21,8 +21,8 @@
name = easybook,
color-scheme = blue,
title = EASYBOOK 使用手册,
- version = v1.53,
- date = 2022/01/25,
+ version = v1.54,
+ date = 2022/01/28,
authors = 瞿毅,
info = 排版简体中文学位论文和书籍,
email = q1jx@foxmail.com,
@@ -1252,7 +1252,7 @@
\item 增加定义脚注正文和内容标记格式的命令 \cs{defupfntmark} 和 \cs{defdownfntmark}。
\item 新增文档主目录中双语标题列表的输出排列方式选项 \option{bilist}。
\end{version}
- \begin{version}[v = 1.53,date = 2022/01/25]
+ \begin{version}[v = 1.54,date = 2022/01/28]
\added
\item 新增文类选项 \option{theorem} 用于提供定理功能支持。
\deprecated
diff --git a/macros/latex/contrib/pascaltriangle/pascaltriangle.pdf b/macros/latex/contrib/pascaltriangle/pascaltriangle.pdf
index 961e826e40..bab79fbb92 100644
--- a/macros/latex/contrib/pascaltriangle/pascaltriangle.pdf
+++ b/macros/latex/contrib/pascaltriangle/pascaltriangle.pdf
Binary files differ
diff --git a/macros/latex/contrib/pascaltriangle/pascaltriangle.sty b/macros/latex/contrib/pascaltriangle/pascaltriangle.sty
index 6c4be46ac3..04c928e4c6 100644
--- a/macros/latex/contrib/pascaltriangle/pascaltriangle.sty
+++ b/macros/latex/contrib/pascaltriangle/pascaltriangle.sty
@@ -7,7 +7,7 @@
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\ProvidesExplPackage{pascaltriangle}{2022-01-07}{v1.0.0}
+\ProvidesExplPackage{pascaltriangle}{2022-01-28}{v1.0.1}
{Typeset Pascal triangle figure with LaTeX3}
\RequirePackage{xparse}
@@ -388,8 +388,8 @@
%% 绘制Pascal三角形用户接口
\NewDocumentCommand{\pascal}{O{} m}
{
- \IfNoValueF{#1}{ \keys_set:nn { pascal } {#1} }
\group_begin:
+ \keys_set:nn { pascal } {#1}
\__pascal_triangle_draw:n{#2}
\group_end:
}
diff --git a/macros/latex/contrib/pascaltriangle/pascaltriangle.tex b/macros/latex/contrib/pascaltriangle/pascaltriangle.tex
index ff9536f62f..55f07865a5 100644
--- a/macros/latex/contrib/pascaltriangle/pascaltriangle.tex
+++ b/macros/latex/contrib/pascaltriangle/pascaltriangle.tex
@@ -119,7 +119,7 @@
{ \__codedoc_cmd:no {#1} { #2 } }
\ExplSyntaxOff
-\def\vers{\texttt{v1.0.0}
+\def\vers{\texttt{v1.0.1}
\thanks{\url{https://github.com/registor/pascaltriangle}}
\thanks{\url{https://gitee.com/nwafu_nan/pascaltriangle}}
}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/CHANGELOG.md b/macros/latex/contrib/pdfmanagement-testphase/CHANGELOG.md
index ec1686c578..62f2c92005 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/CHANGELOG.md
+++ b/macros/latex/contrib/pdfmanagement-testphase/CHANGELOG.md
@@ -5,7 +5,16 @@ first release 0.95a, 2021-02-23 will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
this project uses date-based 'snapshot' version identifiers.
-## [Unreleased]
+## [2022-01-28]
+
+### Changed
+ - adapted the color patch to the changes in (x)color.sty (mathcolor)
+ - documentation uses new doc version (so needs currently latex-dev to compile)
+
+### Fixed
+
+ - xcolor patch failed with color names containing active chars (e.g. from french)
+ - clipping of xform object on the dvips route (issue #25)
## [2022-01-13]
### Changed
diff --git a/macros/latex/contrib/pdfmanagement-testphase/README.md b/macros/latex/contrib/pdfmanagement-testphase/README.md
index e08a4162ff..9336ce7ab4 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/README.md
+++ b/macros/latex/contrib/pdfmanagement-testphase/README.md
@@ -1,6 +1,6 @@
# LaTeX PDF management testphase bundle
-Version: 0.95j, 2022-01-13
+Version: 0.95k, 2022-01-28
This package is used during a test phase to load the new PDF management code
of LaTeX.
diff --git a/macros/latex/contrib/pdfmanagement-testphase/color-ltx.sty b/macros/latex/contrib/pdfmanagement-testphase/color-ltx.sty
index 9ea89b54e1..b530980baa 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/color-ltx.sty
+++ b/macros/latex/contrib/pdfmanagement-testphase/color-ltx.sty
@@ -12,7 +12,9 @@
%%
%%
%% color.dtx Copyright (C) 1994--1999 David Carlisle
-%% Copyright (C) 2005-2020 David Carlisle, LaTeX3 Project
+%% Copyright (C) 2005-2022
+%% The LaTeX Project and any individual authors listed elsewhere
+%% in this file.
%%
%% This file is part of the Standard LaTeX `Graphics Bundle'.
%% It may be distributed under the terms of the LaTeX Project Public
@@ -22,8 +24,8 @@
%% This file has the LPPL maintenance status "maintained".
%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesPackage{color-ltx}[2022-01-13 v0.95j
- Standard LaTeX Color (patched for l3color, part of pdfmanagement-testphase, original version 2021/03/07 v1.2e) (DPC)]
+\ProvidesPackage{color-ltx}[2022-01-28 v0.95k
+ Standard LaTeX Color (patched for l3color, part of pdfmanagement-testphase, original version 2022/01/06 v1.3d) (DPC)]
\edef\Gin@codes{%
\catcode`\noexpand\^^A\the\catcode`\^^A\relax
\catcode`\noexpand\"\the\catcode`\"\relax
@@ -58,7 +60,7 @@
\def\c@lor@namefile{dvipsnam.def}}
\DeclareOption{xdvi}{\ExecuteOptions{dvips,monochrome}}
\DeclareOption{dvipdf}{\def\Gin@driver{dvipdf.def}}
-\DeclareOption{dvipdfm}{\def\Gin@driver{dvipdfm.def}}
+\DeclareOption{dvipdfm}{\def\Gin@driver{dvipdfmx.def}}
\DeclareOption{dvipdfmx}{\def\Gin@driver{dvipdfmx.def}}
\DeclareOption{pdftex}{\def\Gin@driver{pdftex.def}}
\DeclareOption{luatex}{\def\Gin@driver{luatex.def}}
@@ -82,7 +84,7 @@
\let\c@lor@usename\@gobble
\DeclareOption{usenames}{%
\def\c@lor@usename#1{%
- \expandafter\color@named\csname\string\color @#1\endcsname{#1}}}
+ \expandafter\color@named\csname\@backslashchar color@#1\endcsname{#1}}}
\DeclareRobustCommand\color{%
\@ifnextchar[\@undeclaredcolor\@declaredcolor}
\def\@undeclaredcolor[#1]#2{%
@@ -92,10 +94,10 @@
\set@color}%
\ignorespaces}
\def\@declaredcolor#1{%
- \@ifundefined{\string\color @#1}%
+ \@ifundefined{\@backslashchar color@#1}%
{\c@lor@error{`#1'}}%
{\expandafter\let\expandafter\current@color
- \csname\string\color @#1\endcsname
+ \csname\@backslashchar color@#1\endcsname
\set@color}%
\ignorespaces}
\protected\def\textcolor#1#{\@textcolor{#1}}
@@ -107,7 +109,7 @@
\color}
\protected\def\nopagecolor{%
\@ifundefined{no@page@color}{%
- \PackageInfo{color}{\string\nopagecolor\space is not supported}%
+ \PackageInfo{color}{\@backslashchar nopagecolor\space is not supported}%
}{%
\no@page@color
}%
@@ -115,12 +117,12 @@
\protected\def\definecolor#1#2#3{%
\@ifundefined{color@#2}%
{\c@lor@error{model `#2'}}%
- {\@ifundefined{\string\color @#1}{}%
+ {\@ifundefined{\@backslashchar color@#1}{}%
{\PackageInfo{color}{Redefining color #1}}%
\csname color@#2\expandafter\endcsname
- \csname\string\color @#1\endcsname{#3}}%
- \@expl@color@set@@nnn{#1}{#2}{#3}%
- }
+ \csname\@backslashchar color@#1\endcsname{#3}}%
+ \@expl@color@set@@nnn{#1}{#2}{#3}%
+ }
\protected\def\DefineNamedColor#1#2#3#4{%
\@ifundefined{define@color@#1}%
{\c@lor@error{model `#1'}}%
@@ -188,6 +190,7 @@
\dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@
{#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}%
\box\z@}}}
+\InputIfFileExists{mathcolor.ltx}{}{}
\def\color@setgroup{\begingroup\set@color}
\let\color@begingroup\begingroup
\def\color@endgroup{\endgraf\endgroup}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx b/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx
index cc8ab85ef5..5dcc7d28b2 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx
@@ -27,9 +27,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{pdfstandard=A-2b}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass{l3doc}
\usepackage{tabularx,array,booktabs,hyperxmp}
\hypersetup{pdfauthor=The LaTeX Project,
@@ -86,7 +83,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
@@ -962,7 +959,7 @@
%<@@=hyp>
% \end{macrocode}
% \begin{macrocode}
-\ProvidesFile{hgeneric-testphase.def}[2022-01-13 v0.95j %
+\ProvidesFile{hgeneric-testphase.def}[2022-01-28 v0.95k %
generic Hyperref driver for the LaTeX PDF management testphase bundle]
\RequirePackage{etoolbox} %why?
diff --git a/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.pdf b/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.pdf
index 578272d238..4ff66d1f1e 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty b/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty
index a1bc3caddb..c056293ec0 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty
+++ b/macros/latex/contrib/pdfmanagement-testphase/hyperxmp-patches-tmp-ltx.sty
@@ -19,7 +19,7 @@
%
% for those people who are interested.
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
-\ProvidesExplPackage{hyperxmp-patches-tmp-ltx}{2022-01-13}{0.95j}
+\ProvidesExplPackage{hyperxmp-patches-tmp-ltx}{2022-01-28}{0.95k}
{Store hyperref metadata in XMP format / temporay patches to test pdfresource management ... UF}
\cs_if_exist:NT \pdfmanagement_add:nnn
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.dtx
index 54f2e089df..84571e8a2b 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.dtx
@@ -45,7 +45,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
%
@@ -56,27 +56,27 @@
% \begin{macrocode}
%<drivers>\ProvidesExplFile
%<*dvipdfmx>
- {l3backend-testphase-dvipdfmx.def}{2022-01-13}{}
+ {l3backend-testphase-dvipdfmx.def}{2022-01-28}{}
{LaTeX~PDF~management~testphase~bundle~backend~support: dvipdfmx}
%</dvipdfmx>
%<*dvips>
- {l3backend-testphase-dvips.def}{2022-01-13}{}
+ {l3backend-testphase-dvips.def}{2022-01-28}{}
{LaTeX~PDF~management~testphase~bundle~backend~support: dvips}
%</dvips>
%<*dvisvgm>
- {l3backend-testphase-dvisvgm.def}{2022-01-13}{}
+ {l3backend-testphase-dvisvgm.def}{2022-01-28}{}
{LaTeX~PDF~management~testphase~bundle~backend~support: dvisvgm}
%</dvisvgm>
%<*luatex>
- {l3backend-testphase-luatex.def}{2022-01-13}{}
+ {l3backend-testphase-luatex.def}{2022-01-28}{}
{LaTeX~PDF~management~testphase~bundle~backend~support: PDF output (LuaTeX)}
%</luatex>
%<*pdftex>
- {l3backend-testphase-pdftex.def}{2022-01-13}{}
+ {l3backend-testphase-pdftex.def}{2022-01-28}{}
{LaTeX~PDF~management~testphase~bundle~backend~support: PDF output (pdfTeX)}
%</pdftex>
%<*xdvipdfmx>
- {l3backend-testphase-xetex.def}{2022-01-13}{}
+ {l3backend-testphase-xetex.def}{2022-01-28}{}
{LaTeX~PDF~management~testphase~bundle~backend~support: XeTeX}
%</xdvipdfmx>
% \end{macrocode}
@@ -1488,8 +1488,15 @@
% (in atfi-dvips), along with some ideas from pdfbase and has been corrected
% with the help of Alexander Grahn.
% Details like clipping and landscape will probably be corrected in the future.
+% We need some temporary variables to store dimensions
% \begin{macrocode}
%<*dvips>
+\tl_new:N \l_@@_backend_xform_tmpwd_tl
+\tl_new:N \l_@@_backend_xform_tmpdp_tl
+\tl_new:N \l_@@_backend_xform_tmpht_tl
+% \end{macrocode}
+%
+% \begin{macrocode}
\cs_new_protected:Npn\@@_backend_xform_new:nnnn #1 #2 #3 #4 % #1 name, #2 attribute, #4 content
{
\int_gincr:N \g_@@_backend_object_int
@@ -1513,31 +1520,51 @@
\tl_const:cx
{ c_@@_backend_xform_dp_ \tl_to_str:n {#1} _tl }
{ \tex_the:D \box_dp:N \l_@@_backend_tmpa_box }
- %mirror the box
- \box_scale:Nnn \l_@@_backend_tmpa_box {1} {-1}
+ %store content dimensions in DPI units (Dots) (code from issue 25)
+ \tl_set:Nx\l_@@_backend_xform_tmpwd_tl
+ {
+ \dim_to_decimal_in_sp:n{ \box_wd:N \l_@@_backend_tmpa_box }~
+ 65536~div~72.27~div~DVImag~mul~Resolution~mul~
+ }
+ \tl_set:Nx\l_@@_backend_xform_tmpht_tl
+ {
+ \dim_to_decimal_in_sp:n{ \box_ht:N \l_@@_backend_tmpa_box }~
+ 65536~div~72.27~div~DVImag~mul~VResolution~mul~
+ }
+ \tl_set:Nx\l_@@_backend_xform_tmpdp_tl
+ {
+ \dim_to_decimal_in_sp:n{ \box_dp:N \l_@@_backend_tmpa_box }~
+ 65536~div~72.27~div~DVImag~mul~VResolution~mul~
+ }
+ % mirror the box
+ %\box_scale:Nnn \l_@@_backend_tmpa_box {1} {-1}
\hbox_set:Nn\l_@@_backend_tmpb_box
{
\__kernel_backend_postscript:x
{
- gsave~currentpoint~translate~
+ gsave~currentpoint~
+ initclip~ % restore default clipping path (page device/whole page)
+ clippath~pathbbox~newpath~pop~pop~
+ \tl_use:N\l_@@_backend_xform_tmpdp_tl~add~translate~
mark~
- /_objdef~{ pdf.obj \int_use:N\g_@@_backend_object_int }\c_space_tl~
- /BBox[
- currentpoint~\dim_to_decimal:n{\box_dp:N \l_@@_backend_tmpa_box}~72.27~div~VResolution~mul~add~
- currentpoint~
- exch~\dim_to_decimal:n{\box_wd:N \l_@@_backend_tmpa_box}~72.27~div~Resolution~mul~add~
- exch~\dim_to_decimal:n{\box_ht:N \l_@@_backend_tmpa_box}~72.27~div~VResolution~mul~sub~
- ]
- \str_if_eq:eeF{#1}{}
- {
- product~(Distiller)~search~{pop~pop~pop~#2}{pop}ifelse~
- }
- /BP~pdfmark~grestore~
+ /_objdef~{ pdf.obj \int_use:N\g_@@_backend_object_int }\c_space_tl~
+ /BBox[
+ 0~
+ \tl_use:N\l_@@_backend_xform_tmpht_tl~
+ \tl_use:N\l_@@_backend_xform_tmpwd_tl~
+ \tl_use:N\l_@@_backend_xform_tmpdp_tl~
+ neg
+ ]
+ \str_if_eq:eeF{#1}{}
+ {
+ product~(Distiller)~search~{pop~pop~pop~#2}{pop}ifelse~
+ }
+ /BP~pdfmark~1~-1~scale~neg~exch~neg~exch~translate
}
\box_use_drop:N\l_@@_backend_tmpa_box
\__kernel_backend_postscript:n
{
- mark ~ /EP~pdfmark
+ mark ~ /EP~pdfmark ~ grestore
}
\str_if_eq:eeF{#1}{}
{
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.pdf
index bd6d7985ee..3123d08864 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.dtx
index c77314ca25..b852e6ea3a 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{pdfstandard=A-2b}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs,hyperxmp}
\hypersetup{pdfauthor=The LaTeX Project,
@@ -52,7 +49,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
@@ -436,7 +433,7 @@
% \begin{macrocode}
%<@@=pdfannot>
%<*header>
-\ProvidesExplPackage{l3pdfannot}{2022-01-13}{0.95j}
+\ProvidesExplPackage{l3pdfannot}{2022-01-28}{0.95k}
{PDF-annotations}
\RequirePackage{l3pdfdict}
%</header>
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.pdf
index cc44dcca2c..3feab4139a 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.dtx
index 3a63005f37..2a2d80cec9 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{pdfstandard=A-2b}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs,hyperxmp}
\hypersetup{pdfauthor=The LaTeX Project,
@@ -53,7 +50,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
@@ -212,7 +209,7 @@
% \begin{macrocode}
%<@@=pdfdict>
%<*header>
-\ProvidesExplPackage{l3pdfdict}{2022-01-13}{0.95j}
+\ProvidesExplPackage{l3pdfdict}{2022-01-28}{0.95k}
{Tools for PDF dictionaries (LaTeX PDF management testphase bundle)}
%</header>
% \end{macrocode}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.pdf
index 29b211ec27..56965d2854 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.dtx
index 2de21f001a..0e05a47aa9 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs,siunitx}
\usepackage{l3pdffield-testphase,bearwear}
@@ -53,7 +50,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.pdf
index 9e4f0061b1..10bbf6ec75 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.dtx
index eff3d2cd1e..64d6e256c4 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs}
\usepackage{l3pdffield-testphase,bearwear}
@@ -68,7 +65,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.pdf
index 70666fc007..74b88c7273 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.dtx
index 7c16fa4982..12318618f4 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs}
\usepackage{l3pdffield-testphase}
@@ -53,7 +50,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.pdf
index 72dfa1e3ce..a43c6946d0 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.dtx
index eff2adfdb2..62da08394f 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs,siunitx}
\usepackage{l3pdffield-testphase,bearwear}
@@ -59,7 +56,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.pdf
index cf69bffb99..f1d290eaeb 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.dtx
index 9d5515d1f4..784ca7f380 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs}
\usepackage{l3pdffield-testphase,bearwear,tikzlings,tikzducks}
@@ -87,7 +84,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.pdf
index 2164a70c1c..5c54bb4ebf 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.dtx
index 4a5f729910..3227454208 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs}
\usepackage{l3pdffield-testphase}
@@ -53,7 +50,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.pdf
index 2ce744434d..814cce07d3 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.dtx
index b872c40f26..e72fed2071 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass{l3doc}
\usepackage{array,booktabs,caption}
\usepackage{l3pdffield-testphase,tikz}
@@ -73,7 +70,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
@@ -977,7 +974,7 @@
%<*package>
%<@@=pdffield>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesExplPackage{l3pdffield-testphase}{2022-01-13}{0.95j}%
+\ProvidesExplPackage{l3pdffield-testphase}{2022-01-28}{0.95k}%
{form fields}
% \end{macrocode}
% \subsection{hyperref specific command}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.pdf
index 9bb4331db6..feedecbdf7 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.dtx
index 4da7ef9723..2d09da77f8 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{pdfstandard=A-2b}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs,hyperxmp}
\hypersetup{pdfauthor=The LaTeX Project,pdftitle=l3pdffile (LaTeX PDF management testphase bundle)}
@@ -53,7 +50,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
@@ -400,7 +397,7 @@
%
% \begin{macrocode}
%<*header>
-\ProvidesExplPackage{l3pdffile}{2022-01-13}{0.95j}
+\ProvidesExplPackage{l3pdffile}{2022-01-28}{0.95k}
{embedding and referencing files in PDF---LaTeX PDF management testphase bundle}
\RequirePackage{l3pdftools} %temporarly!!
%</header>
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.pdf
index 2561e4d118..ea5bdf4647 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.dtx
index f2e494c1fa..4fb6ff4c8c 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{pdfstandard=A-2b}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{tabularx}
\usepackage{array,booktabs,hyperxmp}
@@ -61,7 +58,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
@@ -622,7 +619,7 @@
%<@@=pdfmanagement>
%<*header>
%
-\ProvidesExplPackage{l3pdfmanagement}{2022-01-13}{0.95j}
+\ProvidesExplPackage{l3pdfmanagement}{2022-01-28}{0.95k}
{Management of core PDF dictionaries (LaTeX PDF management testphase bundle)}
%</header>
% \end{macrocode}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.pdf
index a62a1a0d80..a53b31189b 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx
index f91555dd04..622fd0b41c 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{pdfstandard=A-2b}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs,hyperxmp}
\hypersetup{pdfauthor=The LaTeX Project,pdftitle=l3pdfmeta (LaTeX PDF management testphase bundle)}
@@ -53,7 +50,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
@@ -345,7 +342,7 @@
% \begin{macrocode}
%<@@=pdfmeta>
%<*header>
-\ProvidesExplPackage{l3pdfmeta}{2022-01-13}{0.95j}
+\ProvidesExplPackage{l3pdfmeta}{2022-01-28}{0.95k}
{PDF-Standards---LaTeX PDF management testphase bundle}
%</header>
% \end{macrocode}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.pdf
index 6bf44b039b..af8813dbab 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.dtx
index 9959583cd3..89afdc4300 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{pdfstandard=A-2b}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs,hyperxmp}
\hypersetup{pdfauthor=The LaTeX Project,pdftitle=l3pdftools (LaTeX PDF management testphase bundle)}
@@ -53,7 +50,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
@@ -215,7 +212,7 @@
%
% \begin{macrocode}
%<*header>
-\ProvidesExplPackage{l3pdftools}{2022-01-13}{0.95j}
+\ProvidesExplPackage{l3pdftools}{2022-01-28}{0.95k}
{candidate commands for l3pdf---LaTeX PDF management testphase bundle}
%</header>
% \end{macrocode}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.pdf
index df2e659463..618b279d34 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.dtx
index f4a4a6a7f4..228b3ff72d 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{pdfstandard=A-2b}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs,hyperxmp}
\hypersetup{pdfauthor=The LaTeX Project,pdftitle=l3pdfxform (LaTeX PDF management testphase bundle)}
@@ -52,7 +49,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
@@ -136,7 +133,7 @@
% \begin{macrocode}
%<@@=pdf>
%<*header>
-\ProvidesExplPackage{l3pdfxform}{2022-01-13}{0.95j}
+\ProvidesExplPackage{l3pdfxform}{2022-01-28}{0.95k}
{command to create xforms (beta)---LaTeX PDF management testphase bundle}
%</header>
% \end{macrocode}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.pdf
index 9e341ac965..1491257d68 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.dtx b/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.dtx
index 110bbb09b2..8a2ec5136a 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{pdfstandard=A-2b}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs,hyperxmp}
\hypersetup{pdfauthor=The LaTeX Project,pdftitle=ltdocinit (LaTeX PDF management testphase bundle)}
@@ -51,7 +48,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
@@ -219,7 +216,7 @@
% \begin{macrocode}
%<@@=pdfmanagement>
%<*header>
-\ProvidesExplPackage{ltdocinit}{2022-01-13}{0.95j}
+\ProvidesExplPackage{ltdocinit}{2022-01-28}{0.95k}
{Initialize document metadata}
%</header>
% \end{macrocode}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.pdf b/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.pdf
index 0816edae0f..a3ea02b46b 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/output-patches-tmp-ltx.pdf b/macros/latex/contrib/pdfmanagement-testphase/output-patches-tmp-ltx.pdf
index a99709cf13..7224257eec 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/output-patches-tmp-ltx.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/output-patches-tmp-ltx.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/pdflscape-ltx.sty b/macros/latex/contrib/pdfmanagement-testphase/pdflscape-ltx.sty
index 677e3fe40e..f9e901c52b 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/pdflscape-ltx.sty
+++ b/macros/latex/contrib/pdfmanagement-testphase/pdflscape-ltx.sty
@@ -22,7 +22,7 @@
%% This work consists of the main source file pdflscape-ltx.sty
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesExplPackage{pdflscape-ltx}{2022-01-13}{0.95j}
+\ProvidesExplPackage{pdflscape-ltx}{2022-01-28}{0.95k}
{Display of landscape pages in PDF - adaption of pdflscape to the PDFmanagement bundle (testphase)}
\DeclareOption*{\PassOptionsToPackage\CurrentOption{graphics}}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx
index 6383bd9922..662d1d52dc 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{pdfstandard=A-2b}
-\makeatletter
-\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass[full]{l3doc}
\usepackage{array,booktabs,hyperxmp}
\hypersetup{pdfauthor=The LaTeX Project,pdftitle=pdfmanagement-firstaid
@@ -51,7 +48,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
@@ -67,7 +64,7 @@
% |debug={firstaidoff={name1,name2,...},...}|.
% \begin{macrocode}
%<*package>
-\ProvidesExplPackage{pdfmanagement-firstaid}{2022-01-13}{0.95j}
+\ProvidesExplPackage{pdfmanagement-firstaid}{2022-01-28}{0.95k}
{LaTeX PDF management testphase bundle / firstaid-patches}
%<@@=pdfmanagement>
diff --git a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.pdf b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.pdf
index b730d9e75e..30e7a7bf45 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.dtx b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.dtx
index 1364b8e83c..3d788e5643 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.dtx
@@ -25,9 +25,6 @@
%<*driver>
\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{pdfstandard=A-2b}
-\makeatletter
-%\declare@file@substitution{doc.sty}{doc-v3beta.sty}
-\makeatother
\documentclass{l3doc}
\usepackage{tabularx,array,booktabs,hyperxmp}
\hypersetup{pdfauthor=The LaTeX Project,pdftitle=LaTeX PDF management testphase bundle}
@@ -51,7 +48,7 @@
% }^^A
% }
%
-% \date{Version 0.95j, released 2022-01-13}
+% \date{Version 0.95k, released 2022-01-28}
%
% \maketitle
% \begin{documentation}
@@ -389,7 +386,7 @@
% \begin{macrocode}
%<@@=pdf>
%<*package>
-\ProvidesExplPackage{pdfmanagement-testphase}{2022-01-13}{0.95j}
+\ProvidesExplPackage{pdfmanagement-testphase}{2022-01-28}{0.95k}
{LaTeX PDF management testphase bundle}
\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
\IfFormatAtLeastTF{2020-10-01}{}{
@@ -417,7 +414,7 @@
% to allow to set it in the document.
% \begin{macrocode}
%<*header>
-\ProvidesExplFile{pdfmanagement-testphase.ltx}{2022-01-13}{0.95j}
+\ProvidesExplFile{pdfmanagement-testphase.ltx}{2022-01-28}{0.95k}
{PDF~management~code~(testphase)}
%</header>
%<*package>
diff --git a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.pdf b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.pdf
index 70cf64c5c1..f401c09d25 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/transparent-ltx.sty b/macros/latex/contrib/pdfmanagement-testphase/transparent-ltx.sty
index f9987ba443..4b4cc8907e 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/transparent-ltx.sty
+++ b/macros/latex/contrib/pdfmanagement-testphase/transparent-ltx.sty
@@ -3,7 +3,7 @@
%% a replacement for transparent sty from Heiko Oberdiek
%%
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
-\ProvidesExplPackage{transparent-ltx}{2022-01-13}{0.95j}
+\ProvidesExplPackage{transparent-ltx}{2022-01-28}{0.95k}
{Transparency with color stacks (replacement for transparent.sty from Heiko Oberdiek)}%
\RequirePackage{l3opacity}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/xcolor-patches-tmp-ltx.sty b/macros/latex/contrib/pdfmanagement-testphase/xcolor-patches-tmp-ltx.sty
index 5ff2ef0997..c131c9a922 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/xcolor-patches-tmp-ltx.sty
+++ b/macros/latex/contrib/pdfmanagement-testphase/xcolor-patches-tmp-ltx.sty
@@ -1,6 +1,6 @@
%% LaTeX2e file `xcolor-patches.sty'
%%
-\ProvidesPackage{xcolor-patches-tmp-ltx}[2022-01-13 v0.95j patch xcolor for l3color]
+\ProvidesPackage{xcolor-patches-tmp-ltx}[2022-01-28 v0.95k patch xcolor for l3color]
\@ifundefined{color_set:nn}{\RequirePackage{l3color}}{}
\ExplSyntaxOn
@@ -43,10 +43,13 @@
\cs_generate_variant:Nn \__pdfmanagement_firstaid_xcolor_set:nnnn {nonn}
\cs_set_eq:NN \@expl@xcolor@set@@nonn \__pdfmanagement_firstaid_xcolor_set:nonn
\cs_generate_variant:Nn \color_set:nn {ne}
+\tl_new:N\l__pdfmanagement_firstaid_tmpa_tl
+% the color name should be sanitized to avoid problems with e.g. french making ! active
\cs_new_protected:Npn \@expl@xcolor@set@@ne #1 #2
{
- \exp_args:Nx \__color_if_defined:nT {#2}
- { \color_set:ne {#1}{#2} }
+ \XC@edef\l__pdfmanagement_firstaid_tmpa_tl{#2}
+ \exp_args:NV \__color_if_defined:nT \l__pdfmanagement_firstaid_tmpa_tl
+ { \color_set:ne {#1}{\l__pdfmanagement_firstaid_tmpa_tl} }
}
\ExplSyntaxOff
%\pretocmd{\XC@col@rlet} {\@expl@color@set@@ne{#2}{#4}}{}{\fail}
diff --git a/macros/latex/contrib/proof-at-the-end/README.md b/macros/latex/contrib/proof-at-the-end/README.md
index 0dca926bfc..c111036875 100644
--- a/macros/latex/contrib/proof-at-the-end/README.md
+++ b/macros/latex/contrib/proof-at-the-end/README.md
@@ -1,5 +1,7 @@
# Proof-at-the-end, or how to move proofs in appendix in LaTeX
+WARNING: this package is definitely usable, but may not be as tested and stable as standard packages. Note also that it may change a bit in the future, but we will of course try to avoid as much as possible backward incompatibilities. To ensure your document won't change when the package get updates, it is always safer to copy the `proof-at-the-end.sty` file at the root of your project.
+
## Introduction
This package aims to provide a way to easily move proofs in the appendix. You can:
@@ -34,27 +36,108 @@ pdflatex demo.tex && pdflatex demo.tex
## Quickstart ##
+### Super Quick QuickStart ###
+
+If `proof-at-the-end` it's not installed in your CTAN distribution, copy the [`proof-at-the-end.sty` file](https://github.com/leo-colisson/proof-at-the-end/) in your project. Then, in your project, create new theorem/lemma environments (using any tool you like, like asmthm, ntheorem and thmtools), load the library using `\usepackage[createShortEnv]{proof-at-the-end}` (note that you need the version 2022/01/28 to have `createShortEnv` defined, otherwise you need to use directly `theoremEnd`) and write your theorem using:
+
+```latex
+\begin{thmE}[My title][end, restate]
+ I am a restated theorem whose proof goes in appendix (compile me twice).
+\end{thmE}
+\begin{proofE}
+ And I am a proof.
+\end{proofE}
+```
+The options (here `restate` and `end`) tells what should go in appendix, how to configure the links... Here the proof should go in appendix, and the `restate` options states that the theorem should be restated before the proof.
+
+You can find below a full example to compile which should produce this output (sorry, this is a screenshot, that way I can export it easily in the github page). Just make sure to compile twice to get references.
+
+![Screenshot of the quickstart](screenshot.png)
+
+You can directly copy them (with a more complete demo) in the github page here https://github.com/leo-colisson/proof-at-the-end/.
+
+```latex
+\documentclass{article}
+
+\usepackage{xparse} % Not needed with recent LaTeX
+\usepackage{amsthm}
+
+% Create new theorems, or use ntheorem/thmtools/...
+\newtheorem{thm}{Theorem}[section]
+% Default uses autoref, but you can also use cleveref, see the documentation.
+% Say to autoref that "thm" are Theorems.
+\newcommand{\thmautorefname}{Theorem}
+
+%% Load the library. createShortEnv automatically creates the shortcuts
+%% thmE, theoremE, lemmaE, corrolaryE, proofE. See \newEndThm for more details.
+\usepackage[createShortEnv]{proof-at-the-end}
+
+\begin{document}
+
+\section{Theorems}
+
+\begin{thmE}[My title][end]
+ I am a theorem
+\end{thmE}
+\begin{proofE}
+ And I am a proof.
+\end{proofE}
+
+\section{Proofs}
+\printProofs
+
+\end{document}
+```
+
+
### Install ###
-If your CTAN distribution is recent enough, you have nothing to do. Otherwise if it's not yet in your CTAN distribution, first download the `proof-at-the-end.sty` file and insert it in the root of your project with the following commands on unix (you can also clone this repository if you prefer, or just manually download or copy/paste the files on Windows). It also requires a recent version of xparse, so for simplicity we included the sty file of xparse in this repository as well:
+If your CTAN distribution is recent enough, you have nothing to do (if you are using overleaf, note that you can configure your project to use a more recent TexLive distribution: this packages is included starting from TexLive 2019). Otherwise if it's not yet in your CTAN distribution, first download the `proof-at-the-end.sty` file and insert it in the root of your project with the following commands on unix (you can also clone this repository if you prefer, or just manually download or copy/paste the files on Windows).
-```bash
+``` bash
cd <your project>
repopratend="https://raw.githubusercontent.com/leo-colisson/proof-at-the-end"
wget ${repopratend}/master/proof-at-the-end.sty
-wget ${repopratend}/master/xparse.sty
```
-If you have an old distribution of LaTeX (before 2018 basically, which is the case of Overleaf), you may also need a [more recent expl3](https://tex.stackexchange.com/questions/489646/expl3-and-recent-xparse-on-overleaf-no-expl3-loader-detected/489649?noredirect=1#comment1236409_489649). It is also very easy to install, just download the zip file [http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip](http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip), unzip, and copy the content of the directory `tex/latex/l3kernel/` into your project. On linux it's a matter of two commands in your project:
+
+It also requires a recent version of xparse (not present in TexLive 2018 and before basically), otherwise you will get an error like:
+
+```
+Unknown argument type 'b' replaced by 'm'
+```
+
+While [we used to provide](https://raw.githubusercontent.com/leo-colisson/proof-at-the-end/c2150f4feba4709d47e43c00e5f8eb93ce345cab/xparse.sty) for simplicity a `xparse.sty` file (version `2018-04-12`) in older versions of this repository, we removed it to [avoid license issues and conflicts with recent LaTeX distributions that already include xparse](https://github.com/leo-colisson/proof-at-the-end/issues/6). Nevertheless, if you are using an older distribution, you can also download `xparse` manually [here](http://mirrors.ctan.org/install/macros/latex/contrib/l3packages.tds.zip), unzip it, and copy the `.sty` files contained in `tex/latex/l3packages/xparse/` at the root of your project. On linux, you can do that via:
+
+``` bash
+cd <your project>
+wget http://mirrors.ctan.org/install/macros/latex/contrib/l3packages.tds.zip
+unzip -d . -j l3packages.tds.zip 'tex/latex/l3packages/xparse/*'
+rm -f l3packages.tds.zip xparse.ltx
+```
+
+If you have an old distribution of LaTeX (2017 or before basically), you may also need a [more recent expl3](https://tex.stackexchange.com/questions/489646/expl3-and-recent-xparse-on-overleaf-no-expl3-loader-detected/489649?noredirect=1#comment1236409_489649) or you will get an error like:
+
+```
+Package xparse Error: Support package l3kernel too old.
+```
+
+To install it, download the zip files [http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip](http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip) and [http://mirrors.ctan.org/install/macros/latex/contrib/l3backend.tds.zip](http://mirrors.ctan.org/install/macros/latex/contrib/l3backend.tds.zip) (`l3backend` is [since July 1st, 2019](https://tex.stackexchange.com/questions/499082/file-l3backend-pdfmode-def-not-found-when-loading-expl3) a dependency of l3kernel), unzip, and copy the content of the directories `tex/latex/l3kernel/` (first archive) and `tex/latex/l3backend/` (second archive) into your project. On linux it's a matter of two commands in your project:
```bash
+cd <your project>
wget http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip
unzip -d . -j l3kernel.tds.zip 'tex/latex/l3kernel/*'
rm l3kernel.tds.zip
+wget http://mirrors.ctan.org/install/macros/latex/contrib/l3backend.tds.zip
+unzip -d . -j l3backend.tds.zip 'tex/latex/l3backend/*'
+rm l3backend.tds.zip
```
If you don't want to pollute your main project with all these files, you may be interested to put them in a subfolder and update the environment variable `TEXINPUTS` or, if you use latexmk or overleaf, you can write instead a `latexmkrc` file as explained [here](https://www.overleaf.com/learn/latex/Questions/I_have_a_lot_of_.cls,_.sty,_.bst_files,_and_I_want_to_put_them_in_a_folder_to_keep_my_project_uncluttered._But_my_project_is_not_finding_them_to_compile_correctly).
-That's all!
+If you still have errors, it's likely that your LaTeX distribution is just too old (LaTeX 2016 seems to be too old to install a recent l3exp). So just upgrade to a decent version, and you should not have any troubles anymore.
+
+You can test your install by compiling the `demo.tex` file present in the repository. When it compiles, you are ready to start!
### Use in your project ###
@@ -101,7 +184,18 @@ For example:
\end{proofEnd}
```
-And put in the place where you would like to display the theorem the following code:
+Since `theoremEnd` may be a bit verbose to use, we provide since the version 2022/01/28, an option: if you load the program using `\usepackage[createShortEnv]{proof-at-the-end}`, you will automatically have the shortcut environments `proofE` (to replace `proof`), `thmE` (to replace `thm`), `theoremE` (to replace... ok you got the pattern), `lemmaE` and `corollaryE`. Note that it is your role to define the initial commands `thm`..., but you don't need to define them all, only those that you use. Then, you can use them like:
+
+```latex
+\begin{thmE}[My title][end, restate]
+ I am a restated theorem whose proof goes in appendix (compile me twice).
+\end{thmE}
+\begin{proofE}
+ And I am a proof.
+\end{proofE}
+```
+
+Finally, to display the proofs, just use `\printProofs` where you like:
```latex
\printProofs
@@ -114,6 +208,16 @@ NB: if you want to make sure all the references are linked correctly, make sure
Isn't it simple ?
+
+### A note on `hyperref`
+
+An older version of the package explicitely loaded `hyperref` with no option, and an option clash could occur if the user wanted to add options to `hyperref`. We now push the loading to the very end to avoid that issue, but if you want to load packages *after* `hyperref` (like `cleveref`), it is your job to include `hyperref`, for example by putting at the end of the preambule something like:
+
+```latex
+\usepackage[colorlinks]{hyperref}
+\usepackage{cleveref}
+```
+
## Use cases
### Configuration and how to use and create styles ###
@@ -177,22 +281,16 @@ and for local configuration:
}
```
-Finally, it can be practical to define custom environments to avoid typing always `theoremEnd`:
+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):
```latex
-\NewDocumentEnvironment{thmE}{O{}O{}+b}{%
- \begin{theoremEnd}[normal,#2]{thm}[#1]%
- #3%
- \end{theoremEnd}%
-}{}
-% Do not forget the second parameter or you might get Missing \begin{document} error
-\NewDocumentEnvironment{proofE}{O{}+b}{%
- \begin{proofEnd}[#1]%
- #2%
- \end{proofEnd}%
-}{}
-```
-That you could use like that:
+\newEndThm[normal]{thmE}{thm}
+\newEndProof{proofE}
+```
+
+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
\begin{thmE}[Title]
@@ -352,7 +450,7 @@ Here is the list of fundamental options supported. Most options have a `no` vers
- `text link`: text of the link to the proof, defaults to
`{See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}.}`
-- `text proof`: text displayed in place of "Proof" in the appendix. Defaults to `{Proof of \string\autoref{thm:prAtEnd\pratendcountercurrent}}`
+- `text proof`: text displayed in place of "Proof" in the appendix. Defaults to `{Proof of \string\pratendRef{thm:prAtEnd\pratendcountercurrent}}`
- `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.
@@ -365,14 +463,14 @@ Here are all the alias/styles (you can create you own as well), they are practic
- `proof at the end`: theorems whose proof need to go in the appendix contrary to `end` it does not make sure that there is a link to the proof. Shorcut for `no proof here, no all end, proof end, no both`.
- `debug`: make sure the proof is written in the main text as well (alias of `proof here, no opt all end`), it is quite practical to use when you write a proof to be able to use synctex features to move between the pdf and the file.
- `no link to theorem`: Remove the link from the proof to the theorem, alias of `text proof={\proofname}`
-- `stared` (or `no number`): when you use the stared version of a theorem you don't have any number, so autoref fails to write a nice link to the theorem. This option changes the text of "Proof", by keeping the link but writting only `Proof`. Equivalent to `text proof={\string\mbox{\string\hyperref[thm:prAtEnd\pratendcountercurrent]{\proofname}}}`
+- `stared` (or `no number`): when you use the stared version of a theorem you don't have any number, so cref fails to write a nice link to the theorem. This option changes the text of "Proof", by keeping the link but writting only `Proof`. Equivalent to `text proof={\string\mbox{\string\hyperref[thm:prAtEnd\pratendcountercurrent]{\proofname}}}`
- `see full proof`: useful when you want to write in the main text only a sketch of proof, this alias writes a link `See full proof on page X.`. Equivalent to `text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}.}`
- `one big link`: instead of two links, one for page, one for proof, put just one link around everything. It can also accept an optional argument which will be the text of the link, like `one big link=Go to the proof`. The default value is `See proof on page~\pageref*{proof:prAtEnd\pratendcountercurrent.}`.
- `one big link translated`: This is like `one big link`, but automatically add the page at the end (and a big link around). Practical to quickly define a translation like `one big link translated=Voir preuve page`. See also `text proof translated`.
-- `text link section`: Put a link to the proof looking like "See proof in section X". Defaults to `text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} in \autoref{proofsection:prAtEnd\pratendcountercurrent}.}`
-- `text link section full proof`: Put a link to the proof looking like "See full proof in section X". Defaults to `text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} in \autoref{proofsection:prAtEnd\pratendcountercurrent}.}`
+- `text link section`: Put a link to the proof looking like "See proof in section X". Defaults to `text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} in \pratendSectionlikeCref.}`
+- `text link section full proof`: Put a link to the proof looking like "See full proof in section X". Defaults to `text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} in \pratendSectionlikeCref.}`
- `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\autoref{thm: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}`
- `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
@@ -380,6 +478,62 @@ Here are all the alias/styles (you can create you own as well), they are practic
- `local custom defaults`: empty style that you can overwrite to change the "local" defaults, like category
- `all defaults`: all the defaults, equivalent of `bare defaults, configuration options, global custom defaults, local custom defaults`
+## Package options
+
+The package comes with multiple options:
+- The `conf={CONFIGURATION}` option is used to configure the default style. Usage: `\usepackage[conf={normal, text link section}]{proof-at-the-end}`
+- The `disablePatchSection` is useful to stop the library from patching the section-like commands and chapters (by default, we automatically add a `\label` at the end of the section which is used by `text link section` to find the Appendix). If you enable this option, you can manually add the label by using `\pratendAddLabel` after the appendix section (without any argument).
+- `commandRef=NAMECOMMAND`: By default, theorem are referenced to using `\autoref{}`. You can change the value of `NAMECOMMAND` to use another command, like `commandRef=Cref` to use `\Cref{}`. In that case, make sure to load both `hyperref` and `cleveref` (typically at the very end of your preambule) as `cleveref` needs to be loaded after `hyperref`. Internally, the library creates and uses `\pratendRef` instead of `\autoref`.
+- `createShortEnv`: creates (using `newEndThm` and `newEndProof`) the shortcut environments `proofE` (to replace `proof`), `thmE` (to replace `thm`), `theoremE` (to replace... ok you got the pattern), `lemmaE` and `corollaryE`. Note that it is still your job to define the `thm`, `lemma` environments.
+
+## Troubleshooting
+
+Here are some common issues you may have, with explainations to solve them.
+
+### The link after the proof does not mention the section, but something else (an equation, a figure, etc.)
+
+Sometimes, you may see something like `See proof in Equation A` instead of ``See proof in Appendix A`. This issue [was reported before](https://github.com/leo-colisson/proof-at-the-end/issues/2) and should be solved on newer versions (starting from 2022/01/27) by automatically patching sections. If you have this issue, just upgrade (for instance by copying the [`proof-at-the-end.sty` file](https://github.com/leo-colisson/proof-at-the-end) at the root of your project). We proceed by patching the `\chapter`, `\section`, `\subsection`, `subsubsection` and `\paragraph` commands to add `\pratendAddLabel` which will help the package to find the label of the current section. If you prefer the old behavior, you can disable it using the `disablePatchSection` option (more details in the package options).
+
+### I get an error `ERROR: File ended while scanning use of \@xverbatim.` when using verbatim inside a theorem
+
+I turns out that this library needs to use the `+b` option of environments in order to manipulate appropriately the theorem/proof. Unfortunately, it means that it is not possible to use verbatim environments inside. While [this answer](https://tex.stackexchange.com/questions/489435/use-environment-into-new-xparse-environment) suggests that it is impossible to avoid this issue, other people reported that it may be possible to use catcodes to capture the environment body verbatim, before using scantokens to reparse it, or to use [filecontentsdef](https://mirror.ibcp.fr/pub/CTAN/macros/latex/contrib/filecontentsdef/filecontentsdef.pdf) (see for instance [this comment](https://tex.stackexchange.com/questions/631810/create-a-newdocumentenvironment-programmatically?noredirect=1#comment1575605_631810)], ). However, it may be possible that this make syntex unusable, so it may not worth the effort.
+
+In anycase, there exists some workarounds, some of the are for instance give in the [TeX FAQ](https://texfaq.org/FAQ-verbwithin). The simplest solution, if your code is simple/short enough, is to use `\texttt` (you can replace backslash with `\textbackslash` inside etc, and include it in a `verse` if you have multiple lines). If you have a longer text, you may also like `lrbox` to put your content inside a box, for instance like that:
+
+
+```latex
+%% Create the box
+\newsavebox{\myEndBox}
+
+\begin{lrbox}{\myEndBox}
+ \begin{minipage}{1.0\linewidth}
+\begin{verbatim}
+\newEndThm[normal]{thmE}{thm}
+\newEndProof{proofE}{proof}
+\end{verbatim}
+ \end{minipage}
+\end{lrbox}
+
+%% Create a theorem:
+\begin{thmE}
+ Insert the box:
+
+ \begin{center}
+ \usebox{\myEndBox}
+ \end{center}
+\end{thmE}
+```
+
+
+## Changelog
+
+- 2022/01/28:
+ 1. Fix the issue when using sharps in a proof https://github.com/leo-colisson/proof-at-the-end/issues/7.
+ 2. Provide `\newEndThm`, `\newEndProof` and the option `createShortEnv` to quickly create environments.
+- 2022/01/27:
+ 1. Patch chapters/sections/... to better detect the current section and fix [issue 2](https://github.com/leo-colisson/proof-at-the-end/issues/2). This can be disabled using the package option `disablePatchSection`.
+ 2. Add an option `commandRef` to use other ref libraries, like `cleveref` instead of `autoref`.
+ 3. Normal restatable theorem do not need to be restated. Fix [issue 8](https://github.com/leo-colisson/proof-at-the-end/issues/8).
## Contributions ##
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 91d02323a1..6bb4aa3265 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:
+% -dir "/home/leo/Documents/Informatique/Programmation/LaTeX/proof-at-the-end/"
% -doc "../doc/proof-at-the-end_doc.tex"
% -author "Léo Colisson"
-% -dir "/tmp/pat/proof-at-the-end/"
% -src "proof-at-the-end\.sty=>proof-at-the-end.sty"
% proof-at-the-end
-% Created on 2019/5/22 12:52
+% Created on 2022/1/28 19:43
%\fi
%\iffalse
%<*package>
@@ -29,28 +29,33 @@
%\fi
% \iffalse
% Doc-Source file to use with LaTeX2e
-% Copyright (C) 2019 Léo Colisson, all rights reserved.
+% Copyright (C) 2022 Léo Colisson, all rights reserved.
% \fi
% \iffalse
%<*driver>
-\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
+% Options for packages loaded elsewhere
+\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
+\title{Proof-at-the-end, or how to move proofs in appendix in LaTeX}
+\author{Léo Colisson}
+\date{}
+
+\usepackage{amsmath,amssymb}
\usepackage{lmodern}
-\usepackage{amssymb,amsmath}
-\usepackage{ifxetex,ifluatex}
-\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
+\usepackage{iftex}
+\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
- \usepackage{textcomp} % provides euro and other symbols
-\else % if luatex or xelatex
+ \usepackage{textcomp} % provide euro and other symbols
+\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
-% use upquote if available, for straight quotes in verbatim environments
+% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
@@ -72,9 +77,9 @@
\hypersetup{
pdftitle={Proof-at-the-end, or how to move proofs in appendix in LaTeX},
pdfauthor={Léo Colisson},
- pdfborder={0 0 0},
- breaklinks=true}
-\urlstyle{same} % don't use monospace font for urls
+ hidelinks,
+ pdfcreator={LaTeX via pandoc}}
+\urlstyle{same} % disable monospaced font for URLs
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
@@ -113,29 +118,26 @@
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}}
-\setlength{\emergencystretch}{3em} % prevent overfull lines
+\usepackage{graphicx}
+\makeatletter
+\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
+\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
+\makeatother
+% Scale images if necessary, so that they will not overflow the page
+% margins by default, and it is still possible to overwrite the defaults
+% using explicit options in \includegraphics[width, height, ...]{}
+\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
+% Set default figure placement to htbp
+\makeatletter
+\def\fps@figure{htbp}
+\makeatother
+\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
-% Redefines (sub)paragraphs to behave more like sections
-\ifx\paragraph\undefined\else
- \let\oldparagraph\paragraph
- \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
+\ifLuaTeX
+ \usepackage{selnolig} % disable illegal ligatures
\fi
-\ifx\subparagraph\undefined\else
- \let\oldsubparagraph\subparagraph
- \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
-\fi
-
-% set default figure placement to htbp
-\makeatletter
-\def\fps@figure{htbp}
-\makeatother
-
-
-\title{Proof-at-the-end, or how to move proofs in appendix in LaTeX}
-\author{Léo Colisson}
-\date{}
\begin{document}
\DocInput{proof-at-the-end.dtx}
@@ -148,6 +150,13 @@
%\setcounter{tocdepth}{3}
%\tableofcontents
%}
+%WARNING: this package is definitely usable, but may not be as tested and
+%stable as standard packages. Note also that it may change a bit in the
+%future, but we will of course try to avoid as much as possible backward
+%incompatibilities. To ensure your document won't change when the package
+%get updates, it is always safer to copy the
+%\texttt{proof-at-the-end.sty} file at the root of your project.
+%
%\hypertarget{introduction}{%
%\section{Introduction}\label{introduction}}
%
@@ -206,50 +215,171 @@
%
%\begin{Shaded}
%\begin{Highlighting}[]
-%\FunctionTok{git}\NormalTok{ clone https://github.com/leo-colisson/proof-at-the-end.git}
-%\ExtensionTok{pdflatex}\NormalTok{ demo.tex }\KeywordTok{&&} \ExtensionTok{pdflatex}\NormalTok{ demo.tex}
+%\FunctionTok{git}\NormalTok{ clone https://github.com/leo{-}colisson/proof{-}at{-}the{-}end.git}
+%\ExtensionTok{pdflatex}\NormalTok{ demo.tex }\KeywordTok{\&\&} \ExtensionTok{pdflatex}\NormalTok{ demo.tex}
%\end{Highlighting}
%\end{Shaded}
%
%\hypertarget{quickstart}{%
%\section{Quickstart}\label{quickstart}}
%
+%\hypertarget{super-quick-quickstart}{%
+%\subsection{Super Quick QuickStart}\label{super-quick-quickstart}}
+%
+%If \texttt{proof-at-the-end} it's not installed in your CTAN
+%distribution, copy the
+%\href{https://github.com/leo-colisson/proof-at-the-end/}{\texttt{proof-at-the-end.sty}
+%file} in your project. Then, in your project, create new theorem/lemma
+%environments (using any tool you like, like asmthm, ntheorem and
+%thmtools), load the library using
+%\texttt{\textbackslash{}usepackage{[}createShortEnv{]}\{proof-at-the-end\}}
+%(note that you need the version 2022/01/28 to have
+%\texttt{createShortEnv} defined, otherwise you need to use directly
+%\texttt{theoremEnd}) and write your theorem using:
+%
+%\begin{Shaded}
+%\begin{Highlighting}[]
+%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[My title][end, restate]}
+%\NormalTok{ I am a restated theorem whose proof goes in appendix (compile me twice).}
+%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
+%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
+%\NormalTok{ And I am a proof.}
+%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
+%\end{Highlighting}
+%\end{Shaded}
+%
+%The options (here \texttt{restate} and \texttt{end}) tells what should
+%go in appendix, how to configure the links\ldots{} Here the proof should
+%go in appendix, and the \texttt{restate} options states that the theorem
+%should be restated before the proof.
+%
+%You can find below a full example to compile which should produce this
+%output (sorry, this is a screenshot, that way I can export it easily in
+%the github page). Just make sure to compile twice to get references.
+%
+%\begin{figure}
+%\centering
+%\includegraphics{screenshot.png}
+%\caption{Screenshot of the quickstart}
+%\end{figure}
+%
+%You can directly copy them (with a more complete demo) in the github
+%page here https://github.com/leo-colisson/proof-at-the-end/.
+%
+%\begin{Shaded}
+%\begin{Highlighting}[]
+%\BuiltInTok{\textbackslash{}documentclass}\NormalTok{\{}\ExtensionTok{article}\NormalTok{\}}
+%
+%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{xparse}\NormalTok{\} }\CommentTok{\% Not needed with recent LaTeX}
+%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{amsthm}\NormalTok{\}}
+%
+%\CommentTok{\% Create new theorems, or use ntheorem/thmtools/...}
+%\FunctionTok{\textbackslash{}newtheorem}\NormalTok{\{thm\}\{Theorem\}[section]}
+%\CommentTok{\% Default uses autoref, but you can also use cleveref, see the documentation.}
+%\CommentTok{\% Say to autoref that "thm" are Theorems.}
+%\FunctionTok{\textbackslash{}newcommand}\NormalTok{\{}\ExtensionTok{\textbackslash{}thmautorefname}\NormalTok{\}\{Theorem\}}
+%
+%\CommentTok{\%\% Load the library. createShortEnv automatically creates the shortcuts}
+%\CommentTok{\%\% thmE, theoremE, lemmaE, corrolaryE, proofE. See \textbackslash{}newEndThm for more details.}
+%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[createShortEnv]\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}}
+%
+%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{document}\NormalTok{\}}
+%
+%\KeywordTok{\textbackslash{}section}\NormalTok{\{Theorems\}}
+%
+%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[My title][end]}
+%\NormalTok{ I am a theorem}
+%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
+%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
+%\NormalTok{ And I am a proof.}
+%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
+%
+%\KeywordTok{\textbackslash{}section}\NormalTok{\{Proofs\}}
+%\FunctionTok{\textbackslash{}printProofs}
+%
+%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{document}\NormalTok{\}}
+%\end{Highlighting}
+%\end{Shaded}
+%
%\hypertarget{install}{%
%\subsection{Install}\label{install}}
%
-%If your CTAN distribution is recent enough, you have nothing to do.
-%Otherwise if it's not yet in your CTAN distribution, first download the
-%\texttt{proof-at-the-end.sty} file and insert it in the root of your
-%project with the following commands on unix (you can also clone this
-%repository if you prefer, or just manually download or copy/paste the
-%files on Windows). It also requires a recent version of xparse, so for
-%simplicity we included the sty file of xparse in this repository as
-%well:
+%If your CTAN distribution is recent enough, you have nothing to do (if
+%you are using overleaf, note that you can configure your project to use
+%a more recent TexLive distribution: this packages is included starting
+%from TexLive 2019). Otherwise if it's not yet in your CTAN distribution,
+%first download the \texttt{proof-at-the-end.sty} file and insert it in
+%the root of your project with the following commands on unix (you can
+%also clone this repository if you prefer, or just manually download or
+%copy/paste the files on Windows).
%
%\begin{Shaded}
%\begin{Highlighting}[]
-%\BuiltInTok{cd} \OperatorTok{<}\NormalTok{your project}\OperatorTok{>}
-%\VariableTok{repopratend=}\StringTok{"https://raw.githubusercontent.com/leo-colisson/proof-at-the-end"}
-%\FunctionTok{wget} \VariableTok{$\{repopratend\}}\NormalTok{/master/proof-at-the-end.sty}
-%\FunctionTok{wget} \VariableTok{$\{repopratend\}}\NormalTok{/master/xparse.sty}
+%\BuiltInTok{cd} \OperatorTok{\textless{}}\NormalTok{your project}\OperatorTok{\textgreater{}}
+%\VariableTok{repopratend}\OperatorTok{=}\StringTok{"https://raw.githubusercontent.com/leo{-}colisson/proof{-}at{-}the{-}end"}
+%\FunctionTok{wget} \VariableTok{$\{repopratend\}}\NormalTok{/master/proof{-}at{-}the{-}end.sty}
%\end{Highlighting}
%\end{Shaded}
%
-%If you have an old distribution of LaTeX (before 2018 basically, which
-%is the case of Overleaf), you may also need a
+%It also requires a recent version of xparse (not present in TexLive 2018
+%and before basically), otherwise you will get an error like:
+%
+%\begin{verbatim}
+%Unknown argument type 'b' replaced by 'm'
+%\end{verbatim}
+%
+%While
+%\href{https://raw.githubusercontent.com/leo-colisson/proof-at-the-end/c2150f4feba4709d47e43c00e5f8eb93ce345cab/xparse.sty}{we
+%used to provide} for simplicity a \texttt{xparse.sty} file (version
+%\texttt{2018-04-12}) in older versions of this repository, we removed it
+%to
+%\href{https://github.com/leo-colisson/proof-at-the-end/issues/6}{avoid
+%license issues and conflicts with recent LaTeX distributions that
+%already include xparse}. Nevertheless, if you are using an older
+%distribution, you can also download \texttt{xparse} manually
+%\href{http://mirrors.ctan.org/install/macros/latex/contrib/l3packages.tds.zip}{here},
+%unzip it, and copy the \texttt{.sty} files contained in
+%\texttt{tex/latex/l3packages/xparse/} at the root of your project. On
+%linux, you can do that via:
+%
+%\begin{Shaded}
+%\begin{Highlighting}[]
+%\BuiltInTok{cd} \OperatorTok{\textless{}}\NormalTok{your project}\OperatorTok{\textgreater{}}
+%\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3packages.tds.zip}
+%\FunctionTok{unzip} \AttributeTok{{-}d}\NormalTok{ . }\AttributeTok{{-}j}\NormalTok{ l3packages.tds.zip }\StringTok{\textquotesingle{}tex/latex/l3packages/xparse/*\textquotesingle{}}
+%\FunctionTok{rm} \AttributeTok{{-}f}\NormalTok{ l3packages.tds.zip xparse.ltx}
+%\end{Highlighting}
+%\end{Shaded}
+%
+%If you have an old distribution of LaTeX (2017 or before basically), you
+%may also need a
%\href{https://tex.stackexchange.com/questions/489646/expl3-and-recent-xparse-on-overleaf-no-expl3-loader-detected/489649?noredirect=1\#comment1236409_489649}{more
-%recent expl3}. It is also very easy to install, just download the zip
-%file
-%\url{http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip},
-%unzip, and copy the content of the directory
-%\texttt{tex/latex/l3kernel/} into your project. On linux it's a matter
-%of two commands in your project:
+%recent expl3} or you will get an error like:
+%
+%\begin{verbatim}
+%Package xparse Error: Support package l3kernel too old.
+%\end{verbatim}
+%
+%To install it, download the zip files
+%\url{http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip}
+%and
+%\url{http://mirrors.ctan.org/install/macros/latex/contrib/l3backend.tds.zip}
+%(\texttt{l3backend} is
+%\href{https://tex.stackexchange.com/questions/499082/file-l3backend-pdfmode-def-not-found-when-loading-expl3}{since
+%July 1st, 2019} a dependency of l3kernel), unzip, and copy the content
+%of the directories \texttt{tex/latex/l3kernel/} (first archive) and
+%\texttt{tex/latex/l3backend/} (second archive) into your project. On
+%linux it's a matter of two commands in your project:
%
%\begin{Shaded}
%\begin{Highlighting}[]
+%\BuiltInTok{cd} \OperatorTok{\textless{}}\NormalTok{your project}\OperatorTok{\textgreater{}}
%\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip}
-%\FunctionTok{unzip}\NormalTok{ -d . -j l3kernel.tds.zip }\StringTok{'tex/latex/l3kernel/*'}
+%\FunctionTok{unzip} \AttributeTok{{-}d}\NormalTok{ . }\AttributeTok{{-}j}\NormalTok{ l3kernel.tds.zip }\StringTok{\textquotesingle{}tex/latex/l3kernel/*\textquotesingle{}}
%\FunctionTok{rm}\NormalTok{ l3kernel.tds.zip}
+%\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3backend.tds.zip}
+%\FunctionTok{unzip} \AttributeTok{{-}d}\NormalTok{ . }\AttributeTok{{-}j}\NormalTok{ l3backend.tds.zip }\StringTok{\textquotesingle{}tex/latex/l3backend/*\textquotesingle{}}
+%\FunctionTok{rm}\NormalTok{ l3backend.tds.zip}
%\end{Highlighting}
%\end{Shaded}
%
@@ -259,7 +389,13 @@
%write instead a \texttt{latexmkrc} file as explained
%\href{https://www.overleaf.com/learn/latex/Questions/I_have_a_lot_of_.cls,_.sty,_.bst_files,_and_I_want_to_put_them_in_a_folder_to_keep_my_project_uncluttered._But_my_project_is_not_finding_them_to_compile_correctly}{here}.
%
-%That's all!
+%If you still have errors, it's likely that your LaTeX distribution is
+%just too old (LaTeX 2016 seems to be too old to install a recent l3exp).
+%So just upgrade to a decent version, and you should not have any
+%troubles anymore.
+%
+%You can test your install by compiling the \texttt{demo.tex} file
+%present in the repository. When it compiles, you are ready to start!
%
%\hypertarget{use-in-your-project}{%
%\subsection{Use in your project}\label{use-in-your-project}}
@@ -268,24 +404,24 @@
%
%\begin{Shaded}
%\begin{Highlighting}[]
-%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{proof-at-the-end}\NormalTok{\}}
+%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
%Then, you can configure your theorem/lemma/\ldots{} environments as
-%usual, by using any counter you like\ldots{}:
+%usual, by using any counter you like\ldots:
%
%\begin{Shaded}
%\begin{Highlighting}[]
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{amssymb, amsthm, amsmath}\NormalTok{\}}
-%\CommentTok{% Theorems}
+%\CommentTok{\% Theorems}
%\FunctionTok{\textbackslash{}newtheorem}\NormalTok{\{thm\}\{Theorem\}[section]}
-%\FunctionTok{\textbackslash{}newtheorem}\NormalTok{*\{thm*\}\{Theorem\}}
-%\FunctionTok{\textbackslash{}providecommand}\NormalTok{*}\FunctionTok{\textbackslash{}thmautorefname}\NormalTok{\{Theorem\}}
-%\CommentTok{% Lemmata}
+%\FunctionTok{\textbackslash{}newtheorem*}\NormalTok{\{thm*\}\{Theorem\}}
+%\FunctionTok{\textbackslash{}providecommand*\textbackslash{}thmautorefname}\NormalTok{\{Theorem\}}
+%\CommentTok{\% Lemmata}
%\FunctionTok{\textbackslash{}newtheorem}\NormalTok{\{lemma\}[thm]\{Lemma\}}
-%\FunctionTok{\textbackslash{}newtheorem}\NormalTok{*\{lemma*\}\{Lemma\}}
-%\FunctionTok{\textbackslash{}providecommand}\NormalTok{*}\FunctionTok{\textbackslash{}lemmaautorefname}\NormalTok{\{Lemma\}}
+%\FunctionTok{\textbackslash{}newtheorem*}\NormalTok{\{lemma*\}\{Lemma\}}
+%\FunctionTok{\textbackslash{}providecommand*\textbackslash{}lemmaautorefname}\NormalTok{\{Lemma\}}
%\end{Highlighting}
%\end{Shaded}
%
@@ -297,7 +433,7 @@
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[OPTIONS]\{THEOREM ENVIRONMENT\}[OPTIONAL TITLE]}
%\NormalTok{ YOUR THEOREM, with eventually labels like }\KeywordTok{\textbackslash{}label}\NormalTok{\{}\ExtensionTok{thm:OPTIONAL LABEL}\NormalTok{\}}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}}
-%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\} }\CommentTok{%% Optional environment}
+%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\} }\CommentTok{\%\% Optional environment}
%\NormalTok{ YOUR (OPTIONAL) PROOF}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\end{Highlighting}
@@ -317,8 +453,29 @@
%\end{Highlighting}
%\end{Shaded}
%
-%And put in the place where you would like to display the theorem the
-%following code:
+%Since \texttt{theoremEnd} may be a bit verbose to use, we provide since
+%the version 2022/01/28, an option: if you load the program using
+%\texttt{\textbackslash{}usepackage{[}createShortEnv{]}\{proof-at-the-end\}},
+%you will automatically have 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}. Note that it is your role to
+%define the initial commands \texttt{thm}\ldots, but you don't need to
+%define them all, only those that you use. Then, you can use them like:
+%
+%\begin{Shaded}
+%\begin{Highlighting}[]
+%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[My title][end, restate]}
+%\NormalTok{ I am a restated theorem whose proof goes in appendix (compile me twice).}
+%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
+%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
+%\NormalTok{ And I am a proof.}
+%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}}
+%\end{Highlighting}
+%\end{Shaded}
+%
+%Finally, to display the proofs, just use
+%\texttt{\textbackslash{}printProofs} where you like:
%
%\begin{Shaded}
%\begin{Highlighting}[]
@@ -335,6 +492,25 @@
%
%Isn't it simple ?
%
+%\hypertarget{a-note-on-hyperref}{%
+%\subsection{\texorpdfstring{A note on
+%\texttt{hyperref}}{A note on hyperref}}\label{a-note-on-hyperref}}
+%
+%An older version of the package explicitely loaded \texttt{hyperref}
+%with no option, and an option clash could occur if the user wanted to
+%add options to \texttt{hyperref}. We now push the loading to the very
+%end to avoid that issue, but if you want to load packages \emph{after}
+%\texttt{hyperref} (like \texttt{cleveref}), it is your job to include
+%\texttt{hyperref}, for example by putting at the end of the preambule
+%something like:
+%
+%\begin{Shaded}
+%\begin{Highlighting}[]
+%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[colorlinks]\{}\ExtensionTok{hyperref}\NormalTok{\}}
+%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{cleveref}\NormalTok{\}}
+%\end{Highlighting}
+%\end{Shaded}
+%
%\hypertarget{use-cases}{%
%\section{Use cases}\label{use-cases}}
%
@@ -373,7 +549,7 @@
%\NormalTok{ Each theorem can have a custom configuration!}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
-%\NormalTok{ Quite practical, isn't it?}
+%\NormalTok{ Quite practical, isn\textquotesingle{}t it?}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
@@ -396,7 +572,7 @@
%
%\begin{Shaded}
%\begin{Highlighting}[]
-%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[conf=\{normal, one big link\}]\{}\ExtensionTok{proof-at-the-end}\NormalTok{\}}
+%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[conf=\{normal, one big link\}]\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
%
@@ -411,7 +587,7 @@
%\begin{Shaded}
%\begin{Highlighting}[]
%\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/global custom defaults/.style=\{}
-%\NormalTok{ one big link=\{Go to proof on page~}\KeywordTok{\textbackslash{}pageref}\ErrorTok{*}\NormalTok{\{}\ExtensionTok{proof:prAtEnd\textbackslash{}pratendcountercurrent}\NormalTok{\}\}}
+%\NormalTok{ one big link=\{Go to proof on page\textasciitilde{}}\FunctionTok{\textbackslash{}pageref*}\NormalTok{\{proof:prAtEnd}\FunctionTok{\textbackslash{}pratendcountercurrent}\NormalTok{\}\}}
%\NormalTok{ \}}
%\NormalTok{\}}
%\end{Highlighting}
@@ -429,25 +605,24 @@
%\end{Shaded}
%
%Finally, it can be practical to define custom environments to avoid
-%typing always \texttt{theoremEnd}:
+%typing always \texttt{theoremEnd} using something like that
+%(\texttt{thmE} is the shortcut environment to create, and \texttt{thm}
+%is the old one):
%
%\begin{Shaded}
%\begin{Highlighting}[]
-%\FunctionTok{\textbackslash{}NewDocumentEnvironment}\NormalTok{\{thmE\}\{O\{\}O\{\}+b\}\{}\CommentTok{%}
-% \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[normal,#2]\{thm\}[#1]}\CommentTok{%}
-%\NormalTok{ #3}\CommentTok{%}
-% \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}}\CommentTok{%}
-%\NormalTok{\}\{\}}
-%\CommentTok{% Do not forget the second parameter or you might get Missing \textbackslash{}begin\{document\} error}
-%\FunctionTok{\textbackslash{}NewDocumentEnvironment}\NormalTok{\{proofE\}\{O\{\}+b\}\{}\CommentTok{%}
-% \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}[#1]}\CommentTok{%}
-%\NormalTok{ #2}\CommentTok{%}
-% \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}\CommentTok{%}
-%\NormalTok{\}\{\}}
+%\FunctionTok{\textbackslash{}newEndThm}\NormalTok{[normal]\{thmE\}\{thm\}}
+%\FunctionTok{\textbackslash{}newEndProof}\NormalTok{\{proofE\}}
%\end{Highlighting}
%\end{Shaded}
%
-%That you could use like that:
+%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}
%\begin{Highlighting}[]
@@ -676,7 +851,7 @@
%\NormalTok{ Hint: look at the alias options.}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proof}\NormalTok{\}}
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
-%\NormalTok{ You just use ``see full proof'' as an option}
+%\NormalTok{ You just use \textasciigrave{}\textasciigrave{}see full proof\textquotesingle{}\textquotesingle{} as an option}
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}
%\end{Highlighting}
%\end{Shaded}
@@ -715,7 +890,7 @@
%\item
% \texttt{text\ proof}: text displayed in place of ``Proof'' in the
% appendix. Defaults to
-% \texttt{\{Proof\ of\ \textbackslash{}string\textbackslash{}autoref\{thm:prAtEnd\textbackslash{}pratendcountercurrent\}\}}
+% \texttt{\{Proof\ of\ \textbackslash{}string\textbackslash{}pratendRef\{thm:prAtEnd\textbackslash{}pratendcountercurrent\}\}}
%\item
% \texttt{restate\ command}: name of a unique macro (without backslash)
% that will be defined as an alias to restate the theorem wherever you
@@ -762,10 +937,9 @@
% theorem, alias of \texttt{text\ proof=\{\textbackslash{}proofname\}}
%\item
% \texttt{stared} (or \texttt{no\ number}): when you use the stared
-% version of a theorem you don't have any number, so autoref fails to
-% write a nice link to the theorem. This option changes the text of
-% ``Proof'', by keeping the link but writting only \texttt{Proof}.
-% Equivalent to
+% version of a theorem you don't have any number, so cref fails to write
+% a nice link to the theorem. This option changes the text of ``Proof'',
+% by keeping the link but writting only \texttt{Proof}. Equivalent to
% \texttt{text\ proof=\{\textbackslash{}string\textbackslash{}mbox\{\textbackslash{}string\textbackslash{}hyperref{[}thm:prAtEnd\textbackslash{}pratendcountercurrent{]}\{\textbackslash{}proofname\}\}\}}
%\item
% \texttt{see\ full\ proof}: useful when you want to write in the main
@@ -787,11 +961,11 @@
%\item
% \texttt{text\ link\ section}: Put a link to the proof looking like
% ``See proof in section X''. Defaults to
-% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ in\ \textbackslash{}autoref\{proofsection:prAtEnd\textbackslash{}pratendcountercurrent\}.\}}
+% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ in\ \textbackslash{}pratendSectionlikeCref.\}}
%\item
% \texttt{text\ link\ section\ full\ proof}: Put a link to the proof
% looking like ``See full proof in section X''. Defaults to
-% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{full\ proof\}\ in\ \textbackslash{}autoref\{proofsection:prAtEnd\textbackslash{}pratendcountercurrent\}.\}}
+% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{full\ proof\}\ in\ \textbackslash{}pratendSectionlikeCref.\}}
%\item
% \texttt{default\ text\ link}: default text for the link to the proof,
% equivalent of
@@ -799,7 +973,7 @@
%\item
% \texttt{default\ text\ proof}: default text for the proof in appendix,
% equivalent of
-% \texttt{text\ proof=\{Proof\ of\ \textbackslash{}string\textbackslash{}autoref\{thm:prAtEnd\textbackslash{}pratendcountercurrent\}\}}
+% \texttt{text\ proof=\{Proof\ of\ \textbackslash{}string\textbackslash{}pratendRef\{thm:prAtEnd\textbackslash{}pratendcountercurrent\}\}}
%\item
% \texttt{text\ proof\ translated}: like \texttt{default\ text\ proof},
% but takes one argument and use it instead of \texttt{Proof\ of}.
@@ -825,6 +999,161 @@
% \texttt{bare\ defaults,\ configuration\ options,\ global\ custom\ defaults,\ local\ custom\ defaults}
%\end{itemize}
%
+%\hypertarget{package-options}{%
+%\section{Package options}\label{package-options}}
+%
+%The package comes with multiple options: - The
+%\texttt{conf=\{CONFIGURATION\}} option is used to configure the default
+%style. Usage:
+%\texttt{\textbackslash{}usepackage{[}conf=\{normal,\ text\ link\ section\}{]}\{proof-at-the-end\}}
+%- The \texttt{disablePatchSection} is useful to stop the library from
+%patching the section-like commands and chapters (by default, we
+%automatically add a \texttt{\textbackslash{}label} at the end of the
+%section which is used by \texttt{text\ link\ section} to find the
+%Appendix). If you enable this option, you can manually add the label by
+%using \texttt{\textbackslash{}pratendAddLabel} after the appendix
+%section (without any argument). - \texttt{commandRef=NAMECOMMAND}: By
+%default, theorem are referenced to using
+%\texttt{\textbackslash{}autoref\{\}}. You can change the value of
+%\texttt{NAMECOMMAND} to use another command, like
+%\texttt{commandRef=Cref} to use \texttt{\textbackslash{}Cref\{\}}. In
+%that case, make sure to load both \texttt{hyperref} and
+%\texttt{cleveref} (typically at the very end of your preambule) as
+%\texttt{cleveref} needs to be loaded after \texttt{hyperref}.
+%Internally, the library creates and uses
+%\texttt{\textbackslash{}pratendRef} instead of
+%\texttt{\textbackslash{}autoref}. - \texttt{createShortEnv}: creates
+%(using \texttt{newEndThm} and \texttt{newEndProof}) 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}. Note that it
+%is still your job to define the \texttt{thm}, \texttt{lemma}
+%environments.
+%
+%\hypertarget{troubleshooting}{%
+%\section{Troubleshooting}\label{troubleshooting}}
+%
+%Here are some common issues you may have, with explainations to solve
+%them.
+%
+%\hypertarget{the-link-after-the-proof-does-not-mention-the-section-but-something-else-an-equation-a-figure-etc.}{%
+%\subsection{The link after the proof does not mention the section, but
+%something else (an equation, a figure,
+%etc.)}\label{the-link-after-the-proof-does-not-mention-the-section-but-something-else-an-equation-a-figure-etc.}}
+%
+%Sometimes, you may see something like
+%\texttt{See\ proof\ in\ Equation\ A} instead of
+%`\texttt{See\ proof\ in\ Appendix\ A}. This issue
+%\href{https://github.com/leo-colisson/proof-at-the-end/issues/2}{was
+%reported before} and should be solved on newer versions (starting from
+%2022/01/27) by automatically patching sections. If you have this issue,
+%just upgrade (for instance by copying the
+%\href{https://github.com/leo-colisson/proof-at-the-end}{\texttt{proof-at-the-end.sty}
+%file} at the root of your project). We proceed by patching the
+%\texttt{\textbackslash{}chapter}, \texttt{\textbackslash{}section},
+%\texttt{\textbackslash{}subsection}, \texttt{subsubsection} and
+%\texttt{\textbackslash{}paragraph} commands to add
+%\texttt{\textbackslash{}pratendAddLabel} which will help the package to
+%find the label of the current section. If you prefer the old behavior,
+%you can disable it using the \texttt{disablePatchSection} option (more
+%details in the package options).
+%
+%\hypertarget{i-get-an-error-error-file-ended-while-scanning-use-of-xverbatim.-when-using-verbatim-inside-a-theorem}{%
+%\subsection{\texorpdfstring{I get an error
+%\texttt{ERROR:\ File\ ended\ while\ scanning\ use\ of\ \textbackslash{}@xverbatim.}
+%when using verbatim inside a
+%theorem}{I get an error ERROR: File ended while scanning use of \textbackslash@xverbatim. when using verbatim inside a theorem}}\label{i-get-an-error-error-file-ended-while-scanning-use-of-xverbatim.-when-using-verbatim-inside-a-theorem}}
+%
+%I turns out that this library needs to use the \texttt{+b} option of
+%environments in order to manipulate appropriately the theorem/proof.
+%Unfortunately, it means that it is not possible to use verbatim
+%environments inside. While
+%\href{https://tex.stackexchange.com/questions/489435/use-environment-into-new-xparse-environment}{this
+%answer} suggests that it is impossible to avoid this issue, other people
+%reported that it may be possible to use catcodes to capture the
+%environment body verbatim, before using scantokens to reparse it, or to
+%use
+%\href{https://mirror.ibcp.fr/pub/CTAN/macros/latex/contrib/filecontentsdef/filecontentsdef.pdf}{filecontentsdef}
+%(see for instance
+%\href{https://tex.stackexchange.com/questions/631810/create-a-newdocumentenvironment-programmatically?noredirect=1\#comment1575605_631810}{this
+%comment}{]}, ). However, it may be possible that this make syntex
+%unusable, so it may not worth the effort.
+%
+%In anycase, there exists some workarounds, some of the are for instance
+%give in the \href{https://texfaq.org/FAQ-verbwithin}{TeX FAQ}. The
+%simplest solution, if your code is simple/short enough, is to use
+%\texttt{\textbackslash{}texttt} (you can replace backslash with
+%\texttt{\textbackslash{}textbackslash} inside etc, and include it in a
+%\texttt{verse} if you have multiple lines). If you have a longer text,
+%you may also like \texttt{lrbox} to put your content inside a box, for
+%instance like that:
+%
+%\begin{Shaded}
+%\begin{Highlighting}[]
+%\CommentTok{\%\% Create the box}
+%\FunctionTok{\textbackslash{}newsavebox}\NormalTok{\{}\FunctionTok{\textbackslash{}myEndBox}\NormalTok{\}}
+%
+%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{lrbox}\NormalTok{\}\{}\FunctionTok{\textbackslash{}myEndBox}\NormalTok{\}}
+% \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{minipage}\NormalTok{\}\{1.0}\FunctionTok{\textbackslash{}linewidth}\NormalTok{\}}
+%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{verbatim}\NormalTok{\}}
+%\VerbatimStringTok{\textbackslash{}newEndThm[normal]\{thmE\}\{thm\}}
+%\VerbatimStringTok{\textbackslash{}newEndProof\{proofE\}\{proof\}}
+%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{verbatim}\NormalTok{\}}
+% \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{minipage}\NormalTok{\}}
+%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{lrbox}\NormalTok{\}}
+%
+%\CommentTok{\%\% Create a theorem:}
+%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
+%\NormalTok{ Insert the box:}
+%
+% \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{center}\NormalTok{\}}
+% \FunctionTok{\textbackslash{}usebox}\NormalTok{\{}\FunctionTok{\textbackslash{}myEndBox}\NormalTok{\}}
+% \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{center}\NormalTok{\}}
+%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}}
+%\end{Highlighting}
+%\end{Shaded}
+%
+%\hypertarget{changelog}{%
+%\section{Changelog}\label{changelog}}
+%
+%\begin{itemize}
+%\tightlist
+%\item
+% 2022/01/28:
+%
+% \begin{enumerate}
+% \def\labelenumi{\arabic{enumi}.}
+% \tightlist
+% \item
+% Fix the issue when using sharps in a proof
+% https://github.com/leo-colisson/proof-at-the-end/issues/7.
+% \item
+% Provide \texttt{\textbackslash{}newEndThm},
+% \texttt{\textbackslash{}newEndProof} and the option
+% \texttt{createShortEnv} to quickly create environments.
+% \end{enumerate}
+%\item
+% 2022/01/27:
+%
+% \begin{enumerate}
+% \def\labelenumi{\arabic{enumi}.}
+% \tightlist
+% \item
+% Patch chapters/sections/\ldots{} to better detect the current
+% section and fix
+% \href{https://github.com/leo-colisson/proof-at-the-end/issues/2}{issue
+% 2}. This can be disabled using the package option
+% \texttt{disablePatchSection}.
+% \item
+% Add an option \texttt{commandRef} to use other ref libraries, like
+% \texttt{cleveref} instead of \texttt{autoref}.
+% \item
+% Normal restatable theorem do not need to be restated. Fix
+% \href{https://github.com/leo-colisson/proof-at-the-end/issues/8}{issue
+% 8}.
+% \end{enumerate}
+%\end{itemize}
+%
%\hypertarget{contributions}{%
%\section{Contributions}\label{contributions}}
%
@@ -837,19 +1166,20 @@
%
%\begin{Shaded}
%\begin{Highlighting}[]
-%\ExtensionTok{%%}\NormalTok{ Compile the demo}
+%\ExtensionTok{\%\%}\NormalTok{ Compile the demo}
%\FunctionTok{make}\NormalTok{ demo}
-%\ExtensionTok{%%}\NormalTok{ Clean the project}
+%\ExtensionTok{\%\%}\NormalTok{ Clean the project}
%\FunctionTok{make}\NormalTok{ clean}
-%\ExtensionTok{%%}\NormalTok{ Generate the documentation}
+%\ExtensionTok{\%\%}\NormalTok{ Generate the documentation}
%\FunctionTok{make}\NormalTok{ doc}
-%\ExtensionTok{%%}\NormalTok{ Generate a package for CTAN}
+%\ExtensionTok{\%\%}\NormalTok{ Generate a package for CTAN}
%\FunctionTok{make}\NormalTok{ package}
%\end{Highlighting}
%\end{Shaded}
%
%
%
+%
%\StopEventually{}
%\section{The Code}
%\iffalse
@@ -858,16 +1188,18 @@
% \end{macrocode}
%\fi
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{proof-at-the-end}[2019/05/21 A package to move proofs in appendix]
+\ProvidesPackage{proof-at-the-end}[2022/01/28 A package to move proofs in appendix]
\RequirePackage{etoolbox}
-\RequirePackage{hyperref}
\RequirePackage{thmtools}
\RequirePackage{thm-restate}
\RequirePackage{catchfile}
\RequirePackage{pgfkeys}
\RequirePackage{xparse}
-
+% Load hyperref at the end
+\AtEndPreamble{%
+ \RequirePackage{hyperref}
+}%
\RequirePackage{kvoptions}
%% https://tex.stackexchange.com/questions/109747/put-all-package-options-into-one-command
@@ -876,27 +1208,56 @@
%% \usepackage[conf={normal}]{proof-at-the-end}
\SetupKeyvalOptions{
family=pratendOpt,
- prefix=pratendOpt,
+ prefix=pratendOpt, % "Namespace": Prefix of the commands, conditions....
}
\DeclareStringOption{conf}
\DeclareLocalOptions{conf}% \pratendOptdefconf contains the proof
+\DeclareBoolOption{disablePatchSection} % Use \ifpratendOptdisablePatchSection ... \else ... \fi
+\DeclareStringOption[autoref]{commandRef} % Use commandRef=cref to use cleveref. Defaults to autoref.
+\DeclareBoolOption{createShortEnv} % To create thmE, theoremE, proofE, lemmaE, corrolaryE
\ProcessKeyvalOptions*
% \DeclareOption*{\PackageWarning{proof-at-the-end}{Unknown}}
% \ProcessOptions\relax
+%% https://tex.stackexchange.com/a/13289/116348
\newwrite\appendwrite
+\newcount\pratend@count@makeallother
+
+%%% Loop to make sure all chars are normal letters, including #.
+\newcommand{\makeallother}{%
+ \pratend@count@makeallother0\relax
+ \loop\ifnum\pratend@count@makeallother<255\relax
+ \catcode\pratend@count@makeallother12\relax
+ \advance\pratend@count@makeallother by 1\relax
+ \repeat
+}
+%%% This command allows the user to append things to a file. But the content may contain macros that
+%%% will be evaluated before writing them to the file.
+%%% TODO: Efficiency may be improved by writing to the file only before the printProof.
% The first argument is the file name
% The second argument is the text to write
\NewDocumentCommand\appendtofile{m+m}{%
\begingroup
- \IfFileExists{#1}%
- {\CatchFileDef{\filecontent}{#1}{\catcode`\\=12 \endlinechar=`^^J\catcode\endlinechar=12\relax}}% keep existing end-of-lines
- {\let\filecontent\empty}%
- \immediate\openout\appendwrite=#1\relax
- \immediate\write\appendwrite{\detokenize\expandafter{\filecontent}#2}%
- \immediate\closeout\appendwrite
+ %% Read the content
+ \begingroup%
+ \IfFileExists{#1}{%
+ \newlinechar\endlinechar%
+ \makeallother% Turn all chars into normal letters.
+ \everyeof{\noexpand}%
+ \edef\fileContent{\@@input #1 }%
+ }{%
+ \let\fileContent\empty
+ }%
+ %% Open the file to write in it:
+ \immediate\openout\appendwrite #1\relax%
+ %% Write the text
+ \immediate\write\appendwrite{\fileContent}%
+ \endgroup%
+ \immediate\write\appendwrite{#2}%
+ %% Close the file
+ \immediate\closeout\appendwrite%
\endgroup
}
@@ -1012,19 +1373,19 @@
one big link={#1~\pageref*{proof:prAtEnd\pratendcountercurrent}.}
},
text link section/.style={%
- text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} in \autoref{proofsection:prAtEnd\pratendcountercurrent}.}
+ text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} in \pratendSectionlikeCref.}
},
text link section full proof/.style={%
- text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} in \autoref{proofsection:prAtEnd\pratendcountercurrent}.}
+ text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} in \pratendSectionlikeCref.}
},
default text link/.style={
text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}.},
},
text proof translated/.style={
- text proof={#1 \string\autoref{thm:prAtEnd\pratendcountercurrent}},
+ text proof={#1 \string\pratendRef{thm:prAtEnd\pratendcountercurrent}},
},
default text proof/.style={
- text proof={Proof of \string\autoref{thm:prAtEnd\pratendcountercurrent}},
+ text proof={Proof of \string\pratendRef{thm:prAtEnd\pratendcountercurrent}},
},
%%%% Defaults
bare defaults/.style={
@@ -1116,9 +1477,13 @@
\fi%
%% Create a custom alias to restate the theorem
\expandafter\protected@xdef\csname \pratendcustomrestate\endcsname{\noexpand\csname prAtEndRestate\pratendcountercurrent\endcsname}%
- %% Restate the theorem if needed in appendix
- \ifrestatethm
- \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\prAtEndRestate\pratendcountercurrent*}
+ %% 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*}%
+ \fi%
\fi%
\fi%
%% If the theorem is not stated in the main text,
@@ -1129,7 +1494,7 @@
\protected@xdef\pratendcountercurrent{\roman{counterAllProofEnd}}
%% Create a custom alias to restate the theorem
\expandafter\protected@xdef\csname \pratendcustomrestate\endcsname{\noexpand\csname prAtEndRestate\pratendcountercurrent\endcsname}%
- \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\begin{restatable}[#3]{#2}{prAtEndRestate\pratendcountercurrent}\string\label{thm:prAtEnd\pratendcountercurrent}\detokenize{#4}\string\end{restatable}}%
+ \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\begin{restatable}[\detokenize{#3}]{#2}{prAtEndRestate\pratendcountercurrent}\string\label{thm:prAtEnd\pratendcountercurrent}\detokenize{#4}\string\end{restatable}}%
\fi%
}{}
@@ -1155,7 +1520,13 @@
\fi%
%% Write the proof at the end
\ifproofend%
- \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\label{proofsection:prAtEnd\pratendcountercurrent}\string\begin{proof}[\pratendtextproof]\string\phantomsection\string\label{proof:prAtEnd\pratendcountercurrent}\detokenize{#2}\string\end{proof}}%
+ %% 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}}%
\fi%
}{}
@@ -1198,6 +1569,112 @@
% }
% }
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% Patch sections, chapters...
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% 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
+% directly the section afterwards.
+\newcounter{pratend@counter@sectionlike}
+%% Command to add after a label like "prAtEnd:sectionlike10". Useful to patch \section, \chapter...
+\NewDocumentCommand\pratendAddLabel{}{%
+ %% First, we get the label
+ %% Cool explaination of expandafter, edef, noexpand:
+ %%% https://www.tug.org/TUGboat/tb09-1/tb20bechtolsheim.pdf
+ \edef\pratend@current@sectionlike@label{prAtEnd:sectionlike\thepratend@counter@sectionlike}%
+ \expandafter\label{\pratend@current@sectionlike@label}%
+ \let\pratend@sectionlike@stored@label\@currentlabel%
+}%
+\NewDocumentCommand\pratendSectionlikeCref{}{%
+ \pratendRef{proofsection:prAtEnd\pratendcountercurrent}%
+}
+\NewDocumentCommand\pratendChangeCurrentLabel{}{
+ \ifdefined\pratend@sectionlike@stored@label%
+ \let\@currentlabel\pratend@sectionlike@stored@label%
+ \fi%
+}
+\ifpratendOptdisablePatchSection
+\else
+ %% Add the above command to \chapter if the command exists
+ \ifdef{\@chapter}{
+ \ifpatchable*{\@chapter}{
+ \apptocmd{\@chapter}{\pratendAddLabel}{}{}%
+ }{\PackageWarning{proof-at-the-end}{Chapters are not patchable.}{}}
+ }{}
+ %% patch sections/subsections/paragraph/...
+ %% https://tex.stackexchange.com/questions/631713/patch-section-command-fails/631717?noredirect=1#comment1575337_631717
+ \ifdef{\@sect}{
+ % \apptocmd{\section}{\pratendAddLabel}{}{}%
+ \ifpatchable*{\@sect}{
+ \apptocmd{\@sect}{\pratendAddLabel}{}{}%
+ }{\PackageWarning{proof-at-the-end}{Sections are not patchable.}{}}
+ }{}
+\fi
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% Allow cref/autoref/...
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Instead of \autoref{proof:blabla} use \pratendRef{proof:blabla}, it allows the ref command to be customized
+%% as an option of the package.
+\NewDocumentCommand\pratendRef{m}{%
+ \csname \pratendOptcommandRef\endcsname{#1}
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% Create automatically wrapper
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% Defines a shortcut to avoid typing the whole theoremEnd environment.
+%% Avoid to manually type \NewDocumentEnvironment...
+%% Usage: \newEndThm[default options]{new environment}{old environment}
+% E.g.: \newEndThm[normal]{thmE}{thm}{}
+\NewDocumentCommand{\newEndThm}{O{}mm}{%
+ % \expandafter\NewDocumentEnvironment{#2}{O{}O{}+b}{%
+ % \begin{theoremEnd}[#1,##2]{#3}[##1]%
+ % ##3%
+ % \end{theoremEnd}%
+ % }{}
+ \NewDocumentEnvironment{#2}{O{}O{}}{%
+ \begin{theoremEnd}[#1,##2]{#3}[##1]%
+ }{\end{theoremEnd}}
+}
+
+% \NewDocumentCommand{\newEndThm}{O{}mm}{%
+% % \expandafter\NewDocumentEnvironment{#2}{O{}O{}+b}{%
+% % \begin{theoremEnd}[#1,##2]{#3}[##1]%
+% % ##3%
+% % \end{theoremEnd}%
+% % }{}
+% \expandafter\NewDocumentEnvironment{#2}{O{}O{}+b}{%
+% \begin{theoremEnd}[#1,##2]{#3}[##1]%
+% ##3
+% \end{theoremEnd}%
+% }{}
+% }
+
+%% Avoid to manually type \NewDocumentEnvironment...
+%% Usage: \newEndProof[default options]{new proof environment}{old proof environment}
+% E.g.: \newEndProof[]{proofE}{proof}
+\NewDocumentCommand{\newEndProof}{O{}m}{%
+ \NewDocumentEnvironment{#2}{O{}+b}{%
+ \begin{proofEnd}[#1,##1]%
+ ##2%
+ \end{proofEnd}%
+ }{}
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% Create even more automatically wrapper with option "createShortEnv"
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifpratendOptcreateShortEnv
+ %%% We create automatically the environments.
+ \newEndProof{proofE}
+ \newEndThm{thmE}{thm}
+ \newEndThm{lemmaE}{lemmaE}
+ \newEndThm{theoremE}{theorem}
+ \newEndThm{corollaryE}{corollary}
+\fi
\endinput
%\iffalse
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 0daebc328f..35ac253c53 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,10 +1,10 @@
-% proof-at-the-end.ins generated using makedtx version 1.2 2019/5/22 12:52
+% proof-at-the-end.ins generated using makedtx version 1.2 2022/1/28 19:43
\input docstrip
\preamble
proof-at-the-end.dtx
- Copyright 2019 Léo Colisson
+ Copyright 2022 Léo Colisson
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
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
index de9dd25e63..63ce2cb59f 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
Binary files differ
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
index ce9b0d89f5..2186bcc823 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
Binary files differ
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 f7e9f33ad9..d4f59616c9 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
@@ -1,7 +1,9 @@
\documentclass{article}
\usepackage{amssymb, amsthm, amsmath}
-\usepackage{hyperref}
+\usepackage{xparse}
+\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:
@@ -17,7 +19,7 @@
% text link={\hyperref[proof:prAtEnd\pratendcountercurrent]{See proof on page~\pageref*{proof:prAtEnd\pratendcountercurrent}}}
% }
% }
-%%% You can also easily modify the gloabl/locals defaults in other parts of the code using:
+%%% You can also easily modify the global/locals defaults in other parts of the code using:
% \pgfkeys{/prAtEnd/local custom defaults/.style={
% category=greattheorem
% }
@@ -39,14 +41,17 @@
\providecommand*\lemmaautorefname{Lemma}
%% If you want you can define shortcuts:
-\usepackage{xparse}
-% And to define new shortcuts:
-\NewDocumentEnvironment{mynormalthm}{O{}O{}+b}{%
- \begin{theoremEnd}[normal,#2]{thm}[#1]%
- #3%
- \end{theoremEnd}%
-}{}
+% 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}
\section{Demo of proof-at-the-end}
@@ -94,6 +99,13 @@ And I can refer to my theorems using classic labels, like in \autoref{thm:ilikel
And keep the proof with you!
\end{proofEnd}
+\begin{theoremEnd}[normal,restate]{thm}[I am restatable but normal]
+ See, if you are both normal and restatable, then no need to restate the theorem at the end!
+\end{theoremEnd}
+\begin{proofEnd}
+ I am a proof of a restatable but normal theorem.
+\end{proofEnd}
+
You can also put comments that appear only in the appendix.
\textEnd{See, I am a simple comments with math $\delta = b^2-ac$ and references \autoref{thm:mytheoremattheend}.}
@@ -168,33 +180,67 @@ And of course it is easy to define custom shortcuts, using in prelude:
}{}
\end{verbatim}
-\begin{mynormalthm}[My own environment]
- You can then create your own environment from other styles using
-\end{mynormalthm}
+\newsavebox{\myEndBox}
+
+\begin{lrbox}{\myEndBox}
+ \begin{minipage}{1.0\linewidth}
+\begin{verbatim}
+\newEndThm[normal]{thmE}{thm}
+\newEndProof{proofE}
+\end{verbatim}
+ \end{minipage}
+\end{lrbox}
+
+\newsavebox{\myEndBoxB}
+
+\begin{lrbox}{\myEndBoxB}
+ \begin{minipage}{1.0\linewidth}
+\begin{verbatim}
+\begin{thmE}[Title][optional options]
+ Theorem
+\end{thmE}
+\begin{proofE}
+ Your proof
+\end{proofE}
+\end{verbatim}
+ \end{minipage}
+\end{lrbox}
+
+\begin{thmE}[My own environment][normal]
+ You can then create a wrapper to avoid typing the full theoremEnd environment, and to add custom options by using:
+
+ \begin{center}
+ \usebox{\myEndBox}
+ \end{center}
+
+ \noindent (see that we need to use \texttt{\textbackslash textt} or \texttt{lrbox} to typeset verbatim inside theorem)
+
+ Then, you can simply use:
+\end{thmE}
\begin{proofEnd}
That's quicker :D
\end{proofEnd}
-\begin{mynormalthm}[My own environment][end]
+\begin{thmE}[My own environment][end]
You can use options also with your custom environments.
-\end{mynormalthm}
+\end{thmE}
\begin{proofEnd}
That's quicker with the proof at the end :D
\end{proofEnd}
-\begin{mynormalthm}[][end]
+\begin{thmE}[][end]
And you can remove the title and have options.
-\end{mynormalthm}
-\begin{proofEnd}
+\end{thmE}
+\begin{proofE}
Just leave empty title.
-\end{proofEnd}
+\end{proofE}
-\begin{mynormalthm}[My second own environment][all end]
+\begin{thmE}[My second own environment][all end]
My normal theorem is moved at the end!
-\end{mynormalthm}
-\begin{proofEnd}
+\end{thmE}
+\begin{proofE}
Custom environments are practical no ;)
-\end{proofEnd}
+\end{proofE}
\begin{theoremEnd}[]{thm}[Yes I can have no proof]
Proof is useless. You can do do it. And see, I can include other environments inside me ;)\\
@@ -204,7 +250,6 @@ And of course it is easy to define custom shortcuts, using in prelude:
\end{tabular}
\end{theoremEnd}
-
\begin{theoremEnd}[restate command=mymanualrestate]{thm}[Manual restate]
A theorem can be manually restated
\end{theoremEnd}
diff --git a/macros/latex/contrib/spbmark/spbmark.pdf b/macros/latex/contrib/spbmark/spbmark.pdf
index 0f6853ca4c..956ba69d9e 100644
--- a/macros/latex/contrib/spbmark/spbmark.pdf
+++ b/macros/latex/contrib/spbmark/spbmark.pdf
Binary files differ
diff --git a/macros/latex/contrib/spbmark/spbmark.sty b/macros/latex/contrib/spbmark/spbmark.sty
index 1ab56b6bf3..6b1f60022e 100644
--- a/macros/latex/contrib/spbmark/spbmark.sty
+++ b/macros/latex/contrib/spbmark/spbmark.sty
@@ -9,7 +9,7 @@
% https://creativecommons.org/licenses/by/4.0/legalcode
\NeedsTeXFormat{LaTeX2e}[2018/12/31]
\RequirePackage{xparse,l3keys2e}
-\ProvidesExplPackage{spbmark}{2022/01/25}{1.32}
+\ProvidesExplPackage{spbmark}{2022/01/28}{1.33}
{Customize superscripts and subscripts}
\cs_generate_variant:Nn \box_set_ht:Nn { cv }
@@ -62,6 +62,8 @@
style/#1 .code:n = \keys_set:nn { ctex/style } {#2}
}
}
+\cs_new_protected:Npn \spbshortkv #1#2
+ { \spb_define:n { #1 .meta:n = {#2} } }
\spb_define:n
{
mode .tl_set:N = \l__spb_mode_value_tl,
diff --git a/macros/latex/contrib/spbmark/spbmark.tex b/macros/latex/contrib/spbmark/spbmark.tex
index b68e0bb169..fd16319223 100644
--- a/macros/latex/contrib/spbmark/spbmark.tex
+++ b/macros/latex/contrib/spbmark/spbmark.tex
@@ -6,8 +6,8 @@
{
package = spbmark,
title = the spbmark package,
- version = v1.32,
- date = 2022/01/25,
+ version = v1.33,
+ date = 2022/01/28,
authors = Qu Yi,
info = Customize superscript and subscript,
email = q1jx@foxmail.com,
@@ -19,7 +19,7 @@
color-scheme = blue,
title-format = \huge\bfseries\scshape,
add-frame-options = {innerleftmargin = 2em},
- listings-options = {numbers = none},
+ listings-options = {numbers = none,gobble = 2},
pre-output = {\parindent = 0em}
}
@@ -40,7 +40,7 @@
\section{Macro package options}
\label{sec:macro package options}
-The following macro package options will redefine the scripts commands of the \LaTeX{} kernel. If you do not specify the values of boolean options, they default to \code{true}.
+The following macro package options will redefine the script commands of the \LaTeX{} kernel. If you do not specify the values of boolean options, they default to \code{true}.
\begin{options}
\keybool{text}\Default{false}
\cs{textsuperscript} and \cs{textsubscript} are equivalent to the \cs{super} and \cs{sub} commands.
@@ -54,7 +54,7 @@ The following macro package options will redefine the scripts commands of the \L
The values of \option{text}, \option{math} and \option{foot} three options are \code{true} at the same time.
\begin{example}[code-only]
\usepackage[both]{spbmark}
- \usepackage[text,foot = true]{spbmark}
+ \usepackage[text,foot=true]{spbmark}
\end{example}
\end{options}
@@ -71,8 +71,19 @@ There are currently three commands to set superscript and subscript. Their forma
Defines the style of the superscript or subscript used for the \option{style} option.
\command{spbifmath}[\marg{math code}\marg{text code}]
In some cases, \code{math} or \code{text} output modes require different code for format or move. This command can be used when using the \code{match} option or changing the output mode locally, whitch should be used in the move or format options. It can switch the corresponding code according to different output modes.
+ \command{spbshortkv}[\marg{short opt}\marg{key value}]
+ Converts any existing key-value pair to a shorthand option. The value of key \code{\#1} indicates that the shorthand option needs to be assigned a value.
+ \begin{example}
+ \spbshortkv{x}{sphmove=#1}
+ \defspbstyle{fancy}{sbcmd=\color{blue},mode=math}
+ \spbshortkv{mysb}{style=fancy}
+ A\super[x=2pt]{b} \\
+ A\sub{b}[mysb]
+ \end{example}
\end{commands}
+Since the \cs{super} and \cs{sub} commands enclose the scripts in a horizontal box, the horizontal positions are staggered when using both superscript and subscript, which is different from the simultaneous use of \code{\^{}} and \code{\_} symbols in math mode. In this case, you need to adjust the horizontal offset of the latter command or use the \cs{supersub} command.
+
The options common to \meta{kv list} of the three commands are as follows. They can be used in \meta{key-value list} for the \cs{spbset} command. When the following options are used in the \cs{spbset} command, in addition to \option{style} and \option{mode}, they are set according to the type of the previous most recent command.
\begin{options}
\keyval{vmove}{fixed length}\Default{0pt}
@@ -138,9 +149,9 @@ The following list of keys control the format of superscript and subscript.
\begin{options}
\keyval{spbhmove}{fixed length}\Default{0pt}
Extra vertical move of the superscript and the subscript.
- \kvsplit{spbcmd}{super cmds}{sub cmds}
+ \kvsplit{spbcmd}{super cmds}{sub cmds} \newline
The format commands of superscript and subscript. The first part is in superscript format, and the latter part is in subscript format. They are separated by commas, or only the first part exists.
- \kvsplit{spbcmd+}{super cmds}{sub cmds}
+ \kvsplit{spbcmd+}{super cmds}{sub cmds} \newline
Add code to the previous global superscript and subscript format commands.
\keyval{spbheight}{fixed length}
The distance between the superscript baseline and the previous line.
@@ -155,19 +166,19 @@ The following list of keys control the format of superscript and subscript.
\section{Examples of use}
Here is a list of the three commands, please pay attention to the usage of optional parameters. Note when the horizontal move is negative, the starting point is at the right end of the mark.
\begin{example}
-\defspbstyle{fancy}{cmd=\color{purple}}
-\spbset{spbcmd={\spbifmath{\mathtt}{\ttfamily},\color{blue}}}
-A\super[vmove=0.2ex,hmove=0.2em,cmd=\textcolor{red}]{exam}B \\
-$A\sub[style=fancy,cmd+=\mathsf,mode=math]{exam}B$ \\
-A\supersub[vsep=0.6ex,halign=c]{examsuper}{sub}B \\
-A\super{c}[vmove=5pt,hmove=-5.5pt]B\sub[vmove=5pt,hmove=-5pt]{d}AB
+ \defspbstyle{fancy}{cmd=\color{purple}}
+ \spbset{spbcmd={\spbifmath{\mathtt}{\ttfamily},\color{blue}}}
+ A\super[vmove=0.2ex,hmove=0.2em,cmd=\textcolor{red}]{exam}B \\
+ $A\sub[style=fancy,cmd+=\mathsf,mode=math]{exam}B$ \\
+ A\supersub[vsep=0.6ex,halign=c]{examsuper}{sub}B \\
+ A\super{c}[vmove=5pt,hmove=-5.5pt]B\sub[vmove=5pt,hmove=-5pt]{d}AB
\end{example}
It can also be used with the \pkg*{siunitx} package to output superscript and subscript in the unit:
\begin{example}
-\unit[mode=math]{kg.m/s\super[vmove=-1pt]{2}} \\
-\qty[mode=text]{30}{A\supersub[hmove=1pt,cmd=\color{red}]{b}{c}} \\
-\spbset{sbhmove=2pt}\unit[mode=text]{A\sub{b}}
+ \unit[mode=math]{kg.m/s\super[vmove=-1pt]{2}} \\
+ \qty[mode=text]{30}{A\supersub[hmove=1pt,cmd=\color{red}]{b}{c}} \\
+ \spbset{sbhmove=2pt}\unit[mode=text]{A\sub{b}}
\end{example}
\pkg*{spbmark} also patches the footer markers for standard document class and \cls*{KOMA-Script}. You can format the footer markers by redefining the \cs{fnmarkfont} command. Note that extra horizontal move does not work with footnote markers.
diff --git a/macros/latex/contrib/zref-clever/CHANGELOG.md b/macros/latex/contrib/zref-clever/CHANGELOG.md
index 5a5addd47e..74fdc04b4e 100644
--- a/macros/latex/contrib/zref-clever/CHANGELOG.md
+++ b/macros/latex/contrib/zref-clever/CHANGELOG.md
@@ -1,6 +1,28 @@
# Changelog
-## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.1.2-alpha...HEAD)
+## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.2.0-alpha...HEAD)
+
+## [v0.2.0-alpha](https://github.com/gusbrs/zref-clever/compare/v0.1.2-alpha...v0.2.0-alpha) (2022-01-28)
+
+### Added
+- The reference block formatting has been generalized to allow for more
+ flexibility in setting the reference structure, with the new option
+ `refbounds`.
+
+### Fixed
+- Fixed handling of type names defined to be empty.
+- Fixed distinction of `lastsep` and `pairsep` in cases where the type-block
+ starts or ends with a range.
+
+### Changed
+- The `namefont` and `reffont` options can now be set also in
+ `\zcRefTypeSetup` and `\zcLanguageSetup`.
+- (Internal) Moved from property lists to individually named macros to store
+ and retrieve options.
+
+### Deprecated
+- Options `preposinlink`, `preref`, and `postref` have been deprecated and
+ replaced by new option `refbounds`.
## [v0.1.2-alpha](https://github.com/gusbrs/zref-clever/compare/v0.1.1-alpha...v0.1.2-alpha) (2022-01-10)
@@ -34,7 +56,7 @@
### Removed
- Dropped the `subappendix` reference type.
-## [v0.1.0-alpha](https://github.com/gusbrs/zref-clever/releases/tag/v0.1.0-alpha) (2021-00-24)
+## [v0.1.0-alpha](https://github.com/gusbrs/zref-clever/releases/tag/v0.1.0-alpha) (2021-11-24)
### Added
- Initial release.
diff --git a/macros/latex/contrib/zref-clever/MANIFEST.md b/macros/latex/contrib/zref-clever/MANIFEST.md
index a52c56a9ee..0c7f6e4af5 100644
--- a/macros/latex/contrib/zref-clever/MANIFEST.md
+++ b/macros/latex/contrib/zref-clever/MANIFEST.md
@@ -65,7 +65,9 @@ the same output. These output files are sometimes shared and sometime specific f
different engines (pdfTeX, XeTeX, LuaTeX, etc.).
* zc-LanguageSetup01.lvt
+* zc-LanguageSetup02.lvt
* zc-RefTypeSetup01.lvt
+* zc-RefTypeSetup02.lvt
* zc-class-article01.lvt
* zc-class-book01.lvt
* zc-class-memoir01.lvt
@@ -83,6 +85,7 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.).
* zc-compat-memoir01.lvt
* zc-compat-subcaption01.lvt
* zc-compat-subfig01.lvt
+* zc-fallback01.lvt
* zc-howto-amsmath01.lvt
* zc-howto-enumitem01.lvt
* zc-howto-listings01.lvt
@@ -97,8 +100,12 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.).
* zc-howto-newtheorem04.lvt
* zc-howto-zref-xr01.lvt
* zc-label-options01.lvt
-* zc-langfiles01.lvt
-* zc-langfiles02.lvt
+* zc-langfile-dutch01.lvt
+* zc-langfile-english01.lvt
+* zc-langfile-french01.lvt
+* zc-langfile-german01.lvt
+* zc-langfile-portuguese01.lvt
+* zc-langfile-spanish01.lvt
* zc-languages01.lvt
* zc-opt-check01.lvt
* zc-opt-d01.lvt
@@ -125,16 +132,27 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.).
* zc-typeset01.lvt
* zc-workaround-breqn01.lvt
* zc-zcref-options01.lvt
+* zc-zcref-options02.lvt
* zc-LanguageSetup01.luatex.tlg
* zc-LanguageSetup01.luatexdev.tlg
* zc-LanguageSetup01.tlg
* zc-LanguageSetup01.xetex.tlg
* zc-LanguageSetup01.xetexdev.tlg
+* zc-LanguageSetup02.luatex.tlg
+* zc-LanguageSetup02.luatexdev.tlg
+* zc-LanguageSetup02.tlg
+* zc-LanguageSetup02.xetex.tlg
+* zc-LanguageSetup02.xetexdev.tlg
* zc-RefTypeSetup01.luatex.tlg
* zc-RefTypeSetup01.luatexdev.tlg
* zc-RefTypeSetup01.tlg
* zc-RefTypeSetup01.xetex.tlg
* zc-RefTypeSetup01.xetexdev.tlg
+* zc-RefTypeSetup02.luatex.tlg
+* zc-RefTypeSetup02.luatexdev.tlg
+* zc-RefTypeSetup02.tlg
+* zc-RefTypeSetup02.xetex.tlg
+* zc-RefTypeSetup02.xetexdev.tlg
* zc-class-article01.luatex.tlg
* zc-class-article01.luatexdev.tlg
* zc-class-article01.tlg
@@ -220,6 +238,11 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.).
* zc-compat-subfig01.tlg
* zc-compat-subfig01.xetex.tlg
* zc-compat-subfig01.xetexdev.tlg
+* zc-fallback01.luatex.tlg
+* zc-fallback01.luatexdev.tlg
+* zc-fallback01.tlg
+* zc-fallback01.xetex.tlg
+* zc-fallback01.xetexdev.tlg
* zc-howto-amsmath01.luatex.tlg
* zc-howto-amsmath01.luatexdev.tlg
* zc-howto-amsmath01.tlg
@@ -288,12 +311,16 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.).
* zc-label-options01.luatex.tlg
* zc-label-options01.luatexdev.tlg
* zc-label-options01.tlg
-* zc-langfiles01.tlg
-* zc-langfiles02.luatex.tlg
-* zc-langfiles02.luatexdev.tlg
-* zc-langfiles02.tlg
-* zc-langfiles02.xetex.tlg
-* zc-langfiles02.xetexdev.tlg
+* zc-langfile-dutch01.tlg
+* zc-langfile-english01.tlg
+* zc-langfile-french01.tlg
+* zc-langfile-german01.tlg
+* zc-langfile-portuguese01.luatex.tlg
+* zc-langfile-portuguese01.luatexdev.tlg
+* zc-langfile-portuguese01.tlg
+* zc-langfile-portuguese01.xetex.tlg
+* zc-langfile-portuguese01.xetexdev.tlg
+* zc-langfile-spanish01.tlg
* zc-languages01.tlg
* zc-opt-check01.luatex.tlg
* zc-opt-check01.luatexdev.tlg
@@ -402,6 +429,11 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.).
* zc-zcref-options01.tlg
* zc-zcref-options01.xetex.tlg
* zc-zcref-options01.xetexdev.tlg
+* zc-zcref-options02.luatex.tlg
+* zc-zcref-options02.luatexdev.tlg
+* zc-zcref-options02.tlg
+* zc-zcref-options02.xetex.tlg
+* zc-zcref-options02.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
index b955c4c59f..033edad2dc 100644
--- a/macros/latex/contrib/zref-clever/zref-clever-code.pdf
+++ b/macros/latex/contrib/zref-clever/zref-clever-code.pdf
Binary files differ
diff --git a/macros/latex/contrib/zref-clever/zref-clever.dtx b/macros/latex/contrib/zref-clever/zref-clever.dtx
index 3027bcab15..d850476b4c 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-10} {0.1.2-alpha}
+\ProvidesExplPackage {zref-clever} {2022-01-28} {0.2.0-alpha}
{Clever LaTeX cross-references based on zref}
% \end{macrocode}
%
@@ -398,7 +398,7 @@
{
\bool_if:nTF
{ \prop_if_in_p:Nn \l_@@_counter_resetby_prop {#1} }
- { \prop_item:Nn \l_@@_counter_resetby_prop {#1} }
+ { \prop_item:Nn \l_@@_counter_resetby_prop {#1} }
{
\seq_map_tokens:Nn \l_@@_counter_resetters_seq
{ \@@_counter_reset_by_aux:nn {#1} }
@@ -523,11 +523,6 @@
}
\msg_new:nnn { zref-clever } { key-requires-value }
{ The~'#1'~key~'#2'~requires~a~value~\msg_line_context:. }
-\msg_new:nnn { zref-clever } { key-boolean-or-empty }
- {
- The~key~'#1'~only~accepts~the~values~'true',~'false'~
- or~an~empty~value~\msg_line_context:.
- }
\msg_new:nnn { zref-clever } { language-declared }
{ Language~'#1'~is~already~declared~\msg_line_context:.~Nothing~to~do. }
\msg_new:nnn { zref-clever } { unknown-language-alias }
@@ -544,7 +539,7 @@
}
\msg_new:nnn { zref-clever } { unknown-language-opt }
{
- Language~'#1'~is~unknown~\msg_line_context:.~Using~default.~
+ Language~'#1'~is~unknown~\msg_line_context:.~
See~documentation~for~'\iow_char:N\\zcDeclareLanguage'~and~
'\iow_char:N\\zcDeclareLanguageAlias'.
}
@@ -607,15 +602,6 @@
{ Option~'#1'~is~only~available~after~\iow_char:N\\begin\{document\}. }
\msg_new:nnn { zref-clever } { langfile-loaded }
{ Loaded~'#1'~language~file. }
-\msg_new:nnn { zref-clever } { langfile-not-available }
- { Language~file~for~'#1'~not~available~\msg_line_context:. }
-\msg_new:nnn { zref-clever } { unknown-language-load }
- {
- Language~'#1'~is~unknown~\msg_line_context:.~
- Unable~to~load~language~file.~See~documentation~for~
- '\iow_char:N\\zcDeclareLanguage'~and~
- '\iow_char:N\\zcDeclareLanguageAlias'.
- }
\msg_new:nnn { zref-clever } { zref-property-undefined }
{
Option~'ref=#1'~requested~\msg_line_context:.~
@@ -641,6 +627,12 @@
Unknown~compatibility~module~'#1'~given~to~option~'nocompat'.~
Nothing~to~do.
}
+\msg_new:nnn { zref-clever } { refbounds-must-be-four }
+ {
+ The~value~of~option~'#1'~must~be~a~comma~sepatared~list~
+ of~four~items.~We~received~'#2'~items~\msg_line_context:.~
+ Option~not~set.
+ }
\msg_new:nnn { zref-clever } { missing-zref-check }
{
Option~'check'~requested~\msg_line_context:.~
@@ -652,11 +644,6 @@
{ Reference~property~'#1'~undefined~for~label~'#2'~\msg_line_context:. }
\msg_new:nnn { zref-clever } { missing-name }
{ Reference~format~option~'#1'~undefined~for~type~'#2'~\msg_line_context:. }
-\msg_new:nnn { zref-clever } { missing-string }
- {
- We~couldn't~find~a~value~for~reference~option~'#1'~\msg_line_context:.~
- But~we~should~have:~throw~a~rock~at~the~maintainer.
- }
\msg_new:nnn { zref-clever } { single-element-range }
{ Range~for~type~'#1'~resulted~in~single~element~\msg_line_context:. }
\msg_new:nnn { zref-clever } { compat-package }
@@ -724,21 +711,414 @@
% \end{macro}
%
%
+% \subsection{Option infra}
+%
+% This section provides the functions in which the variables naming scheme of
+% the package options is embodied, and some basic general functions to query
+% these option variables.
+%
+% I had originally implemented the option handling of the package based on
+% property lists, which are definitely very convenient. But as the number of
+% options grew, I started to get concerned about the performance implications.
+% That there was a toll was noticeable, even when we could live with it, of
+% course. Indeed, at the time of writing, the typesetting of a reference
+% queries about 24 different option values, most of them once per type-block,
+% each of these queries can be potentially made in up to 5 option scope
+% levels. Considering the size of the built-in language files is running at
+% the hundreds, the package does have a lot of work to do in querying option
+% values alone, and thus it is best to smooth things in this area as much as
+% possible. This also gives me some peace of mind that the package will scale
+% well in the long term. For some interesting discussion about alternative
+% methods and their performance implications, see
+% \url{https://tex.stackexchange.com/q/147966}. \contributor{Phelype Oleinik}
+% also offered some insight on the matter at
+% \url{https://tex.stackexchange.com/questions/629946/#comment1571118_629946}.
+% The only real downside of this change is that we can no longer list the
+% whole set of options in place at a given moment, which was useful for the
+% purposes of regression testing, since we don't know what the whole set of
+% active options is.
+%
+%
+% \begin{macro}[EXP]{\@@_opt_varname_general:nn}
+% Defines, and leaves in the input stream, the csname of the variable used
+% to store the general \meta{option}. The data type of the variable must be
+% specified (\texttt{tl}, \texttt{seq}, \texttt{bool}, etc.).
+% \begin{syntax}
+% \cs{@@_opt_varname_general:nn} \Arg{option} \Arg{data type}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_opt_varname_general:nn #1#2
+ { l_@@_opt_general_ #1 _ #2 }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP]{\@@_opt_varname_type:nnn}
+% Defines, and leaves in the input stream, the csname of the variable used
+% to store the type-specific \meta{option} for \meta{ref type}.
+% \begin{syntax}
+% \cs{@@_opt_varname_type:nnn} \Arg{ref type} \Arg{option} \Arg{data type}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_opt_varname_type:nnn #1#2#3
+ { l_@@_opt_type_ #1 _ #2 _ #3 }
+\cs_generate_variant:Nn \@@_opt_varname_type:nnn { enn , een }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP]{\@@_opt_varname_language:nnn}
+% Defines, and leaves in the input stream, the csname of the variable used
+% to store the language \meta{option} for \meta{lang} (for general language
+% options, those set with \cs{zcDeclareLanguage}). The
+% ``\texttt{lang_unknown}'' branch should be guarded against, such as we
+% normally should not get there, but this function \emph{must} return some
+% valid csname. The random part is there so that, in the circumstance this
+% could not be avoided, we (hopefully) don't retrieve the value for an
+% ``unknown language'' inadvertently.
+% \begin{syntax}
+% \cs{@@_opt_varname_language:nnn} \Arg{lang} \Arg{option} \Arg{data type}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_opt_varname_language:nnn #1#2#3
+ {
+ \@@_language_if_declared:nTF {#1}
+ {
+ g_@@_opt_language_
+ \tl_use:c { \@@_language_varname:n {#1} }
+ _ #2 _ #3
+ }
+ { g_@@_opt_lang_unknown_ \int_rand:n { 1000000 } _ #3 }
+ }
+\cs_generate_variant:Nn \@@_opt_varname_language:nnn { enn }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP]{\@@_opt_varname_lang_default:nnn}
+% Defines, and leaves in the input stream, the csname of the variable used
+% to store the language-specific default reference format \meta{option} for
+% \meta{lang}.
+% \begin{syntax}
+% \cs{@@_opt_varname_lang_default:nnn} \Arg{lang} \Arg{option} \Arg{data type}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_opt_varname_lang_default:nnn #1#2#3
+ {
+ \@@_language_if_declared:nTF {#1}
+ {
+ g_@@_opt_lang_
+ \tl_use:c { \@@_language_varname:n {#1} }
+ _default_ #2 _ #3
+ }
+ { g_@@_opt_lang_unknown_ \int_rand:n { 1000000 } _ #3 }
+ }
+\cs_generate_variant:Nn \@@_opt_varname_lang_default:nnn { enn }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP]{\@@_opt_varname_lang_type:nnnn}
+% Defines, and leaves in the input stream, the csname of the variable used
+% to store the language- and type-specific reference format \meta{option}
+% for \meta{lang} and \meta{ref type}.
+% \begin{syntax}
+% \cs{@@_opt_varname_lang_type:nnnn} \Arg{lang} \Arg{ref type}
+% ~~\Arg{option} \Arg{data type}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_opt_varname_lang_type:nnnn #1#2#3#4
+ {
+ \@@_language_if_declared:nTF {#1}
+ {
+ g_@@_opt_lang_
+ \tl_use:c { \@@_language_varname:n {#1} }
+ _type_ #2 _ #3 _ #4
+ }
+ { g_@@_opt_lang_unknown_ \int_rand:n { 1000000 } _ #4 }
+ }
+\cs_generate_variant:Nn
+ \@@_opt_varname_lang_type:nnnn { eenn , eeen }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP]{\@@_opt_varname_fallback:nn}
+% Defines, and leaves in the input stream, the csname of the variable used
+% to store the fallback \meta{option}.
+% \begin{syntax}
+% \cs{@@_opt_varname_fallback:nn} \Arg{option} \Arg{data type}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_opt_varname_fallback:nn #1#2
+ { c_@@_opt_fallback_ #1 _ #2 }
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}
+% {
+% \@@_opt_tl_unset:N ,
+% \@@_opt_tl_gunset:N ,
+% }
+% Unset \meta{option tl}. These functions \emph{define} what means to be
+% unset for an option token list, and it must match what the conditional
+% \cs{@@_opt_tl_if_set:N} tests for.
+% \begin{syntax}
+% \cs{@@_opt_tl_unset:N} \Arg{option tl}
+% \cs{@@_opt_tl_gunset:N} \Arg{option tl}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_opt_tl_unset:N #1
+ { \tl_set_eq:NN #1 \c_novalue_tl }
+\cs_new_protected:Npn \@@_opt_tl_gunset:N #1
+ { \tl_gset_eq:NN #1 \c_novalue_tl }
+\cs_generate_variant:Nn \@@_opt_tl_unset:N { c }
+\cs_generate_variant:Nn \@@_opt_tl_gunset:N { c }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP,TF]{\@@_opt_tl_if_set:N}
+% \begin{syntax}
+% \cs{@@_opt_tl_if_set:N(TF)} \Arg{option tl} \Arg{true} \Arg{false}
+% \end{syntax}
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_opt_tl_if_set:N #1 { F , TF }
+ {
+ \bool_lazy_and:nnTF
+ { \tl_if_exist_p:N #1 }
+ { ! \tl_if_novalue_p:n {#1} }
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_opt_tl_gset_if_new:Nn}
+% \begin{syntax}
+% \cs{@@_opt_tl_gset_if_new:Nn} \Arg{option tl} \Arg{value}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_opt_tl_gset_if_new:Nn #1#2
+ {
+ \@@_opt_tl_if_set:NF #1
+ { \tl_gset:Nn #1 {#2} }
+ }
+\cs_generate_variant:Nn \@@_opt_tl_gset_if_new:Nn { cn }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[TF]{\@@_opt_tl_get:NN}
+% \begin{syntax}
+% \cs{@@_opt_tl_get:NN(TF)} \Arg{option tl to get} \Arg{tl var to set}
+% ~~\Arg{true} \Arg{false}
+% \end{syntax}
+% \begin{macrocode}
+\prg_new_protected_conditional:Npnn \@@_opt_tl_get:NN #1#2 { F }
+ {
+ \@@_opt_tl_if_set:NTF #1
+ {
+ \tl_set_eq:NN #2 #1
+ \prg_return_true:
+ }
+ { \prg_return_false: }
+ }
+\prg_generate_conditional_variant:Nnn
+ \@@_opt_tl_get:NN { cN } { F }
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}
+% {
+% \@@_opt_seq_set_clist_split:Nn ,
+% \@@_opt_seq_gset_clist_split:Nn ,
+% }
+% \begin{syntax}
+% \cs{@@_opt_seq_set_clist_split:Nn} \Arg{option seq} \Arg{value}
+% \cs{@@_opt_seq_gset_clist_split:Nn} \Arg{option seq} \Arg{value}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_opt_seq_set_clist_split:Nn #1#2
+ { \seq_set_split:Nnn #1 { , } {#2} }
+\cs_new_protected:Npn \@@_opt_seq_gset_clist_split:Nn #1#2
+ { \seq_gset_split:Nnn #1 { , } {#2} }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}
+% {
+% \@@_opt_seq_unset:N ,
+% \@@_opt_seq_gunset:N ,
+% }
+% Unset \meta{option seq}. These functions \emph{define} what means to be
+% unset for an option sequence, and it must match what the conditional
+% \cs{@@_opt_seq_if_set:N} tests for.
+% \begin{syntax}
+% \cs{@@_opt_seq_unset:N} \Arg{option seq}
+% \cs{@@_opt_seq_gunset:N} \Arg{option seq}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_opt_seq_unset:N #1
+ { \cs_set_eq:NN #1 \scan_stop: }
+\cs_new_protected:Npn \@@_opt_seq_gunset:N #1
+ { \cs_gset_eq:NN #1 \scan_stop: }
+\cs_generate_variant:Nn \@@_opt_seq_unset:N { c }
+\cs_generate_variant:Nn \@@_opt_seq_gunset:N { c }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP,TF]{\@@_opt_seq_if_set:N}
+% \begin{syntax}
+% \cs{@@_opt_seq_if_set:N(TF)} \Arg{option seq} \Arg{true} \Arg{false}
+% \end{syntax}
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_opt_seq_if_set:N #1 { F , TF }
+ { \seq_if_exist:NTF #1 { \prg_return_true: } { \prg_return_false: } }
+\prg_generate_conditional_variant:Nnn
+ \@@_opt_seq_if_set:N { c } { F , TF }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[TF]{\@@_opt_seq_get:NN}
+% \begin{syntax}
+% \cs{@@_opt_seq_get:NN(TF)} \Arg{option seq to get} \Arg{seq var to set}
+% ~~\Arg{true} \Arg{false}
+% \end{syntax}
+% \begin{macrocode}
+\prg_new_protected_conditional:Npnn \@@_opt_seq_get:NN #1#2 { F }
+ {
+ \@@_opt_seq_if_set:NTF #1
+ {
+ \seq_set_eq:NN #2 #1
+ \prg_return_true:
+ }
+ { \prg_return_false: }
+ }
+\prg_generate_conditional_variant:Nnn
+ \@@_opt_seq_get:NN { cN } { F }
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}
+% {
+% \@@_opt_bool_unset:N ,
+% \@@_opt_bool_gunset:N ,
+% }
+% Unset \meta{option bool}. These functions \emph{define} what means to be
+% unset for an option boolean, and it must match what the conditional
+% \cs{@@_opt_bool_if_set:N} tests for. The particular definition we are
+% employing here has some relevant implications. Setting the boolean
+% variable to \cs{scan_stop:} (aka, \cs{relax}) means we can \emph{never}
+% test the variable without first testing if it is \emph{set}.
+% \cs{@@_opt_bool_if:N} does this conveniently.
+% \begin{syntax}
+% \cs{@@_opt_bool_unset:N} \Arg{option bool}
+% \cs{@@_opt_bool_gunset:N} \Arg{option bool}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_opt_bool_unset:N #1
+ { \cs_set_eq:NN #1 \scan_stop: }
+\cs_new_protected:Npn \@@_opt_bool_gunset:N #1
+ { \cs_gset_eq:NN #1 \scan_stop: }
+\cs_generate_variant:Nn \@@_opt_bool_unset:N { c }
+\cs_generate_variant:Nn \@@_opt_bool_gunset:N { c }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP,TF]{\@@_opt_bool_if_set:N}
+% \begin{syntax}
+% \cs{@@_opt_bool_if_set:N(TF)} \Arg{option bool} \Arg{true} \Arg{false}
+% \end{syntax}
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_opt_bool_if_set:N #1 { F , TF }
+ { \bool_if_exist:NTF #1 { \prg_return_true: } { \prg_return_false: } }
+\prg_generate_conditional_variant:Nnn
+ \@@_opt_bool_if_set:N { c } { F , TF }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}[TF]{\@@_opt_bool_get:NN}
+% \begin{syntax}
+% \cs{@@_opt_bool_get:NN(TF)} \Arg{option bool to get} \Arg{bool var to set}
+% ~~\Arg{true} \Arg{false}
+% \end{syntax}
+% \begin{macrocode}
+\prg_new_protected_conditional:Npnn \@@_opt_bool_get:NN #1#2 { F }
+ {
+ \@@_opt_bool_if_set:NTF #1
+ {
+ \bool_set_eq:NN #2 #1
+ \prg_return_true:
+ }
+ { \prg_return_false: }
+ }
+\prg_generate_conditional_variant:Nnn
+ \@@_opt_bool_get:NN { cN } { F }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP,TF]{\@@_opt_bool_if:N}
+% \begin{syntax}
+% \cs{@@_opt_bool_if:N(TF)} \Arg{option bool} \Arg{true} \Arg{false}
+% \end{syntax}
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_opt_bool_if:N #1 { T , F , TF }
+ {
+ \@@_opt_bool_if_set:NTF #1
+ { \bool_if:NTF #1 { \prg_return_true: } { \prg_return_false: } }
+ { \prg_return_false: }
+ }
+\prg_generate_conditional_variant:Nnn
+ \@@_opt_bool_if:N { c } { T , F , TF }
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
% \subsection{Reference format}
%
% For a general discussion on the precedence rules for reference format
% options, see Section ``Reference format'' in the User manual. Internally,
-% these precedence rules are handled / enforced in
-% \cs{@@_get_ref_opt_typeset:nN}, \cs{@@_get_ref_opt_font:nN}, and
+% these precedence rules are handled / enforced in \cs{@@_get_rf_opt_tl:nnnN},
+% \cs{@@_get_rf_opt_seq:nnnN}, \cs{@@_get_rf_opt_bool:nnnnN}, and
% \cs{@@_type_name_setup:} which are the basic functions to retrieve proper
-% values for reference format settings. The ``fallback'' settings are stored
-% in \cs{g_@@_fallback_unknown_lang_prop}.
+% values for reference format settings.
+%
+% The fact that we have multiple scopes to set reference format options has
+% some implications for how we handle these options, and for the resulting UI.
+% Since there is a clear precedence rule between the different levels, setting
+% an option at a high priority level shadows everything below it. Hence, it
+% may be relevant to be able to ``unset'' these options too, so as to be able
+% go back to the lower precedence level of the language-specific options at
+% any given point. However, since many of these options are token lists, or
+% clists, for which ``empty'' is a legitimate value, we cannot rely on
+% emptiness to distinguish that particular intention. How to deal with it,
+% depends on the kind of option (its data type, to be precise). For token
+% lists and clists/sequences, we leverage the distinction of an ``empty valued
+% key'' (\texttt{key=} or \texttt{key=\{\}}) from a ``key with no value''
+% (\texttt{key}). This distinction is captured internally by the lower-level
+% key parsing, but must be made explicit in \cs{keys_define:nn} by means of
+% the \texttt{.default:x} property of the key. For the technique, by
+% \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
+% \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.
%
%
% \begin{macro}
% {
% \l_@@_setup_type_tl ,
-% \l_@@_base_language_tl ,
+% \l_@@_setup_language_tl ,
% \l_@@_lang_decl_case_tl ,
% \l_@@_lang_declension_seq ,
% \l_@@_lang_gender_seq ,
@@ -746,11 +1126,10 @@
% Store ``current'' type, language, and declension cases in different places
% for type-specific and language-specific options handling, notably in
% \cs{@@_provide_langfile:n}, \cs{zcRefTypeSetup}, and
-% \cs{zcLanguageSetup}. But also for language options retrieval, in
-% \cs{@@_get_lang_opt_type:nnnN} and \cs{@@_get_lang_opt_default:nnN}.
+% \cs{zcLanguageSetup}, but also for language specific options retrieval.
% \begin{macrocode}
\tl_new:N \l_@@_setup_type_tl
-\tl_new:N \l_@@_base_language_tl
+\tl_new:N \l_@@_setup_language_tl
\tl_new:N \l_@@_lang_decl_case_tl
\seq_new:N \l_@@_lang_declension_seq
\seq_new:N \l_@@_lang_gender_seq
@@ -760,20 +1139,22 @@
%
% \begin{macro}
% {
-% \c_@@_ref_options_necessarily_not_type_specific_seq ,
-% \c_@@_ref_options_possibly_type_specific_seq ,
-% \c_@@_ref_options_type_names_seq ,
-% \c_@@_ref_options_font_seq ,
-% \c_@@_ref_options_typesetup_seq ,
-% \c_@@_ref_options_reference_seq ,
+% \c_@@_rf_opts_tl_not_type_specific_seq ,
+% \c_@@_rf_opts_tl_maybe_type_specific_seq ,
+% \c_@@_rf_opts_seq_refbounds_seq ,
+% \c_@@_rf_opts_bool_maybe_type_specific_seq ,
+% \c_@@_rf_opts_tl_type_names_seq ,
+% \c_@@_rf_opts_tl_font_seq ,
+% \c_@@_rf_opts_tl_typesetup_seq ,
+% \c_@@_rf_opts_tl_reference_seq ,
% }
-% Lists of reference format related options in ``categories''. Since
-% these options are set in different scopes, and at different places,
-% storing the actual lists in centralized variables makes the job not only
-% easier later on, but also keeps things consistent.
+% Lists of reference format options in ``categories''. Since these
+% options are set in different scopes, and at different places, storing
+% the actual lists in centralized variables makes the job not only easier
+% later on, but also keeps things consistent.
% \begin{macrocode}
\seq_const_from_clist:Nn
- \c_@@_ref_options_necessarily_not_type_specific_seq
+ \c_@@_rf_opts_tl_not_type_specific_seq
{
tpairsep ,
tlistsep ,
@@ -781,24 +1162,44 @@
notesep ,
}
\seq_const_from_clist:Nn
- \c_@@_ref_options_possibly_type_specific_seq
+ \c_@@_rf_opts_tl_maybe_type_specific_seq
{
namesep ,
pairsep ,
listsep ,
lastsep ,
rangesep ,
- preref ,
- postref ,
+ namefont ,
+ reffont ,
+ }
+\seq_const_from_clist:Nn
+ \c_@@_rf_opts_seq_refbounds_seq
+ {
+ refbounds-first ,
+ refbounds-first-sg ,
+ refbounds-first-pb ,
+ refbounds-first-rb ,
+ refbounds-mid ,
+ refbounds-mid-rb ,
+ refbounds-mid-re ,
+ refbounds-last ,
+ refbounds-last-pe ,
+ refbounds-last-re ,
+ }
+\seq_const_from_clist:Nn
+ \c_@@_rf_opts_bool_maybe_type_specific_seq
+ {
+ cap ,
+ abbrev ,
}
% \end{macrocode}
% Only ``type names'' are ``necessarily type-specific'', which makes them
% somewhat special on the retrieval side of things. In short, they don't have
-% their values queried by \cs{@@_get_ref_opt_typeset:nN}, but by
+% their values queried by \cs{@@_get_rf_opt_tl:nnnN}, but by
% \cs{@@_type_name_setup:}.
% \begin{macrocode}
\seq_const_from_clist:Nn
- \c_@@_ref_options_type_names_seq
+ \c_@@_rf_opts_tl_type_names_seq
{
Name-sg ,
name-sg ,
@@ -810,71 +1211,156 @@
name-pl-ab ,
}
% \end{macrocode}
-% \cs{c_@@_ref_options_font_seq} are technically ``possibly type-specific'',
-% but are not ``language-specific'', so we separate them.
+% And, finally, some combined groups of the above variables, for convenience.
% \begin{macrocode}
-\seq_const_from_clist:Nn
- \c_@@_ref_options_font_seq
+\seq_new:N \c_@@_rf_opts_tl_typesetup_seq
+\seq_gconcat:NNN \c_@@_rf_opts_tl_typesetup_seq
+ \c_@@_rf_opts_tl_maybe_type_specific_seq
+ \c_@@_rf_opts_tl_type_names_seq
+\seq_new:N \c_@@_rf_opts_tl_reference_seq
+\seq_gconcat:NNN \c_@@_rf_opts_tl_reference_seq
+ \c_@@_rf_opts_tl_not_type_specific_seq
+ \c_@@_rf_opts_tl_maybe_type_specific_seq
+% \end{macrocode}
+% \end{macro}
+%
+%
+% We set here also the ``derived'' \texttt{refbounds} options, which are the
+% same for every option scope.
+%
+% \begin{macrocode}
+\clist_map_inline:nn
{
- namefont ,
- reffont ,
+ reference ,
+ typesetup ,
+ langsetup ,
+ langfile ,
+ }
+ {
+ \keys_define:nn { zref-clever/ #1 }
+ {
+ +refbounds-first .meta:n =
+ {
+ refbounds-first = {##1} ,
+ refbounds-first-sg = {##1} ,
+ refbounds-first-pb = {##1} ,
+ refbounds-first-rb = {##1} ,
+ } ,
+ +refbounds-first .default:x = \c_novalue_tl ,
+ +refbounds-mid .meta:n =
+ {
+ refbounds-mid = {##1} ,
+ refbounds-mid-rb = {##1} ,
+ refbounds-mid-re = {##1} ,
+ } ,
+ +refbounds-mid .default:x = \c_novalue_tl ,
+ +refbounds-last .meta:n =
+ {
+ refbounds-last = {##1} ,
+ refbounds-last-pe = {##1} ,
+ refbounds-last-re = {##1} ,
+ } ,
+ +refbounds-last .default:x = \c_novalue_tl ,
+ +refbounds-rb .meta:n =
+ {
+ refbounds-first-rb = {##1} ,
+ refbounds-mid-rb = {##1} ,
+ } ,
+ +refbounds-rb .default:x = \c_novalue_tl ,
+ +refbounds-re .meta:n =
+ {
+ refbounds-mid-re = {##1} ,
+ refbounds-last-re = {##1} ,
+ } ,
+ +refbounds-re .default:x = \c_novalue_tl ,
+ +refbounds .meta:n =
+ {
+ +refbounds-first = {##1} ,
+ +refbounds-mid = {##1} ,
+ +refbounds-last = {##1} ,
+ } ,
+ +refbounds .default:x = \c_novalue_tl ,
+ refbounds .meta:n = { +refbounds = {##1} } ,
+ refbounds .default:x = \c_novalue_tl ,
+ }
}
% \end{macrocode}
-% And, finally, some combined groups of the above variables, for convenience.
+%
+%
+% \subsection{Languages}
+%
+%
+% \begin{macro}[EXP]{\@@_language_varname:n}
+% Defines, and leaves in the input stream, the csname of the variable used
+% to store the \meta{base language} (as the value of this variable) for
+% a \meta{language} declared for \pkg{zref-clever}.
+% \begin{syntax}
+% \cs{@@_language_varname:n} \Arg{language}
+% \end{syntax}
% \begin{macrocode}
-\seq_new:N \c_@@_ref_options_typesetup_seq
-\seq_gconcat:NNN \c_@@_ref_options_typesetup_seq
- \c_@@_ref_options_possibly_type_specific_seq
- \c_@@_ref_options_type_names_seq
-\seq_gconcat:NNN \c_@@_ref_options_typesetup_seq
- \c_@@_ref_options_typesetup_seq
- \c_@@_ref_options_font_seq
-\seq_new:N \c_@@_ref_options_reference_seq
-\seq_gconcat:NNN \c_@@_ref_options_reference_seq
- \c_@@_ref_options_necessarily_not_type_specific_seq
- \c_@@_ref_options_possibly_type_specific_seq
-\seq_gconcat:NNN \c_@@_ref_options_reference_seq
- \c_@@_ref_options_reference_seq
- \c_@@_ref_options_font_seq
+\cs_new:Npn \@@_language_varname:n #1
+ { g_@@_declared_language_ #1 _tl }
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[EXP]{\zrefclever_language_varname:n}
+% A public version of \cs{@@_language_varname:n} for use in
+% \pkg{zref-vario}.
+% \begin{macrocode}
+\cs_set_eq:NN \zrefclever_language_varname:n
+ \@@_language_varname:n
+% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}[EXP,TF]{\@@_language_if_declared:n}
+% A language is considered to be declared for \pkg{zref-clever} if it passes
+% this conditional, which requires that a variable with
+% \cs{@@_language_varname:n}\texttt{\{\meta{language}\}} exists.
+% \begin{syntax}
+% \cs{@@_language_if_declared:n(TF)} \Arg{language}
+% \end{syntax}
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_language_if_declared:n #1 { T , F , TF }
+ {
+ \tl_if_exist:cTF { \@@_language_varname:n {#1} }
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+\prg_generate_conditional_variant:Nnn
+ \@@_language_if_declared:n { x } { T , F , TF }
+% \end{macrocode}
+% \end{macro}
%
-% \subsection{Languages}
-%
-% \begin{macro}{\g_@@_languages_prop}
-% Stores the names of known languages and the mapping from ``language name''
-% to ``base language name''. Whether or not a language or alias is known to
-% \pkg{zref-clever} is decided by its presence in this property list. A
-% ``base language'' (loose concept here, meaning just ``the name we gave for
-% the language file in that particular language'') is just like any other
-% one, the only difference is that the ``language name'' happens to be the
-% same as the ``base language name'', in other words, it is an ``alias to
-% itself''.
+% \begin{macro}[EXP,TF]{\zrefclever_language_if_declared:n}
+% A public version of \cs{@@_language_if_declared:n} for use in
+% \pkg{zref-vario}.
% \begin{macrocode}
-\prop_new:N \g_@@_languages_prop
+\prg_set_eq_conditional:NNn \zrefclever_language_if_declared:n
+ \@@_language_if_declared:n { TF }
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}[int]{\zcDeclareLanguage}
-% Declare a new language for use with \pkg{zref-clever}. \meta{language} is
-% taken to be both the ``language name'' and the ``base language name''.
-% \oarg{options} receive a \texttt{k=v} set of options, with three valid
-% options. The first, \opt{declension}, takes the noun declension cases
-% prefixes for \meta{language} as a comma separated list, whose first
-% element is taken to be the default case. The second, \opt{gender},
-% receives the genders for \meta{language} as comma separated list. The
-% third, \opt{allcaps}, receives no value, and indicates that for
-% \meta{language} all nouns must be capitalized for grammatical reasons, in
-% which case, the \opt{cap} option is disregarded for \meta{language}. If
-% \meta{language} is already known, just warn. This implies a particular
-% restriction regarding \oarg{options}, namely that these options, when
-% defined by the package, cannot be redefined by the user. This is
-% deliberate, otherwise the built-in language files would become much too
-% sensitive to this particular user input, and unnecessarily so.
-% \cs{zcDeclareLanguage} is preamble only.
+% Declare a new language for use with \pkg{zref-clever}. \meta{language} is
+% taken to be both the ``language name'' and the ``base language name''. A
+% ``base language'' (loose concept here, meaning just ``the name we gave for
+% the language file in that particular language'') is just like any other one,
+% the only difference is that the ``language name'' happens to be the same as
+% the ``base language name'', in other words, it is an ``alias to itself''.
+% \oarg{options} receive a \texttt{k=v} set of options, with three valid
+% options. The first, \opt{declension}, takes the noun declension cases
+% prefixes for \meta{language} as a comma separated list, whose first element
+% is taken to be the default case. The second, \opt{gender}, receives the
+% genders for \meta{language} as comma separated list. The third,
+% \opt{allcaps}, is a boolean, and indicates that for \meta{language} all
+% nouns must be capitalized for grammatical reasons, in which case, the
+% \opt{cap} option is disregarded for \meta{language}. If \meta{language} is
+% already known, just warn. This implies a particular restriction regarding
+% \oarg{options}, namely that these options, when defined by the package,
+% cannot be redefined by the user. This is deliberate, otherwise the built-in
+% language files would become much too sensitive to this particular user
+% input, and unnecessarily so. \cs{zcDeclareLanguage} is preamble only.
% \begin{syntax}
% \cs{zcDeclareLanguage} \oarg{options} \marg{language}
% \end{syntax}
@@ -884,13 +1370,13 @@
\group_begin:
\tl_if_empty:nF {#2}
{
- \prop_if_in:NnTF \g_@@_languages_prop {#2}
+ \@@_language_if_declared:nTF {#2}
{ \msg_warning:nnn { zref-clever } { language-declared } {#2} }
{
- \prop_gput:Nnn \g_@@_languages_prop {#2} {#2}
- \prop_new:c { g_@@_lang_ #2 _prop }
- \tl_set:Nn \l_@@_base_language_tl {#2}
- \keys_set:nn { zref-clever / declarelang } {#1}
+ \tl_new:c { \@@_language_varname:n {#2} }
+ \tl_gset:cn { \@@_language_varname:n {#2} } {#2}
+ \tl_set:Nn \l_@@_setup_language_tl {#2}
+ \keys_set:nn { zref-clever/declarelang } {#1}
}
}
\group_end:
@@ -903,7 +1389,7 @@
% \begin{macro}[int]{\zcDeclareLanguageAlias}
% Declare \meta{language alias} to be an alias of \meta{aliased language}
% (or ``base language''). \meta{aliased language} must be already known to
-% \pkg{zref-clever}, as stored in \cs{g_@@_languages_prop}.
+% \pkg{zref-clever}.
% \cs{zcDeclareLanguageAlias} is preamble only.
% \begin{syntax}
% \cs{zcDeclareLanguageAlias} \marg{language alias} \marg{aliased language}
@@ -913,11 +1399,10 @@
{
\tl_if_empty:nF {#1}
{
- \prop_if_in:NnTF \g_@@_languages_prop {#2}
+ \@@_language_if_declared:nTF {#2}
{
- \exp_args:NNnx
- \prop_gput:Nnn \g_@@_languages_prop {#1}
- { \prop_item:Nn \g_@@_languages_prop {#2} }
+ \tl_gset:cx { \@@_language_varname:n {#1} }
+ { \tl_use:c { \@@_language_varname:n {#2} } }
}
{ \msg_warning:nnn { zref-clever } { unknown-language-alias } {#2} }
}
@@ -929,50 +1414,60 @@
%
%
% \begin{macrocode}
-\keys_define:nn { zref-clever / declarelang }
+\keys_define:nn { zref-clever/declarelang }
{
declension .code:n =
{
- \prop_gput:cnn
- { g_@@_lang_ \l_@@_base_language_tl _prop }
- { declension } {#1}
+ \seq_gset_from_clist:cn
+ {
+ \@@_opt_varname_language:enn
+ { \l_@@_setup_language_tl } { declension } { seq }
+ }
+ {#1}
} ,
declension .value_required:n = true ,
gender .code:n =
{
- \prop_gput:cnn
- { g_@@_lang_ \l_@@_base_language_tl _prop }
- { gender } {#1}
+ \seq_gset_from_clist:cn
+ {
+ \@@_opt_varname_language:enn
+ { \l_@@_setup_language_tl } { gender } { seq }
+ }
+ {#1}
} ,
gender .value_required:n = true ,
- allcaps .code:n =
+ allcaps .choices:nn =
+ { true , false }
{
- \prop_gput:cnn
- { g_@@_lang_ \l_@@_base_language_tl _prop }
- { allcaps } { true }
+ \use:c { bool_gset_ \l_keys_choice_tl :c }
+ {
+ \@@_opt_varname_language:enn
+ { \l_@@_setup_language_tl } { allcaps } { bool }
+ }
} ,
- allcaps .value_forbidden:n = true ,
+ allcaps .default:n = true ,
}
% \end{macrocode}
%
%
%
-% \begin{macro}{\@@_process_language_options:}
+% \begin{macro}{\@@_process_language_settings:}
% Auxiliary function for \cs{@@_zcref:nnn}, responsible for processing
-% options from \cs{zcDeclareLanguage}. It is necessary to separate them
-% from the reference options machinery because their behavior is language
-% dependent, but the language itself can also be set as an option
-% (\opt{lang}, value stored in \cs{l_@@_ref_language_tl}). Hence, we must
-% validate these options after the reference options have been set. It is
-% expected to be called right (or soon) after \cs{keys_set:nn} in
-% \cs{@@_zcref:nnn}, where current values for \cs{l_@@_ref_language_tl} and
-% \cs{l_@@_ref_decl_case_tl} are in place.
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_process_language_options:
- {
- \exp_args:NNx \prop_get:NnNTF \g_@@_languages_prop
+% language related settings. It is necessary to separate them from the
+% reference options machinery for two reasons. First, because their
+% behavior is language dependent, but the language itself can also be set as
+% an option (\opt{lang}, value stored in \cs{l_@@_ref_language_tl}).
+% Second, some of its tasks must be done regardless of any option being
+% given (e.g. the default declension case, the \opt{allcaps} option).
+% Hence, we must validate the language settings after the reference options
+% have been set. It is expected to be called right (or soon) after
+% \cs{keys_set:nn} in \cs{@@_zcref:nnn}, where current values for
+% \cs{l_@@_ref_language_tl} and \cs{l_@@_ref_decl_case_tl} are in place.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_process_language_settings:
+ {
+ \@@_language_if_declared:xTF
{ \l_@@_ref_language_tl }
- \l_@@_base_language_tl
{
% \end{macrocode}
% Validate the declension case (\opt{d}) option against the declared cases for
@@ -982,16 +1477,13 @@
% clearing the variable, depending on the language setup. And also issues a
% warning about it.
% \begin{macrocode}
- \exp_args:NNx \seq_set_from_clist:Nn
- \l_@@_lang_declension_seq
+ \@@_opt_seq_get:cNF
{
- \prop_item:cn
- {
- g_@@_lang_
- \l_@@_base_language_tl _prop
- }
- { declension }
+ \@@_opt_varname_language:enn
+ { \l_@@_ref_language_tl } { declension } { seq }
}
+ \l_@@_lang_declension_seq
+ { \seq_clear:N \l_@@_lang_declension_seq }
\seq_if_empty:NTF \l_@@_lang_declension_seq
{
\tl_if_empty:NF \l_@@_ref_decl_case_tl
@@ -1027,16 +1519,13 @@
% reference language. If the user value for the latter does not match the
% genders declared for the former, clear \cs{l_@@_ref_gender_tl} and warn.
% \begin{macrocode}
- \exp_args:NNx \seq_set_from_clist:Nn
- \l_@@_lang_gender_seq
+ \@@_opt_seq_get:cNF
{
- \prop_item:cn
- {
- g_@@_lang_
- \l_@@_base_language_tl _prop
- }
- { gender }
+ \@@_opt_varname_language:enn
+ { \l_@@_ref_language_tl } { gender } { seq }
}
+ \l_@@_lang_gender_seq
+ { \seq_clear:N \l_@@_lang_gender_seq }
\seq_if_empty:NTF \l_@@_lang_gender_seq
{
\tl_if_empty:NF \l_@@_ref_gender_tl
@@ -1064,20 +1553,15 @@
}
}
% \end{macrocode}
-% Ensure the \opt{cap} in \cs{l_@@_ref_options_prop} is set to \texttt{true}
-% when the language was declared with \opt{allcaps} option.
+% Ensure the general \opt{cap} is set to \texttt{true} when the language was
+% declared with \opt{allcaps} option.
% \begin{macrocode}
- \str_if_eq:eeT
+ \@@_opt_bool_if:cT
{
- \prop_item:cn
- {
- g_@@_lang_
- \l_@@_base_language_tl _prop
- }
- { allcaps }
+ \@@_opt_varname_language:enn
+ { \l_@@_ref_language_tl } { allcaps } { bool }
}
- { true }
- { \prop_put:Nnn \l_@@_ref_options_prop { cap } { true } }
+ { \keys_set:nn { zref-clever/reference } { cap = true } }
}
{
% \end{macrocode}
@@ -1154,13 +1638,11 @@
% \cs{@@_provide_langfile:n} is only meant to load the built-in language
% files. For languages declared by the user, or for any settings to a known
% language made with \cs{zcLanguageSetup}, values are populated directly to a
-% variable \cs{g_@@_lang_\meta{language}_prop}. Hence, there is no need to
-% ``load'' anything in this case: definitions and assignments made by the user
-% are performed immediately.
+% corresponding variables. Hence, there is no need to ``load'' anything in
+% this case: definitions and assignments made by the user are performed
+% immediately.
%
%
-% \subsubsection*{Provide}
-%
% \begin{macro}{\g_@@_loaded_langfiles_seq}
% Used to keep track of whether a language file has already been loaded or
% not.
@@ -1169,14 +1651,6 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\l_@@_load_langfile_verbose_bool}
-% Controls whether \cs{@@_provide_langfile:n} fails silently or verbosely
-% in case of unknown languages or not found language files.
-% \begin{macrocode}
-\bool_new:N \l_@@_load_langfile_verbose_bool
-% \end{macrocode}
-% \end{macro}
-%
%
% \begin{macro}{\@@_provide_langfile:n}
% Load language file for known \meta{language} if it is available and if it
@@ -1189,77 +1663,61 @@
{
\group_begin:
\@bsphack
- \prop_get:NnNTF \g_@@_languages_prop {#1}
- \l_@@_base_language_tl
+ \@@_language_if_declared:nT {#1}
{
- \seq_if_in:NVF
+ \seq_if_in:NxF
\g_@@_loaded_langfiles_seq
- \l_@@_base_language_tl
+ { \tl_use:c { \@@_language_varname:n {#1} } }
{
\exp_args:Nx \file_get:nnNTF
- { zref-clever- \l_@@_base_language_tl .lang }
+ {
+ zref-clever-
+ \tl_use:c { \@@_language_varname:n {#1} }
+ .lang
+ }
{ \ExplSyntaxOn }
\l_tmpa_tl
{
+ \tl_set:Nn \l_@@_setup_language_tl {#1}
\tl_clear:N \l_@@_setup_type_tl
- \exp_args:NNx \seq_set_from_clist:Nn
- \l_@@_lang_declension_seq
+ \@@_opt_seq_get:cNF
{
- \prop_item:cn
- {
- g_@@_lang_
- \l_@@_base_language_tl _prop
- }
- { declension }
+ \@@_opt_varname_language:nnn
+ {#1} { declension } { seq }
}
+ \l_@@_lang_declension_seq
+ { \seq_clear:N \l_@@_lang_declension_seq }
\seq_if_empty:NTF \l_@@_lang_declension_seq
{ \tl_clear:N \l_@@_lang_decl_case_tl }
{
\seq_get_left:NN \l_@@_lang_declension_seq
\l_@@_lang_decl_case_tl
}
- \exp_args:NNx \seq_set_from_clist:Nn
- \l_@@_lang_gender_seq
+ \@@_opt_seq_get:cNF
{
- \prop_item:cn
- {
- g_@@_lang_
- \l_@@_base_language_tl _prop
- }
- { gender }
+ \@@_opt_varname_language:nnn
+ {#1} { gender } { seq }
}
- \keys_set:nV { zref-clever / langfile } \l_tmpa_tl
- \seq_gput_right:NV \g_@@_loaded_langfiles_seq
- \l_@@_base_language_tl
- \msg_note:nnx { zref-clever } { langfile-loaded }
- { \l_@@_base_language_tl }
+ \l_@@_lang_gender_seq
+ { \seq_clear:N \l_@@_lang_gender_seq }
+ \keys_set:nV { zref-clever/langfile } \l_tmpa_tl
+ \seq_gput_right:Nx \g_@@_loaded_langfiles_seq
+ { \tl_use:c { \@@_language_varname:n {#1} } }
+ \msg_info:nnx { zref-clever } { langfile-loaded }
+ { \tl_use:c { \@@_language_varname:n {#1} } }
}
{
- \bool_if:NT \l_@@_load_langfile_verbose_bool
- {
- \msg_warning:nnx { zref-clever } { langfile-not-available }
- { \l_@@_base_language_tl }
- }
% \end{macrocode}
% Even if we don't have the actual language file, we register it as
% ``loaded''. At this point, it is a known language, properly declared.
-% There is no point in trying to load it multiple times, because users cannot
-% really provide the language files (well, technically they could, but we are
-% working so they don't need to, and have better ways to do what they want).
-% And if the users had provided some language-specific options themselves, by
-% means of \cs{zcLanguageSetup}, everything would be in place, and they could
-% use the \opt{lang} option multiple times, and the
-% \texttt{langfile-not-available} warning would never go away.
-% \begin{macrocode}
- \seq_gput_right:NV \g_@@_loaded_langfiles_seq
- \l_@@_base_language_tl
+% There is no point in trying to load it multiple times, if it was not found
+% the first time, it won't be the next.
+% \begin{macrocode}
+ \seq_gput_right:Nx \g_@@_loaded_langfiles_seq
+ { \tl_use:c { \@@_language_varname:n {#1} } }
}
}
}
- {
- \bool_if:NT \l_@@_load_langfile_verbose_bool
- { \msg_warning:nnn { zref-clever } { unknown-language-load } {#1} }
- }
\@esphack
\group_end:
}
@@ -1268,60 +1726,6 @@
% \end{macro}
%
%
-% \begin{macro}{\@@_provide_langfile_verbose:n}
-% Does the same as \cs{@@_provide_langfile:n}, but warns if the loading of
-% the language file has failed.
-% \begin{syntax}
-% \cs{@@_provide_langfile_verbose:n} \Arg{language}
-% \end{syntax}
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_provide_langfile_verbose:n #1
- {
- \group_begin:
- \bool_set_true:N \l_@@_load_langfile_verbose_bool
- \@@_provide_langfile:n {#1}
- \group_end:
- }
-\cs_generate_variant:Nn \@@_provide_langfile_verbose:n { x }
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}
-% {
-% \@@_provide_lang_opt_type:nn ,
-% \@@_provide_lang_opt_default:nn ,
-% }
-% A couple of auxiliary functions for the of
-% \texttt{{zref-clever/langfile}} keys set in
-% \cs{@@_provide_langfile:n}. They respectively ``provide'' (i.e. set if
-% it value does not exist, do nothing if it already does) ``type-specific''
-% and ``default'' language options. Both receive \meta{key} and
-% \meta{value} as arguments, but \cs{@@_provide_lang_opt_type:nn}
-% relies on the current value of \cs{l_@@_setup_type_tl}, as set by the
-% \texttt{type} key.
-% \begin{syntax}
-% \cs{@@_provide_lang_opt_type:nn} \Arg{key} \Arg{value}
-% \cs{@@_provide_lang_opt_default:nn} \Arg{key} \Arg{value}
-% \end{syntax}
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_provide_lang_opt_type:nn #1#2
- {
- \exp_args:Nnx \prop_gput_if_new:cnn
- { g_@@_lang_ \l_@@_base_language_tl _prop }
- { type- \l_@@_setup_type_tl - #1 } {#2}
- }
-\cs_generate_variant:Nn \@@_provide_lang_opt_type:nn { nV }
-\cs_new_protected:Npn \@@_provide_lang_opt_default:nn #1#2
- {
- \prop_gput_if_new:cnn
- { g_@@_lang_ \l_@@_base_language_tl _prop }
- { default- #1 } {#2}
- }
-\cs_generate_variant:Nn \@@_provide_lang_opt_default:nn { nV }
-% \end{macrocode}
-% \end{macro}
-%
%
% The set of keys for \texttt{{zref-clever/langfile}}, which is used to
% process the language files in \cs{@@_provide_langfile:n}. The no-op cases
@@ -1330,7 +1734,7 @@
% placed there nevertheless, and can be leveraged in regression tests.
%
% \begin{macrocode}
-\keys_define:nn { zref-clever / langfile }
+\keys_define:nn { zref-clever/langfile }
{
type .code:n =
{
@@ -1344,14 +1748,14 @@
\seq_if_empty:NTF \l_@@_lang_declension_seq
{
\msg_info:nnxx { zref-clever } { language-no-decl-setup }
- { \l_@@_base_language_tl } {#1}
+ { \l_@@_setup_language_tl } {#1}
}
{
\seq_if_in:NnTF \l_@@_lang_declension_seq {#1}
{ \tl_set:Nn \l_@@_lang_decl_case_tl {#1} }
{
\msg_info:nnxx { zref-clever } { unknown-decl-case }
- {#1} { \l_@@_base_language_tl }
+ {#1} { \l_@@_setup_language_tl }
\seq_get_left:NN \l_@@_lang_declension_seq
\l_@@_lang_decl_case_tl
}
@@ -1359,12 +1763,13 @@
} ,
case .value_required:n = true ,
+ gender .default:x = \c_novalue_tl ,
gender .code:n =
{
\seq_if_empty:NTF \l_@@_lang_gender_seq
{
\msg_info:nnxxx { zref-clever } { language-no-gender }
- { \l_@@_base_language_tl } { gender } {#1}
+ { \l_@@_setup_language_tl } { gender } {#1}
}
{
\tl_if_empty:NTF \l_@@_setup_type_tl
@@ -1373,71 +1778,64 @@
{ option-only-type-specific } { gender }
}
{
- \clist_clear:N \l_tmpa_clist
- \clist_map_inline:nn {#1}
+ \tl_if_novalue:nF {#1}
{
- \seq_if_in:NnTF \l_@@_lang_gender_seq {##1}
- { \clist_put_right:Nn \l_tmpa_clist {##1} }
+ \seq_clear:N \l_tmpa_seq
+ \clist_map_inline:nn {#1}
{
- \msg_info:nnxx { zref-clever }
- { gender-not-declared }
- { \l_@@_base_language_tl } {##1}
+ \seq_if_in:NnTF \l_@@_lang_gender_seq {##1}
+ { \seq_put_right:Nn \l_tmpa_seq {##1} }
+ {
+ \msg_info:nnxx { zref-clever }
+ { gender-not-declared }
+ { \l_@@_setup_language_tl } {##1}
+ }
+ }
+ \@@_opt_seq_if_set:cF
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ { gender }
+ { seq }
+ }
+ {
+ \seq_gset_eq:cN
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ { gender }
+ { seq }
+ }
+ \l_tmpa_seq
}
- }
- \clist_if_empty:NF \l_tmpa_clist
- {
- \exp_args:Nnx \@@_provide_lang_opt_type:nn
- { gender } { \clist_use:Nn \l_tmpa_clist { , } }
}
}
}
} ,
- gender .value_required:n = true ,
-
- cap .choices:nn =
- { true , false }
- {
- \tl_if_empty:NTF \l_@@_setup_type_tl
- {
- \@@_provide_lang_opt_default:nV
- { cap } \l_keys_choice_tl
- }
- {
- \@@_provide_lang_opt_type:nV
- { cap } \l_keys_choice_tl
- }
- } ,
- cap .default:n = true ,
- nocap .meta:n = { cap = false } ,
- nocap .value_forbidden:n = true ,
-
- abbrev .choices:nn =
- { true , false }
- {
- \tl_if_empty:NTF \l_@@_setup_type_tl
- {
- \@@_provide_lang_opt_default:nV
- { abbrev } \l_keys_choice_tl
- }
- {
- \@@_provide_lang_opt_type:nV
- { abbrev } \l_keys_choice_tl
- }
- } ,
- abbrev .default:n = true ,
- noabbrev .meta:n = { abbrev = false },
- noabbrev .value_forbidden:n = true ,
}
\seq_map_inline:Nn
- \c_@@_ref_options_necessarily_not_type_specific_seq
+ \c_@@_rf_opts_tl_not_type_specific_seq
{
- \keys_define:nn { zref-clever / langfile }
+ \keys_define:nn { zref-clever/langfile }
{
- #1 .value_required:n = true ,
+ #1 .default:x = \c_novalue_tl ,
#1 .code:n =
{
\tl_if_empty:NTF \l_@@_setup_type_tl
- { \@@_provide_lang_opt_default:nn {#1} {##1} }
+ {
+ \tl_if_novalue:nF {##1}
+ {
+ \@@_opt_tl_gset_if_new:cn
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl }
+ {#1} { tl }
+ }
+ {##1}
+ }
+ }
{
\msg_info:nnn { zref-clever }
{ option-not-type-specific } {#1}
@@ -1446,25 +1844,48 @@
}
}
\seq_map_inline:Nn
- \c_@@_ref_options_possibly_type_specific_seq
+ \c_@@_rf_opts_tl_maybe_type_specific_seq
{
- \keys_define:nn { zref-clever / langfile }
+ \keys_define:nn { zref-clever/langfile }
{
- #1 .value_required:n = true ,
+ #1 .default:x = \c_novalue_tl ,
#1 .code:n =
{
\tl_if_empty:NTF \l_@@_setup_type_tl
- { \@@_provide_lang_opt_default:nn {#1} {##1} }
- { \@@_provide_lang_opt_type:nn {#1} {##1} }
+ {
+ \tl_if_novalue:nF {##1}
+ {
+ \@@_opt_tl_gset_if_new:cn
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl }
+ {#1} { tl }
+ }
+ {##1}
+ }
+ }
+ {
+ \tl_if_novalue:nF {##1}
+ {
+ \@@_opt_tl_gset_if_new:cn
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { tl }
+ }
+ {##1}
+ }
+ }
} ,
}
}
\seq_map_inline:Nn
- \c_@@_ref_options_type_names_seq
+ \c_@@_rf_opts_tl_type_names_seq
{
- \keys_define:nn { zref-clever / langfile }
+ \keys_define:nn { zref-clever/langfile }
{
- #1 .value_required:n = true ,
+ #1 .default:x = \c_novalue_tl ,
#1 .code:n =
{
\tl_if_empty:NTF \l_@@_setup_type_tl
@@ -1474,37 +1895,230 @@
}
{
\tl_if_empty:NTF \l_@@_lang_decl_case_tl
- { \@@_provide_lang_opt_type:nn {#1} {##1} }
{
- \@@_provide_lang_opt_type:nn
- { \l_@@_lang_decl_case_tl - #1 } {##1}
+ \tl_if_novalue:nF {##1}
+ {
+ \@@_opt_tl_gset_if_new:cn
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { tl }
+ }
+ {##1}
+ }
+ }
+ {
+ \tl_if_novalue:nF {##1}
+ {
+ \@@_opt_tl_gset_if_new:cn
+ {
+ \@@_opt_varname_lang_type:eeen
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ { \l_@@_lang_decl_case_tl - #1 } { tl }
+ }
+ {##1}
+ }
+ }
+ }
+ } ,
+ }
+ }
+\seq_map_inline:Nn
+ \c_@@_rf_opts_seq_refbounds_seq
+ {
+ \keys_define:nn { zref-clever/langfile }
+ {
+ #1 .default:x = \c_novalue_tl ,
+ #1 .code:n =
+ {
+ \tl_if_empty:NTF \l_@@_setup_type_tl
+ {
+ \tl_if_novalue:nF {##1}
+ {
+ \@@_opt_seq_if_set:cF
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl } {#1} { seq }
+ }
+ {
+ \seq_gclear:N \g_tmpa_seq
+ \@@_opt_seq_gset_clist_split:Nn
+ \g_tmpa_seq {##1}
+ \bool_lazy_or:nnTF
+ { \tl_if_empty_p:n {##1} }
+ {
+ \int_compare_p:nNn
+ { \seq_count:N \g_tmpa_seq } = { 4 }
+ }
+ {
+ \seq_gset_eq:cN
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl }
+ {#1} { seq }
+ }
+ \g_tmpa_seq
+ }
+ {
+ \msg_info:nnxx { zref-clever }
+ { refbounds-must-be-four }
+ {#1} { \seq_count:N \g_tmpa_seq }
+ }
+ }
+ }
+ }
+ {
+ \tl_if_novalue:nF {##1}
+ {
+ \@@_opt_seq_if_set:cF
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl } {#1} { seq }
+ }
+ {
+ \seq_gclear:N \g_tmpa_seq
+ \@@_opt_seq_gset_clist_split:Nn
+ \g_tmpa_seq {##1}
+ \bool_lazy_or:nnTF
+ { \tl_if_empty_p:n {##1} }
+ {
+ \int_compare_p:nNn
+ { \seq_count:N \g_tmpa_seq } = { 4 }
+ }
+ {
+ \seq_gset_eq:cN
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { seq }
+ }
+ \g_tmpa_seq
+ }
+ {
+ \msg_info:nnxx { zref-clever }
+ { refbounds-must-be-four }
+ {#1} { \seq_count:N \g_tmpa_seq }
+ }
+ }
}
}
} ,
}
}
+\seq_map_inline:Nn
+ \c_@@_rf_opts_bool_maybe_type_specific_seq
+ {
+ \keys_define:nn { zref-clever/langfile }
+ {
+ #1 .choice: ,
+ #1 / true .code:n =
+ {
+ \tl_if_empty:NTF \l_@@_setup_type_tl
+ {
+ \@@_opt_bool_if_set:cF
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl }
+ {#1} { bool }
+ }
+ {
+ \bool_gset_true:c
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl }
+ {#1} { bool }
+ }
+ }
+ }
+ {
+ \@@_opt_bool_if_set:cF
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { bool }
+ }
+ {
+ \bool_gset_true:c
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { bool }
+ }
+ }
+ }
+ } ,
+ #1 / false .code:n =
+ {
+ \tl_if_empty:NTF \l_@@_setup_type_tl
+ {
+ \@@_opt_bool_if_set:cF
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl }
+ {#1} { bool }
+ }
+ {
+ \bool_gset_false:c
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl }
+ {#1} { bool }
+ }
+ }
+ }
+ {
+ \@@_opt_bool_if_set:cF
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { bool }
+ }
+ {
+ \bool_gset_false:c
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { bool }
+ }
+ }
+ }
+ } ,
+ #1 / unset .code:n = { } ,
+ #1 .default:n = true ,
+ no #1 .meta:n = { #1 = false } ,
+ no #1 .value_forbidden:n = true ,
+ }
+ }
% \end{macrocode}
%
%
%
-% \subsubsection*{Fallback}
-%
-% All ``strings'' queried with \cs{@@_get_ref_opt_typeset:nN} -- in practice,
-% those in either \cs{c_@@_ref_options_necessarily_not_type_specific_seq} or
-% \cs{c_@@_ref_options_possibly_type_specific_seq} -- must have their values
-% set for ``fallback'', even if to empty ones, since this is what will be
-% retrieved in the absence of a proper language-specific option, which will be
-% the case if \pkg{babel} or \pkg{polyglossia} is loaded and sets a language
-% which \pkg{zref-clever} does not know. On the other hand, ``type names''
-% are not looked for in ``fallback'', since it is indeed impossible to provide
-% any reasonable value for them for a ``specified but unknown language''.
-% Also ``font'' options -- those in \cs{c_@@_ref_options_font_seq}, and
-% queried with \cs{@@_get_ref_opt_font:nN} -- do not need to be provided here,
-% since the later function sets an empty value if the option is not found.
+% It is convenient for a number of language typesetting options (some basic
+% separators) to have some ``fallback'' value available in case \pkg{babel} or
+% \pkg{polyglossia} is loaded and sets a language which \pkg{zref-clever} does
+% not know. On the other hand, ``type names'' are not looked for in
+% ``fallback'', since it is indeed impossible to provide any reasonable value
+% for them for a ``specified but unknown language''. Other typesetting
+% options, for which it is not a problem being empty, need not be catered for
+% with a fallback value.
%
% \begin{macrocode}
-\prop_new:N \g_@@_fallback_unknown_lang_prop
-\prop_gset_from_keyval:Nn \g_@@_fallback_unknown_lang_prop
+\cs_new_protected:Npn \@@_opt_tl_cset_fallback:nn #1#2
+ {
+ \tl_const:cn
+ { \@@_opt_varname_fallback:nn {#1} { tl } } {#2}
+ }
+\keyval_parse:nnn
+ { }
+ { \@@_opt_tl_cset_fallback:nn }
{
tpairsep = {,~} ,
tlistsep = {,~} ,
@@ -1515,96 +2129,8 @@
listsep = {,~} ,
lastsep = {,~} ,
rangesep = {\textendash} ,
- preref = {} ,
- postref = {} ,
- }
-% \end{macrocode}
-%
-%
-%
-% \subsubsection*{Get language options}
-%
-% \begin{macro}{\@@_get_lang_opt_type:nnnNF}
-% Get type-specific language option of \meta{key} for \meta{type} and
-% \meta{language}, and store it in \meta{tl variable} if found. If not
-% found, leave the \meta{false code} on the stream, in which case the value
-% of \meta{tl variable} should not be relied upon.
-% \begin{syntax}
-% \cs{@@_get_lang_opt_type:nnnNF} \Arg{language} \Arg{type} \Arg{key}
-% ~~\meta{tl variable} \Arg{false code}
-% \end{syntax}
-% \begin{macrocode}
-\prg_new_protected_conditional:Npnn
- \@@_get_lang_opt_type:nnnN #1#2#3#4 { F }
- {
- \prop_get:NnNTF \g_@@_languages_prop {#1}
- \l_@@_base_language_tl
- {
- \prop_get:cnNTF
- { g_@@_lang_ \l_@@_base_language_tl _prop }
- { type- #2 - #3 } #4
- { \prg_return_true: }
- { \prg_return_false: }
- }
- { \prg_return_false: }
}
-\prg_generate_conditional_variant:Nnn
- \@@_get_lang_opt_type:nnnN { xxxN , xxnN } { F }
% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\@@_get_lang_opt_default:nnNF}
-% Get default language option of \meta{key} for \meta{language}, and store
-% it in \meta{tl variable} if found. If not found, leave the \meta{false
-% code} on the stream, in which case the value of \meta{tl variable} should
-% not be relied upon.
-% \begin{syntax}
-% \cs{@@_get_lang_opt_default:nnNF} \Arg{language} \Arg{key}
-% ~~\meta{tl variable} \Arg{false code}
-% \end{syntax}
-% \begin{macrocode}
-\prg_new_protected_conditional:Npnn
- \@@_get_lang_opt_default:nnN #1#2#3 { F }
- {
- \prop_get:NnNTF \g_@@_languages_prop {#1}
- \l_@@_base_language_tl
- {
- \prop_get:cnNTF
- { g_@@_lang_ \l_@@_base_language_tl _prop }
- { default- #2 } #3
- { \prg_return_true: }
- { \prg_return_false: }
- }
- { \prg_return_false: }
- }
-\prg_generate_conditional_variant:Nnn
- \@@_get_lang_opt_default:nnN { xnN } { F }
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\@@_get_fallback_unknown_lang_opt:nNF}
-% Get fallback language option of \meta{key}, and store it in \meta{tl
-% variable} if found. If not found, leave the \meta{false code} on the
-% stream, in which case the value of \meta{tl variable} should not be relied
-% upon.
-% \begin{syntax}
-% \cs{@@_get_fallback_unknown_lang_opt:nNF} \Arg{key}
-% ~~\meta{tl variable} \Arg{false code}
-% \end{syntax}
-% \begin{macrocode}
-% {<key>}<tl var to set>
-\prg_new_protected_conditional:Npnn
- \@@_get_fallback_unknown_lang_opt:nN #1#2 { F }
- {
- \prop_get:NnNTF \g_@@_fallback_unknown_lang_prop
- { #1 } #2
- { \prg_return_true: }
- { \prg_return_false: }
- }
-% \end{macrocode}
-% \end{macro}
%
%
%
@@ -1646,7 +2172,7 @@
%
% \begin{macrocode}
\tl_new:N \l_@@_ref_property_tl
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
ref .code:n =
{
@@ -1671,7 +2197,7 @@
% \begin{macrocode}
\bool_new:N \l_@@_typeset_ref_bool
\bool_new:N \l_@@_typeset_name_bool
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
typeset .choice: ,
typeset / both .code:n =
@@ -1705,7 +2231,7 @@
%
% \begin{macrocode}
\bool_new:N \l_@@_typeset_sort_bool
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
sort .bool_set:N = \l_@@_typeset_sort_bool ,
sort .initial:n = true ,
@@ -1726,7 +2252,7 @@
%
% \begin{macrocode}
\seq_new:N \l_@@_typesort_seq
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
typesort .code:n =
{
@@ -1748,7 +2274,7 @@
%
% \begin{macrocode}
\bool_new:N \l_@@_typeset_compress_bool
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
comp .bool_set:N = \l_@@_typeset_compress_bool ,
comp .initial:n = true ,
@@ -1764,7 +2290,7 @@
%
% \begin{macrocode}
\bool_new:N \l_@@_typeset_range_bool
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
range .bool_set:N = \l_@@_typeset_range_bool ,
range .initial:n = false ,
@@ -1776,30 +2302,14 @@
%
% \subsubsection*{\opt{cap} and \opt{capfirst} options}
%
+% The \opt{cap} option is currently being handled with other reference format
+% option booleans at \cs{c_@@_rf_opts_bool_maybe_type_specific_seq}.
+%
% \begin{macrocode}
-\bool_new:N \l_@@_capitalize_first_bool
-\keys_define:nn { zref-clever / reference }
+\bool_new:N \l_@@_capfirst_bool
+\keys_define:nn { zref-clever/reference }
{
- cap .code:n =
- {
- \tl_if_empty:nTF {#1}
- { \prop_remove:Nn \l_@@_ref_options_prop { cap } }
- {
- \bool_lazy_or:nnTF
- { \str_if_eq_p:nn {#1} { true } }
- { \str_if_eq_p:nn {#1} { false } }
- { \prop_put:Nnn \l_@@_ref_options_prop { cap } {#1} }
- {
- \msg_warning:nnn { zref-clever }
- { key-boolean-or-empty } {#1}
- }
- }
- } ,
- cap .default:n = true ,
- nocap .meta:n = { cap = false } ,
- nocap .value_forbidden:n = true ,
-
- capfirst .bool_set:N = \l_@@_capitalize_first_bool ,
+ capfirst .bool_set:N = \l_@@_capfirst_bool ,
capfirst .initial:n = false ,
capfirst .default:n = true ,
}
@@ -1808,29 +2318,13 @@
%
% \subsubsection*{\opt{abbrev} and \opt{noabbrevfirst} options}
%
+% The \opt{abbrev} option is currently being handled with other reference
+% format option booleans at \cs{c_@@_rf_opts_bool_maybe_type_specific_seq}.
+%
% \begin{macrocode}
\bool_new:N \l_@@_noabbrev_first_bool
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
- abbrev .code:n =
- {
- \tl_if_empty:nTF {#1}
- { \prop_remove:Nn \l_@@_ref_options_prop { abbrev } }
- {
- \bool_lazy_or:nnTF
- { \str_if_eq_p:nn {#1} { true } }
- { \str_if_eq_p:nn {#1} { false } }
- { \prop_put:Nnn \l_@@_ref_options_prop { abbrev } {#1} }
- {
- \msg_warning:nnn { zref-clever }
- { key-boolean-or-empty } {#1}
- }
- }
- } ,
- abbrev .default:n = true ,
- noabbrev .meta:n = { abbrev = false },
- noabbrev .value_forbidden:n = true ,
-
noabbrevfirst .bool_set:N = \l_@@_noabbrev_first_bool ,
noabbrevfirst .initial:n = false ,
noabbrevfirst .default:n = true ,
@@ -1842,11 +2336,11 @@
% \subsubsection*{\opt{S} option}
%
% \begin{macrocode}
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
S .meta:n =
- { capfirst = true , noabbrevfirst = true },
- S .value_forbidden:n = true ,
+ { capfirst = {#1} , noabbrevfirst = {#1} },
+ S .default:n = true ,
}
% \end{macrocode}
%
@@ -1854,28 +2348,38 @@
% \subsubsection*{\opt{hyperref} option}
%
% \begin{macrocode}
-\bool_new:N \l_@@_use_hyperref_bool
-\bool_new:N \l_@@_warn_hyperref_bool
-\keys_define:nn { zref-clever / reference }
+\bool_new:N \l_@@_hyperlink_bool
+\bool_new:N \l_@@_hyperref_warn_bool
+\keys_define:nn { zref-clever/reference }
{
hyperref .choice: ,
hyperref / auto .code:n =
{
- \bool_set_true:N \l_@@_use_hyperref_bool
- \bool_set_false:N \l_@@_warn_hyperref_bool
+ \bool_set_true:N \l_@@_hyperlink_bool
+ \bool_set_false:N \l_@@_hyperref_warn_bool
} ,
hyperref / true .code:n =
{
- \bool_set_true:N \l_@@_use_hyperref_bool
- \bool_set_true:N \l_@@_warn_hyperref_bool
+ \bool_set_true:N \l_@@_hyperlink_bool
+ \bool_set_true:N \l_@@_hyperref_warn_bool
} ,
hyperref / false .code:n =
{
- \bool_set_false:N \l_@@_use_hyperref_bool
- \bool_set_false:N \l_@@_warn_hyperref_bool
+ \bool_set_false:N \l_@@_hyperlink_bool
+ \bool_set_false:N \l_@@_hyperref_warn_bool
} ,
hyperref .initial:n = auto ,
- hyperref .default:n = auto
+ hyperref .default:n = true ,
+% \end{macrocode}
+% \opt{nohyperref} is provided mainly as a means to inhibit hyperlinking
+% locally in \pkg{zref-vario}'s commands without the need to be setting
+% \pkg{zref-clever}'s internal variables directly. What limits setting
+% \opt{hyperref} out of the preamble is that enabling hyperlinks requires
+% loading packages. But \opt{nohyperref} can only disable them, so we can use
+% it in the document body too.
+% \begin{macrocode}
+ nohyperref .meta:n = { hyperref = false } ,
+ nohyperref .value_forbidden:n = true ,
}
% \end{macrocode}
%
@@ -1884,18 +2388,20 @@
{
\@@_if_package_loaded:nTF { hyperref }
{
- \bool_if:NT \l_@@_use_hyperref_bool
+ \bool_if:NT \l_@@_hyperlink_bool
{ \RequirePackage { zref-hyperref } }
}
{
- \bool_if:NT \l_@@_warn_hyperref_bool
+ \bool_if:NT \l_@@_hyperref_warn_bool
{ \msg_warning:nn { zref-clever } { missing-hyperref } }
- \bool_set_false:N \l_@@_use_hyperref_bool
+ \bool_set_false:N \l_@@_hyperlink_bool
}
- \keys_define:nn { zref-clever / reference }
+ \keys_define:nn { zref-clever/reference }
{
hyperref .code:n =
- { \msg_warning:nn { zref-clever } { hyperref-preamble-only } }
+ { \msg_warning:nn { zref-clever } { hyperref-preamble-only } } ,
+ nohyperref .code:n =
+ { \bool_set_false:N \l_@@_hyperlink_bool } ,
}
}
% \end{macrocode}
@@ -1906,7 +2412,7 @@
%
% \begin{macrocode}
\str_new:N \l_@@_nameinlink_str
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
nameinlink .choice: ,
nameinlink / true .code:n =
@@ -1923,15 +2429,17 @@
% \end{macrocode}
%
%
-% \subsubsection*{\opt{preposinlink} option}
+% \subsubsection*{\opt{preposinlink} option (deprecated)}
%
% \begin{macrocode}
-\bool_new:N \l_@@_preposinlink_bool
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
- preposinlink .bool_set:N = \l_@@_preposinlink_bool ,
- preposinlink .initial:n = false ,
- preposinlink .default:n = true ,
+ preposinlink .code:n =
+ {
+ % NOTE Option deprecated in 2022-01-12 for v0.2.0-alpha.
+ \msg_warning:nnnn { zref-clever }{ option-deprecated }
+ { preposinlink } { refbounds }
+ } ,
}
% \end{macrocode}
%
@@ -1996,22 +2504,18 @@
\tl_set:Nn \l_@@_main_language_tl { english }
}
}
-% \end{macrocode}
-% Provide default value for \cs{l_@@_ref_language_tl} corresponding to option
-% \opt{current}, but do so outside of the \pkg{l3keys} machinery (that is,
-% instead of using \texttt{.initial:n}), so that we are able to distinguish
-% when the user actually gave the option, in which case the language file
-% loading is done verbosely, from when we are setting the default value
-% (here), in which case the language file loading is done silently.
-% \begin{macrocode}
- \tl_set:Nn \l_@@_ref_language_tl
- { \l_@@_current_language_tl }
}
% \end{macrocode}
%
+% \begin{macro}{\l_zrefclever_ref_language_tl}
+% A public version of \cs{l_@@_ref_language_tl} for use in \pkg{zref-vario}.
+% \begin{macrocode}
+\tl_set:Nn \l_zrefclever_ref_language_tl { \l_@@_ref_language_tl }
+% \end{macrocode}
+% \end{macro}
%
% \begin{macrocode}
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
lang .code:n =
{
@@ -2023,32 +2527,27 @@
{
\tl_set:Nn \l_@@_ref_language_tl
{ \l_@@_current_language_tl }
- \@@_provide_langfile_verbose:x
- { \l_@@_ref_language_tl }
}
{ main }
{
\tl_set:Nn \l_@@_ref_language_tl
{ \l_@@_main_language_tl }
- \@@_provide_langfile_verbose:x
- { \l_@@_ref_language_tl }
}
}
{
- \prop_if_in:NnTF \g_@@_languages_prop {#1}
- { \tl_set:Nn \l_@@_ref_language_tl {#1} }
+ \tl_set:Nn \l_@@_ref_language_tl {#1}
+ \@@_language_if_declared:nF {#1}
{
\msg_warning:nnn { zref-clever }
{ unknown-language-opt } {#1}
- \tl_set:Nn \l_@@_ref_language_tl
- { \l_@@_current_language_tl }
}
- \@@_provide_langfile_verbose:x
- { \l_@@_ref_language_tl }
}
+ \@@_provide_langfile:x
+ { \l_@@_ref_language_tl }
}
} ,
+ lang .initial:n = current ,
lang .value_required:n = true ,
}
% \end{macrocode}
@@ -2060,18 +2559,11 @@
\AddToHook { begindocument }
{
% \end{macrocode}
-% If any \opt{lang} option has been given by the user, the corresponding
-% language is already loaded, otherwise, ensure the default one
-% (\texttt{current}) gets loaded early, but not verbosely.
-% \begin{macrocode}
- \@@_provide_langfile:x { \l_@@_ref_language_tl }
-% \end{macrocode}
% Redefinition of the \texttt{lang} key option for the document body. Also,
-% drop the verbose language file loading in the document body, as it can
-% become intrusive depending on the use case, and does not provide much
-% ``juice'' anyway: in \cs{zcref} missing names warnings will already ensue.
+% drop the language file loading in the document body, it is somewhat
+% redundant, since \cs{@@_zcref:nnn} already ensures it.
% \begin{macrocode}
- \keys_define:nn { zref-clever / reference }
+ \keys_define:nn { zref-clever/reference }
{
lang .code:n =
{
@@ -2081,32 +2573,23 @@
{
\tl_set:Nn \l_@@_ref_language_tl
{ \l_@@_current_language_tl }
- \@@_provide_langfile:x
- { \l_@@_ref_language_tl }
}
{ main }
{
\tl_set:Nn \l_@@_ref_language_tl
{ \l_@@_main_language_tl }
- \@@_provide_langfile:x
- { \l_@@_ref_language_tl }
}
}
{
- \prop_if_in:NnTF \g_@@_languages_prop {#1}
- { \tl_set:Nn \l_@@_ref_language_tl {#1} }
+ \tl_set:Nn \l_@@_ref_language_tl {#1}
+ \@@_language_if_declared:nF {#1}
{
\msg_warning:nnn { zref-clever }
{ unknown-language-opt } {#1}
- \tl_set:Nn \l_@@_ref_language_tl
- { \l_@@_current_language_tl }
}
- \@@_provide_langfile:x
- { \l_@@_ref_language_tl }
}
} ,
- lang .value_required:n = true ,
}
}
}
@@ -2128,18 +2611,18 @@
%
% \begin{macrocode}
\tl_new:N \l_@@_ref_decl_case_tl
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
d .code:n =
{ \msg_warning:nnn { zref-clever } { option-document-only } { d } } ,
}
\AddToHook { begindocument }
{
- \keys_define:nn { zref-clever / reference }
+ \keys_define:nn { zref-clever/reference }
{
% \end{macrocode}
% We just store the value at this point, which is validated by
-% \cs{@@_process_language_options:} after \cs{keys_set:nn}.
+% \cs{@@_process_language_settings:} after \cs{keys_set:nn}.
% \begin{macrocode}
d .tl_set:N = \l_@@_ref_decl_case_tl ,
d .value_required:n = true ,
@@ -2158,7 +2641,7 @@
\bool_new:N \l_@@_nudge_singular_bool
\bool_new:N \l_@@_nudge_gender_bool
\tl_new:N \l_@@_ref_gender_tl
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
nudge .choice: ,
nudge / true .code:n =
@@ -2219,11 +2702,11 @@
}
\AddToHook { begindocument }
{
- \keys_define:nn { zref-clever / reference }
+ \keys_define:nn { zref-clever/reference }
{
% \end{macrocode}
% We just store the value at this point, which is validated by
-% \cs{@@_process_language_options:} after \cs{keys_set:nn}.
+% \cs{@@_process_language_settings:} after \cs{keys_set:nn}.
% \begin{macrocode}
g .tl_set:N = \l_@@_ref_gender_tl ,
g .value_required:n = true ,
@@ -2245,7 +2728,7 @@
%
% \begin{macrocode}
\tl_new:N \l_@@_ref_typeset_font_tl
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{ font .tl_set:N = \l_@@_ref_typeset_font_tl }
% \end{macrocode}
%
@@ -2254,14 +2737,14 @@
% \subsubsection*{\opt{titleref} option}
%
% \begin{macrocode}
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
titleref .code:n = { \RequirePackage { zref-titleref } } ,
titleref .value_forbidden:n = true ,
}
\AddToHook { begindocument }
{
- \keys_define:nn { zref-clever / reference }
+ \keys_define:nn { zref-clever/reference }
{
titleref .code:n =
{ \msg_warning:nn { zref-clever } { titleref-preamble-only } }
@@ -2274,7 +2757,7 @@
%
% \begin{macrocode}
\tl_new:N \l_@@_zcref_note_tl
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
note .tl_set:N = \l_@@_zcref_note_tl ,
note .value_required:n = true ,
@@ -2289,7 +2772,7 @@
% \begin{macrocode}
\bool_new:N \l_@@_zrefcheck_available_bool
\bool_new:N \l_@@_zcref_with_check_bool
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
check .code:n = { \RequirePackage { zref-check } } ,
check .value_forbidden:n = true ,
@@ -2299,7 +2782,7 @@
\@@_if_package_loaded:nTF { zref-check }
{
\bool_set_true:N \l_@@_zrefcheck_available_bool
- \keys_define:nn { zref-clever / reference }
+ \keys_define:nn { zref-clever/reference }
{
check .code:n =
{
@@ -2311,7 +2794,7 @@
}
{
\bool_set_false:N \l_@@_zrefcheck_available_bool
- \keys_define:nn { zref-clever / reference }
+ \keys_define:nn { zref-clever/reference }
{
check .value_forbidden:n = false ,
check .code:n =
@@ -2332,7 +2815,7 @@
%
% \begin{macrocode}
\prop_new:N \l_@@_counter_type_prop
-\keys_define:nn { zref-clever / label }
+\keys_define:nn { zref-clever/label }
{
countertype .code:n =
{
@@ -2396,7 +2879,7 @@
%
% \begin{macrocode}
\seq_new:N \l_@@_counter_resetters_seq
-\keys_define:nn { zref-clever / label }
+\keys_define:nn { zref-clever/label }
{
counterresetters .code:n =
{
@@ -2435,7 +2918,7 @@
%
% \begin{macrocode}
\prop_new:N \l_@@_counter_resetby_prop
-\keys_define:nn { zref-clever / label }
+\keys_define:nn { zref-clever/label }
{
counterresetby .code:n =
{
@@ -2476,7 +2959,7 @@
%
% \begin{macrocode}
\tl_new:N \l_@@_current_counter_tl
-\keys_define:nn { zref-clever / label }
+\keys_define:nn { zref-clever/label }
{
currentcounter .tl_set:N = \l_@@_current_counter_tl ,
currentcounter .value_required:n = true ,
@@ -2491,7 +2974,7 @@
% \begin{macrocode}
\bool_new:N \g_@@_nocompat_bool
\seq_new:N \g_@@_nocompat_modules_seq
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
nocompat .code:n =
{
@@ -2511,7 +2994,7 @@
}
\AddToHook { begindocument }
{
- \keys_define:nn { zref-clever / reference }
+ \keys_define:nn { zref-clever/reference }
{
nocompat .code:n =
{
@@ -2566,53 +3049,121 @@
% This is a set of options related to reference typesetting which receive
% equal treatment and, hence, are handled in batch. Since we are dealing with
% options to be passed to \cs{zcref} or to \cs{zcsetup} or at load time, only
-% ``not necessarily type-specific'' options are pertinent here. However, they
-% \emph{may} either be type-specific or language-specific, and thus must be
-% stored in a property list, \cs{l_@@_ref_options_prop}, in order to be
-% retrieved from the option \emph{name} by \cs{@@_get_ref_opt_typeset:nN} and
-% \cs{@@_get_ref_opt_font:nN} according to context and precedence rules.
+% ``not necessarily type-specific'' options are pertinent here.
%
-% The keys are set so that any value, including an empty one, is added to
-% \cs{l_@@_ref_options_prop}, while a key with \emph{no value} removes the
-% property from the list, so that these options can then fall back to lower
-% precedence levels settings. For discussion about the used technique, see
-% \zcref{sec:zcreftypesetup}.
%
% \begin{macrocode}
-\prop_new:N \l_@@_ref_options_prop
\seq_map_inline:Nn
- \c_@@_ref_options_reference_seq
+ \c_@@_rf_opts_tl_reference_seq
{
- \keys_define:nn { zref-clever / reference }
+ \keys_define:nn { zref-clever/reference }
{
- #1 .default:V = \c_novalue_tl ,
+ #1 .default:x = \c_novalue_tl ,
#1 .code:n =
{
\tl_if_novalue:nTF {##1}
- { \prop_remove:Nn \l_@@_ref_options_prop {#1} }
- { \prop_put:Nnn \l_@@_ref_options_prop {#1} {##1} }
+ {
+ \@@_opt_tl_unset:c
+ { \@@_opt_varname_general:nn {#1} { tl } }
+ }
+ {
+ \tl_set:cn
+ { \@@_opt_varname_general:nn {#1} { tl } }
+ {##1}
+ }
} ,
}
}
-\keys_define:nn { zref-clever / reference }
+\keys_define:nn { zref-clever/reference }
{
refpre .code:n =
{
% NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha.
\msg_warning:nnnn { zref-clever }{ option-deprecated }
- { refpre } { preref }
+ { refpre } { refbounds }
} ,
refpos .code:n =
{
% NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha.
\msg_warning:nnnn { zref-clever }{ option-deprecated }
- { refpos } { postref }
+ { refpos } { refbounds }
+ } ,
+ preref .code:n =
+ {
+ % NOTE Option deprecated in 2022-01-14 for v0.2.0-alpha.
+ \msg_warning:nnnn { zref-clever }{ option-deprecated }
+ { preref } { refbounds }
+ } ,
+ postref .code:n =
+ {
+ % NOTE Option deprecated in 2022-01-14 for v0.2.0-alpha.
+ \msg_warning:nnnn { zref-clever }{ option-deprecated }
+ { postref } { refbounds }
} ,
}
+\seq_map_inline:Nn
+ \c_@@_rf_opts_seq_refbounds_seq
+ {
+ \keys_define:nn { zref-clever/reference }
+ {
+ #1 .default:x = \c_novalue_tl ,
+ #1 .code:n =
+ {
+ \tl_if_novalue:nTF {##1}
+ {
+ \@@_opt_seq_unset:c
+ { \@@_opt_varname_general:nn {#1} { seq } }
+ }
+ {
+ \seq_clear:N \l_tmpa_seq
+ \@@_opt_seq_set_clist_split:Nn
+ \l_tmpa_seq {##1}
+ \bool_lazy_or:nnTF
+ { \tl_if_empty_p:n {##1} }
+ { \int_compare_p:nNn { \seq_count:N \l_tmpa_seq } = { 4 } }
+ {
+ \seq_set_eq:cN
+ { \@@_opt_varname_general:nn {#1} { seq } }
+ \l_tmpa_seq
+ }
+ {
+ \msg_warning:nnxx { zref-clever }
+ { refbounds-must-be-four }
+ {#1} { \seq_count:N \l_tmpa_seq }
+ }
+ }
+ } ,
+ }
+ }
+\seq_map_inline:Nn
+ \c_@@_rf_opts_bool_maybe_type_specific_seq
+ {
+ \keys_define:nn { zref-clever/reference }
+ {
+ #1 .choice: ,
+ #1 / true .code:n =
+ {
+ \bool_set_true:c
+ { \@@_opt_varname_general:nn {#1} { bool } }
+ } ,
+ #1 / false .code:n =
+ {
+ \bool_set_false:c
+ { \@@_opt_varname_general:nn {#1} { bool } }
+ } ,
+ #1 / unset .code:n =
+ {
+ \@@_opt_bool_unset:c
+ { \@@_opt_varname_general:nn {#1} { bool } }
+ } ,
+ #1 .default:n = true ,
+ no #1 .meta:n = { #1 = false } ,
+ no #1 .value_forbidden:n = true ,
+ }
+ }
% \end{macrocode}
%
%
-%
% \subsubsection*{Package options}
%
% The options have been separated in two different groups, so that we can
@@ -2625,10 +3176,10 @@
% \begin{macrocode}
\keys_define:nn { }
{
- zref-clever / zcsetup .inherit:n =
+ zref-clever/zcsetup .inherit:n =
{
- zref-clever / label ,
- zref-clever / reference ,
+ zref-clever/label ,
+ zref-clever/reference ,
}
}
% \end{macrocode}
@@ -2637,7 +3188,7 @@
% Process load-time package options
% (\url{https://tex.stackexchange.com/a/15840}).
% \begin{macrocode}
-\ProcessKeysOptions { zref-clever / zcsetup }
+\ProcessKeysOptions { zref-clever/zcsetup }
% \end{macrocode}
%
%
@@ -2665,7 +3216,7 @@
% \end{syntax}
% \begin{macrocode}
\cs_new_protected:Npn \@@_zcsetup:n #1
- { \keys_set:nn { zref-clever / zcsetup } {#1} }
+ { \keys_set:nn { zref-clever/zcsetup } {#1} }
\cs_generate_variant:Nn \@@_zcsetup:n { x }
% \end{macrocode}
% \end{macro}
@@ -2691,114 +3242,19 @@
% \begin{macrocode}
\NewDocumentCommand \zcRefTypeSetup { m m }
{
- \prop_if_exist:cF { l_@@_type_ #1 _options_prop }
- { \prop_new:c { l_@@_type_ #1 _options_prop } }
\tl_set:Nn \l_@@_setup_type_tl {#1}
- \keys_set:nn { zref-clever / typesetup } {#2}
+ \keys_set:nn { zref-clever/typesetup } {#2}
}
% \end{macrocode}
% \end{macro}
%
%
-% Inside \cs{zcRefTypeSetup} any of the options \emph{can} receive empty
-% values, and those values, if they exist in the property list, will override
-% language-specific options, regardless of their emptiness. In principle, we
-% could live with the situation of, once a setting has been made in
-% \cs{l_@@_type_<type>_options_prop} or in \cs{l_@@_ref_options_prop} it stays
-% there forever, and can only be overridden by a new value at the same
-% precedence level or a higher one. But it would be nice if an user can
-% ``unset'' an option at either of those scopes to go back to the lower
-% precedence level of the language-specific options at any given point. So
-% both in \cs{zcRefTypeSetup} and in setting reference options (see
-% \zcref{sec:reference-options}), we leverage the distinction of an ``empty
-% valued key'' (\texttt{key=} or \texttt{key=\{\}}) from a ``key with no
-% value'' (\texttt{key}). This distinction is captured internally by the
-% lower-level key parsing, but must be made explicit at \cs{keys_set:nn} by
-% means of the \texttt{.default:V} property of the key in \cs{keys_define:nn}.
-% For the technique, by \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}.
-%
-%
-% \begin{macrocode}
-\keys_define:nn { zref-clever / typesetup }
- {
- cap .code:n =
- {
- \tl_if_empty:nTF {#1}
- {
- \prop_remove:cn
- {
- l_@@_type_
- \l_@@_setup_type_tl _options_prop
- }
- { cap }
- }
- {
- \bool_lazy_or:nnTF
- { \str_if_eq_p:nn {#1} { true } }
- { \str_if_eq_p:nn {#1} { false } }
- {
- \prop_put:cnn
- {
- l_@@_type_
- \l_@@_setup_type_tl _options_prop
- }
- { cap } {#1}
- }
- {
- \msg_warning:nnn { zref-clever }
- { key-boolean-or-empty } {#1}
- }
- }
- } ,
- cap .default:n = true ,
- nocap .meta:n = { cap = false } ,
- nocap .value_forbidden:n = true ,
-
- abbrev .code:n =
- {
- \tl_if_empty:nTF {#1}
- {
- \prop_remove:cn
- {
- l_@@_type_
- \l_@@_setup_type_tl _options_prop
- }
- { abbrev }
- }
- {
- \bool_lazy_or:nnTF
- { \str_if_eq_p:nn {#1} { true } }
- { \str_if_eq_p:nn {#1} { false } }
- {
- \prop_put:cnn
- {
- l_@@_type_
- \l_@@_setup_type_tl _options_prop
- }
- { abbrev } {#1}
- }
- {
- \msg_warning:nnn { zref-clever }
- { key-boolean-or-empty } {#1}
- }
- }
- } ,
- abbrev .default:n = true ,
- noabbrev .meta:n = { abbrev = false },
- noabbrev .value_forbidden:n = true ,
- }
-% \end{macrocode}
-%
%
% \begin{macrocode}
\seq_map_inline:Nn
- \c_@@_ref_options_necessarily_not_type_specific_seq
+ \c_@@_rf_opts_tl_not_type_specific_seq
{
- \keys_define:nn { zref-clever / typesetup }
+ \keys_define:nn { zref-clever/typesetup }
{
#1 .code:n =
{
@@ -2807,57 +3263,141 @@
} ,
}
}
-% \end{macrocode}
-%
-%
-% \begin{macrocode}
\seq_map_inline:Nn
- \c_@@_ref_options_typesetup_seq
+ \c_@@_rf_opts_tl_typesetup_seq
{
- \keys_define:nn { zref-clever / typesetup }
+ \keys_define:nn { zref-clever/typesetup }
{
- #1 .default:V = \c_novalue_tl ,
+ #1 .default:x = \c_novalue_tl ,
#1 .code:n =
{
\tl_if_novalue:nTF {##1}
{
- \prop_remove:cn
+ \@@_opt_tl_unset:c
{
- l_@@_type_
- \l_@@_setup_type_tl _options_prop
+ \@@_opt_varname_type:enn
+ { \l_@@_setup_type_tl } {#1} { tl }
}
- {#1}
}
{
- \prop_put:cnn
+ \tl_set:cn
{
- l_@@_type_
- \l_@@_setup_type_tl _options_prop
+ \@@_opt_varname_type:enn
+ { \l_@@_setup_type_tl } {#1} { tl }
}
- {#1} {##1}
+ {##1}
}
} ,
}
}
-\keys_define:nn { zref-clever / typesetup }
+\keys_define:nn { zref-clever/typesetup }
{
refpre .code:n =
{
% NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha.
\msg_warning:nnnn { zref-clever }{ option-deprecated }
- { refpre } { preref }
+ { refpre } { refbounds }
} ,
refpos .code:n =
{
% NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha.
\msg_warning:nnnn { zref-clever }{ option-deprecated }
- { refpos } { postref }
+ { refpos } { refbounds }
+ } ,
+ preref .code:n =
+ {
+ % NOTE Option deprecated in 2022-01-14 for v0.2.0-alpha.
+ \msg_warning:nnnn { zref-clever }{ option-deprecated }
+ { preref } { refbounds }
+ } ,
+ postref .code:n =
+ {
+ % NOTE Option deprecated in 2022-01-14 for v0.2.0-alpha.
+ \msg_warning:nnnn { zref-clever }{ option-deprecated }
+ { postref } { refbounds }
} ,
}
+\seq_map_inline:Nn
+ \c_@@_rf_opts_seq_refbounds_seq
+ {
+ \keys_define:nn { zref-clever/typesetup }
+ {
+ #1 .default:x = \c_novalue_tl ,
+ #1 .code:n =
+ {
+ \tl_if_novalue:nTF {##1}
+ {
+ \@@_opt_seq_unset:c
+ {
+ \@@_opt_varname_type:enn
+ { \l_@@_setup_type_tl } {#1} { seq }
+ }
+ }
+ {
+ \seq_clear:N \l_tmpa_seq
+ \@@_opt_seq_set_clist_split:Nn
+ \l_tmpa_seq {##1}
+ \bool_lazy_or:nnTF
+ { \tl_if_empty_p:n {##1} }
+ { \int_compare_p:nNn { \seq_count:N \l_tmpa_seq } = { 4 } }
+ {
+ \seq_set_eq:cN
+ {
+ \@@_opt_varname_type:enn
+ { \l_@@_setup_type_tl } {#1} { seq }
+ }
+ \l_tmpa_seq
+ }
+ {
+ \msg_warning:nnxx { zref-clever }
+ { refbounds-must-be-four }
+ {#1} { \seq_count:N \l_tmpa_seq }
+ }
+ }
+ } ,
+ }
+ }
+\seq_map_inline:Nn
+ \c_@@_rf_opts_bool_maybe_type_specific_seq
+ {
+ \keys_define:nn { zref-clever/typesetup }
+ {
+ #1 .choice: ,
+ #1 / true .code:n =
+ {
+ \bool_set_true:c
+ {
+ \@@_opt_varname_type:enn
+ { \l_@@_setup_type_tl }
+ {#1} { bool }
+ }
+ } ,
+ #1 / false .code:n =
+ {
+ \bool_set_false:c
+ {
+ \@@_opt_varname_type:enn
+ { \l_@@_setup_type_tl }
+ {#1} { bool }
+ }
+ } ,
+ #1 / unset .code:n =
+ {
+ \@@_opt_bool_unset:c
+ {
+ \@@_opt_varname_type:enn
+ { \l_@@_setup_type_tl }
+ {#1} { bool }
+ }
+ } ,
+ #1 .default:n = true ,
+ no #1 .meta:n = { #1 = false } ,
+ no #1 .value_forbidden:n = true ,
+ }
+ }
% \end{macrocode}
%
%
-%
% \subsection{\cs{zcLanguageSetup}}
%
% \cs{zcLanguageSetup} is the main user interface for ``language-specific''
@@ -2879,37 +3419,31 @@
\NewDocumentCommand \zcLanguageSetup { m m }
{
\group_begin:
- \prop_get:NnNTF \g_@@_languages_prop {#1}
- \l_@@_base_language_tl
+ \@@_language_if_declared:nTF {#1}
{
\tl_clear:N \l_@@_setup_type_tl
- \exp_args:NNx \seq_set_from_clist:Nn
- \l_@@_lang_declension_seq
+ \tl_set:Nn \l_@@_setup_language_tl {#1}
+ \@@_opt_seq_get:cNF
{
- \prop_item:cn
- {
- g_@@_lang_
- \l_@@_base_language_tl _prop
- }
- { declension }
+ \@@_opt_varname_language:nnn
+ {#1} { declension } { seq }
}
+ \l_@@_lang_declension_seq
+ { \seq_clear:N \l_@@_lang_declension_seq }
\seq_if_empty:NTF \l_@@_lang_declension_seq
{ \tl_clear:N \l_@@_lang_decl_case_tl }
{
\seq_get_left:NN \l_@@_lang_declension_seq
\l_@@_lang_decl_case_tl
}
- \exp_args:NNx \seq_set_from_clist:Nn
- \l_@@_lang_gender_seq
+ \@@_opt_seq_get:cNF
{
- \prop_item:cn
- {
- g_@@_lang_
- \l_@@_base_language_tl _prop
- }
- { gender }
+ \@@_opt_varname_language:nnn
+ {#1} { gender } { seq }
}
- \keys_set:nn { zref-clever / langsetup } {#2}
+ \l_@@_lang_gender_seq
+ { \seq_clear:N \l_@@_lang_gender_seq }
+ \keys_set:nn { zref-clever/langsetup } {#2}
}
{ \msg_warning:nnn { zref-clever } { unknown-language-setup } {#1} }
\group_end:
@@ -2919,44 +3453,12 @@
% \end{macro}
%
%
-% \begin{macro}
-% {
-% \@@_declare_lang_opt_type:nnnn ,
-% \@@_declare_lang_opt_default:nnn ,
-% }
-% A couple of auxiliary functions for the of
-% \texttt{{zref-clever/langsetup}} keys set in \cs{zcLanguageSetup}. They
-% respectively declare (unconditionally set) ``type-specific'' and
-% ``default'' language-specific options.
-% \begin{syntax}
-% \cs{@@_declare_lang_opt_type:nnnn} \Arg{language} \Arg{type}
-% ~~\Arg{key} \Arg{value}
-% \cs{@@_declare_lang_opt_default:nnn} \Arg{language}
-% ~~\Arg{key} \Arg{value}
-% \end{syntax}
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_declare_lang_opt_type:nnnn #1#2#3#4
- {
- \prop_gput:cnn { g_@@_lang_ #1 _prop }
- { type- #2 - #3 } {#4}
- }
-\cs_generate_variant:Nn
- \@@_declare_lang_opt_type:nnnn { VVnn , VVxn , VVnx , VVnV }
-\cs_new_protected:Npn \@@_declare_lang_opt_default:nnn #1#2#3
- {
- \prop_gput:cnn { g_@@_lang_ #1 _prop }
- { default- #2 } {#3}
- }
-\cs_generate_variant:Nn \@@_declare_lang_opt_default:nnn { Vnn , VnV }
-% \end{macrocode}
-% \end{macro}
-%
%
% The set of keys for \texttt{{zref-clever/langsetup}}, which is used to set
% language-specific options in \cs{zcLanguageSetup}.
%
% \begin{macrocode}
-\keys_define:nn { zref-clever / langsetup }
+\keys_define:nn { zref-clever/langsetup }
{
type .code:n =
{
@@ -2970,14 +3472,14 @@
\seq_if_empty:NTF \l_@@_lang_declension_seq
{
\msg_warning:nnxx { zref-clever } { language-no-decl-setup }
- { \l_@@_base_language_tl } {#1}
+ { \l_@@_setup_language_tl } {#1}
}
{
\seq_if_in:NnTF \l_@@_lang_declension_seq {#1}
{ \tl_set:Nn \l_@@_lang_decl_case_tl {#1} }
{
\msg_warning:nnxx { zref-clever } { unknown-decl-case }
- {#1} { \l_@@_base_language_tl }
+ {#1} { \l_@@_setup_language_tl }
\seq_get_left:NN \l_@@_lang_declension_seq
\l_@@_lang_decl_case_tl
}
@@ -2985,12 +3487,13 @@
} ,
case .value_required:n = true ,
+ gender .default:x = \c_novalue_tl ,
gender .code:n =
{
\seq_if_empty:NTF \l_@@_lang_gender_seq
{
\msg_warning:nnxxx { zref-clever } { language-no-gender }
- { \l_@@_base_language_tl } { gender } {#1}
+ { \l_@@_setup_language_tl } { gender } {#1}
}
{
\tl_if_empty:NTF \l_@@_setup_type_tl
@@ -2999,82 +3502,69 @@
{ option-only-type-specific } { gender }
}
{
- \clist_clear:N \l_tmpa_clist
- \clist_map_inline:nn {#1}
+ \tl_if_novalue:nTF {#1}
{
- \seq_if_in:NnTF \l_@@_lang_gender_seq {##1}
- { \clist_put_right:Nn \l_tmpa_clist {##1} }
+ \@@_opt_seq_gunset:c
{
- \msg_warning:nnxx { zref-clever }
- { gender-not-declared }
- { \l_@@_base_language_tl } {##1}
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ { gender }
+ { seq }
}
}
- \clist_if_empty:NF \l_tmpa_clist
{
- \@@_declare_lang_opt_type:VVnx
- \l_@@_base_language_tl
- \l_@@_setup_type_tl
- { gender } { \clist_use:Nn \l_tmpa_clist { , } }
+ \seq_clear:N \l_tmpa_seq
+ \clist_map_inline:nn {#1}
+ {
+ \seq_if_in:NnTF \l_@@_lang_gender_seq {##1}
+ { \seq_put_right:Nn \l_tmpa_seq {##1} }
+ {
+ \msg_warning:nnxx { zref-clever }
+ { gender-not-declared }
+ { \l_@@_setup_language_tl } {##1}
+ }
+ }
+ \seq_gset_eq:cN
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ { gender }
+ { seq }
+ }
+ \l_tmpa_seq
}
}
}
} ,
- gender .value_required:n = true ,
-
- cap .choices:nn =
- { true , false }
- {
- \tl_if_empty:NTF \l_@@_setup_type_tl
- {
- \@@_declare_lang_opt_default:VnV
- \l_@@_base_language_tl
- { cap } \l_keys_choice_tl
- }
- {
- \@@_declare_lang_opt_type:VVnV
- \l_@@_base_language_tl
- \l_@@_setup_type_tl
- { cap } \l_keys_choice_tl
- }
- } ,
- cap .default:n = true ,
- nocap .meta:n = { cap = false } ,
- nocap .value_forbidden:n = true ,
-
- abbrev .choices:nn =
- { true , false }
- {
- \tl_if_empty:NTF \l_@@_setup_type_tl
- {
- \@@_declare_lang_opt_default:VnV
- \l_@@_base_language_tl
- { abbrev } \l_keys_choice_tl
- }
- {
- \@@_declare_lang_opt_type:VVnV
- \l_@@_base_language_tl
- \l_@@_setup_type_tl
- { abbrev } \l_keys_choice_tl
- }
- } ,
- abbrev .default:n = true ,
- noabbrev .meta:n = { abbrev = false },
- noabbrev .value_forbidden:n = true ,
}
\seq_map_inline:Nn
- \c_@@_ref_options_necessarily_not_type_specific_seq
+ \c_@@_rf_opts_tl_not_type_specific_seq
{
- \keys_define:nn { zref-clever / langsetup }
+ \keys_define:nn { zref-clever/langsetup }
{
- #1 .value_required:n = true ,
+ #1 .default:x = \c_novalue_tl ,
#1 .code:n =
{
\tl_if_empty:NTF \l_@@_setup_type_tl
{
- \@@_declare_lang_opt_default:Vnn
- \l_@@_base_language_tl
- {#1} {##1}
+ \tl_if_novalue:nTF {##1}
+ {
+ \@@_opt_tl_gunset:c
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl } {#1} { tl }
+ }
+ }
+ {
+ \tl_gset:cn
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl } {#1} { tl }
+ }
+ {##1}
+ }
}
{
\msg_warning:nnn { zref-clever }
@@ -3084,47 +3574,88 @@
}
}
\seq_map_inline:Nn
- \c_@@_ref_options_possibly_type_specific_seq
+ \c_@@_rf_opts_tl_maybe_type_specific_seq
{
- \keys_define:nn { zref-clever / langsetup }
+ \keys_define:nn { zref-clever/langsetup }
{
#1 .value_required:n = true ,
#1 .code:n =
{
\tl_if_empty:NTF \l_@@_setup_type_tl
{
- \@@_declare_lang_opt_default:Vnn
- \l_@@_base_language_tl
- {#1} {##1}
+ \tl_if_novalue:nTF {##1}
+ {
+ \@@_opt_tl_gunset:c
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl } {#1} { tl }
+ }
+ }
+ {
+ \tl_gset:cn
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl } {#1} { tl }
+ }
+ {##1}
+ }
}
{
- \@@_declare_lang_opt_type:VVnn
- \l_@@_base_language_tl
- \l_@@_setup_type_tl
- {#1} {##1}
+ \tl_if_novalue:nTF {##1}
+ {
+ \@@_opt_tl_gunset:c
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { tl }
+ }
+ }
+ {
+ \tl_gset:cn
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { tl }
+ }
+ {##1}
+ }
}
} ,
}
}
-\keys_define:nn { zref-clever / langsetup }
+\keys_define:nn { zref-clever/langsetup }
{
refpre .code:n =
{
% NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha.
\msg_warning:nnnn { zref-clever }{ option-deprecated }
- { refpre } { preref }
+ { refpre } { refbounds }
} ,
refpos .code:n =
{
% NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha.
\msg_warning:nnnn { zref-clever }{ option-deprecated }
- { refpos } { postref }
+ { refpos } { refbounds }
+ } ,
+ preref .code:n =
+ {
+ % NOTE Option deprecated in 2022-01-14 for v0.2.0-alpha.
+ \msg_warning:nnnn { zref-clever }{ option-deprecated }
+ { preref } { refbounds }
+ } ,
+ postref .code:n =
+ {
+ % NOTE Option deprecated in 2022-01-14 for v0.2.0-alpha.
+ \msg_warning:nnnn { zref-clever }{ option-deprecated }
+ { postref } { refbounds }
} ,
}
\seq_map_inline:Nn
- \c_@@_ref_options_type_names_seq
+ \c_@@_rf_opts_tl_type_names_seq
{
- \keys_define:nn { zref-clever / langsetup }
+ \keys_define:nn { zref-clever/langsetup }
{
#1 .value_required:n = true ,
#1 .code:n =
@@ -3135,27 +3666,205 @@
{ option-only-type-specific } {#1}
}
{
- \tl_if_empty:NTF \l_@@_lang_decl_case_tl
+ \tl_if_novalue:nTF {##1}
{
- \@@_declare_lang_opt_type:VVnn
- \l_@@_base_language_tl
- \l_@@_setup_type_tl
- {#1} {##1}
+ \@@_opt_tl_gunset:c
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { tl }
+ }
}
{
- \@@_declare_lang_opt_type:VVxn
- \l_@@_base_language_tl
- \l_@@_setup_type_tl
- { \l_@@_lang_decl_case_tl - #1 } {##1}
+ \tl_if_empty:NTF \l_@@_lang_decl_case_tl
+ {
+ \tl_gset:cn
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { tl }
+ }
+ {##1}
+ }
+ {
+ \tl_gset:cn
+ {
+ \@@_opt_varname_lang_type:eeen
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ { \l_@@_lang_decl_case_tl - #1 }
+ { tl }
+ }
+ {##1}
+ }
}
}
} ,
}
}
+\seq_map_inline:Nn
+ \c_@@_rf_opts_seq_refbounds_seq
+ {
+ \keys_define:nn { zref-clever/langsetup }
+ {
+ #1 .default:x = \c_novalue_tl ,
+ #1 .code:n =
+ {
+ \tl_if_empty:NTF \l_@@_setup_type_tl
+ {
+ \tl_if_novalue:nTF {##1}
+ {
+ \@@_opt_seq_gunset:c
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl }
+ {#1} { seq }
+ }
+ }
+ {
+ \seq_gclear:N \g_tmpa_seq
+ \@@_opt_seq_gset_clist_split:Nn
+ \g_tmpa_seq {##1}
+ \bool_lazy_or:nnTF
+ { \tl_if_empty_p:n {##1} }
+ {
+ \int_compare_p:nNn
+ { \seq_count:N \g_tmpa_seq } = { 4 }
+ }
+ {
+ \seq_gset_eq:cN
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl }
+ {#1} { seq }
+ }
+ \g_tmpa_seq
+ }
+ {
+ \msg_warning:nnxx { zref-clever }
+ { refbounds-must-be-four }
+ {#1} { \seq_count:N \g_tmpa_seq }
+ }
+ }
+ }
+ {
+ \tl_if_novalue:nTF {##1}
+ {
+ \@@_opt_seq_gunset:c
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl } {#1} { seq }
+ }
+ }
+ {
+ \seq_gclear:N \g_tmpa_seq
+ \@@_opt_seq_gset_clist_split:Nn
+ \g_tmpa_seq {##1}
+ \bool_lazy_or:nnTF
+ { \tl_if_empty_p:n {##1} }
+ {
+ \int_compare_p:nNn
+ { \seq_count:N \g_tmpa_seq } = { 4 }
+ }
+ {
+ \seq_gset_eq:cN
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl } {#1} { seq }
+ }
+ \g_tmpa_seq
+ }
+ {
+ \msg_warning:nnxx { zref-clever }
+ { refbounds-must-be-four }
+ {#1} { \seq_count:N \g_tmpa_seq }
+ }
+ }
+ }
+ } ,
+ }
+ }
+\seq_map_inline:Nn
+ \c_@@_rf_opts_bool_maybe_type_specific_seq
+ {
+ \keys_define:nn { zref-clever/langsetup }
+ {
+ #1 .choice: ,
+ #1 / true .code:n =
+ {
+ \tl_if_empty:NTF \l_@@_setup_type_tl
+ {
+ \bool_gset_true:c
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl }
+ {#1} { bool }
+ }
+ }
+ {
+ \bool_gset_true:c
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { bool }
+ }
+ }
+ } ,
+ #1 / false .code:n =
+ {
+ \tl_if_empty:NTF \l_@@_setup_type_tl
+ {
+ \bool_gset_false:c
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl }
+ {#1} { bool }
+ }
+ }
+ {
+ \bool_gset_false:c
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { bool }
+ }
+ }
+ } ,
+ #1 / unset .code:n =
+ {
+ \tl_if_empty:NTF \l_@@_setup_type_tl
+ {
+ \@@_opt_bool_gunset:c
+ {
+ \@@_opt_varname_lang_default:enn
+ { \l_@@_setup_language_tl }
+ {#1} { bool }
+ }
+ }
+ {
+ \@@_opt_bool_gunset:c
+ {
+ \@@_opt_varname_lang_type:eenn
+ { \l_@@_setup_language_tl }
+ { \l_@@_setup_type_tl }
+ {#1} { bool }
+ }
+ }
+ } ,
+ #1 .default:n = true ,
+ no #1 .meta:n = { #1 = false } ,
+ no #1 .value_forbidden:n = true ,
+ }
+ }
% \end{macrocode}
%
%
-%
% \section{User interface}
%
% \subsection{\cs{zcref}}
@@ -3187,7 +3896,7 @@
% \end{macrocode}
% Set options.
% \begin{macrocode}
- \keys_set:nn { zref-clever / reference } {#3}
+ \keys_set:nn { zref-clever/reference } {#3}
% \end{macrocode}
% Store arguments values.
% \begin{macrocode}
@@ -3202,9 +3911,9 @@
% \begin{macrocode}
\@@_provide_langfile:x { \l_@@_ref_language_tl }
% \end{macrocode}
-% Process \cs{zcDeclareLanguage} options.
+% Process language settings.
% \begin{macrocode}
- \@@_process_language_options:
+ \@@_process_language_settings:
% \end{macrocode}
% Integration with \pkg{zref-check}.
% \begin{macrocode}
@@ -3232,7 +3941,10 @@
% \begin{macrocode}
\tl_if_empty:NF \l_@@_zcref_note_tl
{
- \@@_get_ref_opt_typeset:nN { notesep } \l_tmpa_tl
+ \@@_get_rf_opt_tl:nxxN { notesep }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
+ \l_tmpa_tl
\l_tmpa_tl
\l_@@_zcref_note_tl
}
@@ -3280,9 +3992,11 @@
% \begin{macrocode}
\NewDocumentCommand \zcpageref { s O { } m }
{
- \IfBooleanTF {#1}
- { \zcref*[#2, ref = page] {#3} }
- { \zcref [#2, ref = page] {#3} }
+ \group_begin:
+ \IfBooleanT {#1}
+ { \bool_set_false:N \l_@@_hyperlink_bool }
+ \zcref [#2, ref = page] {#3}
+ \group_end:
}
% \end{macrocode}
% \end{macro}
@@ -3370,7 +4084,7 @@
% Store label types sequence.
% \begin{macrocode}
\seq_clear:N \l_@@_label_types_seq
- \tl_if_eq:NnF \l_@@_ref_property_tl { page }
+ \tl_if_eq:NnF \l_@@_ref_propserty_tl { page }
{
\seq_map_function:NN \l_@@_zcref_labels_seq
\@@_label_type_put_new_right:n
@@ -3432,7 +4146,7 @@
\cs_new_protected:Npn \@@_label_type_put_new_right:n #1
{
\@@_extract_default:Nnnn
- \l_@@_label_type_a_tl {#1} { zc@type } { \c_empty_tl }
+ \l_@@_label_type_a_tl {#1} { zc@type } { }
\seq_if_in:NVF \l_@@_label_types_seq
\l_@@_label_type_a_tl
{
@@ -3480,15 +4194,15 @@
\cs_new_protected:Npn \@@_sort_default_same_type:nn #1#2
{
\@@_extract_default:Nnnn \l_@@_label_enclval_a_tl
- {#1} { zc@enclval } { \c_empty_tl }
+ {#1} { zc@enclval } { }
\tl_reverse:N \l_@@_label_enclval_a_tl
\@@_extract_default:Nnnn \l_@@_label_enclval_b_tl
- {#2} { zc@enclval } { \c_empty_tl }
+ {#2} { zc@enclval } { }
\tl_reverse:N \l_@@_label_enclval_b_tl
\@@_extract_default:Nnnn \l_@@_label_extdoc_a_tl
- {#1} { externaldocument } { \c_empty_tl }
+ {#1} { externaldocument } { }
\@@_extract_default:Nnnn \l_@@_label_extdoc_b_tl
- {#2} { externaldocument } { \c_empty_tl }
+ {#2} { externaldocument } { }
\bool_set_false:N \l_@@_sort_decided_bool
@@ -3819,11 +4533,13 @@
% {
% \l_@@_type_count_int ,
% \l_@@_label_count_int ,
+% \l_@@_ref_count_int ,
% }
% Auxiliary variables for \cs{@@_typeset_refs:} main counters.
% \begin{macrocode}
\int_new:N \l_@@_type_count_int
\int_new:N \l_@@_label_count_int
+\int_new:N \l_@@_ref_count_int
% \end{macrocode}
% \end{macro}
%
@@ -3852,17 +4568,19 @@
% {
% \l_@@_type_name_tl ,
% \l_@@_name_in_link_bool ,
+% \l_@@_type_name_missing_bool ,
% \l_@@_name_format_tl ,
% \l_@@_name_format_fallback_tl ,
-% \l_@@_type_name_gender_tl ,
+% \l_@@_type_name_gender_seq ,
% }
% Auxiliary variables for \cs{@@_typeset_refs:} type name handling.
% \begin{macrocode}
\tl_new:N \l_@@_type_name_tl
\bool_new:N \l_@@_name_in_link_bool
+\bool_new:N \l_@@_type_name_missing_bool
\tl_new:N \l_@@_name_format_tl
\tl_new:N \l_@@_name_format_fallback_tl
-\tl_new:N \l_@@_type_name_gender_tl
+\seq_new:N \l_@@_type_name_gender_seq
% \end{macrocode}
% \end{macro}
%
@@ -3894,15 +4612,13 @@
% \l_@@_listsep_tl ,
% \l_@@_lastsep_tl ,
% \l_@@_rangesep_tl ,
-% \l_@@_preref_tl ,
-% \l_@@_postref_tl ,
% \l_@@_namefont_tl ,
% \l_@@_reffont_tl ,
-% \l_@@_capitalize_bool ,
+% \l_@@_cap_bool ,
% \l_@@_abbrev_bool ,
% }
-% Auxiliary variables for \cs{@@_typeset_refs:} separators, pre-/postref and
-% font and other options.
+% Auxiliary variables for \cs{@@_typeset_refs:} separators, and font and
+% other options.
% \begin{macrocode}
\tl_new:N \l_@@_tpairsep_tl
\tl_new:N \l_@@_tlistsep_tl
@@ -3912,15 +4628,45 @@
\tl_new:N \l_@@_listsep_tl
\tl_new:N \l_@@_lastsep_tl
\tl_new:N \l_@@_rangesep_tl
-\tl_new:N \l_@@_preref_tl
-\tl_new:N \l_@@_postref_tl
\tl_new:N \l_@@_namefont_tl
\tl_new:N \l_@@_reffont_tl
-\bool_new:N \l_@@_capitalize_bool
+\bool_new:N \l_@@_cap_bool
\bool_new:N \l_@@_abbrev_bool
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}
+% {
+% \l_@@_refbounds_first_seq ,
+% \l_@@_refbounds_first_sg_seq ,
+% \l_@@_refbounds_first_pb_seq ,
+% \l_@@_refbounds_first_rb_seq ,
+% \l_@@_refbounds_mid_seq ,
+% \l_@@_refbounds_mid_rb_seq ,
+% \l_@@_refbounds_mid_re_seq ,
+% \l_@@_refbounds_last_seq ,
+% \l_@@_refbounds_last_pe_seq ,
+% \l_@@_refbounds_last_re_seq ,
+% \l_@@_type_first_refbounds_seq ,
+% \l_@@_type_first_refbounds_set_bool ,
+% }
+% Auxiliary variables for \cs{@@_typeset_refs:}: advanced reference format
+% options.
+% \begin{macrocode}
+\seq_new:N \l_@@_refbounds_first_seq
+\seq_new:N \l_@@_refbounds_first_sg_seq
+\seq_new:N \l_@@_refbounds_first_pb_seq
+\seq_new:N \l_@@_refbounds_first_rb_seq
+\seq_new:N \l_@@_refbounds_mid_seq
+\seq_new:N \l_@@_refbounds_mid_rb_seq
+\seq_new:N \l_@@_refbounds_mid_re_seq
+\seq_new:N \l_@@_refbounds_last_seq
+\seq_new:N \l_@@_refbounds_last_pe_seq
+\seq_new:N \l_@@_refbounds_last_re_seq
+\seq_new:N \l_@@_type_first_refbounds_seq
+\bool_new:N \l_@@_type_first_refbounds_set_bool
+% \end{macrocode}
+% \end{macro}
%
% \begin{macro}{\l_@@_verbose_testing_bool}
% Internal variable which enables extra log messaging at points of interest
@@ -3948,15 +4694,23 @@
\tl_clear:N \l_@@_range_beg_label_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_@@_type_first_refbounds_set_bool
% Get type block options (not type-specific).
- \@@_get_ref_opt_typeset:nN { tpairsep }
+ \@@_get_rf_opt_tl:nxxN { tpairsep }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
\l_@@_tpairsep_tl
- \@@_get_ref_opt_typeset:nN { tlistsep }
+ \@@_get_rf_opt_tl:nxxN { tlistsep }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
\l_@@_tlistsep_tl
- \@@_get_ref_opt_typeset:nN { tlastsep }
+ \@@_get_rf_opt_tl:nxxN { tlastsep }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
\l_@@_tlastsep_tl
% Process label stack.
@@ -4039,32 +4793,86 @@
}
}
- % Get type-specific separators, pre-/postref font and other options,
- % once per type.
+ % Get possibly type-specific separators, refbounds, font and other
+ % options, once per type.
\int_compare:nNnT { \l_@@_label_count_int } = { 0 }
{
- \@@_get_ref_opt_typeset:nN { namesep }
+ \@@_get_rf_opt_tl:nxxN { namesep }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
\l_@@_namesep_tl
- \@@_get_ref_opt_typeset:nN { pairsep }
+ \@@_get_rf_opt_tl:nxxN { pairsep }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
\l_@@_pairsep_tl
- \@@_get_ref_opt_typeset:nN { listsep }
+ \@@_get_rf_opt_tl:nxxN { listsep }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
\l_@@_listsep_tl
- \@@_get_ref_opt_typeset:nN { lastsep }
+ \@@_get_rf_opt_tl:nxxN { lastsep }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
\l_@@_lastsep_tl
- \@@_get_ref_opt_typeset:nN { rangesep }
+ \@@_get_rf_opt_tl:nxxN { rangesep }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
\l_@@_rangesep_tl
- \@@_get_ref_opt_typeset:nN { preref }
- \l_@@_preref_tl
- \@@_get_ref_opt_typeset:nN { postref }
- \l_@@_postref_tl
- \@@_get_ref_opt_font:nN { namefont }
+ \@@_get_rf_opt_tl:nxxN { namefont }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
\l_@@_namefont_tl
- \@@_get_ref_opt_font:nN { reffont }
+ \@@_get_rf_opt_tl:nxxN { reffont }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
\l_@@_reffont_tl
- \@@_get_ref_opt_bool:nnN { cap } { false }
- \l_@@_capitalize_bool
- \@@_get_ref_opt_bool:nnN { abbrev } { false }
+ \@@_get_rf_opt_bool:nnxxN { cap } { false }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
+ \l_@@_cap_bool
+ \@@_get_rf_opt_bool:nnxxN { abbrev } { false }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
\l_@@_abbrev_bool
+ \@@_get_rf_opt_seq:nxxN { refbounds-first }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
+ \l_@@_refbounds_first_seq
+ \@@_get_rf_opt_seq:nxxN { refbounds-first-sg }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
+ \l_@@_refbounds_first_sg_seq
+ \@@_get_rf_opt_seq:nxxN { refbounds-first-pb }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
+ \l_@@_refbounds_first_pb_seq
+ \@@_get_rf_opt_seq:nxxN { refbounds-first-rb }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
+ \l_@@_refbounds_first_rb_seq
+ \@@_get_rf_opt_seq:nxxN { refbounds-mid }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
+ \l_@@_refbounds_mid_seq
+ \@@_get_rf_opt_seq:nxxN { refbounds-mid-rb }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
+ \l_@@_refbounds_mid_rb_seq
+ \@@_get_rf_opt_seq:nxxN { refbounds-mid-re }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
+ \l_@@_refbounds_mid_re_seq
+ \@@_get_rf_opt_seq:nxxN { refbounds-last }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
+ \l_@@_refbounds_last_seq
+ \@@_get_rf_opt_seq:nxxN { refbounds-last-pe }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
+ \l_@@_refbounds_last_pe_seq
+ \@@_get_rf_opt_seq:nxxN { refbounds-last-re }
+ { \l_@@_label_type_a_tl }
+ { \l_@@_ref_language_tl }
+ \l_@@_refbounds_last_re_seq
}
% Here we send this to a couple of auxiliary functions.
@@ -4109,19 +4917,31 @@
\l_@@_label_a_tl
\tl_set:NV \l_@@_type_first_label_type_tl
\l_@@_label_type_a_tl
+ \seq_set_eq:NN \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_sg_seq
+ \bool_set_true:N \l_@@_type_first_refbounds_set_bool
}
% The last is the second: we have a pair (if not repeated).
% Test: 'zc-typeset01.lvt': "Last of type: pair"
{ 1 }
{
- \int_compare:nNnF { \l_@@_range_same_count_int } = { 1 }
+ \int_compare:nNnTF { \l_@@_range_same_count_int } = { 1 }
+ {
+ \seq_set_eq:NN \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_sg_seq
+ \bool_set_true:N \l_@@_type_first_refbounds_set_bool
+ }
{
\tl_put_right:Nx \l_@@_typeset_queue_curr_tl
{
\exp_not:V \l_@@_pairsep_tl
- \@@_get_ref:V \l_@@_label_a_tl
+ \@@_get_ref:VN \l_@@_label_a_tl
+ \l_@@_refbounds_last_pe_seq
}
+ \seq_set_eq:NN \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_pb_seq
+ \bool_set_true:N \l_@@_type_first_refbounds_set_bool
}
}
}
@@ -4134,28 +4954,56 @@
% Test: 'zc-typeset01.lvt': "Last of type: not range"
{ 0 }
{
- \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ \int_compare:nNnTF { \l_@@_ref_count_int } < { 2 }
{
- \exp_not:V \l_@@_lastsep_tl
- \@@_get_ref:V \l_@@_label_a_tl
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ {
+ \exp_not:V \l_@@_pairsep_tl
+ \@@_get_ref:VN \l_@@_label_a_tl
+ \l_@@_refbounds_last_pe_seq
+ }
+ }
+ {
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ {
+ \exp_not:V \l_@@_lastsep_tl
+ \@@_get_ref:VN \l_@@_label_a_tl
+ \l_@@_refbounds_last_seq
+ }
}
}
% Last in the range is also the second in it.
% Test: 'zc-typeset01.lvt': "Last of type: pair in sequence"
{ 1 }
{
- \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ \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.
- \exp_not:V \l_@@_listsep_tl
- \@@_get_ref:V \l_@@_range_beg_label_tl
- \int_compare:nNnF
- { \l_@@_range_same_count_int } = { 1 }
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ {
+ \exp_not:V \l_@@_pairsep_tl
+ \@@_get_ref:VN
+ \l_@@_range_beg_label_tl
+ \l_@@_refbounds_last_pe_seq
+ }
+ \seq_set_eq:NN \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_pb_seq
+ \bool_set_true:N
+ \l_@@_type_first_refbounds_set_bool
+ }
+ {
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
{
+ \exp_not:V \l_@@_listsep_tl
+ \@@_get_ref:VN
+ \l_@@_range_beg_label_tl
+ \l_@@_refbounds_mid_seq
\exp_not:V \l_@@_lastsep_tl
- \@@_get_ref:V \l_@@_label_a_tl
+ \@@_get_ref:VN \l_@@_label_a_tl
+ \l_@@_refbounds_last_seq
}
}
}
@@ -4173,49 +5021,117 @@
{ 0 }
{
% If `range_beg_label' is empty, it means it was also the
- % first of the type, and hence was already handled.
- \tl_if_empty:VF \l_@@_range_beg_label_tl
+ % 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
{
- \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ \seq_set_eq:NN \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_sg_seq
+ \bool_set_true:N
+ \l_@@_type_first_refbounds_set_bool
+ }
+ {
+ \int_compare:nNnTF
+ { \l_@@_ref_count_int } < { 2 }
{
- \exp_not:V \l_@@_lastsep_tl
- \@@_get_ref:V
- \l_@@_range_beg_label_tl
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ {
+ \exp_not:V \l_@@_pairsep_tl
+ \@@_get_ref:VN
+ \l_@@_range_beg_label_tl
+ \l_@@_refbounds_last_pe_seq
+ }
+ }
+ {
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ {
+ \exp_not:V \l_@@_lastsep_tl
+ \@@_get_ref:VN
+ \l_@@_range_beg_label_tl
+ \l_@@_refbounds_last_seq
+ }
}
}
}
- % A `range', but with no skipped value, treat as list.
+ % 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"
{ 1 }
{
- \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ % Ditto.
+ \tl_if_empty:VTF \l_@@_range_beg_label_tl
{
- % Ditto.
- \tl_if_empty:VF \l_@@_range_beg_label_tl
+ \seq_set_eq:NN \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_pb_seq
+ \bool_set_true:N
+ \l_@@_type_first_refbounds_set_bool
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ {
+ \exp_not:V \l_@@_pairsep_tl
+ \@@_get_ref:VN \l_@@_label_a_tl
+ \l_@@_refbounds_last_pe_seq
+ }
+ }
+ {
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
{
\exp_not:V \l_@@_listsep_tl
- \@@_get_ref:V
+ \@@_get_ref:VN
\l_@@_range_beg_label_tl
+ \l_@@_refbounds_mid_seq
+ }
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ {
+ \exp_not:V \l_@@_lastsep_tl
+ \@@_get_ref:VN \l_@@_label_a_tl
+ \l_@@_refbounds_last_seq
}
- \exp_not:V \l_@@_lastsep_tl
- \@@_get_ref:V \l_@@_label_a_tl
}
}
}
{
% An actual range.
% Test: 'zc-typeset01.lvt': "Last of type: range"
- \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ % Ditto.
+ \tl_if_empty:VTF \l_@@_range_beg_label_tl
{
- % Ditto.
- \tl_if_empty:VF \l_@@_range_beg_label_tl
+ \seq_set_eq:NN \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_rb_seq
+ \bool_set_true:N
+ \l_@@_type_first_refbounds_set_bool
+ }
+ {
+ \int_compare:nNnTF
+ { \l_@@_ref_count_int } < { 2 }
{
- \exp_not:V \l_@@_lastsep_tl
- \@@_get_ref:V
- \l_@@_range_beg_label_tl
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ {
+ \exp_not:V \l_@@_pairsep_tl
+ \@@_get_ref:VN
+ \l_@@_range_beg_label_tl
+ \l_@@_refbounds_mid_rb_seq
+ }
+ \seq_set_eq:NN
+ \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_pb_seq
+ \bool_set_true:N
+ \l_@@_type_first_refbounds_set_bool
}
+ {
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ {
+ \exp_not:V \l_@@_lastsep_tl
+ \@@_get_ref:VN
+ \l_@@_range_beg_label_tl
+ \l_@@_refbounds_mid_rb_seq
+ }
+ }
+ }
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ {
\exp_not:V \l_@@_rangesep_tl
- \@@_get_ref:V \l_@@_label_a_tl
+ \@@_get_ref:VN \l_@@_label_a_tl
+ \l_@@_refbounds_last_re_seq
}
}
}
@@ -4247,16 +5163,40 @@
}
% Test: 'zc-typeset01.lvt': "Last of type: option range"
% Test: 'zc-typeset01.lvt': "Last of type: option range to pair"
- \tl_set:Nx \l_@@_typeset_queue_curr_tl
+ \bool_if:NTF \l_@@_next_maybe_range_bool
+ {
+ \tl_set:Nx \l_@@_typeset_queue_curr_tl
+ {
+ \exp_not:V \l_@@_pairsep_tl
+ \@@_get_ref:VN \l_@@_label_a_tl
+ \l_@@_refbounds_last_pe_seq
+ }
+ \seq_set_eq:NN \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_pb_seq
+ \bool_set_true:N \l_@@_type_first_refbounds_set_bool
+ }
{
- \bool_if:NTF \l_@@_next_maybe_range_bool
- { \exp_not:V \l_@@_pairsep_tl }
- { \exp_not:V \l_@@_rangesep_tl }
- \@@_get_ref:V \l_@@_label_a_tl
+ \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
+ \bool_set_true:N \l_@@_type_first_refbounds_set_bool
}
}
}
+ % If none of the special cases for the first of type refbounds have been
+ % set, do it.
+ \bool_if:NF \l_@@_type_first_refbounds_set_bool
+ {
+ \seq_set_eq:NN \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_seq
+ }
+
% Now that the type block is finished, we can add the name and the first
% ref to the queue. Also, if "typeset" option is not "both", handle it
% here as well.
@@ -4272,7 +5212,10 @@
{
% Test: 'zc-typeset01.lvt': "Last of type: option typeset ref"
\tl_put_left:Nx \l_@@_typeset_queue_curr_tl
- { \@@_get_ref:V \l_@@_type_first_label_tl }
+ {
+ \@@_get_ref:VN \l_@@_type_first_label_tl
+ \l_@@_type_first_refbounds_seq
+ }
}
{
\bool_if:NTF \l_@@_typeset_name_bool
@@ -4372,9 +5315,11 @@
\tl_clear:N \l_@@_type_first_label_type_tl
\tl_clear:N \l_@@_range_beg_label_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_@@_type_first_refbounds_set_bool
}
}
% \end{macrocode}
@@ -4409,6 +5354,7 @@
\l_@@_label_a_tl
\tl_set:NV \l_@@_type_first_label_type_tl
\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
@@ -4453,10 +5399,12 @@
% Test: 'zc-typeset01.lvt': "Not last of type: no range"
{ 0 }
{
+ \int_incr:N \l_@@_ref_count_int
\tl_put_right:Nx \l_@@_typeset_queue_curr_tl
{
\exp_not:V \l_@@_listsep_tl
- \@@_get_ref:V \l_@@_label_a_tl
+ \@@_get_ref:VN \l_@@_label_a_tl
+ \l_@@_refbounds_mid_seq
}
}
% Last is second in the range: if `range_same_count' is also
@@ -4466,20 +5414,33 @@
% Test: 'zc-typeset01.lvt': "Not last of type: range pair"
{ 1 }
{
- \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ \tl_if_empty:VTF \l_@@_range_beg_label_tl
{
- \tl_if_empty:VF \l_@@_range_beg_label_tl
+ \seq_set_eq:NN \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_seq
+ \bool_set_true:N
+ \l_@@_type_first_refbounds_set_bool
+ }
+ {
+ \int_incr:N \l_@@_ref_count_int
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
{
\exp_not:V \l_@@_listsep_tl
- \@@_get_ref:V
+ \@@_get_ref:VN
\l_@@_range_beg_label_tl
+ \l_@@_refbounds_mid_seq
}
- \int_compare:nNnF
- { \l_@@_range_same_count_int } = { 1 }
+ }
+ \int_compare:nNnF
+ { \l_@@_range_same_count_int } = { 1 }
+ {
+ \int_incr:N \l_@@_ref_count_int
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
{
\exp_not:V \l_@@_listsep_tl
- \@@_get_ref:V
+ \@@_get_ref:VN
\l_@@_label_a_tl
+ \l_@@_refbounds_mid_seq
}
}
}
@@ -4498,44 +5459,85 @@
% Test: 'zc-typeset01.lvt': "Not last of type: range to one"
{ 0 }
{
- \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ \tl_if_empty:VTF \l_@@_range_beg_label_tl
{
- \tl_if_empty:VF \l_@@_range_beg_label_tl
+ \seq_set_eq:NN
+ \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_seq
+ \bool_set_true:N
+ \l_@@_type_first_refbounds_set_bool
+ }
+ {
+ \int_incr:N \l_@@_ref_count_int
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
{
\exp_not:V \l_@@_listsep_tl
- \@@_get_ref:V
+ \@@_get_ref:VN
\l_@@_range_beg_label_tl
+ \l_@@_refbounds_mid_seq
}
}
}
% Test: 'zc-typeset01.lvt': "Not last of type: range to pair"
{ 1 }
{
- \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ \tl_if_empty:VTF \l_@@_range_beg_label_tl
+ {
+ \seq_set_eq:NN
+ \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_seq
+ \bool_set_true:N
+ \l_@@_type_first_refbounds_set_bool
+ }
{
- \tl_if_empty:VF \l_@@_range_beg_label_tl
+ \int_incr:N \l_@@_ref_count_int
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
{
\exp_not:V \l_@@_listsep_tl
- \@@_get_ref:V
+ \@@_get_ref:VN
\l_@@_range_beg_label_tl
+ \l_@@_refbounds_mid_seq
}
+ }
+ \int_incr:N \l_@@_ref_count_int
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ {
\exp_not:V \l_@@_listsep_tl
- \@@_get_ref:V \l_@@_label_a_tl
+ \@@_get_ref:VN \l_@@_label_a_tl
+ \l_@@_refbounds_mid_seq
}
}
}
{
% Test: 'zc-typeset01.lvt': "Not last of type: range"
- \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ \tl_if_empty:VTF \l_@@_range_beg_label_tl
{
- \tl_if_empty:VF \l_@@_range_beg_label_tl
+ \seq_set_eq:NN
+ \l_@@_type_first_refbounds_seq
+ \l_@@_refbounds_first_rb_seq
+ \bool_set_true:N
+ \l_@@_type_first_refbounds_set_bool
+ }
+ {
+ \int_incr:N \l_@@_ref_count_int
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
{
\exp_not:V \l_@@_listsep_tl
- \@@_get_ref:V
+ \@@_get_ref:VN
\l_@@_range_beg_label_tl
+ \l_@@_refbounds_mid_rb_seq
}
+ }
+ % 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
+ % (here or with the first of type), we refrain from
+ % incrementing 'ref_count_int'.
+ \tl_put_right:Nx \l_@@_typeset_queue_curr_tl
+ {
\exp_not:V \l_@@_rangesep_tl
- \@@_get_ref:V \l_@@_label_a_tl
+ \@@_get_ref:VN \l_@@_label_a_tl
+ \l_@@_refbounds_mid_re_seq
}
}
}
@@ -4554,8 +5556,8 @@
%
% \subsection*{Auxiliary functions}
%
-% \cs{@@_get_ref:n} and \cs{@@_get_ref_first:} are the two functions which
-% actually build the reference blocks for typesetting. \cs{@@_get_ref:n}
+% \cs{@@_get_ref:nN} and \cs{@@_get_ref_first:} are the two functions which
+% actually build the reference blocks for typesetting. \cs{@@_get_ref:nN}
% handles all references but the first of its type, and \cs{@@_get_ref_first:}
% deals with the first reference of a type. Saying they do ``typesetting'' is
% imprecise though, they actually prepare material to be accumulated in
@@ -4566,10 +5568,10 @@
% the queue, we are using a number of variables which are transient to the
% current label, the label properties among them, but not only. Hence, these
% variables \emph{must} be expanded to their current values to be stored in
-% the queue. Indeed, \cs{@@_get_ref:n} and \cs{@@_get_ref_first:} get called,
-% as they must, in the context of \texttt{x} type expansions. But we don't
-% want to expand the values of the variables themselves, so we need to get
-% current values, but stop expansion after that. In particular, reference
+% the queue. Indeed, \cs{@@_get_ref:nN} and \cs{@@_get_ref_first:} get
+% called, as they must, in the context of \texttt{x} type expansions. But we
+% don't want to expand the values of the variables themselves, so we need to
+% get current values, but stop expansion after that. In particular, reference
% options given by the user should reach the stream for its final typesetting
% (when the queue itself gets typeset) \emph{unmodified} (``no manipulation'',
% to use the \texttt{n} signature jargon). We also need to prevent premature
@@ -4594,58 +5596,55 @@
% \end{macro}
%
%
-% \begin{macro}{\@@_get_ref:n}
+% \begin{macro}{\@@_get_ref:nN}
% Handles a complete reference block to be accumulated in the ``queue'',
-% including ``pre'' and ``pos'' elements, and hyperlinking. For use with
-% all labels, except the first of its type, which is done by
-% \cs{@@_get_ref_first:}.
+% including refbounds, and hyperlinking. For use with all labels, except
+% the first of its type, which is done by \cs{@@_get_ref_first:}.
% \begin{syntax}
-% \cs{@@_get_ref:n} \Arg{label}
+% \cs{@@_get_ref:nN} \Arg{label} \Arg{refbounds}
% \end{syntax}
% \begin{macrocode}
-\cs_new:Npn \@@_get_ref:n #1
+\cs_new:Npn \@@_get_ref:nN #1#2
{
\zref@ifrefcontainsprop {#1} { \l_@@_ref_property_tl }
{
\bool_if:nTF
{
- \l_@@_use_hyperref_bool &&
+ \l_@@_hyperlink_bool &&
! \l_@@_link_star_bool
}
{
- \bool_if:NF \l_@@_preposinlink_bool
- { \exp_not:V \l_@@_preref_tl }
+ \exp_not:N \group_begin:
+ \exp_not:V \l_@@_reffont_tl
+ \seq_item:Nn #2 { 1 }
% It's two `@s', but escaped for DocStrip.
\exp_not:N \hyper@@@@link
{ \@@_extract_url_unexp:n {#1} }
{ \@@_extract_unexp:nnn {#1} { anchor } { } }
{
- \bool_if:NT \l_@@_preposinlink_bool
- { \exp_not:V \l_@@_preref_tl }
- \exp_not:N \group_begin:
- \exp_not:V \l_@@_reffont_tl
+ \seq_item:Nn #2 { 2 }
\@@_extract_unexp:nvn {#1}
{ l_@@_ref_property_tl } { }
- \exp_not:N \group_end:
- \bool_if:NT \l_@@_preposinlink_bool
- { \exp_not:V \l_@@_postref_tl }
+ \seq_item:Nn #2 { 3 }
}
- \bool_if:NF \l_@@_preposinlink_bool
- { \exp_not:V \l_@@_postref_tl }
+ \seq_item:Nn #2 { 4 }
+ \exp_not:N \group_end:
}
{
- \exp_not:V \l_@@_preref_tl
\exp_not:N \group_begin:
\exp_not:V \l_@@_reffont_tl
+ \seq_item:Nn #2 { 1 }
+ \seq_item:Nn #2 { 2 }
\@@_extract_unexp:nvn {#1}
{ l_@@_ref_property_tl } { }
+ \seq_item:Nn #2 { 3 }
+ \seq_item:Nn #2 { 4 }
\exp_not:N \group_end:
- \exp_not:V \l_@@_postref_tl
}
}
{ \@@_ref_default: }
}
-\cs_generate_variant:Nn \@@_get_ref:n { V }
+\cs_generate_variant:Nn \@@_get_ref:nN { VN }
% \end{macrocode}
% \end{macro}
%
@@ -4671,6 +5670,7 @@
{ \l_@@_type_first_label_tl }
{ \l_@@_ref_property_tl }
{
+ \exp_not:N \group_begin:
% It's two `@s', but escaped for DocStrip.
\exp_not:N \hyper@@@@link
{
@@ -4687,18 +5687,19 @@
\exp_not:V \l_@@_type_name_tl
\exp_not:N \group_end:
\exp_not:V \l_@@_namesep_tl
- \exp_not:V \l_@@_preref_tl
\exp_not:N \group_begin:
\exp_not:V \l_@@_reffont_tl
+ \seq_item:Nn \l_@@_type_first_refbounds_seq { 1 }
+ \seq_item:Nn \l_@@_type_first_refbounds_seq { 2 }
\@@_extract_unexp:Vvn
\l_@@_type_first_label_tl
{ l_@@_ref_property_tl } { }
+ \seq_item:Nn \l_@@_type_first_refbounds_seq { 3 }
\exp_not:N \group_end:
- \bool_if:NT \l_@@_preposinlink_bool
- { \exp_not:V \l_@@_postref_tl }
}
- \bool_if:NF \l_@@_preposinlink_bool
- { \exp_not:V \l_@@_postref_tl }
+ \exp_not:V \l_@@_reffont_tl
+ \seq_item:Nn \l_@@_type_first_refbounds_seq { 4 }
+ \exp_not:N \group_end:
}
{
\exp_not:N \group_begin:
@@ -4710,7 +5711,7 @@
}
}
{
- \tl_if_empty:NTF \l_@@_type_name_tl
+ \bool_if:nTF \l_@@_type_name_missing_bool
{
\@@_name_default:
\exp_not:V \l_@@_namesep_tl
@@ -4720,7 +5721,8 @@
\exp_not:V \l_@@_namefont_tl
\exp_not:V \l_@@_type_name_tl
\exp_not:N \group_end:
- \exp_not:V \l_@@_namesep_tl
+ \tl_if_empty:NF \l_@@_type_name_tl
+ { \exp_not:V \l_@@_namesep_tl }
}
\zref@ifrefcontainsprop
{ \l_@@_type_first_label_tl }
@@ -4728,12 +5730,14 @@
{
\bool_if:nTF
{
- \l_@@_use_hyperref_bool &&
+ \l_@@_hyperlink_bool &&
! \l_@@_link_star_bool
}
{
- \bool_if:NF \l_@@_preposinlink_bool
- { \exp_not:V \l_@@_preref_tl }
+ \exp_not:N \group_begin:
+ \exp_not:V \l_@@_reffont_tl
+ \seq_item:Nn
+ \l_@@_type_first_refbounds_seq { 1 }
% It's two '@s', but escaped for DocStrip.
\exp_not:N \hyper@@@@link
{
@@ -4745,29 +5749,29 @@
\l_@@_type_first_label_tl { anchor } { }
}
{
- \bool_if:NT \l_@@_preposinlink_bool
- { \exp_not:V \l_@@_preref_tl }
- \exp_not:N \group_begin:
- \exp_not:V \l_@@_reffont_tl
+ \seq_item:Nn
+ \l_@@_type_first_refbounds_seq { 2 }
\@@_extract_unexp:Vvn
\l_@@_type_first_label_tl
{ l_@@_ref_property_tl } { }
- \exp_not:N \group_end:
- \bool_if:NT \l_@@_preposinlink_bool
- { \exp_not:V \l_@@_postref_tl }
+ \seq_item:Nn
+ \l_@@_type_first_refbounds_seq { 3 }
}
- \bool_if:NF \l_@@_preposinlink_bool
- { \exp_not:V \l_@@_postref_tl }
+ \seq_item:Nn
+ \l_@@_type_first_refbounds_seq { 4 }
+ \exp_not:N \group_end:
}
{
- \exp_not:V \l_@@_preref_tl
\exp_not:N \group_begin:
\exp_not:V \l_@@_reffont_tl
+ \seq_item:Nn \l_@@_type_first_refbounds_seq { 1 }
+ \seq_item:Nn \l_@@_type_first_refbounds_seq { 2 }
\@@_extract_unexp:Vvn
\l_@@_type_first_label_tl
{ l_@@_ref_property_tl } { }
+ \seq_item:Nn \l_@@_type_first_refbounds_seq { 3 }
+ \seq_item:Nn \l_@@_type_first_refbounds_seq { 4 }
\exp_not:N \group_end:
- \exp_not:V \l_@@_postref_tl
}
}
{ \@@_ref_default: }
@@ -4794,18 +5798,24 @@
\cs_new_protected:Npn \@@_type_name_setup:
{
\zref@ifrefundefined { \l_@@_type_first_label_tl }
- { \tl_clear:N \l_@@_type_name_tl }
+ {
+ \tl_clear:N \l_@@_type_name_tl
+ \bool_set_true:N \l_@@_type_name_missing_bool
+ }
{
\tl_if_eq:NnTF
\l_@@_type_first_label_type_tl { zc@missingtype }
- { \tl_clear:N \l_@@_type_name_tl }
+ {
+ \tl_clear:N \l_@@_type_name_tl
+ \bool_set_true:N \l_@@_type_name_missing_bool
+ }
{
% Determine whether we should use capitalization, abbreviation,
% and plural.
\bool_lazy_or:nnTF
- { \l_@@_capitalize_bool }
+ { \l_@@_cap_bool }
{
- \l_@@_capitalize_first_bool &&
+ \l_@@_capfirst_bool &&
\int_compare_p:nNn { \l_@@_type_count_int } = { 0 }
}
{ \tl_set:Nn \l_@@_name_format_tl {Name} }
@@ -4860,19 +5870,15 @@
{ \l_@@_nudge_gender_bool }
{ ! \tl_if_empty_p:N \l_@@_ref_gender_tl }
{
- \@@_get_lang_opt_type:xxnNF
- { \l_@@_ref_language_tl }
+ \@@_get_rf_opt_seq:nxxN { gender }
{ \l_@@_type_first_label_type_tl }
- { gender }
- \l_@@_type_name_gender_tl
- { \tl_clear:N \l_@@_type_name_gender_tl }
- \clist_set:NV \l_tmpa_clist
- \l_@@_type_name_gender_tl
- \clist_if_in:NVF
- \l_tmpa_clist
+ { \l_@@_ref_language_tl }
+ \l_@@_type_name_gender_seq
+ \seq_if_in:NVF
+ \l_@@_type_name_gender_seq
\l_@@_ref_gender_tl
{
- \tl_if_empty:NTF \l_@@_type_name_gender_tl
+ \seq_if_empty:NTF \l_@@_type_name_gender_seq
{
\msg_warning:nnxxx { zref-clever }
{ nudge-gender-not-declared-for-type }
@@ -4885,7 +5891,10 @@
{ nudge-gender-mismatch }
{ \l_@@_type_first_label_type_tl }
{ \l_@@_ref_gender_tl }
- { \l_@@_type_name_gender_tl }
+ {
+ \seq_use:Nn
+ \l_@@_type_name_gender_seq { ,~ }
+ }
{ \l_@@_ref_language_tl }
}
}
@@ -4894,12 +5903,13 @@
\tl_if_empty:NTF \l_@@_name_format_fallback_tl
{
- \prop_get:cVNF
+ \@@_opt_tl_get:cNF
{
- l_@@_type_
- \l_@@_type_first_label_type_tl _options_prop
+ \@@_opt_varname_type:een
+ { \l_@@_type_first_label_type_tl }
+ { \l_@@_name_format_tl }
+ { tl }
}
- \l_@@_name_format_tl
\l_@@_type_name_tl
{
\tl_if_empty:NF \l_@@_ref_decl_case_tl
@@ -4908,13 +5918,18 @@
\tl_put_left:NV \l_@@_name_format_tl
\l_@@_ref_decl_case_tl
}
- \@@_get_lang_opt_type:xxxNF
- { \l_@@_ref_language_tl }
- { \l_@@_type_first_label_type_tl }
- { \l_@@_name_format_tl }
+ \@@_opt_tl_get:cNF
+ {
+ \@@_opt_varname_lang_type:eeen
+ { \l_@@_ref_language_tl }
+ { \l_@@_type_first_label_type_tl }
+ { \l_@@_name_format_tl }
+ { tl }
+ }
\l_@@_type_name_tl
{
\tl_clear:N \l_@@_type_name_tl
+ \bool_set_true:N \l_@@_type_name_missing_bool
\msg_warning:nnxx { zref-clever } { missing-name }
{ \l_@@_name_format_tl }
{ \l_@@_type_first_label_type_tl }
@@ -4922,20 +5937,22 @@
}
}
{
- \prop_get:cVNF
+ \@@_opt_tl_get:cNF
{
- l_@@_type_
- \l_@@_type_first_label_type_tl _options_prop
+ \@@_opt_varname_type:een
+ { \l_@@_type_first_label_type_tl }
+ { \l_@@_name_format_tl }
+ { tl }
}
- \l_@@_name_format_tl
\l_@@_type_name_tl
{
- \prop_get:cVNF
+ \@@_opt_tl_get:cNF
{
- l_@@_type_
- \l_@@_type_first_label_type_tl _options_prop
+ \@@_opt_varname_type:een
+ { \l_@@_type_first_label_type_tl }
+ { \l_@@_name_format_fallback_tl }
+ { tl }
}
- \l_@@_name_format_fallback_tl
\l_@@_type_name_tl
{
\tl_if_empty:NF \l_@@_ref_decl_case_tl
@@ -4950,19 +5967,29 @@
\l_@@_name_format_fallback_tl
\l_@@_ref_decl_case_tl
}
- \@@_get_lang_opt_type:xxxNF
- { \l_@@_ref_language_tl }
- { \l_@@_type_first_label_type_tl }
- { \l_@@_name_format_tl }
- \l_@@_type_name_tl
+ \@@_opt_tl_get:cNF
{
- \@@_get_lang_opt_type:xxxNF
+ \@@_opt_varname_lang_type:eeen
{ \l_@@_ref_language_tl }
{ \l_@@_type_first_label_type_tl }
- { \l_@@_name_format_fallback_tl }
+ { \l_@@_name_format_tl }
+ { tl }
+ }
+ \l_@@_type_name_tl
+ {
+ \@@_opt_tl_get:cNF
+ {
+ \@@_opt_varname_lang_type:eeen
+ { \l_@@_ref_language_tl }
+ { \l_@@_type_first_label_type_tl }
+ { \l_@@_name_format_fallback_tl }
+ { tl }
+ }
\l_@@_type_name_tl
{
\tl_clear:N \l_@@_type_name_tl
+ \bool_set_true:N
+ \l_@@_type_name_missing_bool
\msg_warning:nnxx { zref-clever }
{ missing-name }
{ \l_@@_name_format_tl }
@@ -4978,7 +6005,7 @@
% Signal whether the type name is to be included in the hyperlink or not.
\bool_lazy_any:nTF
{
- { ! \l_@@_use_hyperref_bool }
+ { ! \l_@@_hyperlink_bool }
{ \l_@@_link_star_bool }
{ \tl_if_empty_p:N \l_@@_type_name_tl }
{ \str_if_eq_p:Vn \l_@@_nameinlink_str { false } }
@@ -5017,11 +6044,11 @@
\cs_new:Npn \@@_extract_url_unexp:n #1
{
\zref@ifpropundefined { urluse }
- { \@@_extract_unexp:nnn {#1} { url } { \c_empty_tl } }
+ { \@@_extract_unexp:nnn {#1} { url } { } }
{
\zref@ifrefcontainsprop {#1} { urluse }
- { \@@_extract_unexp:nnn {#1} { urluse } { \c_empty_tl } }
- { \@@_extract_unexp:nnn {#1} { url } { \c_empty_tl } }
+ { \@@_extract_unexp:nnn {#1} { urluse } { } }
+ { \@@_extract_unexp:nnn {#1} { url } { } }
}
}
\cs_generate_variant:Nn \@@_extract_url_unexp:n { V }
@@ -5045,9 +6072,9 @@
\cs_new_protected:Npn \@@_labels_in_sequence:nn #1#2
{
\@@_extract_default:Nnnn \l_@@_label_extdoc_a_tl
- {#1} { externaldocument } { \c_empty_tl }
+ {#1} { externaldocument } { }
\@@_extract_default:Nnnn \l_@@_label_extdoc_b_tl
- {#2} { externaldocument } { \c_empty_tl }
+ {#2} { externaldocument } { }
\tl_if_eq:NNT
\l_@@_label_extdoc_a_tl
@@ -5124,187 +6151,142 @@
%
%
% Finally, some functions for retrieving reference options values, according
-% to the relevant precedence rules. They both receive an \meta{option} as
-% argument, and store the retrieved value in an appropriate. Though these are
-% mostly general functions (for a change\dots{}), they are not completely so,
-% they rely on the current state of \cs{l_@@_label_type_a_tl}, as set during
-% the processing of the label stack. This could be easily generalized, of
-% course, but I don't think it is worth it, \cs{l_@@_label_type_a_tl} is
-% indeed what we want in all practical cases. The difference between each of
-% these functions is the kind of option each should be used for.
-% \cs{@@_get_ref_opt_typeset:nN} is meant for the general options, and
-% attempts to find values for them in all precedence levels (four plus
-% ``fallback''). \cs{@@_get_ref_opt_font:nN} is intended for ``font''
-% options, which cannot be ``language-specific'', thus for these we just
-% search general options and type options. \cs{@@_get_ref_opt_bool:nN} is
-% intended for boolean options.
-%
-% \begin{macro}{\@@_get_ref_opt_typeset:nN}
+% to the relevant precedence rules. They receive an \meta{option} as
+% argument, and store the retrieved value in an appropriate \meta{variable}.
+% The difference between each of these functions is the data type of the
+% option each should be used for.
+%
+%
+% \begin{macro}{\@@_get_rf_opt_tl:nnnN}
% \begin{syntax}
-% \cs{@@_get_ref_opt_typeset:nN} \Arg{option} \Arg{tl variable}
+% \cs{@@_get_rf_opt_tl:nnnN} \Arg{option}
+% ~~\Arg{ref type} \Arg{language} \Arg{tl variable}
% \end{syntax}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_get_ref_opt_typeset:nN #1#2
+\cs_new_protected:Npn \@@_get_rf_opt_tl:nnnN #1#2#3#4
{
% First attempt: general options.
- \prop_get:NnNF \l_@@_ref_options_prop {#1} #2
+ \@@_opt_tl_get:cNF
+ { \@@_opt_varname_general:nn {#1} { tl } }
+ #4
{
% If not found, try type specific options.
- \bool_lazy_and:nnTF
- {
- \prop_if_exist_p:c
- {
- l_@@_type_
- \l_@@_label_type_a_tl _options_prop
- }
- }
- {
- \prop_if_in_p:cn
- {
- l_@@_type_
- \l_@@_label_type_a_tl _options_prop
- }
- {#1}
- }
- {
- \prop_get:cnN
- {
- l_@@_type_
- \l_@@_label_type_a_tl _options_prop
- }
- {#1} #2
- }
+ \@@_opt_tl_get:cNF
+ { \@@_opt_varname_type:nnn {#2} {#1} { tl } }
+ #4
{
% If not found, try type- and language-specific.
- \@@_get_lang_opt_type:xxnNF
- { \l_@@_ref_language_tl }
- { \l_@@_label_type_a_tl }
- {#1} #2
+ \@@_opt_tl_get:cNF
+ { \@@_opt_varname_lang_type:nnnn {#3} {#2} {#1} { tl } }
+ #4
{
% If not found, try language-specific default.
- \@@_get_lang_opt_default:xnNF
- { \l_@@_ref_language_tl }
- {#1} #2
+ \@@_opt_tl_get:cNF
+ { \@@_opt_varname_lang_default:nnn {#3} {#1} { tl } }
+ #4
{
% If not found, try fallback.
- \@@_get_fallback_unknown_lang_opt:nNF {#1} #2
- {
- \tl_clear:N #2
- \msg_warning:nnn { zref-clever }
- { missing-string } {#1}
- }
+ \@@_opt_tl_get:cNF
+ { \@@_opt_varname_fallback:nn {#1} { tl } }
+ #4
+ { \tl_clear:N #4 }
}
}
}
}
}
+\cs_generate_variant:Nn \@@_get_rf_opt_tl:nnnN { nxxN }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_get_ref_opt_font:nN}
+%
+% \begin{macro}{\@@_get_rf_opt_seq:nnnN}
% \begin{syntax}
-% \cs{@@_get_ref_opt_font:nN} \Arg{option} \Arg{tl variable}
+% \cs{@@_get_rf_opt_seq:nnnN} \Arg{option}
+% ~~\Arg{ref type} \Arg{language} \Arg{seq variable}
% \end{syntax}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_get_ref_opt_font:nN #1#2
+\cs_new_protected:Npn \@@_get_rf_opt_seq:nnnN #1#2#3#4
{
% First attempt: general options.
- \prop_get:NnNF \l_@@_ref_options_prop {#1} #2
+ \@@_opt_seq_get:cNF
+ { \@@_opt_varname_general:nn {#1} { seq } }
+ #4
{
% If not found, try type specific options.
- \bool_if:nTF
- {
- \prop_if_exist_p:c
- {
- l_@@_type_
- \l_@@_label_type_a_tl _options_prop
- }
- }
+ \@@_opt_seq_get:cNF
+ { \@@_opt_varname_type:nnn {#2} {#1} { seq } }
+ #4
{
- \prop_get:cnNF
+ % If not found, try type- and language-specific.
+ \@@_opt_seq_get:cNF
+ { \@@_opt_varname_lang_type:nnnn {#3} {#2} {#1} { seq } }
+ #4
{
- l_@@_type_
- \l_@@_label_type_a_tl _options_prop
+ % If not found, try language-specific default.
+ \@@_opt_seq_get:cNF
+ { \@@_opt_varname_lang_default:nnn {#3} {#1} { seq } }
+ #4
+ {
+ % If not found, try fallback.
+ \@@_opt_seq_get:cNF
+ { \@@_opt_varname_fallback:nn {#1} { seq } }
+ #4
+ { \seq_clear:N #4 }
+ }
}
- {#1} #2
- { \tl_clear:N #2 }
}
- { \tl_clear:N #2 }
}
}
+\cs_generate_variant:Nn \@@_get_rf_opt_seq:nnnN { nxxN }
% \end{macrocode}
% \end{macro}
%
%
-% \begin{macro}{\@@_get_ref_opt_bool:nnN}
+% \begin{macro}{\@@_get_rf_opt_bool:nnnnN}
% \begin{syntax}
-% \cs{@@_get_ref_opt_bool:nN} \Arg{option}
-% ~~\Arg{default} \Arg{bool variable}
+% \cs{@@_get_rf_opt_bool:nN} \Arg{option} \Arg{default}
+% ~~\Arg{ref type} \Arg{language} \Arg{bool variable}
% \end{syntax}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_get_ref_opt_bool:nnN #1#2#3
+\cs_new_protected:Npn \@@_get_rf_opt_bool:nnnnN #1#2#3#4#5
{
% First attempt: general options.
- \prop_get:NnNF \l_@@_ref_options_prop {#1} \l_tmpa_tl
+ \@@_opt_bool_get:cNF
+ { \@@_opt_varname_general:nn {#1} { bool } }
+ #5
{
% If not found, try type specific options.
- \bool_lazy_and:nnTF
- {
- \prop_if_exist_p:c
- {
- l_@@_type_
- \l_@@_label_type_a_tl _options_prop
- }
- }
- {
- \prop_if_in_p:cn
- {
- l_@@_type_
- \l_@@_label_type_a_tl _options_prop
- }
- {#1}
- }
- {
- \prop_get:cnN
- {
- l_@@_type_
- \l_@@_label_type_a_tl _options_prop
- }
- {#1} \l_tmpa_tl
- }
+ \@@_opt_bool_get:cNF
+ { \@@_opt_varname_type:nnn {#3} {#1} { bool } }
+ #5
{
% If not found, try type- and language-specific.
- \@@_get_lang_opt_type:xxnNF
- { \l_@@_ref_language_tl }
- { \l_@@_label_type_a_tl }
- {#1} \l_tmpa_tl
+ \@@_opt_bool_get:cNF
+ { \@@_opt_varname_lang_type:nnnn {#4} {#3} {#1} { bool } }
+ #5
{
% If not found, try language-specific default.
- \@@_get_lang_opt_default:xnNF
- { \l_@@_ref_language_tl }
- {#1} \l_tmpa_tl
+ \@@_opt_bool_get:cNF
+ { \@@_opt_varname_lang_default:nnn {#4} {#1} { bool } }
+ #5
{
- % If not found, use default argument.
- \bool_lazy_or:nnTF
- { \str_if_eq_p:nn {#2} { true } }
- { \str_if_eq_p:nn {#2} { false } }
- { \tl_set:Nn \l_tmpa_tl {#2} }
- {
- % And, if even that fails, presume false.
- \tl_set:Nn \l_tmpa_tl { false }
- }
+ % If not found, try fallback.
+ \@@_opt_bool_get:cNF
+ { \@@_opt_varname_fallback:nn {#1} { bool } }
+ #5
+ { \use:c { bool_set_ #2 :N } #5 }
}
}
}
}
- % Having retrieved the option value, set the boolean. At this point, we
- % *know* '\l_tmpa_tl' is either 'true' or 'false'.
- \use:c { bool_set_ \l_tmpa_tl :N } #3
}
+\cs_generate_variant:Nn \@@_get_rf_opt_bool:nnnnN { nnxxN }
% \end{macrocode}
% \end{macro}
%
%
+%
% \section{Compatibility}
%
% This section is meant to aggregate any ``special handling'' needed for
@@ -5796,11 +6778,7 @@
% references \cs{textup}.
% \begin{macrocode}
\zcRefTypeSetup { equation }
- {
- reffont = \upshape ,
- preref = {\textup{(}} ,
- postref = {\textup{)}} ,
- }
+ { reffont = \upshape }
\msg_info:nnn { zref-clever } { compat-package } { amsmath }
}
}
@@ -6091,7 +7069,7 @@
%
% \section{Language files}
%
-% Initial values for the English, German, French, Portuguese, and Spanish,
+% Initial values for the English, German, French, Portuguese, and Spanish
% language files have been provided by the author. Translations available for
% document elements' names in other packages have been an useful reference for
% the purpose, namely: \pkg{babel}, \pkg{cleveref}, \pkg{translator}, and
@@ -6232,8 +7210,8 @@ type = equation ,
name-sg-ab = eq. ,
Name-pl-ab = Eqs. ,
name-pl-ab = eqs. ,
- preref = {(} ,
- postref = {)} ,
+ refbounds-first-sg = {,(,),} ,
+ refbounds = {(,,,)} ,
type = theorem ,
Name-sg = Theorem ,
@@ -6586,8 +7564,8 @@ type = equation ,
case = G ,
Name-sg = Gleichung ,
Name-pl = Gleichungen ,
- preref = {(} ,
- postref = {)} ,
+ refbounds-first-sg = {,(,),} ,
+ refbounds = {(,,,)} ,
type = theorem ,
gender = n ,
@@ -6931,8 +7909,8 @@ type = equation ,
name-sg = équation ,
Name-pl = Équations ,
name-pl = équations ,
- preref = {(} ,
- postref = {)} ,
+ refbounds-first-sg = {,(,),} ,
+ refbounds = {(,,,)} ,
type = theorem ,
gender = m ,
@@ -7180,8 +8158,8 @@ type = equation ,
name-sg-ab = eq. ,
Name-pl-ab = Eqs. ,
name-pl-ab = eqs. ,
- preref = {(} ,
- postref = {)} ,
+ refbounds-first-sg = {,(,),} ,
+ refbounds = {(,,,)} ,
type = theorem ,
gender = m ,
@@ -7411,8 +8389,8 @@ type = equation ,
name-sg = ecuación ,
Name-pl = Ecuaciones ,
name-pl = ecuaciones ,
- preref = {(} ,
- postref = {)} ,
+ refbounds-first-sg = {,(,),} ,
+ refbounds = {(,,,)} ,
type = theorem ,
gender = m ,
@@ -7648,8 +8626,8 @@ type = equation ,
name-sg-ab = vgl. ,
Name-pl-ab = Vgl.'s ,
name-pl-ab = vgl.'s ,
- preref = {(} ,
- postref = {)} ,
+ refbounds-first-sg = {,(,),} ,
+ refbounds = {(,,,)} ,
type = theorem ,
gender = f ,
@@ -7657,12 +8635,11 @@ type = theorem ,
name-sg = stelling ,
Name-pl = Stellingen ,
name-pl = stellingen ,
+
% \end{macrocode}
-%
% 2022-01-09, \texttt{niluxv}: An alternative plural is ``lemmata''. That is
% also a correct English plural for lemma, but the English language file
% chooses ``lemmas''. For consistency we therefore choose ``lemma's''.
-%
% \begin{macrocode}
type = lemma ,
gender = n ,
@@ -7726,11 +8703,10 @@ type = algorithm ,
name-sg = algoritme ,
Name-pl = Algoritmes ,
name-pl = algoritmes ,
+
% \end{macrocode}
-%
% 2022-01-09, \texttt{niluxv}: EN-NL Van Dale translates listing as (3)
% ``uitdraai van computerprogramma'', ``listing''.
-%
% \begin{macrocode}
type = listing ,
gender = m ,
diff --git a/macros/latex/contrib/zref-clever/zref-clever.pdf b/macros/latex/contrib/zref-clever/zref-clever.pdf
index 1c64f52147..99292b0570 100644
--- a/macros/latex/contrib/zref-clever/zref-clever.pdf
+++ b/macros/latex/contrib/zref-clever/zref-clever.pdf
Binary files differ
diff --git a/macros/latex/contrib/zref-clever/zref-clever.tex b/macros/latex/contrib/zref-clever/zref-clever.tex
index a4e3ab8638..64d5028f62 100644
--- a/macros/latex/contrib/zref-clever/zref-clever.tex
+++ b/macros/latex/contrib/zref-clever/zref-clever.tex
@@ -591,13 +591,6 @@ the second reference none of them will. The package's default is
\texttt{nameinlink=tsingle}, and the option given without a value is
equivalent to \texttt{nameinlink=true}.
-\DescribeOption{preposinlink} %
-The \opt{preposinlink} option controls whether the \opt{preref} and
-\opt{postref} reference format options (see \zcref{sec:reference-format}) are
-included in the reference hyperlink or not. It is a boolean option. The
-package's default is \texttt{preposinlink=false}, and the option given without
-a value is equivalent to \texttt{preposinlink=true}.
-
\DescribeOption{lang} %
The \opt{lang} option controls the language used by \cs{zcref} when looking
for language-specific reference format options (see
@@ -932,8 +925,7 @@ more detail soon, and lists the scopes in which each is available.
type-specific) & listsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
& lastsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
& rangesep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
- & preref & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
- & postref & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & refbounds & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
\addlinespace
Typesetting & Name-sg & & $\bullet$ & $\bullet$ & \\
@@ -946,8 +938,8 @@ more detail soon, and lists the scopes in which each is available.
& name-pl-ab & & $\bullet$ & $\bullet$ & \\
\addlinespace
- Font & namefont & $\bullet$ & $\bullet$ & & \\
- & reffont & $\bullet$ & $\bullet$ & & \\
+ Font & namefont & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & reffont & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
\addlinespace
Other & cap & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
@@ -967,15 +959,28 @@ that which a standard \LaTeX{} \cs{ref} would typeset. A \pkg{zref-clever}
\begin{refformat}
\item \reffmt{ref-block} \(\equiv\)
-\item \reffmt{preref} \reffmt{ref} \reffmt{postref}
+\item \reffmt{preref*}
+ \raisebox{-\baselineskip}{\makebox[0pt]{\^{}}}%
+ \raisebox{-1.2\baselineskip}{\makebox[0pt]{\footnotesize{}hyperlink start}}
+ \reffmt{preref} \reffmt{ref} \reffmt{postref}
+ \raisebox{-\baselineskip}{\makebox[0pt]{\^{}}}%
+ \raisebox{-1.2\baselineskip}{\makebox[0pt]{\footnotesize{}hyperlink end}}
+ \reffmt{postref*}
\end{refformat}
-A \texttt{ref-block} is built for \emph{each} label given as argument to
-\cs{zcref}. When the \meta{labels} argument is comprised of multiple labels,
-each ``reference type group'', or \texttt{type-group} is potentially made from
-the combination of single reference blocks, ``reference block pairs'',
-``reference block lists'', or ``reference block ranges'', where each is
-respectively built as:
+Where the \opt{refbounds} option, which receives as value a comma separated
+list of four items in the form \texttt{\{preref*,preref,postref,postref*\}},
+sets the surrounding elements to \texttt{ref}.\footnote{As usual, if each of
+ the items contains start or end spaces, or commas anywhere, they must be
+ protected by a pair of braces. However, care is taken that empty items
+ don't need such protection. So you can set, for example, something like
+ \texttt{refbounds=\{(,{},{},)\}} to get parentheses around your references,
+ outside the hyperlink.} A \texttt{ref-block} is built for \emph{each} label
+given as argument to \cs{zcref}. When the \meta{labels} argument is comprised
+of multiple labels, each ``reference type group'', or \texttt{type-group} is
+potentially made from the combination of single reference blocks, ``reference
+block pairs'', ``reference block lists'', or ``reference block ranges'', where
+each is respectively built as:
\begin{refformat}
\item \reffmt{type-group} is a combination of:
@@ -1061,8 +1066,7 @@ mentioned above. These ``last resort'' option values are required by
language that \pkg{zref-clever} does not know and has no language file for, it
cannot guess what language that is, and thus has to provide some reasonable
``language agnostic'' default, at least for the options for which this makes
-sense (all the ``typesetting'' options, except for the \texttt{[Nn]ame-}
-ones). Users do not need to have access to this scope, since they know the
+sense. Users do not need to have access to this scope, since they know the
language of their document, or know the values they want for those options,
and can set them as general options, type-specific options, or language
options through the user interface provided for the purpose. But the
@@ -1081,11 +1085,90 @@ pairsep = {,`\textvisiblespace{}'} ,
listsep = {,`\textvisiblespace{}'} ,
lastsep = {,`\textvisiblespace{}'} ,
rangesep = {\textendash} ,
-preref = {} ,
-postref = {} ,
\end{zcexample}
+\subsection{Advanced reference formatting}
+
+The reference format options discussed above and presented in
+\zcref{tab:reference-format} should suffice for most needs. However, if more
+fine-grained control of the reference format is needed, this can be achieved
+through a more detailed specification of \opt{refbounds} for the different
+cases in which they may occur when a reference is processed. The options
+available for this purpose are presented in
+\zcref{tab:advanced-reference-format}.
+
+\begin{table}
+ \centering
+ \DeleteShortVerb \|
+ \begin{tabular}{l>{\ttfamily}lcccc}
+ \toprule
+ & & General & Type & \multicolumn{2}{c}{Language} \\
+ \cmidrule(lr){5-6}
+ & & & & Type & Default \\
+ & & (i) & (ii) & (iii) & (iv) \\
+
+ \midrule
+ Base & refbounds-first & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ options & refbounds-first-sg & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & refbounds-first-pb & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & refbounds-first-rb & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & refbounds-mid & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & refbounds-mid-rb & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & refbounds-mid-re & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & refbounds-last & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & refbounds-last-pe & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & refbounds-last-re & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+
+ \addlinespace
+ Derived & +refbounds-first & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ options & +refbounds-mid & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ (groups) & +refbounds-last & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & +refbounds-rb & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & +refbounds-re & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ & +refbounds & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\
+ \bottomrule
+ \end{tabular}
+ \caption{Advanced reference format options and their scopes}
+ \zlabel{tab:advanced-reference-format}
+\end{table}
+
+The ``base'' options are the actually operative ones, while the ``derived''
+options are convenience aliases to set multiple base options in one go. In
+the naming scheme of these options, as is easy to presume, ``\texttt{first}''
+refers to the first reference of a type-block, ``\texttt{mid}'' to the middle
+ones, and ``\texttt{last}'' to the last reference of the type-block. Less
+obviously, but hopefully still mnemonic enough, ``\texttt{sg}'' stands for
+``single'', ``\texttt{pb}'' and ``\texttt{pe}'' for ``pair begin'' and ``pair
+end'', and finally ``\texttt{rb}'' and ``\texttt{re}'' for ``range begin'' and
+``range end''. Each of them which receives as value a comma separated list of
+four items in the form \texttt{\{preref*,preref,postref,postref*\}}, just like
+\opt{refbounds}.
+
+The base options are mutually exclusive, which means, for example, that it is
+not sufficient to set \opt{refbounds-first} to define the behavior of all
+first references of a type block. \opt{refbounds-first} is the value used for
+the first reference when not single, not the beginning of a pair, and not the
+beginning of a range. Setting a group of them is the purpose of the derived
+options. Each of these sets all options under it. Some examples.
+\opt{+refbounds-first} sets \opt{refbounds-first}, \opt{refbounds-first-sg},
+\opt{refbounds-first-pb}, and \opt{refbounds-first-rg}. In turn,
+\opt{+refbounds-first-rb} sets \opt{refbounds-first-rb} and
+\opt{refbounds-first-rb}. And quite conveniently, \opt{+refbounds} sets
+\opt{+refbounds-first}, \opt{+refbounds-mid}, and \opt{+refbounds-last}, it is
+hence sufficient to set it to define the behavior of what is typeset around
+all references for the whole type-block. As you probably guessed by now, the
+\opt{refbounds} option presented in \zcref{tab:reference-format} is an alias
+of \opt{+refbounds}.
+
+Given that base and derived options are actually setting the same group of
+underlying options (the base ones), the order in which they are given is
+relevant: the last one prevails. The idea here is to use first the derived
+options to set some general defaults, and then change one or another base
+option to handle exceptions as needed. Of course, how best to use them
+depends on the case.
+
+
\section{Internationalization}
\zlabel{sec:internationalization}
@@ -1111,7 +1194,7 @@ the \emph{current} or \emph{main} language of the document, as defined by
will note that \zcref{tab:languages-and-aliases} contains only \pkg{babel}
language names.} Users can also set \opt{lang} to a specific language
directly, in which case \pkg{babel} and \pkg{polyglossia} are disregarded.
-\pkg{zref-clever} provides a number of built-in ``language file'', for the
+\pkg{zref-clever} provides a number of built-in ``language files'', for the
languages listed in \zcref{tab:languages-and-aliases}, which also includes the
declared aliases to those languages.
@@ -2190,11 +2273,13 @@ were generously provided by (in chronological order):
% 2021-08-20: https://tex.stackexchange.com/q/611424/105447 (comments)
% 2021-09-06: https://github.com/ho-tex/zref/issues/13
% 2021-10-26: https://github.com/latex3/latex2e/issues/687
+ % 2022-01-12: https://chat.stackexchange.com/transcript/message/60129233#60129233
Phelype Oleinik,
% 2021-08-20: https://tex.stackexchange.com/q/611370 (comments)
% 2021-09-09: https://tex.stackexchange.com/a/614704
% 2021-10-06: https://tex.stackexchange.com/a/617998
% 2021-10-21: https://github.com/latex3/latex2e/pull/699
+ % 2022-01-12: https://tex.stackexchange.com/questions/629946/#comment1571118_629946
Enrico Gregorio,
% 2021-08-20: https://tex.stackexchange.com/a/611385
% 2021-08-20: https://tex.stackexchange.com/q/611370/#comment1529282_611385
@@ -2205,6 +2290,8 @@ were generously provided by (in chronological order):
% 2021-09-09: https://github.com/latex3/latex3/pull/988
David Carlisle,
% 2021-10-10: https://tex.stackexchange.com/questions/618434/#comment1544401_618439
+ % 2022-01-12: https://chat.stackexchange.com/transcript/message/60129096#60129096
+ % and following discussion.
Frank Mittelbach,
% 2021-10-14: https://github.com/latex3/latex2e/issues/687
`\texttt{samcarter}',