diff options
author | Norbert Preining <norbert@preining.info> | 2022-02-13 03:00:36 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-02-13 03:00:36 +0000 |
commit | a488c0e94aba29c7f7062852569792d58efda8dc (patch) | |
tree | 055ce3e8af6b02021a55b0acd80ba42c86216939 /macros/latex | |
parent | 5656f95d1f5070edb430085a49ca8cd1f6f6f064 (diff) |
CTAN sync 202202130300
Diffstat (limited to 'macros/latex')
38 files changed, 1196 insertions, 825 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index 3e1a1609b5..d242a6773b 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/02/11}{1.623} +\ProvidesExplClass{easybook}{2022/02/12}{1.624} {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/02/11}{1.623} +\ProvidesExplPackage{easybase}{2022/02/12}{1.624} {Typeset Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -1202,17 +1202,15 @@ \ctex_define:n { figure/#1 .meta:nn = { ctex/#1 } {##1} } \ctex_define:n { table/#1 .meta:nn = { ctex/#1 } {##1} } \ctex_define:n { list/#1 .meta:nn = { ctex/#1 } {##1} } -\cs_new_protected:Npn \eb_titletoc_if_hang_fix:n #1 +\cs_new_protected:Npn \eb_toc_entry_if_hang:n #1 { - \bool_if:NT \l__eb_titletoc_hang_fix_bool + \bool_if:NT \l__eb_toc_entry_hang_bool + { \contentspush } { - \contentspush - { - \bool_if:NT \l__eb_toc_number_color_bool - { \color{ctex@toc@number} } - \thecontentslabel - \tl_use:c { l__eb_toc_#1_after_tl } - } + \bool_if:NT \l__eb_toc_number_color_bool + { \textcolor{ctex@toc@number} } + { \thecontentslabel } + \tl_use:c { l__eb_toc_#1_after_tl } } } \cs_new_protected:Npn \eb_toc_assign_keys:n #1 @@ -1224,13 +1222,15 @@ #1/tocformat~+ .code:n = \tl_put_right:cn { l__eb_toc_#1_format_tl } {##1}, #1/tocindent .dim_set:c = l__eb_toc_#1_indent_dim, #1/tocrule .tl_set:c = l__eb_toc_#1_rule_tl, - #1/tocafter .tl_set:c = l__eb_toc_#1_after_tl + #1/tocafter .tl_set:c = l__eb_toc_#1_after_tl, + #1/tocbelow .tl_set:c = l__eb_toc_#1_below_tl } \titlecontents{#1} [\dim_use:c { l__eb_toc_#1_indent_dim }] {\tl_use:c { l__eb_toc_#1_format_tl }} - {\eb_titletoc_if_hang_fix:n {#1}}{} + {\eb_toc_entry_if_hang:n {#1}}{} {\tl_use:c { l__eb_toc_#1_rule_tl }} + [\tl_use:c { l__eb_toc_#1_below_tl }] } \seq_map_function:NN \c__ctex_headings_seq \eb_toc_assign_keys:n @@ -1280,26 +1280,21 @@ lolskip .skip_set:N = \eb@toc@lol@skip, lolskip .initial:n = 10pt, between .tl_set:N = \l__eb_toc_main_between_hook_tl, - between .initial:n = - { - \bool_if:NTF \l__eb_class_mode_book_bool - { \vspace*{-1pc} } - { \vspace*{-0.2pc} } - }, + between .initial:n = \bool_if:NT \l__eb_class_mode_book_bool { \vspace*{-1pc} }, dotalign .bool_set:N = \l__eb_toc_dot_align_bool, dotalign .default:n = true, dotalign .initial:n = true, - hang .bool_set:N = \l__eb_titletoc_hang_fix_bool, + hang .bool_set:N = \l__eb_toc_entry_hang_bool, hang .default:n = true, hang .initial:n = true, pagenumwd .code:n = \contentsmargin{#1}, pagenumwd .initial:n = 1.55em, unknown .code:n = \eb_msg_deprecated_option:n { tocset } } -\NewDocumentCommand{\tocrule}{st-O{0.7pc}D(){1.2}mO{}} +\NewDocumentCommand{\tocrule}{st-O{0.7pc}d()mO{}} { \normalsize\normalfont - \titlerule*[#3]{\scalebox{#4}{#5}}#6 + \titlerule*[#3]{\IfValueTF{#4}{\scalebox{#4}{#5}}{#5}}#6 \bgroup \IfBooleanF{#2} { @@ -1313,44 +1308,20 @@ } \egroup } -\cs_set_eq:NN \ctexnumberline \CTEXnumberline \cs_new:Npn \p@numberline { \protect\numberline } -\cs_set:Npn \CTEXnumberline #1 - { - \CTEXifname - { - \bool_if:NTF \l__eb_titletoc_hang_fix_bool - { \p@numberline{\use:c { CTEXthe#1 }} } - { - \use:c { CTEXthe#1 } - \tl_use:c { l__eb_toc_#1_after_tl } - } - }{} - } \cs_new:Npn \listnumberline #1 - { - \bool_if:NTF \l__eb_titletoc_hang_fix_bool - { \p@numberline{\use:c { #1name }~\use:c { the#1 }} } - { - \use:c { #1name }~\use:c { the#1 } - \tl_use:c { l__eb_toc_#1_after_tl } - } - } + { \p@numberline{\use:c { #1name }~\use:c { the#1 }} } \ctex_set:n { part/tocformat = \addvspace{1pc}\sffamily\large, part/tocindent = 0em, part/tocrule = \tocrule{}[\bfseries], part/tocline = \CTEXnumberline{#1}#2, - chapter/tocformat = \addvspace{1pc}\sffamily\large, + chapter/tocformat = \addvspace{1pc}\sffamily, chapter/tocindent = 0em, chapter/tocrule = \tocrule{$\cdot$}[\bfseries], chapter/tocline = \CTEXnumberline{#1}#2, - section/tocformat = - { - \addvspace{0.2pc} - \bool_if:NF \l__eb_class_mode_book_bool { \sffamily } - }, + section/tocformat = \bool_if:NF \l__eb_class_mode_book_bool { \sffamily }, section/tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 1.5em } { 0em }, section/tocrule = { @@ -1358,15 +1329,11 @@ { \tocrule{$\cdot$} } { \tocrule{$\cdot$}[\bfseries] } }, - section/tocline = \CTEXnumberline{#1}#2, - subsection/tocformat = \addvspace{0.2pc}, subsection/tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 3.8em } { 1.4em }, subsection/tocrule = \tocrule{$\cdot$}, - subsection/tocline = \CTEXnumberline{#1}#2, - list/tocformat = \addvspace{0.2pc}, list/tocindent = 0em, list/tocrule = \tocrule{$\cdot$}, - list/between = \vspace*{-0.2pc\bool_if:NT \l__eb_class_mode_book_bool { - 10pt }}, + list/between = \bool_if:NT \l__eb_class_mode_book_bool { \vspace*{-10pt} }, table/tocline = \listnumberline{table}#2, figure/tocline = \listnumberline{figure}#2, lstlisting/tocline = \listnumberline{lstlisting}#2 @@ -2332,7 +2299,7 @@ } %</package> %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2022/02/11}{1.623} +\ProvidesExplFile{eb-tcolorbox.cfg}{2022/02/12}{1.624} {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 Binary files differindex d0bae8c32f..2afdd2a192 100644 --- a/macros/latex/contrib/easybook/easybook.pdf +++ b/macros/latex/contrib/easybook/easybook.pdf diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex index aa8364f58f..c007570fa9 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.623, - date = 2022/02/11, + version = v1.624, + date = 2022/02/12, authors = 瞿毅, info = 排版简体中文学位论文和书籍, email = q1jx@foxmail.com, @@ -98,14 +98,15 @@ \@firstofone } % A tag that distinguishes the options for different paths -\NewDocumentCommand{\dtag}{O{\ding{73}}} +\NewDocumentCommand{\dtag}{sO{\ding{73}}} { \begingroup \reversemarginpar - \marginnote{\hfill\llap{#1}} + \marginnote{\hfill\llap{#2}} \endgroup - \cnltx@checkdefault{\hfill\newline} + \IfBooleanF{#1}{\cnltx@checkdefault{\hfill\newline}} } +\newnote{\newtag}[1][New]{\textcolor{red}{\ding{70}\ #1}} % Use a separate module margin marker to prevent overlap \newcommand{\smodule}{\cnltx@module@text{}} \newcommand{\noitemsep}{\setlength{\itemsep}{0ex}} @@ -886,18 +887,20 @@ \subsection{目录样式} \label{subsec:catalog style} -模块 \module*{tocset} 将使用 \pkg*{titletoc} 宏包处理目录样式。模块或扩展包括了 \module*{part}、\module*{chapter}、\module*{section}、\module*{subsection}、\module*{figure}、\module*{table} 和 \module*{lstlisting} 二级路径,而使用 \module*{list} 路径可以统一设置图片、表格和代码目录的样式。选项前带有 \ding{73} 符号表示支持所有相应\textbf{标题级别}的路径,其它选项则处于 \module*{tocset} 路径下。目前支持标准的论文目录样式,更复杂的样式可以查看 \pkg*{titletoc} 的相关用法。 +模块 \module*{tocset} 将使用 \pkg*{titletoc} 宏包处理目录样式。模块或扩展包括了 \module*{part}、\module*{chapter}、\module*{section}、\module*{subsection}、\module*{figure}、\module*{table} 和 \module*{lstlisting} 二级路径,而使用 \module*{list} 路径可以统一设置图片、表格和代码目录的样式。选项前带有 \ding{73} 符号表示支持所有相应\textbf{条目级别}的路径,其它选项则处于 \module*{tocset} 路径下。目前支持标准的论文目录样式,更复杂的样式可以查看 \pkg*{titletoc} 的相关用法。 \begin{options} \keyval{tocformat}{条目格式}\dtag\smodule{tocset}% 目录中各级别条目的格式。可以设置条目字体和加入垂直间距等,垂直间距最好使用防止垂直间距重合的 \cs*{addvspace} 命令。 \keyval{tocformat+}{条目格式}\dtag 与 \option{tocformat} 用法一样,只是在已有的格式命令后附加代码。 \keyval{tocindent}{刚性长度}\dtag - 各级别目录中的标题左边缩进距离,通常标题级别越低缩进越大。 + 目录条目左边的缩进距离,通常条目级别越低缩进越大。 \keyval{tocrule}{引导线命令}\dtag 引导线选项 \option{tocrule} 中一般可以使用基于 \cs*{xleaders} 命令的 \cs{tocrule} 绘制引导线。 \keyval{tocafter}{距离命令}\dtag\Default{\cs*{hspace}\Marg{1em}} - 在各级别目录中标签与标题间的代码,默认为插入 \code{1em} 横向距离。 + 目录条目编号与标题间的代码,默认为插入 \code{1em} 横向距离。 + \keyval{tocbelow}{距离命令}\dtag\newtag + 在目录条目下方执行的代码,可以插入垂直距离等命令。 \keyval{tocline}{条目定义}\dtag 这个选项扩展了图片、表格或代码题注在目录文件中的定义。选项中参数 \code{\#1} 代表相应题注编号 \cs*{the}\meta{计数器} 的值,参数 \code{\#2} 代表相应题注内容。 \begin{ctexexam}[labelref = exam:list command usage] @@ -911,11 +914,9 @@ \begin{commands} \command{tocrule}[\sarg\harg\oarg{引导点间距}\darg{放大因子}\marg{引导点}\oarg{页码格式}] - 目录命令 \cs{tocrule} 生成目录引导线,需要在引导线选项 \option{tocrule} 中使用。带有星号的命令会使当前级别的目录引导线右端与页码相连而不是对齐。带有 \harg{} 号的命令不添加引导线后的目录页码。\meta{引导点间距} 需带有长度单位,\meta{放大因子} 不带单位,为 \meta{引导点} 的放大倍数,\meta{引导点} 一般为英文句号或 \cs*{cdot} 中心点符号。\meta{页码格式} 的代码位于页码前面,可以设置页码字体和距离等,最后一个命令可以带有一个参数,这个参数为页码编号。 - \command*{CTEXnumberline}[\marg{编号级别}] - 目录命令 \cs*{CTEXnumberline} 用于在 C\TeX 文档类的 \option*{tocline} 选项中设置章节的目录标签。它已经被重新定义,使得目录标签后代码选项 \option{tocafter} 仍然有效。\meta{编号级别} 为 \code{chapter} 和 \code{section} 等,也可用参数 \code{\#1} 代替当前级别类型,标题名用参数 \code{\#2} 代替一般不变。 - \command{listnumberline}[\marg{编号级别}] - 这个命令用于设置图片、表格或代码的目录标签,默认包含与题注名相同的目录标签名。其中 \meta{编号级别} 需要显示指定,即为 \code{figure}、\code{table} 或 \code{lstlisting}。关于命令的用法可见\ref{exam:list command usage}。 + 生成目录引导线的命令,需要在引导线选项 \option{tocrule} 中使用。带有星号的命令会使当前级别的目录引导线右端与页码相连而不是对齐。带有 \harg{} 号的命令不添加引导线后的目录页码。\meta{引导点间距} 需带有长度单位,\meta{放大因子} 不带单位,为 \meta{引导点} 的放大倍数,\meta{引导点} 一般为英文句号或 \cs*{cdot} 中心点符号。\meta{页码格式} 的代码位于页码前面,可以设置页码字体和距离等,最后一个命令可以带有一个参数,这个参数为页码编号。 + \command{listnumberline}[\marg{条目级别}] + 在图片、表格或代码目录中插入条目编号的命令,默认包含与题注名相同的标签名。其中 \meta{条目级别} 需要显示指定,即为 \code{figure}、\code{table} 或 \code{lstlisting}。关于命令的用法可见\ref{exam:list command usage}。 \begin{ctexexam} \ctexset { @@ -932,9 +933,9 @@ \begin{options} \keybool{hang}\Default{true} - 悬挂缩进选项 \option{hang} 使目录标题为悬挂缩进形式。缩进距离为标签及其与标题间距的长度,但此时标题编号会失去超链接。这个选项对所有标题级别有效。 + 悬挂缩进选项 \option{hang} 使目录条目为悬挂缩进形式。缩进距离为条目编号及其与标题间距的长度和。这个选项对所有条目级别有效。 \keyval{lolskip}{弹性长度}\Default{10pt} - 代码目录中每章代码标题的额外距离。与 C\TeX 的表格和图片目录中每章间的标题距离选项 \option*{lotskip} 和 \option*{lofskip} 类似,在 \cls*{article} 模式中此选项失效。 + 代码目录中每章第一个条目上方增加的垂直距离。与 C\TeX 的表格和图片目录中每章间的条目距离选项 \option*{lotskip} 和 \option*{lofskip} 类似,在 \cls*{article} 模式中此选项失效。 \keyval{between}{代码钩子} 目录标题与内容间的钩子,一般插入负的垂直距离代码用于抵消目录首行额外的垂直间距。一级路径此选项对应文档主目录的钩子,二级路径为 \module*{figure}、\module*{table} 和 \module*{lstlisting},或者用位于 \module*{list} 路径的此选项统一设置相应类型目录的钩子。 \keybool{dotalign}\Default{true} @@ -942,9 +943,9 @@ \keyval{pagenumwd}{刚性长度}\Default{1.55em} 目录条目页码的宽度。开启 \option{dotalign} 选项时宽度越大引导线与页码的距离就越大。 \keyval{tocafter-every}{距离命令}\Default{\cs*{hspace}\Marg{1em}} - 统一设置所有级别在目录中标签与标题间的代码。 + 统一设置所有级别条目编号与标题间的代码。 \keyval{tocindent-every}{刚性长度} - 统一设置所有级别的目录标题左边缩进。 + 统一设置所有级别条目的左边缩进。 \keyval{tocrule-every}{引导线命令} 统一设置所有级别的目录引导线样式。 \end{options} @@ -1276,6 +1277,7 @@ \item 文档类移除预置的定理环境,改为由用户自行定义环境。 \item 考虑到功能性和实用性不强弃用摘要环境 \env*{outline} 和习题环境 \env*{exercise}。 \end{version} + \shortversion{v = 1.624,date = 2022/02/12,changes = 增加目录条目下方执行的代码选项 \option{tocbelow}。} \end{changelog} \nocite{*} diff --git a/macros/latex/contrib/knowledge/README.md b/macros/latex/contrib/knowledge/README.md index 93d3a6adb0..07b55368a0 100644 --- a/macros/latex/contrib/knowledge/README.md +++ b/macros/latex/contrib/knowledge/README.md @@ -3,8 +3,8 @@ This directory contains the package name: knowledge license: LaTeX Project Public License version 1.2 or above - version: v1.27 - date: 2022/01/12 + version: v1.28 + date: 2022/02/12 author: Thomas Colcombet mail: thomas.colcombet@irif.fr web: https://ctan.org/pkg/knowledge diff --git a/macros/latex/contrib/knowledge/knowledge-code.dtx b/macros/latex/contrib/knowledge/knowledge-code.dtx index 0f66f049d1..2f6a4f0a12 100644 --- a/macros/latex/contrib/knowledge/knowledge-code.dtx +++ b/macros/latex/contrib/knowledge/knowledge-code.dtx @@ -23,7 +23,7 @@ % % \iffalse %<head>\usepackage{expl3} -%<head>\ProvidesExplPackage{knowledge}{2022/01/12}{1.27}{} +%<head>\ProvidesExplPackage{knowledge}{2022/02/12}{1.28}{} %<*driver> \def\knowledgecode{active} \input{knowledge.tex} @@ -60,6 +60,7 @@ % \changes{1.25}{2021/03/31}{bug correction} % % \changes{1.26}{2021/12/20}{enhanced math+other functionalities+extra options} % % \changes{1.27}{2022/01/12}{doc changes} % +% \changes{1.28}{2022/02/12}{imakeidx support} % % \GetFileInfo{knowledge.sty} % % \DoNotIndex{} % @@ -79,8 +80,8 @@ This directory contains the package name: knowledge license: LaTeX Project Public License version 1.2 or above - version: v1.27 - date: 2022/01/12 + version: v1.28 + date: 2022/02/12 author: Thomas Colcombet mail: thomas.colcombet@irif.fr web: https://ctan.org/pkg/knowledge @@ -620,9 +621,16 @@ This directory contains the package % % \subsubsection{External package options} % -%\csintro{\knowledge_xcolor_active_bool}, \csintro{\knowledge_xcolor_syntax_bool}, -%\csintro{\knowledge_hyperref_active_bool}, \csintro{\knowledge_hyperref_syntax_bool}, -%\csintro{\knowledge_makeidx_active_bool}, \csintro{\knowledge_makeidx_syntax_bool} +%\csintro{\knowledge_xcolor_active_bool}, +% \csintro{\knowledge_xcolor_syntax_bool}, +%\csintro{\knowledge_hyperref_active_bool}, +%\csintro{\knowledge_hyperref_syntax_bool}, +%\csintro{\knowledge_makeidx_active_bool}, +%\csintro{\knowledge_makeidx_syntax_bool}, +%\csintro{\knowledge_imakeidx_active_bool}, +%\csintro{\knowledge_imakeidx_syntax_bool}. +% +% % % First, one tests the package available. % \csintro{\package_if_loaded:nTF} tests if a package is loaded. @@ -645,6 +653,7 @@ This directory contains the package \knowledge_option_aci_test_loaded:n{hyperref} \knowledge_option_aci_test_loaded:n{xcolor} \knowledge_option_aci_test_loaded:n{makeidx} +\knowledge_option_aci_test_loaded:n{imakeidx} \knowledge_option_aci_test_loaded:n{cleveref} % \end{macrocode} %\begin{quote}\tt @@ -690,6 +699,7 @@ This directory contains the package \knowledge_option_aci_define:n{hyperref} \knowledge_option_aci_define:n{xcolor} \knowledge_option_aci_define:n{makeidx} +\knowledge_option_aci_define:n{imakeidx} \knowledge_option_aci_define:n{cleveref} % \end{macrocode} % @@ -762,6 +772,7 @@ This directory contains the package \knowledge_option_aci_autoload:nnn{ hyperref }{}{} \knowledge_option_aci_autoload:nn{ xcolor }{} \knowledge_option_aci_autoload:nn{ makeidx }{} +\knowledge_option_aci_autoload:nn{ imakeidx }{} \knowledge_option_aci_autoload:nn{ cleveref }{} % \end{macrocode} % @@ -3988,7 +3999,7 @@ This directory contains the package % \end{macrocode} % % -% \subsubsection{The \kl{makeidx option}} +% \subsubsection{The \kl{makeidx option} and \kl{imakeidx} options} % % \begin{macrocode} %\bool_if:NT\knowledge_makeidx_active_bool{ @@ -4008,18 +4019,36 @@ This directory contains the package % }}}} %} % \end{macrocode} +% Since "imakeidx@@package" extends the syntax of "makeidx@@package", +% internally, activating the package or the syntax for "imakeidx@@package" +% does the same thing for "makeidx@@package". +% \begin{macrocode} +\bool_if:NT\knowledge_imakeidx_active_bool{\bool_set_true:N\knowledge_makeidx_active_bool} +\bool_if:NT\knowledge_imakeidx_syntax_bool{\bool_set_true:N\knowledge_makeidx_syntax_bool} +% \end{macrocode} +% The index option has to variant, depending on whether the name of the index is used or not. % \begin{macrocode} +\cs_new:Npn \knowledge_index:nn #1 #2{ + \tl_if_empty:nTF {#1} + {\index{#2}} + {\index[{#1}]{#2}} + } + +\cs_generate_variant:Nn \knowledge_index:nn {xx} + \cs_new:Nn\knowledge_kl_compute_code_makeidx:{ \bool_if:NF\knowledge_kl_noindex_bool{ \tl_if_exist_ne:NTF\knowledge_kl_index_tl - {\exp_args:Nx\index - {\tl_if_exist_ne:NTF\knowledge_kl_index_parent_key_tl - {\exp_not:V\knowledge_kl_index_parent_key_tl!}{} - \tl_if_exist_ne:NTF\knowledge_kl_index_key_tl - {\exp_not:V\knowledge_kl_index_key_tl@}{} + {\knowledge_index:xx + {\tl_if_exist_ne:NTF \knowledge_kl_index_name_tl + {\exp_not:V \knowledge_kl_index_name_tl}{}} + {\tl_if_exist_ne:NTF\knowledge_kl_index_parent_key_tl + {\exp_not:V\knowledge_kl_index_parent_key_tl!}{} + \tl_if_exist_ne:NTF\knowledge_kl_index_key_tl + {\exp_not:V\knowledge_kl_index_key_tl@}{} \expandafter\tl_to_str:n\expandafter{\knowledge_kl_index_tl} \tl_if_exist_ne:NTF\knowledge_kl_index_number_style_tl - {|\exp_not:V\knowledge_kl_index_number_style_tl}{} + {|\exp_not:V\knowledge_kl_index_number_style_tl}{} }}{} } } @@ -4034,12 +4063,26 @@ This directory contains the package {\knowledge_delay_directive:n{index={#1}}}}, index .default:n = {} } - -\NewKnowledgeParamTl*[\knowledge_kl_index_number_style_tl]{index~style} -\NewKnowledgeParamTl*[\knowledge_kl_index_parent_key_tl]{index~parent~key} -\NewKnowledgeParamTl*[\knowledge_kl_index_key_tl]{index~key} -\NewKnowledgeParamBool*{no~index}\knowledge_kl_noindex_bool + +\bool_if:NT\knowledge_makeidx_syntax_bool +{ \NewKnowledgeParamTl*[\knowledge_kl_index_number_style_tl]{index~style} + \NewKnowledgeParamTl*[\knowledge_kl_index_parent_key_tl]{index~parent~key} + \NewKnowledgeParamTl*[\knowledge_kl_index_key_tl]{index~key} + \NewKnowledgeParamBool*{no~index}\knowledge_kl_noindex_bool +} +\bool_if:NT\knowledge_imakeidx_syntax_bool { + \NewKnowledgeParamTl*[\knowledge_kl_index_name_tl]{index~name} +} % \end{macrocode} +% Activating error message is packages not loaded. +% \begin{macrocode} +\knowledge_directives_require_aci_package:nn + {index,index~key,index~parent~key,index~style}{makeidx} +\knowledge_directives_require_aci_package:nn + {index~name}{imakeidx} +% \end{macrocode} +% +% % % \subsubsection{The \kl{cleveref option}} % diff --git a/macros/latex/contrib/knowledge/knowledge.pdf b/macros/latex/contrib/knowledge/knowledge.pdf Binary files differindex 124bdf88ca..2e7e53daac 100644 --- a/macros/latex/contrib/knowledge/knowledge.pdf +++ b/macros/latex/contrib/knowledge/knowledge.pdf diff --git a/macros/latex/contrib/knowledge/knowledge.tex b/macros/latex/contrib/knowledge/knowledge.tex index aca0ea97dd..a821315e1b 100644 --- a/macros/latex/contrib/knowledge/knowledge.tex +++ b/macros/latex/contrib/knowledge/knowledge.tex @@ -13,6 +13,8 @@ \GetFileInfo{knowledge.sty} \edef\knowledgeversiondate{\fileversion--\filedate} +\knowledgeconfigure{diagnose line=true} + % Depending on whether the file is included from knowledge-code.dtx % or not, some configuration changes. % This involves mainly the presence of the code. @@ -333,6 +335,7 @@ \knowledge{index key=}{directive} \knowledge{index parent key=}{directive} \knowledge{index style=}{directive} +\knowledge{index name=}{directive} \knowledge{label scope}[label scope=]{option} \knowledge{color=}{directive} \knowledge{cyclic color}{directive} @@ -359,9 +362,12 @@ \knowledge{quotation}[quotation=]{option} \knowledge{notion}{option} \knowledge{cyclic colors=}{option} + \knowledge{imakeidx}{option} \end{scope} + \knowledge{hyperref option}{link=hyperref,link scope=option} \knowledge{makeidx option}{link=makeidx,link scope=option} +\knowledge{imakeidx option}{link=imakeidx,link scope=option} \knowledge{cleveref option}{link=cleveref,link scope=option} \knowledge{scope option}{link=scope,link scope=option} \knowledge{xcolor option}{link=xcolor,link scope=option} @@ -409,6 +415,7 @@ \knowledge{standalone}{package,url={https://www.ctan.org/pkg/standalone}} \knowledge{xcolor}{package,url={https://www.ctan.org/pkg/xcolor}} \knowledge{makeidx}{package,url={https://www.ctan.org/pkg/makeidx}} + \knowledge{imakeidx}{package,url={https://www.ctan.org/pkg/imakeidx}} \knowledge{cleveref}{package,url={https://www.ctan.org/pkg/cleveref}} \knowledge{etoolbox}{package,url={https://www.ctan.org/pkg/etoolbox}} \knowledge{xparse}{package,url={https://www.ctan.org/pkg/xparse}} @@ -753,7 +760,7 @@ I have seen Till Tantau who explained me how to test whether a material is displ \item[2018-02-24] Documentation improvement for the environment "thebibliography@@env". \item[2018-05-17] Correction to be compatible with the latest version of "expl3@@package" (thanks to Leo Stefanesco). \item[2018-07-26] Compatibility with utf8 symbols in labels (thanks to Yves Guiraud). -\item[2018-11-22] Corrected bug for "makeidx@@package" (thanks to Sylvain Schmitz). V1.14 on "CTAN". +\item[2018-11-22] Corrected bug for "makeidx@@option" (thanks to Sylvain Schmitz). V1.14 on "CTAN". \item[2019-01-27] Minor improvement of the doc, and hiding links in it. V1.15. \item[2019-02-15] Correction of a placement problem with \cs\AP. V1.16. \item[2019-05-23] Adding of the "`\vbar'-notation" for the \cs{\knowledge} command. @@ -772,13 +779,14 @@ I have seen Till Tantau who explained me how to test whether a material is displ \item[2020-05-02] Doc update ("acmart@@package" colors, thanks to Daniela Petri\c san). \item[2020-09-22] Adding the "silent" option as suggested by Patrick Lambein-Monette. V1.24. \item[2021-03-31] Correcting a bug caused by a change of semantics in "expl3@@package". V1.25. -\item[2021-05-25] Added the \cs\kref, \cs\kpageref, \cs\kcref, and \cs\kCref\ commands a suggested by Ziv Scully. +\item[2021-05-25] Added the \cs\kref, \cs\kpageref, \cs\kcref, and \cs\kCref\ commands as suggested by Ziv Scully. \item[2021-05-26] Corrected wrongly used default parameter in \cs\knowledgedirective. \item[2021-05-27] The explicit text given in a \cs\kl-command now overrides the "text=" directive. \item[2021-07-18] Adding the "no index" directive. \item[2021-12-20] Adding options "anchor point shape", "anchor point color", "anchor point shift" (request of Rémi Morvan). \item[2021-12-27] Bug correction for corner shape, and doc update (thanks to Rémi Morvan). \item[2022-01-12] Minor changes. Removing dead link for the webpage. V1.27 +\item[2022-02-12] Adding support of "imakeidx@@package" and the directive "index name=" (request and code change by Maximilian Keßler). V1.28 \end{compactdesc} \normalsize %\restoregeometry @@ -1142,17 +1150,6 @@ The use of "variants of \cs{\kl}" is also useful for typesetting mathematics. I \section{Usage of the \kl(package){knowledge} package} \label{section:doc} -\iffalse -We shall now give a more complete description of the functionalities of the "knwoeldge@@package". -\ref{subsection:loading packages} -\ref{subsection:knowledge command} -\ref{subsection:kl command} -\ref{subsection:diagnose file} -\ref{subsection:hyperref package} -\ref{subsection:xcolor package} -\ref{subsection:makeidx package} -\fi - \subsection{Options and configuration} \label{subsection:loading packages} @@ -1167,7 +1164,7 @@ The options that can be used in the optional parameter of \cs{\usepackage} when \begin{compactdesc} \itemAP[Writing mode] The "paper", "electronic" or "composition" modes are possible ("composition" is by default) (see Section~\ref{subsubsection:writing modes} for more details). These modes change several rendering settings. -\itemAP[Other packages] some of the options concern the loading and the use of other packages (\kl(package){hyperref}, \kl(package){xcolor}, \kl (package){makeidx}, \dots). Note that these package can also be loaded before "knowledge@@package". This is explained in Section~\ref{subsubsection:packages-loading}. +\itemAP[Other packages] some of the options concern the loading and the use of other packages (\kl(package){hyperref}, \kl(package){xcolor}, \kl (package){makeidx}, \kl (package){imakeidx}, \kl (package){cleveref}, \dots). Note that these package can also be loaded before "knowledge@@package". This is explained in Section~\ref{subsubsection:packages-loading}. \itemAP[Configuration options] as used by the command \cs{\knowledgeconfigure} can be used when loading the package. \itemAP[Scoping] The \kl[scope option]{scope} "option@package option" makes the package aware at a fine level of the structure of the document (see Section~\ref{subsection:scoping} for explanations). This provides, for instance, the possibility to define pieces of "knowledge" that are attached to a sections of the document. \itemAP[Other] The "no patch" option prevents the "knowledge@@package" to apply some patches that are convenient by default. @@ -1220,7 +1217,7 @@ The following primitives are available to the user for "writing mode"-sensitive \label{subsubsection:packages-loading} A certain number of "package options" coincide with the loading of other packages. For the moment, the packages that are concerned are \kl(option){hyperref}, -\kl(option){xcolor}, and \kl(option){makeidx}. +\kl(option){xcolor}, \kl(option){makeidx}, and "imakeidx@@option". For activating these functionalities, it is sufficient, either to load the package \emph{before} the "knowledge@@package" package, or to name it explicitly as an "option@package option" for "knowledge@@package". Loading separately the package is convenient for setting options for it. For instance, @@ -1250,7 +1247,7 @@ Currently, the packages that can be loaded are: \begin{description} \itemAP[\kl(package){hyperref}] which activates all the (auto)referencing capabilities. \item[\kl(package){xcolor}] which activates coloring commands. -\item[\kl(package){makeidx}] for handling the index automatically. +\item[\kl(package){makeidx} and "imakeidx@@package"] for handling the index automatically. \end{description} \subsubsection{Configuring and \cs{\knowledgeconfigure}} @@ -1385,7 +1382,7 @@ A certain number of Boolean directives are available without any options. These (that leaves it in the default state, or the one determined by surrounding knowledges). The general boolean \kl[\knowledge directives]{directives} are the following: \begin{description} -\itemAP[\kl{autoref}] activates the ability to introduce once, use several times an instance. This is often used for defining links inside a document (see the "hyperref@@option" in \kCref*"hyperref@@option"). This can also be used for constructing the index (see the "makeidx@@option" in \kCref*"makeidx@@option"). It can simply be used for referencing the number of the environment or the proper page of introduction (see \cs\kref\ and \cs\kpageref\ commands and their more powerful "cleveref@@option" in \kCref*"cleveref@@option"). +\itemAP[\kl{autoref}] activates the ability to introduce once, use several times an instance. This is often used for defining links inside a document (see the "hyperref@@option" in \kCref*"hyperref@@option"). This can also be used for constructing the index (see the "makeidx@@option" and in "imakeidx@@option"\kCref*"makeidx@@option"). It can simply be used for referencing the number of the environment or the proper page of introduction (see \cs\kref\ and \cs\kpageref\ commands and their more powerful "cleveref@@option" in \kCref*"cleveref@@option"). \itemAP[\kl{autorefhere}] puts immediately a label at the location of the definition, and makes all \cs{\kl} occurrences of this \kl{knowledge} hyperlink to this location. \itemAP[\intro{emphasize}] forces the text to be emphasized using `\cs{\emph}', @@ -2405,16 +2402,17 @@ Finally, the "anchor points" reference point can be shifted, using: in which $x$ and $y$ are by default in unit \texttt{em} (note the use of curly braces and of no parenthesis, which is mandatory). -\subsubsection{The \kl{makeidx option}} +\subsubsection{The \kl(option){makeidx} and \kl(option){imakeidx} options} \label{subsection:makeidx option} -\subsubsubsection{Activating the \kl{makeidx option}} +\subsubsubsection{Activating the \kl(option){makeidx} and \kl(option){makeidx} options} -The \intro{makeidx option} loads the \intro(package){makeidx} package and triggers a certain number of link-related features. This is done either by the command: +The \intro{makeidx option} loads the \kl(package){imakeidx} package and triggers a certain number of link-related features. This is done either by the command: \begin{center} \smallcode{\cs{\usepackage}[\kl(option){makeidx}]\{\kl(package){knowledge}\}} \end{center}\noindent or by loading the \kl(package){makeidx} before the "knowledge@@package" package. +The same goes for the \intro{imakeidx option}. \subsubsubsection{Features} @@ -2428,6 +2426,7 @@ The following \kl[\knowledge directives]{directives} are to be used: \begin{code}[8cm] \cs\def\cs\knowledgeIntroIndexStyle\#1\{\cs\fbox\{\#1\}\} \end{code} +\itemAP[\intro{index name=}] requires to activate "imakeidx@@option", and allows to choose the index name in case of multiple indexes. \end{description} \AP The "directive" ""no index"", deactivates the index feature for a knowledge. This is meant to be used in a "style". @@ -3101,6 +3100,7 @@ If other kind of problems occur, report them to \texttt{thomas.colcombet@irif.fr %\item[\kl{import=}] (\kl{not implemented}) \item[\kl{index=}] Chooses the text to be displayed in the \kl{index=}. \item[\kl{index key=}] the key used to choose the place in the \kl{index}. +\item[\kl{index name=}] the name of the \kl{index} (requires "imakeidx@@option"). \item[\kl{index style=}] the \kl{style} to be used to display in the \kl{index}. \item[\kl{index parent key=}] the parent key in the \kl{index}. \item[\kl{intro style=}] Chooses the typesetting in case of an intro. diff --git a/macros/latex/contrib/snotez/README b/macros/latex/contrib/snotez/README index 8382efb026..6c83440e3d 100644 --- a/macros/latex/contrib/snotez/README +++ b/macros/latex/contrib/snotez/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the SNOTEZ package v0.6 2022/02/10 +the SNOTEZ package v0.7 2022/02/12 Sidenotes for LaTeX2e diff --git a/macros/latex/contrib/snotez/snotez-manual.pdf b/macros/latex/contrib/snotez/snotez-manual.pdf Binary files differindex 80470bfd00..88795984c6 100644 --- a/macros/latex/contrib/snotez/snotez-manual.pdf +++ b/macros/latex/contrib/snotez/snotez-manual.pdf diff --git a/macros/latex/contrib/snotez/snotez-manual.tex b/macros/latex/contrib/snotez/snotez-manual.tex index 1cc9061ab2..c0f874d9b4 100644 --- a/macros/latex/contrib/snotez/snotez-manual.tex +++ b/macros/latex/contrib/snotez/snotez-manual.tex @@ -241,6 +241,10 @@ For these cases \snotez\ provides\sinceversion{0.5} these environments: Places a table in the margin within a \cs*{marginpar}. \cs*{caption} can be used in the usual way. \end{environments} +\begin{sidefigure} + \includegraphics[width=\marginparwidth]{example-image} + \caption{An example for a figure in the margin.} +\end{sidefigure} In order to be able to place other floats in the margin, too, \snotez\ provides the following command: diff --git a/macros/latex/contrib/snotez/snotez.sty b/macros/latex/contrib/snotez/snotez.sty index f6e9b7a746..aca80f677d 100644 --- a/macros/latex/contrib/snotez/snotez.sty +++ b/macros/latex/contrib/snotez/snotez.sty @@ -22,8 +22,8 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\def\snotez@date{2022/02/10} -\def\snotez@version{v0.6} +\def\snotez@date{2022/02/12} +\def\snotez@version{v0.7} \def\snotez@description{sidenote support for LaTeX 2e (CN)} \NeedsTeXFormat{LaTeX2e} @@ -259,7 +259,9 @@ \newcommand*\snotez@sidefloat@format{\raggedright} \newenvironment{snotez@sidefloat}[2]{% - \def\@captype{#1}% + \ifdef\caption@settype + {\caption@settype{#1}} + {\def\@captype{#1}}% \begin{lrbox}{\snotez@sidefloat@box}% \minipage{\marginparwidth}% \snotez@sidefloat@format#2% @@ -335,3 +337,4 @@ 2020/12/14 v0.5a - fix issue #1 2022/02/10 v0.6 - fix issue #2 - add option `perchapter' +2022/02/12 v0.7 - make `snotez' and `caption' compatible diff --git a/macros/latex/contrib/spbmark/spbmark.pdf b/macros/latex/contrib/spbmark/spbmark.pdf Binary files differindex ea8bda569d..f7ef48f0cd 100644 --- a/macros/latex/contrib/spbmark/spbmark.pdf +++ b/macros/latex/contrib/spbmark/spbmark.pdf diff --git a/macros/latex/contrib/spbmark/spbmark.sty b/macros/latex/contrib/spbmark/spbmark.sty index b6ab48bdde..9b3b44c917 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/02/08}{1.35} +\ProvidesExplPackage{spbmark}{2022/02/12}{1.36} {Customize superscripts and subscripts} \cs_generate_variant:Nn \box_set_ht:Nn { cv } diff --git a/macros/latex/contrib/spbmark/spbmark.tex b/macros/latex/contrib/spbmark/spbmark.tex index 0fa51a2fea..4a3c3dcef6 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.35, - date = 2022/02/08, + version = v1.36, + date = 2022/02/12, authors = Qu Yi, info = Customize superscript and subscript, email = q1jx@foxmail.com, @@ -34,7 +34,7 @@ \newsplitarg{\splitoarg}{[}{]} \newsplitarg{\splitmarg}{\{}{\}} \newsplitarg{\splitdarg}{(}{)} -\newnote{\newtag}{\textcolor{red}{\ding{73}\ New}} +\newnote{\newtag}[1][New]{\textcolor{red}{\ding{73}\ #1}} \makeatother \begin{document} diff --git a/macros/latex/contrib/xsim/HISTORY b/macros/latex/contrib/xsim/HISTORY index 37068a327a..b3ac707e96 100644 --- a/macros/latex/contrib/xsim/HISTORY +++ b/macros/latex/contrib/xsim/HISTORY @@ -5,9 +5,9 @@ XSIM -- eXercise Sheets IMproved -------------------------------------------------------------------------- Clemens Niederberger Web: https://github.com/cgnieder/xsim -E-Mail: contact@mychemistry.eu +E-Mail: clemens@cnltx.de -------------------------------------------------------------------------- -Copyright 2017--2021 Clemens Niederberger +Copyright 2017--2022 Clemens Niederberger This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c @@ -181,3 +181,22 @@ HISTORY: v0.20b 2021/02/02 - fix issue #78 v0.20c 2021/02/03 - fix issue #80 - add missing test in \xsim_if_exist:nnnTF + v0.21 2022/02/12 - make \__xsim_set_file_signature:nnn public + - make \l__xsim_file_path_and_name_tl, \l__xsim_file_name_tl + and \l__xsim_file_path_tl public + - introduce XSIMsetfilebeginX and XSIMsetfileendX (xsimverb) + - reduce comment line in automated comments in exercise and + solution files + - add option <tag>/use-unmatched + - document option `blank/fill' + - add counter foreach type and collection that holds the + number of exercises of a type in a collection + - fix issue #90 + - correct file hooks + - implement issue #88 + - fix issue #96 + - `use!' and `print!' had gone lost. Add them back in. + - add new options `match-all'/`match-any' for the collection + conditions. Resolves issue #94. + - new \ForEachUsedExerciseByOrder, used in the table + templates which resolves issue #85 diff --git a/macros/latex/contrib/xsim/README b/macros/latex/contrib/xsim/README index 7399405eaa..99a1f2cd5e 100644 --- a/macros/latex/contrib/xsim/README +++ b/macros/latex/contrib/xsim/README @@ -1,15 +1,15 @@ -------------------------------------------------------------------------- -XSIM 2021/02/03 v0.20c -XSIMVERB 2021/01/31 v0.3 +XSIM 2022/02/12 v0.21 +XSIMVERB 2022/02/12 v0.4 eXercise Sheets IMproved -------------------------------------------------------------------------- Clemens Niederberger Web: https://github.com/cgnieder/xsim -E-Mail: contact@mychemistry.eu +E-Mail: clemens@cnltx.de -------------------------------------------------------------------------- -Copyright 2017--2021 Clemens Niederberger +Copyright 2017--2022 Clemens Niederberger This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c diff --git a/macros/latex/contrib/xsim/examples/xsim.issues-49.pdf b/macros/latex/contrib/xsim/examples/xsim.issues-49.pdf Binary files differindex 3ea1c70ace..8ea46e93f0 100644 --- a/macros/latex/contrib/xsim/examples/xsim.issues-49.pdf +++ b/macros/latex/contrib/xsim/examples/xsim.issues-49.pdf diff --git a/macros/latex/contrib/xsim/examples/xsim.issues-49.tex b/macros/latex/contrib/xsim/examples/xsim.issues-49.tex index f9baf0a601..b10d57a36a 100644 --- a/macros/latex/contrib/xsim/examples/xsim.issues-49.tex +++ b/macros/latex/contrib/xsim/examples/xsim.issues-49.tex @@ -9,7 +9,7 @@ \usepackage{tasks,fontawesome,fmtcount,multicol} \NewTasksEnvironment[label=\Alph*),label-width=12pt]{choices}[\choice] -\newcommand*\correct{\thetask\expanded{\SetExerciseProperty{choice}{\thetask}}} +\newcommand*\correct{\refstepcounter{task}\thetask\expanded{\SetExerciseProperty{choice}{\thetask}}} \NewTasksEnvironment[label=\Roman*,label-width=12pt]{options}[\option] diff --git a/macros/latex/contrib/xsim/examples/xsim.texsx-391530-exercises.tex b/macros/latex/contrib/xsim/examples/xsim.texsx-391530-exercises.tex deleted file mode 100644 index 716921adc0..0000000000 --- a/macros/latex/contrib/xsim/examples/xsim.texsx-391530-exercises.tex +++ /dev/null @@ -1,12 +0,0 @@ -\begin{question} - Who is the Defence Minister? -\end{question} -\begin{question} - Who is the Home Minister? -\end{question} -\begin{question} - Who is the Finance Minister? -\end{question} -\begin{question} - Who is the External Affairs Minister? -\end{question} diff --git a/macros/latex/contrib/xsim/xsim-manual.cls b/macros/latex/contrib/xsim/xsim-manual.cls index 6d09782c37..3d3a083911 100644 --- a/macros/latex/contrib/xsim/xsim-manual.cls +++ b/macros/latex/contrib/xsim/xsim-manual.cls @@ -6,9 +6,9 @@ % ---------------------------------------------------------------------------- % Clemens Niederberger % Web: https://github.com/cgnieder/xsim -% E-Mail: contact@mychemistry.eu +% E-Mail: clemens@cnltx.de % ---------------------------------------------------------------------------- -% Copyright 2017--2021 Clemens Niederberger +% Copyright 2017--2022 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3c @@ -51,7 +51,7 @@ the official successor of the \cnltxpackagenameformat{exsheets} package , url = https://github.com/cgnieder/xsim , authors = Clemens Niederberger , - email = contact@mychemistry.eu , + email = clemens@cnltx.de , quote-format = \small\biolinumLF , add-cmds = { blank , @@ -179,10 +179,12 @@ XSIMatenddocument , XSIMexpandcode , XSIMsetfilebegin , + XSIMsetfilebeginX , XSIMfilewritestart , XSIMfilewritestop , XSIMgobblechars , XSIMsetfileend , + XSIMsetfileendX , XSIMifblankT , XSIMifblankF , XSIMifblankTF , @@ -854,7 +856,7 @@ \begin{cnltxcode}[ step and label={examplefile}{example:##1} , sidebyside align=top seam,sidebyside, - righthand width=.3\linewidth, + righthand width=5.2cm, sidebyside gap=1em, lower separated=false, bottom=1mm, @@ -872,9 +874,11 @@ type=pdf, ext=.##1.pdf, read=.##1.pdf, - pagebox=cropbox, - viewport=4.5cm 18.6cm 8.7cm 23cm, - clip]{\xsim@example@pdffile@path}% + % pagebox=cropbox, + % viewport=4.5cm 18.6cm 8.7cm 23cm, + % clip + width=5cm + ]{\xsim@example@pdffile@path}% }% }% \end{cnltxcode} @@ -999,6 +1003,7 @@ \xsim@add@version{0.20a} {2021-02-01} \xsim@add@version{0.20b} {2021-02-02} \xsim@add@version{0.20c} {2021-02-03} +\xsim@add@version{0.21} {2022-02-12} % ---------------------------------------------------------------------------- \newrobustcmd*\xsimauxfileinfo{% diff --git a/macros/latex/contrib/xsim/xsim-manual.pdf b/macros/latex/contrib/xsim/xsim-manual.pdf Binary files differindex 45529ae8d5..4c701f0a5c 100644 --- a/macros/latex/contrib/xsim/xsim-manual.pdf +++ b/macros/latex/contrib/xsim/xsim-manual.pdf diff --git a/macros/latex/contrib/xsim/xsim-manual.tex b/macros/latex/contrib/xsim/xsim-manual.tex index 00ad03acc8..2b43735d36 100644 --- a/macros/latex/contrib/xsim/xsim-manual.tex +++ b/macros/latex/contrib/xsim/xsim-manual.tex @@ -1,5 +1,5 @@ -% !arara: pdflatex: { interaction: nonstopmode } -% !arara: biber +% arara: pdflatex: { interaction: nonstopmode } +% arara: biber % arara: pdflatex: { interaction: nonstopmode } % arara: pdflatex: { interaction: nonstopmode } % !arara: pdflatex: { interaction: nonstopmode } @@ -771,7 +771,8 @@ following code: \DeclareExerciseTagging{topics} \xsimsetup{tags/ignore-untagged=false} \end{sourcecode} -This means that these options are available: +For each new tag new options are defined and available. They are described +for the two predefined tags: \begin{options} \keyval{tags}{csv list of tags} Choose the set of tags whose associated exercises should be printed. @@ -783,6 +784,12 @@ This means that these options are available: \keybool{ignore-untagged}\Module{topics}\Default{true} If set to true exercises with no topics will be printed even if topics have been chosen with the option \option{topics}. + \keybool{use-unmatched}\Module{tags}\Default{false} + \sinceversion{0.21}If set to true exercises with no matching tags will be + used (i.e., for example the counter gets stepped). + \keybool{use-untagged}\Module{topics}\Default{true} + \sinceversion{0.21}If set to true exercises with no matching topics will + be used (i.e., for example the counter gets stepped). \end{options} It may happen that you choose certain tags for printing and want one or two @@ -981,6 +988,17 @@ collection can be printed as often as needed. exercises which fit the tags are automatically added to the new collection. \end{commands} +You\sinceversion{0.21} have a choice whether \emph{any} or \emph{all} of the +tags sould match. So \Oarg{topics=algebra,level=1} should probably match +\emph{all} conditions but the choice is up to you. For each defined collection +an option exists: +\begin{options} + \keybool{match-all}\Module{collection/\meta{name}}\Default{true} + If set to \code{true} \emph{all} conditions must be met. + \keybool{match-any}\Module{collection/\meta{name}}\Default{false} + The inverse option to \option{match-all}. If set to \code{true} \emph{any} of + the conditions must be met. +\end{options} \subsubsection{Activating collections} If a collection is not activated per default in can be activated (or @@ -999,7 +1017,7 @@ These commands do not influence exercises in other ways other than adding them to collections. \begin{commands} \command{collectexercises}[\marg{collection name}] - Activates the collection \meta{collection name} which now collects all + Activates the collectiocollectexercisesn \meta{collection name} which now collects all exercises until the collection is deactivated, starts a group with \cs*{begingroup} and sets the option \option{collect}, see below. \command{collectexercisesstop}[\marg{collection name}] @@ -1576,6 +1594,19 @@ yourself in order to achieve certain layouts\footnote{I plan to incorporate \item \code{\#5}: the \property{points} property of the exercise \item \code{\#6}: the \property{bonus-points} property of the exercise \end{itemize} + \command{ForEachUsedExerciseByOrder}[\marg{code}] + Loops\sinceversion{0.21} over each \emph{used} exercise ordered by the + exercise types and within each type by the order they have been used in + the document. Inside \meta{code} you can refer to several properties of + the corresponding exercise: + \begin{itemize} + \item \code{\#1}: the type of the exercise + \item \code{\#2}: the id of the exercise + \item \code{\#3}: the \property{counter} property of the exercise + \item \code{\#4}: the \property{subtitle} property of the exercise + \item \code{\#5}: the \property{points} property of the exercise + \item \code{\#6}: the \property{bonus-points} property of the exercise + \end{itemize} \command{ForEachPrintedExerciseByID}[\marg{code}] Loops over each \emph{printed} exercise order by the exercise id. Inside \meta{code} you can refer to several properties of the corresponding @@ -2148,7 +2179,7 @@ Those are the options for customization: Shortcut for setting both \option{blank-style} and \option{filled-style} at once. \keyval{scale}{decimal number}\Module{blank}\Default{\code{1}} -\textsc{} Scales the blank to \meta{decimal number} times its natural width. + Scales the blank to \meta{decimal number} times its natural width. \keyval{width}{dim}\Module{blank}\Default Sets the blank to a width of \meta{dim}. This takes precendence over \option{scale}. @@ -2161,7 +2192,10 @@ Those are the options for customization: end up with a non-ending compilation. Experiment with values to find the suiting one for your use case. \keyval{line-minimum-length}{dim}\Module{blank}\Default{\code{2em}} - The minimal length a line must have before it is built step by step. + The minimal length a line must have before it is built step by step. + \keybool{fill}\Module{blank}\Default{false} + If set to true, this will show the correct answers in the blanks within + an exercise as well. \end{options} \begin{example} @@ -2350,10 +2384,16 @@ also available in \xsim, too): This command can be used to write something to the external file \emph{before} the environment contents. Must be set before \cs{XSIMfilewritestart} in the \emph{begin} definition. + \command{XSIMsetfilebeginX}[\marg{code}] + \sinceversion{0.21}The same as \cs{XSIMsetfilebegin} but expands its + argument first. \command{XSIMsetfileend}[\marg{code}] This command can be used to write something to the external file \emph{after} the environment contents. Must be set before \cs{XSIMfilewritestart} in the \emph{begin} definition. + \command{XSIMsetfileendX}[\marg{code}] + \sinceversion{0.21}The same as \cs{XSIMsetfileend} but expands its + argument first. \command{XSIMgobblechars}[\marg{integer}] Determines how many characters are cut off of the beginning of each line of the environment body before it is written to the file. The default @@ -2368,8 +2408,8 @@ The following code shows an example of how to use those commands: \makeatletter \NewDocumentEnvironment{example}{o} {% - \XSIMsetfilebegin{\@percentchar\space file `\jobname.tmp'}% - \XSIMsetfileend{\@percentchar\space bye bye}% + \XSIMsetfilebeginX{\@percentchar\space file `\jobname.tmp'}% + \XSIMsetfileendX{\@percentchar\space bye bye}% \IfNoValueTF{#1} {\XSIMfilewritestart*{\jobname.tmp}} {\XSIMfilewritestart{\jobname.tmp}}% diff --git a/macros/latex/contrib/xsim/xsim.sty b/macros/latex/contrib/xsim/xsim.sty index c802477528..a178ceab61 100644 --- a/macros/latex/contrib/xsim/xsim.sty +++ b/macros/latex/contrib/xsim/xsim.sty @@ -6,9 +6,9 @@ % ---------------------------------------------------------------------------- % Clemens Niederberger % Web: https://github.com/cgnieder/xsim -% E-Mail: contact@mychemistry.eu +% E-Mail: clemens@cnltx.de % ---------------------------------------------------------------------------- -% Copyright 2017--2021 Clemens Niederberger +% Copyright 2017--2022 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3c @@ -29,10 +29,10 @@ \ExplSyntaxOn -\tl_const:Nn \c_xsim_date_tl {2021/02/03} +\tl_const:Nn \c_xsim_date_tl {2022/02/12} \tl_const:Nn \c_xsim_version_major_number_tl {0} -\tl_const:Nn \c_xsim_version_minor_number_tl {20} -\tl_const:Nn \c_xsim_version_subrelease_tl {c} +\tl_const:Nn \c_xsim_version_minor_number_tl {21} +\tl_const:Nn \c_xsim_version_subrelease_tl {} \tl_const:Nx \c_xsim_version_number_tl { \c_xsim_version_major_number_tl . @@ -248,7 +248,7 @@ \tl_if_exist:NF \c_xsim_version_tl { \tl_set:Nx \l__xsim_module_version_tl {\c_xsimverb_version_tl} } -\hook_gput_code:nnn {package/after/xsim} {xsim} +\hook_gput_code:nnn {package/xsim/after} {xsim} { \tl_set:NV \l__xsim_module_date_tl \c_xsim_date_tl \tl_set:NV \l__xsim_module_version_tl \c_xsim_version_tl @@ -376,6 +376,7 @@ \cs_generate_variant:Nn \file_input:n {V,x} \cs_generate_variant:Nn \file_if_exist:nT {V,x} \cs_generate_variant:Nn \file_if_exist:nTF {V} +\cs_generate_variant:Nn \file_get_mdfive_hash:nN {V} \cs_generate_variant:Nn \msg_error:nnnnn {nnnxx} \cs_generate_variant:Nn \msg_warning:nnn {nnV} \cs_generate_variant:Nn \keys_define:nn {nx} @@ -386,6 +387,7 @@ \cs_generate_variant:Nn \tl_if_blank:nTF {f,e} \cs_generate_variant:Nn \tl_set_rescan:Nnn {Nnx} \cs_generate_variant:Nn \iow_now:Nn {NV} +\cs_generate_variant:Nn \iow_open:Nn {NV} \cs_generate_variant:Nn \str_if_eq:nnT {x} \cs_generate_variant:Nn \str_if_eq:nnF {xx} \cs_generate_variant:Nn \str_if_eq_p:nn {e} @@ -554,7 +556,7 @@ { \msg_expandable_error:nnn {xsim} {attribute-not-set} {#1::#2} } } } - + % #1: attribute % #2: item \prg_new_conditional:Npnn \xsim_attribute_if_set:nn #1#2 {p,T,F,TF} @@ -640,8 +642,15 @@ \xsim_if_use_aux:F { \iow_new:N \l__xsim_aux_file_iow + \tl_new:N \l__xsim_mdfive_hash_tl + \tl_const:Nx \c_xsim_auxfile_tl { \c_sys_jobname_str .xsim } \hook_gput_code:nnn {begindocument} {xsim} - { \iow_open:Nn \l__xsim_aux_file_iow { \c_sys_jobname_str .xsim } } + { + \file_get_mdfive_hash:VN + \c_xsim_auxfile_tl + \l__xsim_mdfive_hash_tl + \iow_open:NV \l__xsim_aux_file_iow \c_xsim_auxfile_tl + } } \cs_new_protected:Npn \xsim_close_aux: @@ -649,6 +658,10 @@ \xsim_if_use_aux:F { \iow_close:N \l__xsim_aux_file_iow + \file_get_mdfive_hash:VN + \c_xsim_auxfile_tl + \l__xsim_tmpa_tl + \tl_if_eq:NNF \l__xsim_mdfive_hash_tl \l__xsim_tmpa_tl { \xsim_rerun: } \legacy_if:nT {@filesw} { \iow_now:Nx \@auxout { \token_to_str:N \XSIM {readaux} } } } @@ -656,8 +669,8 @@ \xsim_new_aux_property:cpn {readaux} { - \file_if_exist:nT { \c_sys_jobname_str .xsim } - { \file_input:n { \c_sys_jobname_str .xsim } } + \file_if_exist:VT \c_xsim_auxfile_tl + { \file_input:V \c_xsim_auxfile_tl } } % ---------------------------------------------------------------------------- @@ -717,7 +730,7 @@ { \seq_gremove_all:cV {g__xsim_list_#1_seq} \l__xsim_tmpa_str } \seq_gput_right:cV {g__xsim_list_#1_seq} \l__xsim_tmpa_str } -\cs_generate_variant:Nn \xsim_add_to_list:nn {nx} +\cs_generate_variant:Nn \xsim_add_to_list:nn {nx,nV} % #1: name % #2: entry @@ -1215,6 +1228,12 @@ { \xsim_attribute_get:nn {#1!#2} {#3} } \cs_generate_variant:Nn \xsim_get_property:nnn {nx,ne,xx,oo,no,nnf,nf,oof,nV} +% #1: type +% #2: id +% #3: property +\cs_new:Npn \xsim_show_property:nnn #1#2#3 + { \xsim_attribute_show:nn {#1!#2} {#3} } + % #1: property % #2: value \cs_new:Npn \xsim_get_id_for_property:nn #1#2 @@ -1338,11 +1357,10 @@ } \tl_new:N \l__xsim_file_name_signature_tl -\tl_new:N \l__xsim_file_path_tl -\tl_new:N \l__xsim_file_path_and_name_tl -\tl_new:N \l__xsim_file_name_tl +\tl_new:N \l_xsim_file_path_tl +\tl_new:N \l_xsim_file_path_and_name_tl +\tl_new:N \l_xsim_file_name_tl \tl_new:N \l__xsim_file_extension_tl -\tl_new:N \l__xsim_solution_tl \bool_new:N \l__xsim_options_given_bool \bool_new:N \l__xsim_insert_mode_bool @@ -1361,7 +1379,7 @@ \keys_define:nn {xsim} { - path .tl_set:N = \l__xsim_file_path_tl , + path .tl_set:N = \l_xsim_file_path_tl , file-extension .tl_set:N = \l__xsim_file_extension_tl , file-extension .initial:n = tex } @@ -1388,18 +1406,18 @@ % #1: type % #2: id % #3: exercise|solution -\cs_new_protected:Npn \__xsim_set_file_signature:nnn #1#2#3 +\cs_new_protected:Npn \xsim_set_file_signature:nnn #1#2#3 { \tl_set:Nn \l__xsim_file_name_signature_tl {#1-#2-#3} } -\cs_generate_variant:Nn \__xsim_set_file_signature:nnn {nx,nV} +\cs_generate_variant:Nn \xsim_set_file_signature:nnn {nx,nV} -\tl_set:Nn \l__xsim_file_name_tl +\tl_set:Nn \l_xsim_file_name_tl { \c_sys_jobname_str - \l__xsim_file_name_signature_tl -body . \l__xsim_file_extension_tl } -\tl_set:Nn \l__xsim_file_path_and_name_tl +\tl_set:Nn \l_xsim_file_path_and_name_tl { - \tl_if_blank:VF \l__xsim_file_path_tl - { \l__xsim_file_path_tl / } - \l__xsim_file_name_tl + \tl_if_blank:VF \l_xsim_file_path_tl + { \l_xsim_file_path_tl / } + \l_xsim_file_name_tl } % #1: type @@ -1474,14 +1492,14 @@ { \xsim_verbose:n { Starting~ to~ write~ #3~ environment~ type~ `#1'~ id~ `#2' } - \__xsim_set_file_signature:nnn {#1} {#2} {#3} + \xsim_set_file_signature:nnn {#1} {#2} {#3} \__xsim_file_info:nnnVV {#1} {#2} {#3} - \l__xsim_file_name_tl - \l__xsim_file_path_tl + \l_xsim_file_name_tl + \l_xsim_file_path_tl \int_zero:N \l_xsim_line_gobble_int \xsim_file_write_start:nV { \l__xsim_options_given_bool } - \l__xsim_file_path_and_name_tl + \l_xsim_file_path_and_name_tl } \cs_new_protected:Npn \__xsim_write_environment_body_end: @@ -1496,8 +1514,11 @@ { \xsim_verbose:n { Saving~ #3~ environment~ type~ `#1'~ id~ `#2' } \xsim_set_property:nnnn {#1} {#2} {#3-body} {#4} - \xsim_if_exchange:nnnF {#1} {#2} {#3} - { \xsim_set_property:nnnn {#1} {#2} {solution-body} {#4} } + \xsim_if_exchange:nnnT {#1} {#2} {#3} + { + \tl_if_eq:nnT {#3} {exercise} + { \xsim_set_property:nnnn {#1} {#2} {solution-body} {#4} } + } } \cs_new:Npn \__xsim_save_environment_body_end: { } @@ -1609,9 +1630,9 @@ \xsim_if_write_to_files:TF { \xsim_if_exchange:nnnTF {#1} {#2} {#3} - { \__xsim_set_file_signature:nnn {#1} {#2} {exercise} } - { \__xsim_set_file_signature:nnn {#1} {#2} {#3} } - \file_if_exist:VTF \l__xsim_file_path_and_name_tl + { \xsim_set_file_signature:nnn {#1} {#2} {exercise} } + { \xsim_set_file_signature:nnn {#1} {#2} {#3} } + \file_if_exist:VTF \l_xsim_file_path_and_name_tl { \prg_return_true: } { \prg_return_false: } } @@ -1654,15 +1675,15 @@ \cs_new_protected:Npn \xsim_input:nnn #1#2#3 { \xsim_if_exchange:nnnTF {#1} {#2} {#3} - { \__xsim_set_file_signature:nnn {#1} {#2} {exercise} } - { \__xsim_set_file_signature:nnn {#1} {#2} {#3} } + { \xsim_set_file_signature:nnn {#1} {#2} {exercise} } + { \xsim_set_file_signature:nnn {#1} {#2} {#3} } \xsim_if_write_to_files:TF { - \file_if_exist:VTF \l__xsim_file_path_and_name_tl - { \file_input:V \l__xsim_file_path_and_name_tl } + \file_if_exist:VTF \l_xsim_file_path_and_name_tl + { \file_input:V \l_xsim_file_path_and_name_tl } { \xsim_verbose:n - { File~ `\l__xsim_file_path_and_name_tl'~ doesn't~ exist. } + { File~ `\l_xsim_file_path_and_name_tl'~ doesn't~ exist. } } } { @@ -1671,7 +1692,7 @@ { \xsim_get_property:nnn {#1} {#2} {#3-body} } } } -\cs_generate_variant:Nn \xsim_input:nnn {oo} +\cs_generate_variant:Nn \xsim_input:nnn {oo,nV} \prg_new_conditional:Npnn \xsim_if_insert_mode: {T,F,TF} { @@ -1911,12 +1932,14 @@ \seq_new:c {l__xsim_chosen_tags_#1_seq} \bool_new:c {l__xsim_ignore_untagged_#1_bool} \bool_new:c {l____xsim_tagged_#1_bool} + \bool_new:c {l__xsim_use_unmatched_#1_bool} \keys_define:nn {xsim} { #1/ignore-untagged .bool_set:c = {l__xsim_ignore_untagged_#1_bool} , #1/ignore-untagged .initial:n = true , - #1 .code:n = - \seq_set_from_clist:cn {l__xsim_chosen_tags_#1_seq} {##1} + #1 .code:n = \seq_set_from_clist:cn {l__xsim_chosen_tags_#1_seq} {##1} , + #1/use-unmatched .bool_set:c = {l__xsim_use_unmatched_#1_bool} , + #1/use-unmatched .initial:n = false } \prg_new_protected_conditional:cpnn {xsim_if_#1_value:n} ##1 {T,F,TF} { @@ -2047,7 +2070,7 @@ { \prg_return_true: } { \prg_return_false: } } -\prg_generate_conditional_variant:Nnn \xsim_has_tags:nnnn {nnVV} {T} +\prg_generate_conditional_variant:Nnn \xsim_has_tags:nnnn {nnVV} {T,F} % #1: exercise type % #2: id @@ -2067,6 +2090,59 @@ { \prg_return_false: } } +% #1: exercise type +% #2: id +% #3: tag type +\prg_new_protected_conditional:Npnn \xsim_if_tags_match:nnn #1#2#3 {T,F,TF} + { + \bool_set_false:c {l____xsim_tagged_#3_bool} + \seq_if_empty:cTF {l__xsim_chosen_tags_#3_seq} + { \bool_set_true:c {l____xsim_tagged_#3_bool} } + { + \seq_set_from_clist:Nx + \l__xsim_tmpa_seq + { \xsim_get_property:nnn {#1} {#2} {#3} } + \seq_if_empty:NTF \l__xsim_tmpa_seq + { + \bool_set_eq:cc + {l____xsim_tagged_#3_bool} + {l__xsim_ignore_untagged_#3_bool} + } + { + \seq_map_inline:Nn \l__xsim_tmpa_seq + { + \seq_if_in:cnT {l__xsim_chosen_tags_#3_seq} {##1} + { + \bool_set_true:c {l____xsim_tagged_#3_bool} + \seq_map_break: + } + } + } + } + \bool_if:cTF {l____xsim_tagged_#3_bool} + { \prg_return_true: } + { \prg_return_false: } + } + +\prg_new_protected_conditional:Npnn \xsim_if_tagged_use:nn #1#2 {T,F,TF} + { + \bool_set_true:N \l____xsim_tagged_bool + \seq_map_inline:Nn \l__xsim_tag_types_seq + { + \xsim_if_tags_match:nnnF {#1} {#2} {##1} + { + + \bool_if:cF {l__xsim_use_unmatched_##1_bool} + { + \bool_set_false:N \l____xsim_tagged_bool + \seq_map_break: + } + } + } + \bool_if:NTF \l____xsim_tagged_bool + { \prg_return_true: } + { \prg_return_false: } + } % #1: exercise type % #2: id @@ -2492,6 +2568,8 @@ % ---------------------------------------------------------------------------- \xsim_new_list:n {types} +\xsim_new_list:n {order} +\xsim_at_end_document:n { \xsim_update_list:n {order} } \xsim_new_list:n {idtypes} % #1: true|false (fixed parameter) @@ -2635,6 +2713,9 @@ \cs_new_protected:Npn \xsim_foreach_exercise_id:n #1 { \int_step_inline:nnnn {1} {1} { \g_xsim_max_id_int } {#1} } +\cs_new_protected:Npn \xsim_foreach_exercise_order:n #1 + { \xsim_foreach_new_list_entry:nn {order} {#1} } + % #1: macro name % #2: 0 to 9 times `n' (= number of arguments of internal item) % #3: code; may contain a suiting \__xsim_loop_item:<nnn> @@ -2681,6 +2762,16 @@ } } +\xsim_define_loop_macro:Nnn \xsim_foreach_exercise_type_order:nn + {nnnnnn} + { + \xsim_foreach_exercise_type:n + { + \xsim_foreach_exercise_order:n + { \__xsim_deliver_exercise_details:nnn {##1} {####1} {#1} } + } + } + \xsim_define_loop_macro:Nnn \xsim_foreach_exercise_id_type:nn {nnnnnn} { @@ -2859,6 +2950,9 @@ % boolean: \xsim_declare_property:nnnn { \c_false_bool } { \c_true_bool } { \c_false_bool } {#1} + % boolean: + \xsim_declare_property:nnnn + { \c_false_bool } { \c_true_bool } { \c_false_bool } {#1!} % boolean, noupdate: \xsim_declare_property:nnnn { \c_false_bool } { \c_true_bool } { \c_true_bool } {(#2)} @@ -2927,36 +3021,44 @@ \prg_new_conditional:Npnn \xsim_exercise_if_use:nn #1#2 {T,F,TF} { - \xsim_if_boolean_property:nnnTF {#1} {#2} {(used)} - { \prg_return_false: } + \xsim_if_boolean_property:nnnTF {#1} {#2} {use!} + { \prg_return_true: } { - \xsim_if_insert_mode:TF - { - \xsim_if_property_set:nnnTF {#1} {#2} {use} - { - \xsim_if_boolean_property:nnnTF {#1} {#2} {use} - { \prg_return_true: } - { \prg_return_false: } - } - { - \bool_if:cTF {l__xsim_#1_exercise_use_bool} - { \prg_return_false: } - { \prg_return_true: } - } - } + \xsim_if_tagged_use:nnTF {#1} {#2} { - \xsim_if_property_set:nnnTF {#1} {#2} {use} - { - \xsim_if_boolean_property:nnnTF {#1} {#2} {use} - { \prg_return_true: } - { \prg_return_false: } - } + \xsim_if_boolean_property:nnnTF {#1} {#2} {(used)} + { \prg_return_false: } { - \bool_if:cTF {l__xsim_#1_exercise_use_bool} - { \prg_return_true: } - { \prg_return_false: } + \xsim_if_insert_mode:TF + { + \xsim_if_property_set:nnnTF {#1} {#2} {use} + { + \xsim_if_boolean_property:nnnTF {#1} {#2} {use} + { \prg_return_true: } + { \prg_return_false: } + } + { + \bool_if:cTF {l__xsim_#1_exercise_use_bool} + { \prg_return_false: } + { \prg_return_true: } + } + } + { + \xsim_if_property_set:nnnTF {#1} {#2} {use} + { + \xsim_if_boolean_property:nnnTF {#1} {#2} {use} + { \prg_return_true: } + { \prg_return_false: } + } + { + \bool_if:cTF {l__xsim_#1_exercise_use_bool} + { \prg_return_true: } + { \prg_return_false: } + } + } } } + { \prg_return_false: } } } \prg_generate_conditional_variant:Nnn \xsim_exercise_if_use:nn {nV} {T,TF} @@ -2993,29 +3095,33 @@ \prg_new_conditional:Npnn \xsim_exercise_if_print:nn #1#2 {T,F,TF} { - \xsim_if_tagged:nnTF {#1} {#2} + \xsim_if_boolean_property:nnnTF {#1} {#2} {print!} + { \prg_return_true: } { - \xsim_if_insert_mode:TF - { \prg_return_true: } + \xsim_if_tagged:nnTF {#1} {#2} { - \bool_if:cTF {l__xsim_#1_exercise_print_bool} + \xsim_if_insert_mode:TF + { \prg_return_true: } { - \xsim_if_property_set:nnnTF {#1} {#2} {print} + \bool_if:cTF {l__xsim_#1_exercise_print_bool} + { + \xsim_if_property_set:nnnTF {#1} {#2} {print} + { + \xsim_if_boolean_property:nnnTF {#1} {#2} {print} + { \prg_return_true: } + { \prg_return_false: } + } + { \prg_return_true: } + } { \xsim_if_boolean_property:nnnTF {#1} {#2} {print} { \prg_return_true: } { \prg_return_false: } } - { \prg_return_true: } - } - { - \xsim_if_boolean_property:nnnTF {#1} {#2} {print} - { \prg_return_true: } - { \prg_return_false: } } } + { \prg_return_false: } } - { \prg_return_false: } } \prg_generate_conditional_variant:Nnn \xsim_exercise_if_print:nn {nV} {T,TF} @@ -3079,6 +3185,7 @@ } \xsim_exercise_if_use:nVT {#1} \g_xsim_exercise_id_tl { + \xsim_add_to_list:nV {order} \g_xsim_exercise_id_tl \xsim_set_property:nVnn {#1} \g_xsim_exercise_id_tl {(used)} {true} \xsim_set_property:nVnn {#1} \g_xsim_exercise_id_tl {used} {true} \xsim_update_goals:nV {#1} \g_xsim_exercise_id_tl @@ -3577,8 +3684,33 @@ \xsim_attribute_set:nnn {collection:conditions} {#1} {#2} \seq_gput_right:Nn \g__xsim_collections_seq {#1} \xsim_new_list:n {collection:#1} + \bool_new:c {l__xsim_collection_#1_condition_all_bool} + \keys_define:nn {xsim/collection/#1} + { + match-all .bool_set:c = {l__xsim_collection_#1_condition_all_bool} , + match-all .initial:n = true , + match-any .bool_set_inverse:c = {l__xsim_collection_#1_condition_all_bool} + } + \xsim_before_begin_document:n + { + \xsim_foreach_exercise_type:n + { + \int_new:c {g_xsim_collection_##1_in_#1_int} + \newcounter {total##1in#1} + } + } \xsim_at_end_document:n - { \xsim_update_list:n {collection:#1} } + { + \xsim_update_list:n {collection:#1} + \xsim_foreach_exercise_type:n + { + \xsim_write_to_aux:x + { + \token_to_str:N \setcounter {total##1in#1} + { \int_use:c {g_xsim_collection_##1_in_#1_int} } + } + } + } } } @@ -3710,7 +3842,9 @@ % #3: ID \prg_new_protected_conditional:Npnn \xsim_collection_conditions_if:nnn #1#2#3 {T,F,TF} { - \bool_set_false:N \l____xsim_collection_condition_bool + \bool_if:cTF {l__xsim_collection_#1_condition_all_bool} + { \bool_set_true:N \l____xsim_collection_condition_bool } + { \bool_set_false:N \l____xsim_collection_condition_bool } \clist_set:Nx \l__xsim_tmpa_clist { \xsim_attribute_get:nn {collection:conditions} {#1} } \clist_if_empty:NTF \l__xsim_tmpa_clist @@ -3725,10 +3859,20 @@ { \__xsim_get_condition_values:w ##1 \q_stop } \xsim_if_tag_type_exist:VTF \l__xsim_tmpa_tl { - \xsim_has_tags:nnVVT {#2} {#3} \l__xsim_tmpa_tl \l__xsim_tmpb_tl + \bool_if:cTF {l__xsim_collection_#1_condition_all_bool} { - \bool_set_true:N \l____xsim_collection_condition_bool - \clist_map_break: + \xsim_has_tags:nnVVF {#2} {#3} \l__xsim_tmpa_tl \l__xsim_tmpb_tl + { + \bool_set_false:N \l____xsim_collection_condition_bool + \clist_map_break: + } + } + { + \xsim_has_tags:nnVVT {#2} {#3} \l__xsim_tmpa_tl \l__xsim_tmpb_tl + { + \bool_set_true:N \l____xsim_collection_condition_bool + \clist_map_break: + } } } { \msg_warning:nnV {xsim} {tag-unknown} \l__xsim_tmpa_tl } @@ -3770,6 +3914,7 @@ { \clist_put_right:Nn \l__xsim_tmpa_clist {#1} } \xsim_set_property:nnnV {#2} {#3} {collections} \l__xsim_tmpa_clist \xsim_add_to_list:nn {collection:#1} {#2-#3} + \int_gincr:c {g_xsim_collection_#2_in_#1_int} } % ---------------------------------------------------------------------------- @@ -3825,15 +3970,17 @@ { \clist_pop:NN \l__xsim_tmpa_clist \l__xsim_tmpa_tl \clist_pop:NN \l__xsim_tmpb_clist \l__xsim_tmpb_tl - \str_case:Vn \l__xsim_print_collection_choice_tl - { - {exercises} { \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {exercise} } - {solutions} { \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {solution} } - {both} { - \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {exercise} - \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {solution} - } - } + \str_case:Vn \l__xsim_print_collection_choice_tl + { + {exercises} + { \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {exercise} } + {solutions} + { \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {solution} } + {both} { + \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {exercise} + \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {solution} + } + } } } } @@ -3869,10 +4016,7 @@ \cs_set_protected:Npn \xsim_write_cloze_filled:n ##1 {#1} , filled-style .initial:n = \underline {#1} , style .meta:n = - { - blank-style = #1 , - filled-style = #1 - } , + { blank-style = #1 , filled-style = #1 } , fill .bool_set:N = \l__xsim_fill_blank_bool , fill .initial:n = false , scale .tl_set:N = \l__xsim_blank_scale_tl , @@ -4996,6 +5140,14 @@ \tl_clear:N \XSIMtmp } +\NewDocumentCommand \ForEachUsedExerciseByOrder {+m} + { + \tl_set_eq:NN \XSIMtmp \ExerciseType + \xsim_foreach_exercise_type_order:nn {used} {#1} + \tl_set_eq:NN \ExerciseType \XSIMtmp + \tl_clear:N \XSIMtmp + } + % ---------------------------------------------------------------------------- \NewDocumentCommand \DeclareExerciseTranslations {mm} @@ -5397,7 +5549,7 @@ { \XSIMmixedcase { \GetExerciseParameter {exercise-name} } } & } - \ForEachUsedExerciseByType + \ForEachUsedExerciseByOrder { \XSIMifeqT {#1} { \ExerciseTableType {#1} } { @@ -5417,7 +5569,7 @@ \XSIMtranslate {total} \\ \midrule \XSIMmixedcase { \XSIMtranslate {points} } & } - \ForEachUsedExerciseByType + \ForEachUsedExerciseByOrder { \XSIMifeqT {#1} { \ExerciseTableType {#1} } { @@ -5433,7 +5585,7 @@ \\ \midrule \XSIMtranslate {reached} & } - \ForEachUsedExerciseByType + \ForEachUsedExerciseByOrder { \XSIMifeqT {#1} { \ExerciseTableType {#1} } { \XSIMputright \ExerciseTableCode {&} } @@ -5465,7 +5617,7 @@ \XSIMtranslate {reached} \\ \midrule } - \ForEachUsedExerciseByType + \ForEachUsedExerciseByOrder { \XSIMifeqT {#1} { \ExerciseTableType {#1} } { diff --git a/macros/latex/contrib/xsim/xsim.style.layouts.code.tex b/macros/latex/contrib/xsim/xsim.style.layouts.code.tex index 120df82fef..143f04a84c 100644 --- a/macros/latex/contrib/xsim/xsim.style.layouts.code.tex +++ b/macros/latex/contrib/xsim/xsim.style.layouts.code.tex @@ -8,7 +8,7 @@ % Web: https://github.com/cgnieder/xsim % E-Mail: contact@mychemistry.eu % ---------------------------------------------------------------------------- -% Copyright 2017--2021 Clemens Niederberger +% Copyright 2017--2022 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3c diff --git a/macros/latex/contrib/xsim/xsimverb.sty b/macros/latex/contrib/xsim/xsimverb.sty index 712440d423..a81146719c 100644 --- a/macros/latex/contrib/xsim/xsimverb.sty +++ b/macros/latex/contrib/xsim/xsimverb.sty @@ -6,9 +6,9 @@ % ---------------------------------------------------------------------------- % Clemens Niederberger % Web: https://github.com/cgnieder/xsim -% E-Mail: contact@mychemistry.eu +% E-Mail: clemens@cnltx.de % ---------------------------------------------------------------------------- -% Copyright 2017--2021 Clemens Niederberger +% Copyright 2017--2022 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3c @@ -28,9 +28,9 @@ \RequirePackage {l3keys2e} \ExplSyntaxOn -\tl_const:Nn \c_xsimverb_date_tl {2021/01/31} +\tl_const:Nn \c_xsimverb_date_tl {2022/02/12} \tl_const:Nn \c_xsimverb_version_major_number_tl {0} -\tl_const:Nn \c_xsimverb_version_minor_number_tl {3} +\tl_const:Nn \c_xsimverb_version_minor_number_tl {4} \tl_const:Nn \c_xsimverb_version_subrelease_tl {} \tl_const:Nx \c_xsimverb_version_number_tl { @@ -288,6 +288,7 @@ } % ---------------------------------------------------------------------------- +\cs_generate_variant:Nn \tl_set:Nn {Ne} \NewDocumentCommand \XSIMfilewritestart {sm} { @@ -302,9 +303,15 @@ \NewDocumentCommand \XSIMsetfilebegin {+m} { \tl_set:Nn \l_xsim_file_begin_tl {#1} } +\NewDocumentCommand \XSIMsetfilebeginX {+m} + { \tl_set:Ne \l_xsim_file_begin_tl {#1} } + \NewDocumentCommand \XSIMsetfileend {+m} { \tl_set:Nn \l_xsim_file_end_tl {#1} } +\NewDocumentCommand \XSIMsetfileendX {+m} + { \tl_set:Ne \l_xsim_file_end_tl {#1} } + \NewDocumentCommand \XSIMgobblechars {m} { \int_set:Nn \l_xsim_line_gobble_int {#1} } diff --git a/macros/latex/contrib/zref-check/CHANGELOG.md b/macros/latex/contrib/zref-check/CHANGELOG.md index 17895758fa..76f4d6b20b 100644 --- a/macros/latex/contrib/zref-check/CHANGELOG.md +++ b/macros/latex/contrib/zref-check/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/zref-check/compare/v0.2.4...HEAD) +## [Unreleased](https://github.com/gusbrs/zref-check/compare/v0.2.5...HEAD) + +## [v0.2.5](https://github.com/gusbrs/zref-check/compare/v0.2.4...v0.2.5) (2022-02-11) + +### Changed +- (Internal) Option variables setting was reviewed, ensuring proper scope is + in use and that they are always properly declared. `expl3` debugging + enabled in regression tests. ## [v0.2.4](https://github.com/gusbrs/zref-check/compare/v0.2.3...v0.2.4) (2022-02-08) diff --git a/macros/latex/contrib/zref-check/zref-check-code.pdf b/macros/latex/contrib/zref-check/zref-check-code.pdf Binary files differindex 92dafc7ae1..71e442e631 100644 --- a/macros/latex/contrib/zref-check/zref-check-code.pdf +++ b/macros/latex/contrib/zref-check/zref-check-code.pdf diff --git a/macros/latex/contrib/zref-check/zref-check.dtx b/macros/latex/contrib/zref-check/zref-check.dtx index 6392f43c43..186173b35c 100644 --- a/macros/latex/contrib/zref-check/zref-check.dtx +++ b/macros/latex/contrib/zref-check/zref-check.dtx @@ -510,7 +510,7 @@ % % Identify the package. % \begin{macrocode} -\ProvidesExplPackage {zref-check} {2022-02-08} {0.2.4} +\ProvidesExplPackage {zref-check} {2022-02-11} {0.2.5} {Flexible cross-references with contextual checks based on zref} % \end{macrocode} % @@ -546,7 +546,7 @@ \AddToHook { cmd / chapter / before } { \int_gincr:N \g_@@_abschap_int - \int_zero:N \g_@@_abssec_int + \int_gzero:N \g_@@_abssec_int } \zref@newprop { zc@abschap } [0] { \int_use:N \g_@@_abschap_int } \zref@addprop \ZREF@mainlist { zc@abschap } @@ -1033,7 +1033,7 @@ % \end{variable} % % \begin{macrocode} -\tl_set:Nn \g_tmpa_tl { \c_sys_jobname_str .aux } +\tl_gset:Nn \g_tmpa_tl { \c_sys_jobname_str .aux } \file_if_exist:nT { \g_tmpa_tl } { % \end{macrocode} @@ -1518,8 +1518,7 @@ % % \begin{variable}{\c_@@_single_label_checks_seq} % \begin{macrocode} -\seq_new:N \c_@@_single_label_checks_seq -\seq_set_from_clist:Nn \c_@@_single_label_checks_seq +\seq_const_from_clist:Nn \c_@@_single_label_checks_seq { thischap , prevchap , @@ -1632,8 +1631,7 @@ % \begin{macrocode} \bool_new:N \l_@@_passedcheck_bool \bool_new:N \l_@@_onpage_bool -\seq_new:N \c_@@_onpage_checks_seq -\seq_set_from_clist:Nn \c_@@_onpage_checks_seq +\seq_const_from_clist:Nn \c_@@_onpage_checks_seq { above , below , before , after } % \end{macrocode} % \end{variable} diff --git a/macros/latex/contrib/zref-check/zref-check.pdf b/macros/latex/contrib/zref-check/zref-check.pdf Binary files differindex 3c20e85536..ecfd8ee3fa 100644 --- a/macros/latex/contrib/zref-check/zref-check.pdf +++ b/macros/latex/contrib/zref-check/zref-check.pdf diff --git a/macros/latex/contrib/zref-clever/CHANGELOG.md b/macros/latex/contrib/zref-clever/CHANGELOG.md index 66d7e69c3d..5023b04b7a 100644 --- a/macros/latex/contrib/zref-clever/CHANGELOG.md +++ b/macros/latex/contrib/zref-clever/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.2.1-alpha...HEAD) +## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.2.2-alpha...HEAD) + +## [v0.2.2-alpha](https://github.com/gusbrs/zref-clever/compare/v0.2.1-alpha...v0.2.2-alpha) (2022-02-11) + +### Changed +- (Internal) Option variables setting was reviewed, ensuring proper scope is + in use and that they are always properly declared. `expl3` debugging + enabled in regression tests. ## [v0.2.1-alpha](https://github.com/gusbrs/zref-clever/compare/v0.2.0-alpha...v0.2.1-alpha) (2022-02-07) diff --git a/macros/latex/contrib/zref-clever/zref-clever-code.pdf b/macros/latex/contrib/zref-clever/zref-clever-code.pdf Binary files differindex 9e8212f083..c77a6ef340 100644 --- a/macros/latex/contrib/zref-clever/zref-clever-code.pdf +++ b/macros/latex/contrib/zref-clever/zref-clever-code.pdf diff --git a/macros/latex/contrib/zref-clever/zref-clever.dtx b/macros/latex/contrib/zref-clever/zref-clever.dtx index e6c175d33f..5464fb5575 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-02-07} {0.2.1-alpha} +\ProvidesExplPackage {zref-clever} {2022-02-11} {0.2.2-alpha} {Clever LaTeX cross-references based on zref} % \end{macrocode} % @@ -643,6 +643,11 @@ Option~'check'~requested~\msg_line_context:.~ But~package~'zref-check'~is~not~loaded,~can't~run~the~checks. } +\msg_new:nnn { zref-clever } { zref-check-too-old } + { + Option~'check'~requested~\msg_line_context:.~ + But~'zref-check'~newer~than~'#1'~is~required,~can't~run~the~checks. + } \msg_new:nnn { zref-clever } { missing-type } { Reference~type~undefined~for~label~'#1'~\msg_line_context:. } \msg_new:nnn { zref-clever } { missing-property } @@ -856,56 +861,158 @@ % \end{macro} % % +% \begin{macro}[EXP]{\@@_opt_var_set_bool:n} +% The \LaTeX3 programming layer does not have the concept of a variable +% \emph{existing} only locally, it also considers an ``error'' if an +% assignment is made to a variable which was not previously declared, but +% declaration is always global, which means that ``setting a local variable +% at a local scope'', given these requirements, results in it existing, and +% being empty, globally. Therefore, we need an independent mechanism from +% the mere existence of a variable to keep track of whether variables are +% ``set'' or ``unset'', within the logic of the precedence rules for options +% in different scopes. \cs{@@_opt_var_set_bool:n} expands to the name of +% the boolean variable used to track this state for \meta{option var}. See +% discussion with \contributor{Phelype Oleinik} at +% \url{https://tex.stackexchange.com/questions/633341/#comment1579825_633347} +% \begin{syntax} +% \cs{@@_opt_var_set_bool:n} \Arg{option var} +% \end{syntax} +% \begin{macrocode} +\cs_new:Npn \@@_opt_var_set_bool:n #1 + { \cs_to_str:N #1 _is_set_bool } +% \end{macrocode} +% \end{macro} +% +% % % \begin{macro} % { -% \@@_opt_tl_unset:N , -% \@@_opt_tl_gunset:N , +% \@@_opt_tl_set:Nn , +% \@@_opt_tl_clear:N , +% \@@_opt_tl_gset:Nn , +% \@@_opt_tl_gclear: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_set:N} \Arg{option tl} \Arg{value} +% \cs{@@_opt_tl_clear:N} \Arg{option tl} +% \cs{@@_opt_tl_gset:N} \Arg{option tl} \Arg{value} +% \cs{@@_opt_tl_gclear:N} \Arg{option tl} +% \end{syntax} +% \begin{macrocode} +\cs_new_protected:Npn \@@_opt_tl_set:Nn #1#2 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_set:Nn #1 {#2} + \bool_if_exist:cF { \@@_opt_var_set_bool:n {#1} } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \@@_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \@@_opt_tl_set:Nn { cn } +\cs_new_protected:Npn \@@_opt_tl_clear:N #1 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_clear:N #1 + \bool_if_exist:cF { \@@_opt_var_set_bool:n {#1} } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \@@_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \@@_opt_tl_clear:N { c } +\cs_new_protected:Npn \@@_opt_tl_gset:Nn #1#2 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gset:Nn #1 {#2} + } +\cs_generate_variant:Nn \@@_opt_tl_gset:Nn { cn } +\cs_new_protected:Npn \@@_opt_tl_gclear:N #1 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gclear:N #1 + } +\cs_generate_variant:Nn \@@_opt_tl_gclear:N { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_opt_tl_unset:N} +% Unset \meta{option tl}. % \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 } + { + \tl_if_exist:NT #1 + { + \tl_clear:N #1 % ? + \bool_if_exist:cTF { \@@_opt_var_set_bool:n {#1} } + { \bool_set_false:c { \@@_opt_var_set_bool:n {#1} } } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + } + } \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} +% This conditional \emph{defines} what means to be unset for a token list +% option. Note that the ``set bool'' not existing signals that the variable +% \emph{is set}, that would be the case of all global option variables +% (language-specific ones). But this means care should be taken to always +% define and set the ``set bool'' for local variables. % \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: } + \tl_if_exist:NTF #1 + { + \bool_if_exist:cTF { \@@_opt_var_set_bool:n {#1} } + { + \bool_if:cTF { \@@_opt_var_set_bool:n {#1} } + { \prg_return_true: } + { \prg_return_false: } + } + { \prg_return_true: } + } { \prg_return_false: } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_opt_tl_gset_if_new:Nn} +% \begin{macro} +% { +% \@@_opt_tl_gset_if_new:Nn , +% \@@_opt_tl_gclear_if_new:N , +% } % \begin{syntax} % \cs{@@_opt_tl_gset_if_new:Nn} \Arg{option tl} \Arg{value} +% \cs{@@_opt_tl_gclear_if_new:N} \Arg{option tl} % \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} } + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gset:Nn #1 {#2} + } } \cs_generate_variant:Nn \@@_opt_tl_gset_if_new:Nn { cn } +\cs_new_protected:Npn \@@_opt_tl_gclear_if_new:N #1 + { + \@@_opt_tl_if_set:NF #1 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gclear:N #1 + } + } +\cs_generate_variant:Nn \@@_opt_tl_gclear_if_new:N { c } % \end{macrocode} % \end{macro} % @@ -935,48 +1042,81 @@ % { % \@@_opt_seq_set_clist_split:Nn , % \@@_opt_seq_gset_clist_split:Nn , +% \@@_opt_seq_set_eq:NN , +% \@@_opt_seq_gset_eq: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} +% \cs{@@_opt_seq_set_eq:NN} \Arg{option seq} \Arg{seq var} +% \cs{@@_opt_seq_gset_eq:NN} \Arg{option seq} \Arg{seq var} % \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} } +\cs_new_protected:Npn \@@_opt_seq_set_eq:NN #1#2 + { + \seq_if_exist:NF #1 + { \seq_new:N #1 } + \seq_set_eq:NN #1 #2 + \bool_if_exist:cF { \@@_opt_var_set_bool:n {#1} } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \@@_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \@@_opt_seq_set_eq:NN { cN } +\cs_new_protected:Npn \@@_opt_seq_gset_eq:NN #1#2 + { + \seq_if_exist:NF #1 + { \seq_new:N #1 } + \seq_gset_eq:NN #1 #2 + } +\cs_generate_variant:Nn \@@_opt_seq_gset_eq:NN { cN } % \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{macro}{\@@_opt_seq_unset:N} +% Unset \meta{option seq}. % \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: } + { + \seq_if_exist:NT #1 + { + \seq_clear:N #1 % ? + \bool_if_exist:cTF { \@@_opt_var_set_bool:n {#1} } + { \bool_set_false:c { \@@_opt_var_set_bool:n {#1} } } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + } + } \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} +% This conditional \emph{defines} what means to be unset for a sequence +% option. % \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: } } + { + \seq_if_exist:NTF #1 + { + \bool_if_exist:cTF { \@@_opt_var_set_bool:n {#1} } + { + \bool_if:cTF { \@@_opt_var_set_bool:n {#1} } + { \prg_return_true: } + { \prg_return_false: } + } + { \prg_return_true: } + } + { \prg_return_false: } + } \prg_generate_conditional_variant:Nnn \@@_opt_seq_if_set:N { c } { F , TF } % \end{macrocode} @@ -1004,44 +1144,103 @@ % % % -% \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{macro}{\@@_opt_bool_unset:N} +% Unset \meta{option bool}. % \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: } + { + \bool_if_exist:NT #1 + { + % \bool_set_false:N #1 % ? + \bool_if_exist:cTF { \@@_opt_var_set_bool:n {#1} } + { \bool_set_false:c { \@@_opt_var_set_bool:n {#1} } } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + } + } \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} +% This conditional \emph{defines} what means to be unset for a boolean +% option. % \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: } } + { + \bool_if_exist:NTF #1 + { + \bool_if_exist:cTF { \@@_opt_var_set_bool:n {#1} } + { + \bool_if:cTF { \@@_opt_var_set_bool:n {#1} } + { \prg_return_true: } + { \prg_return_false: } + } + { \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} +% { +% \@@_opt_bool_set_true:N , +% \@@_opt_bool_set_false:N , +% \@@_opt_bool_gset_true:N , +% \@@_opt_bool_gset_false:N , +% } +% \begin{syntax} +% \cs{@@_opt_bool_set_true:N} \Arg{option bool} +% \cs{@@_opt_bool_set_false:N} \Arg{option bool} +% \cs{@@_opt_bool_gset_true:N} \Arg{option bool} +% \cs{@@_opt_bool_gset_false:N} \Arg{option bool} +% \end{syntax} +% \begin{macrocode} +\cs_new_protected:Npn \@@_opt_bool_set_true:N #1 + { + \bool_if_exist:NF #1 + { \bool_new:N #1 } + \bool_set_true:N #1 + \bool_if_exist:cF { \@@_opt_var_set_bool:n {#1} } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \@@_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \@@_opt_bool_set_true:N { c } +\cs_new_protected:Npn \@@_opt_bool_set_false:N #1 + { + \bool_if_exist:NF #1 + { \bool_new:N #1 } + \bool_set_false:N #1 + \bool_if_exist:cF { \@@_opt_var_set_bool:n {#1} } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \@@_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \@@_opt_bool_set_false:N { c } +\cs_new_protected:Npn \@@_opt_bool_gset_true:N #1 + { + \bool_if_exist:NF #1 + { \bool_new:N #1 } + \bool_gset_true:N #1 + } +\cs_generate_variant:Nn \@@_opt_bool_gset_true:N { c } +\cs_new_protected:Npn \@@_opt_bool_gset_false:N #1 + { + \bool_if_exist:NF #1 + { \bool_new:N #1 } + \bool_gset_false:N #1 + } +\cs_generate_variant:Nn \@@_opt_bool_gset_false:N { c } +% \end{macrocode} +% \end{macro} +% % % \begin{macro}[TF]{\@@_opt_bool_get:NN} % \begin{syntax} @@ -1104,7 +1303,7 @@ % 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 +% the \texttt{.default:o} 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 @@ -1118,12 +1317,18 @@ % ``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. And similarly for -% ``choice'' options. In the language files the ``unsetting'' behavior is -% less meaningful, since they only change any variable if it is unset to start -% with, so that unsetting an unset variable would be redundant. However, for -% UI symmetry also in the language files keys with no value should not be -% considered ``empty'' and boolean \texttt{unset} values should exist. They -% are just no-op. +% ``choice'' options. +% +% However, ``unsetting'' options is only supported at the general and +% reference type levels, that is, at \cs{zcsetup}, at \cs{zcref}, and at +% \cs{zcRefTypeSetup}. For language-specific options -- in the language files +% or at \cs{zcLanguageSetup} -- there is no unsetting, an option which has +% been set can there only be changed to another value. This for two reasons. +% First, these are low precedence levels, so it is less meaningful to be able +% to unset these options. Second, these settings can only be done in the +% preamble (or the package itself). They are meant to be global. So, do it +% once, do it right, and if you need to locally change something along the +% document, use a higher precedence level. % % % \begin{macro} @@ -1150,30 +1355,36 @@ % % \begin{macro} % { -% \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 , +% \g_@@_rf_opts_tl_not_type_specific_seq , +% \g_@@_rf_opts_tl_maybe_type_specific_seq , +% \g_@@_rf_opts_seq_refbounds_seq , +% \g_@@_rf_opts_bool_maybe_type_specific_seq , +% \g_@@_rf_opts_tl_type_names_seq , +% \g_@@_rf_opts_tl_typesetup_seq , +% \g_@@_rf_opts_tl_reference_seq , % } % 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. +% later on, but also keeps things consistent. These variables are +% \emph{constants}, but I don't seem to be able to find a way to +% concatenate two constants into a third one without triggering \LaTeX3 +% debug error ``Inconsistent local/global assignment''. And repeating +% things in a new \cs{seq_const_from_clist:Nn} defeats the purpose of +% these variables. % \begin{macrocode} -\seq_const_from_clist:Nn - \c_@@_rf_opts_tl_not_type_specific_seq +\seq_new:N \g_@@_rf_opts_tl_not_type_specific_seq +\seq_gset_from_clist:Nn + \g_@@_rf_opts_tl_not_type_specific_seq { tpairsep , tlistsep , tlastsep , notesep , } -\seq_const_from_clist:Nn - \c_@@_rf_opts_tl_maybe_type_specific_seq +\seq_new:N \g_@@_rf_opts_tl_maybe_type_specific_seq +\seq_gset_from_clist:Nn + \g_@@_rf_opts_tl_maybe_type_specific_seq { namesep , pairsep , @@ -1183,8 +1394,9 @@ namefont , reffont , } -\seq_const_from_clist:Nn - \c_@@_rf_opts_seq_refbounds_seq +\seq_new:N \g_@@_rf_opts_seq_refbounds_seq +\seq_gset_from_clist:Nn + \g_@@_rf_opts_seq_refbounds_seq { refbounds-first , refbounds-first-sg , @@ -1197,8 +1409,9 @@ refbounds-last-pe , refbounds-last-re , } -\seq_const_from_clist:Nn - \c_@@_rf_opts_bool_maybe_type_specific_seq +\seq_new:N \g_@@_rf_opts_bool_maybe_type_specific_seq +\seq_gset_from_clist:Nn + \g_@@_rf_opts_bool_maybe_type_specific_seq { cap , abbrev , @@ -1210,8 +1423,9 @@ % their values queried by \cs{@@_get_rf_opt_tl:nnnN}, but by % \cs{@@_type_name_setup:}. % \begin{macrocode} -\seq_const_from_clist:Nn - \c_@@_rf_opts_tl_type_names_seq +\seq_new:N \g_@@_rf_opts_tl_type_names_seq +\seq_gset_from_clist:Nn + \g_@@_rf_opts_tl_type_names_seq { Name-sg , name-sg , @@ -1225,20 +1439,20 @@ % \end{macrocode} % And, finally, some combined groups of the above variables, for convenience. % \begin{macrocode} -\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 +\seq_new:N \g_@@_rf_opts_tl_typesetup_seq +\seq_gconcat:NNN \g_@@_rf_opts_tl_typesetup_seq + \g_@@_rf_opts_tl_maybe_type_specific_seq + \g_@@_rf_opts_tl_type_names_seq +\seq_new:N \g_@@_rf_opts_tl_reference_seq +\seq_gconcat:NNN \g_@@_rf_opts_tl_reference_seq + \g_@@_rf_opts_tl_not_type_specific_seq + \g_@@_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. +% We set here also the ``derived'' \texttt{refbounds} options, which are +% (almost) the same for every option scope. % % \begin{macrocode} \clist_map_inline:nn @@ -1258,42 +1472,69 @@ 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 , + } + } +\clist_map_inline:nn + { + reference , + typesetup , + } + { + \keys_define:nn { zref-clever/ #1 } + { + +refbounds-first .default:o = \c_novalue_tl , + +refbounds-mid .default:o = \c_novalue_tl , + +refbounds-last .default:o = \c_novalue_tl , + +refbounds-rb .default:o = \c_novalue_tl , + +refbounds-re .default:o = \c_novalue_tl , + +refbounds .default:o = \c_novalue_tl , + refbounds .default:o = \c_novalue_tl , + } + } +\clist_map_inline:nn + { + langsetup , + langfile , + } + { + \keys_define:nn { zref-clever/ #1 } + { + +refbounds-first .value_required:n = true , + +refbounds-mid .value_required:n = true , + +refbounds-last .value_required:n = true , + +refbounds-rb .value_required:n = true , + +refbounds-re .value_required:n = true , + +refbounds .value_required:n = true , + refbounds .value_required:n = true , } } % \end{macrocode} @@ -1302,6 +1543,30 @@ % \subsection{Languages} % % +% \cs{l_@@_current_language_tl} is an internal alias for \pkg{babel}'s +% \cs{languagename} or \pkg{polyglossia}'s \cs{mainbabelname} and, if none of +% them is loaded, we set it to \texttt{english}. \cs{l_@@_main_language_tl} +% is an internal alias for \pkg{babel}'s \cs{bbl@main@language} or for +% \pkg{polyglossia}'s \cs{mainbabelname}, as the case may be. Note that for +% \pkg{polyglossia} we get \pkg{babel}'s language names, so that we only need +% to handle those internally. \cs{l_@@_ref_language_tl} is the internal +% variable which stores the language in which the reference is to be made. +% +% \begin{macrocode} +\tl_new:N \l_@@_ref_language_tl +\tl_new:N \l_@@_current_language_tl +\tl_new:N \l_@@_main_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_new:N \l_zrefclever_ref_language_tl +\tl_set:Nn \l_zrefclever_ref_language_tl { \l_@@_ref_language_tl } +% \end{macrocode} +% \end{macro} +% +% % \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 @@ -1413,6 +1678,7 @@ { \@@_language_if_declared:nTF {#2} { + \tl_new:c { \@@_language_varname:n {#1} } \tl_gset:cx { \@@_language_varname:n {#1} } { \tl_use:c { \@@_language_varname:n {#2} } } } @@ -1430,6 +1696,11 @@ { declension .code:n = { + \seq_new:c + { + \@@_opt_varname_language:enn + { \l_@@_setup_language_tl } { declension } { seq } + } \seq_gset_from_clist:cn { \@@_opt_varname_language:enn @@ -1440,6 +1711,11 @@ declension .value_required:n = true , gender .code:n = { + \seq_new:c + { + \@@_opt_varname_language:enn + { \l_@@_setup_language_tl } { gender } { seq } + } \seq_gset_from_clist:cn { \@@_opt_varname_language:enn @@ -1451,6 +1727,11 @@ allcaps .choices:nn = { true , false } { + \bool_new:c + { + \@@_opt_varname_language:enn + { \l_@@_setup_language_tl } { allcaps } { bool } + } \use:c { bool_gset_ \l_keys_choice_tl :c } { \@@_opt_varname_language:enn @@ -1775,7 +2056,7 @@ } , case .value_required:n = true , - gender .default:x = \c_novalue_tl , + gender .value_required:n = true , gender .code:n = { \seq_if_empty:NTF \l_@@_lang_gender_seq @@ -1790,20 +2071,27 @@ { option-only-type-specific } { gender } } { - \tl_if_novalue:nF {#1} + \seq_clear:N \l_tmpa_seq + \clist_map_inline:nn {#1} { - \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} } { - \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} - } + \msg_info:nnxx { zref-clever } + { gender-not-declared } + { \l_@@_setup_language_tl } {##1} } - \@@_opt_seq_if_set:cF + } + \@@_opt_seq_if_set:cF + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { gender } + { seq } + } + { + \seq_new:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -1811,42 +2099,37 @@ { gender } { seq } } + \seq_gset_eq:cN { - \seq_gset_eq:cN - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - { gender } - { seq } - } - \l_tmpa_seq + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { gender } + { seq } } + \l_tmpa_seq } } } } , } \seq_map_inline:Nn - \c_@@_rf_opts_tl_not_type_specific_seq + \g_@@_rf_opts_tl_not_type_specific_seq { \keys_define:nn { zref-clever/langfile } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_if_novalue:nF {##1} + \@@_opt_tl_gset_if_new:cn { - \@@_opt_tl_gset_if_new:cn - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } - {#1} { tl } - } - {##1} + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + {#1} { tl } } + {##1} } { \msg_info:nnn { zref-clever } @@ -1856,44 +2139,39 @@ } } \seq_map_inline:Nn - \c_@@_rf_opts_tl_maybe_type_specific_seq + \g_@@_rf_opts_tl_maybe_type_specific_seq { \keys_define:nn { zref-clever/langfile } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_if_novalue:nF {##1} + \@@_opt_tl_gset_if_new:cn { - \@@_opt_tl_gset_if_new:cn - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } - {#1} { tl } - } - {##1} + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + {#1} { tl } } + {##1} } { - \tl_if_novalue:nF {##1} + \@@_opt_tl_gset_if_new:cn { - \@@_opt_tl_gset_if_new:cn - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - {#1} { tl } - } - {##1} + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + {#1} { tl } } + {##1} } } , } } \keys_define:nn { zref-clever/langfile } { + endrange .value_required:n = true , endrange .code:n = { \str_case:nnF {#1} @@ -1902,38 +2180,34 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangefunc } { tl } } - { } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangeprop } { tl } } - { } } { - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } { endrangefunc } { tl } } - { } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } { endrangeprop } { tl } } - { } } } @@ -1948,13 +2222,12 @@ { endrangefunc } { tl } } { @@_get_endrange_stripprefix } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangeprop } { tl } } - { } } { \@@_opt_tl_gset_if_new:cn @@ -1965,14 +2238,13 @@ { endrangefunc } { tl } } { @@_get_endrange_stripprefix } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } { endrangeprop } { tl } } - { } } } @@ -1987,13 +2259,12 @@ { endrangefunc } { tl } } { @@_get_endrange_pagecomp } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangeprop } { tl } } - { } } { \@@_opt_tl_gset_if_new:cn @@ -2004,14 +2275,13 @@ { endrangefunc } { tl } } { @@_get_endrange_pagecomp } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } { endrangeprop } { tl } } - { } } } @@ -2026,13 +2296,12 @@ { endrangefunc } { tl } } { @@_get_endrange_pagecomptwo } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangeprop } { tl } } - { } } { \@@_opt_tl_gset_if_new:cn @@ -2043,19 +2312,15 @@ { endrangefunc } { tl } } { @@_get_endrange_pagecomptwo } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } { endrangeprop } { tl } } - { } } } - - { unset } - { } } { \tl_if_empty:nTF {#1} @@ -2109,14 +2374,13 @@ } } } , - endrange .value_required:n = true , } \seq_map_inline:Nn - \c_@@_rf_opts_tl_type_names_seq + \g_@@_rf_opts_tl_type_names_seq { \keys_define:nn { zref-clever/langfile } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl @@ -2127,113 +2391,101 @@ { \tl_if_empty:NTF \l_@@_lang_decl_case_tl { - \tl_if_novalue:nF {##1} + \@@_opt_tl_gset_if_new:cn { - \@@_opt_tl_gset_if_new:cn - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - {#1} { tl } - } - {##1} + \@@_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_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} + \@@_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 + \g_@@_rf_opts_seq_refbounds_seq { \keys_define:nn { zref-clever/langfile } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #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 } + } { - \@@_opt_seq_if_set:cF + \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} } { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } {#1} { seq } + \int_compare_p:nNn + { \seq_count:N \g_tmpa_seq } = { 4 } } { - \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} } + \@@_opt_seq_gset_eq:cN { - \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 } + \@@_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_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} } { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } {#1} { seq } + \int_compare_p:nNn + { \seq_count:N \g_tmpa_seq } = { 4 } } { - \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 - } + \@@_opt_seq_gset_eq:cN { - \msg_info:nnxx { zref-clever } - { refbounds-must-be-four } - {#1} { \seq_count:N \g_tmpa_seq } + \@@_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 } } } } @@ -2241,7 +2493,7 @@ } } \seq_map_inline:Nn - \c_@@_rf_opts_bool_maybe_type_specific_seq + \g_@@_rf_opts_bool_maybe_type_specific_seq { \keys_define:nn { zref-clever/langfile } { @@ -2257,7 +2509,7 @@ {#1} { bool } } { - \bool_gset_true:c + \@@_opt_bool_gset_true:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -2274,7 +2526,7 @@ {#1} { bool } } { - \bool_gset_true:c + \@@_opt_bool_gset_true:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -2295,7 +2547,7 @@ {#1} { bool } } { - \bool_gset_false:c + \@@_opt_bool_gset_false:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -2312,7 +2564,7 @@ {#1} { bool } } { - \bool_gset_false:c + \@@_opt_bool_gset_false:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -2322,7 +2574,6 @@ } } } , - #1 / unset .code:n = { } , #1 .default:n = true , no #1 .meta:n = { #1 = false } , no #1 .value_forbidden:n = true , @@ -2586,12 +2837,12 @@ { { ref } { - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_general:nn { endrangefunc } { tl } } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_general:nn { endrangeprop } { tl } @@ -2600,13 +2851,13 @@ { stripprefix } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_general:nn { endrangefunc } { tl } } { @@_get_endrange_stripprefix } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_general:nn { endrangeprop } { tl } @@ -2615,13 +2866,13 @@ { pagecomp } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_general:nn { endrangefunc } { tl } } { @@_get_endrange_pagecomp } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_general:nn { endrangeprop } { tl } @@ -2630,13 +2881,13 @@ { pagecomp2 } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_general:nn { endrangefunc } { tl } } { @@_get_endrange_pagecomptwo } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_general:nn { endrangeprop } { tl } @@ -2670,13 +2921,13 @@ { endrange-property-undefined } {#1} } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_general:nn { endrangefunc } { tl } } { @@_get_endrange_property } - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_general:nn { endrangeprop } { tl } @@ -2964,7 +3215,7 @@ % \subsubsection*{\opt{range} and \opt{rangetopair} options} % % The \opt{rangetopair} option is being handled with other reference format -% option booleans at \cs{c_@@_rf_opts_bool_maybe_type_specific_seq}. +% option booleans at \cs{g_@@_rf_opts_bool_maybe_type_specific_seq}. % % \begin{macrocode} \bool_new:N \l_@@_typeset_range_bool @@ -2981,7 +3232,7 @@ % \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}. +% option booleans at \cs{g_@@_rf_opts_bool_maybe_type_specific_seq}. % % \begin{macrocode} \bool_new:N \l_@@_capfirst_bool @@ -2997,7 +3248,7 @@ % \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}. +% format option booleans at \cs{g_@@_rf_opts_bool_maybe_type_specific_seq}. % % \begin{macrocode} \bool_new:N \l_@@_noabbrev_first_bool @@ -3125,15 +3376,6 @@ % \subsubsection*{\opt{lang} option} % \phantomsection{}\zlabel{sec:lang-option} % -% \cs{l_@@_current_language_tl} is an internal alias for \pkg{babel}'s -% \cs{languagename} or \pkg{polyglossia}'s \cs{mainbabelname} and, if none of -% them is loaded, we set it to \texttt{english}. \cs{l_@@_main_language_tl} -% is an internal alias for \pkg{babel}'s \cs{bbl@main@language} or for -% \pkg{polyglossia}'s \cs{mainbabelname}, as the case may be. Note that for -% \pkg{polyglossia} we get \pkg{babel}'s language names, so that we only need -% to handle those internally. \cs{l_@@_ref_language_tl} is the internal -% variable which stores the language in which the reference is to be made. -% % The overall setup here seems a little roundabout, but this is actually % required. In the preamble, we (potentially) don't yet have values for the % ``current'' and ``main'' document languages, this must be retrieved at a @@ -3159,11 +3401,8 @@ % \cs{babelprovide}, either directly, ``on the fly'', or with the % \texttt{provide} option, \texttt{do not} get included in \cs{bbl@loaded}. % - +% % \begin{macrocode} -\tl_new:N \l_@@_ref_language_tl -\tl_new:N \l_@@_current_language_tl -\tl_new:N \l_@@_main_language_tl \AddToHook { begindocument } { \@@_if_package_loaded:nTF { babel } @@ -3185,12 +3424,6 @@ } % \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 } @@ -3481,22 +3714,35 @@ { \@@_if_package_loaded:nTF { zref-check } { - \bool_set_true:N \l_@@_zrefcheck_available_bool - \keys_define:nn { zref-clever/reference } + \IfPackageAtLeastTF { zref-check } { 2021-09-16 } { - check .code:n = + \bool_set_true:N \l_@@_zrefcheck_available_bool + \keys_define:nn { zref-clever/reference } { - \bool_set_true:N \l_@@_zcref_with_check_bool - \keys_set:nn { zref-check / zcheck } {#1} - } , - check .value_required:n = true , + check .code:n = + { + \bool_set_true:N \l_@@_zcref_with_check_bool + \keys_set:nn { zref-check / zcheck } {#1} + } , + check .value_required:n = true , + } + } + { + \bool_set_false:N \l_@@_zrefcheck_available_bool + \keys_define:nn { zref-clever/reference } + { + check .code:n = + { + \msg_warning:nnn { zref-clever } + { zref-check-too-old } { 2021-09-16~v0.2.1 } + } , + } } } { \bool_set_false:N \l_@@_zrefcheck_available_bool \keys_define:nn { zref-clever/reference } { - check .value_forbidden:n = false , check .code:n = { \msg_warning:nn { zref-clever } { missing-zref-check } } , } @@ -3754,11 +4000,11 @@ % % \begin{macrocode} \seq_map_inline:Nn - \c_@@_rf_opts_tl_reference_seq + \g_@@_rf_opts_tl_reference_seq { \keys_define:nn { zref-clever/reference } { - #1 .default:x = \c_novalue_tl , + #1 .default:o = \c_novalue_tl , #1 .code:n = { \tl_if_novalue:nTF {##1} @@ -3767,7 +4013,7 @@ { \@@_opt_varname_general:nn {#1} { tl } } } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_general:nn {#1} { tl } } {##1} } @@ -3802,11 +4048,11 @@ } , } \seq_map_inline:Nn - \c_@@_rf_opts_seq_refbounds_seq + \g_@@_rf_opts_seq_refbounds_seq { \keys_define:nn { zref-clever/reference } { - #1 .default:x = \c_novalue_tl , + #1 .default:o = \c_novalue_tl , #1 .code:n = { \tl_if_novalue:nTF {##1} @@ -3822,7 +4068,7 @@ { \tl_if_empty_p:n {##1} } { \int_compare_p:nNn { \seq_count:N \l_tmpa_seq } = { 4 } } { - \seq_set_eq:cN + \@@_opt_seq_set_eq:cN { \@@_opt_varname_general:nn {#1} { seq } } \l_tmpa_seq } @@ -3836,19 +4082,19 @@ } } \seq_map_inline:Nn - \c_@@_rf_opts_bool_maybe_type_specific_seq + \g_@@_rf_opts_bool_maybe_type_specific_seq { \keys_define:nn { zref-clever/reference } { #1 .choice: , #1 / true .code:n = { - \bool_set_true:c + \@@_opt_bool_set_true:c { \@@_opt_varname_general:nn {#1} { bool } } } , #1 / false .code:n = { - \bool_set_false:c + \@@_opt_bool_set_false:c { \@@_opt_varname_general:nn {#1} { bool } } } , #1 / unset .code:n = @@ -3953,7 +4199,7 @@ % % \begin{macrocode} \seq_map_inline:Nn - \c_@@_rf_opts_tl_not_type_specific_seq + \g_@@_rf_opts_tl_not_type_specific_seq { \keys_define:nn { zref-clever/typesetup } { @@ -3965,11 +4211,11 @@ } } \seq_map_inline:Nn - \c_@@_rf_opts_tl_typesetup_seq + \g_@@_rf_opts_tl_typesetup_seq { \keys_define:nn { zref-clever/typesetup } { - #1 .default:x = \c_novalue_tl , + #1 .default:o = \c_novalue_tl , #1 .code:n = { \tl_if_novalue:nTF {##1} @@ -3981,7 +4227,7 @@ } } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } {#1} { tl } @@ -3999,12 +4245,12 @@ { { ref } { - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangefunc } { tl } } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangeprop } { tl } @@ -4013,13 +4259,13 @@ { stripprefix } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangefunc } { tl } } { @@_get_endrange_stripprefix } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangeprop } { tl } @@ -4028,13 +4274,13 @@ { pagecomp } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangefunc } { tl } } { @@_get_endrange_pagecomp } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangeprop } { tl } @@ -4043,13 +4289,13 @@ { pagecomp2 } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangefunc } { tl } } { @@_get_endrange_pagecomptwo } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangeprop } { tl } @@ -4083,14 +4329,14 @@ { endrange-property-undefined } {#1} } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangefunc } { tl } } { @@_get_endrange_property } - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } @@ -4131,11 +4377,11 @@ } , } \seq_map_inline:Nn - \c_@@_rf_opts_seq_refbounds_seq + \g_@@_rf_opts_seq_refbounds_seq { \keys_define:nn { zref-clever/typesetup } { - #1 .default:x = \c_novalue_tl , + #1 .default:o = \c_novalue_tl , #1 .code:n = { \tl_if_novalue:nTF {##1} @@ -4154,7 +4400,7 @@ { \tl_if_empty_p:n {##1} } { \int_compare_p:nNn { \seq_count:N \l_tmpa_seq } = { 4 } } { - \seq_set_eq:cN + \@@_opt_seq_set_eq:cN { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } {#1} { seq } @@ -4171,14 +4417,14 @@ } } \seq_map_inline:Nn - \c_@@_rf_opts_bool_maybe_type_specific_seq + \g_@@_rf_opts_bool_maybe_type_specific_seq { \keys_define:nn { zref-clever/typesetup } { #1 .choice: , #1 / true .code:n = { - \bool_set_true:c + \@@_opt_bool_set_true:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } @@ -4187,7 +4433,7 @@ } , #1 / false .code:n = { - \bool_set_false:c + \@@_opt_bool_set_false:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } @@ -4300,7 +4546,7 @@ } , case .value_required:n = true , - gender .default:x = \c_novalue_tl , + gender .value_required:n = true , gender .code:n = { \seq_if_empty:NTF \l_@@_lang_gender_seq @@ -4315,69 +4561,46 @@ { option-only-type-specific } { gender } } { - \tl_if_novalue:nTF {#1} + \seq_clear:N \l_tmpa_seq + \clist_map_inline:nn {#1} { - \@@_opt_seq_gunset:c + \seq_if_in:NnTF \l_@@_lang_gender_seq {##1} + { \seq_put_right:Nn \l_tmpa_seq {##1} } { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - { gender } - { seq } + \msg_warning:nnxx { zref-clever } + { gender-not-declared } + { \l_@@_setup_language_tl } {##1} } } + \@@_opt_seq_gset_eq:cN { - \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 + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { gender } + { seq } } + \l_tmpa_seq } } } , } \seq_map_inline:Nn - \c_@@_rf_opts_tl_not_type_specific_seq + \g_@@_rf_opts_tl_not_type_specific_seq { \keys_define:nn { zref-clever/langsetup } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_if_novalue:nTF {##1} - { - \@@_opt_tl_gunset:c - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } {#1} { tl } - } - } + \@@_opt_tl_gset:cn { - \tl_gset:cn - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } {#1} { tl } - } - {##1} + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } {#1} { tl } } + {##1} } { \msg_warning:nnn { zref-clever } @@ -4387,7 +4610,7 @@ } } \seq_map_inline:Nn - \c_@@_rf_opts_tl_maybe_type_specific_seq + \g_@@_rf_opts_tl_maybe_type_specific_seq { \keys_define:nn { zref-clever/langsetup } { @@ -4396,50 +4619,29 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_if_novalue:nTF {##1} - { - \@@_opt_tl_gunset:c - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } {#1} { tl } - } - } + \@@_opt_tl_gset:cn { - \tl_gset:cn - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } {#1} { tl } - } - {##1} + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } {#1} { tl } } + {##1} } { - \tl_if_novalue:nTF {##1} + \@@_opt_tl_gset:cn { - \@@_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} + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + {#1} { tl } } + {##1} } } , } } \keys_define:nn { zref-clever/langsetup } { + endrange .value_required:n = true , endrange .code:n = { \str_case:nnF {#1} @@ -4448,13 +4650,13 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangefunc } { tl } } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4462,14 +4664,14 @@ } } { - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } { endrangefunc } { tl } } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4483,14 +4685,14 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangefunc } { tl } } { @@_get_endrange_stripprefix } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4498,7 +4700,7 @@ } } { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4506,7 +4708,7 @@ { endrangefunc } { tl } } { @@_get_endrange_stripprefix } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4520,14 +4722,14 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangefunc } { tl } } { @@_get_endrange_pagecomp } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4535,7 +4737,7 @@ } } { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4543,7 +4745,7 @@ { endrangefunc } { tl } } { @@_get_endrange_pagecomp } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4557,14 +4759,14 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangefunc } { tl } } { @@_get_endrange_pagecomptwo } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4572,7 +4774,7 @@ } } { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4580,42 +4782,7 @@ { endrangefunc } { tl } } { @@_get_endrange_pagecomptwo } - \tl_gclear:c - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - { endrangeprop } { tl } - } - } - } - - { unset } - { - \tl_if_empty:NTF \l_@@_setup_type_tl - { - \@@_opt_tl_gunset:c - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } - { endrangefunc } { tl } - } - \@@_opt_tl_gunset:c - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } - { endrangeprop } { tl } - } - } - { - \@@_opt_tl_gunset:c - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - { endrangefunc } { tl } - } - \@@_opt_tl_gunset:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4640,14 +4807,14 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangefunc } { tl } } { @@_get_endrange_property } - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4656,7 +4823,7 @@ {#1} } { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4664,7 +4831,7 @@ { endrangefunc } { tl } } { @@_get_endrange_property } - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4677,7 +4844,6 @@ } } } , - endrange .value_required:n = true , } \keys_define:nn { zref-clever/langsetup } { @@ -4707,7 +4873,7 @@ } , } \seq_map_inline:Nn - \c_@@_rf_opts_tl_type_names_seq + \g_@@_rf_opts_tl_type_names_seq { \keys_define:nn { zref-clever/langsetup } { @@ -4720,130 +4886,96 @@ { option-only-type-specific } {#1} } { - \tl_if_novalue:nTF {##1} + \tl_if_empty:NTF \l_@@_lang_decl_case_tl { - \@@_opt_tl_gunset:c + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } {#1} { tl } } + {##1} } { - \tl_if_empty:NTF \l_@@_lang_decl_case_tl + \@@_opt_tl_gset:cn { - \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} + \@@_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 + \g_@@_rf_opts_seq_refbounds_seq { \keys_define:nn { zref-clever/langsetup } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_if_novalue:nTF {##1} + \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 } + } { - \@@_opt_seq_gunset:c + \@@_opt_seq_gset_eq:cN { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } {#1} { seq } } + \g_tmpa_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 } - } + \msg_warning:nnxx { zref-clever } + { refbounds-must-be-four } + {#1} { \seq_count:N \g_tmpa_seq } } } { - \tl_if_novalue:nTF {##1} + \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} } { - \@@_opt_seq_gunset:c + \int_compare_p:nNn + { \seq_count:N \g_tmpa_seq } = { 4 } + } + { + \@@_opt_seq_gset_eq:cN { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } {#1} { seq } } + \g_tmpa_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 } - } + \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 + \g_@@_rf_opts_bool_maybe_type_specific_seq { \keys_define:nn { zref-clever/langsetup } { @@ -4852,7 +4984,7 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \bool_gset_true:c + \@@_opt_bool_gset_true:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4860,7 +4992,7 @@ } } { - \bool_gset_true:c + \@@_opt_bool_gset_true:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4873,28 +5005,7 @@ { \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_bool_gset_false:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4902,7 +5013,7 @@ } } { - \@@_opt_bool_gunset:c + \@@_opt_bool_gset_false:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } diff --git a/macros/latex/contrib/zref-clever/zref-clever.pdf b/macros/latex/contrib/zref-clever/zref-clever.pdf Binary files differindex f623839df6..2b439d1d54 100644 --- a/macros/latex/contrib/zref-clever/zref-clever.pdf +++ b/macros/latex/contrib/zref-clever/zref-clever.pdf diff --git a/macros/latex/contrib/zref-clever/zref-clever.tex b/macros/latex/contrib/zref-clever/zref-clever.tex index 3079e6384a..e26992005d 100644 --- a/macros/latex/contrib/zref-clever/zref-clever.tex +++ b/macros/latex/contrib/zref-clever/zref-clever.tex @@ -2304,6 +2304,7 @@ were generously provided by (in chronological order): % 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 + % 2022-01-11: https://tex.stackexchange.com/questions/633341/#comment1579825_633347 Enrico Gregorio, % 2021-08-20: https://tex.stackexchange.com/a/611385 % 2021-08-20: https://tex.stackexchange.com/q/611370/#comment1529282_611385 diff --git a/macros/latex/contrib/zref-vario/CHANGELOG.md b/macros/latex/contrib/zref-vario/CHANGELOG.md index 256cf2d24a..512c7e6c4e 100644 --- a/macros/latex/contrib/zref-vario/CHANGELOG.md +++ b/macros/latex/contrib/zref-vario/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/zref-vario/compare/v0.1.2-alpha...HEAD) +## [Unreleased](https://github.com/gusbrs/zref-vario/compare/v0.1.3-alpha...HEAD) + +## [v0.1.3-alpha](https://github.com/gusbrs/zref-vario/compare/v0.1.2-alpha...v0.1.3-alpha) (2022-02-11) + +### Changed +- (Internal) Option variables setting was reviewed, ensuring proper scope is + in use and that they are always properly declared. `expl3` debugging + enabled in regression tests. ## [v0.1.2-alpha](https://github.com/gusbrs/zref-vario/compare/v0.1.1-alpha...v0.1.2-alpha) (2022-02-08) diff --git a/macros/latex/contrib/zref-vario/zref-vario-code.pdf b/macros/latex/contrib/zref-vario/zref-vario-code.pdf Binary files differindex 64dcae0165..fe8c46ac95 100644 --- a/macros/latex/contrib/zref-vario/zref-vario-code.pdf +++ b/macros/latex/contrib/zref-vario/zref-vario-code.pdf diff --git a/macros/latex/contrib/zref-vario/zref-vario.dtx b/macros/latex/contrib/zref-vario/zref-vario.dtx index 17c01eed42..2c0aa78192 100644 --- a/macros/latex/contrib/zref-vario/zref-vario.dtx +++ b/macros/latex/contrib/zref-vario/zref-vario.dtx @@ -128,7 +128,7 @@ % % Identify the package. % \begin{macrocode} -\ProvidesExplPackage {zref-vario} {2022-02-08} {0.1.2-alpha} +\ProvidesExplPackage {zref-vario} {2022-02-11} {0.1.3-alpha} {Extended LaTeX page cross-references with varioref and zref-clever} % \end{macrocode} % @@ -342,11 +342,21 @@ % % % \begin{macrocode} +\cs_new_protected:Npn \@@_opt_tl_gset:Nn #1#2 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gset:Nn #1 {#2} + } +\cs_generate_variant:Nn \@@_opt_tl_gset:Nn { cn } +% \end{macrocode} +% +% \begin{macrocode} \keys_define:nn { zref-vario/langsetup } { reftextfaceafter .code:n = { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_ref_opt_name_lang_tl:en { \l_@@_setup_language_tl } @@ -355,7 +365,7 @@ } , reftextfacebefore .code:n = { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_ref_opt_name_lang_tl:en { \l_@@_setup_language_tl } @@ -364,7 +374,7 @@ } , reftextafter .code:n = { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_ref_opt_name_lang_tl:en { \l_@@_setup_language_tl } @@ -373,7 +383,7 @@ } , reftextbefore .code:n = { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_ref_opt_name_lang_tl:en { \l_@@_setup_language_tl } @@ -382,7 +392,7 @@ } , reftextcurrent .code:n = { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_ref_opt_name_lang_tl:en { \l_@@_setup_language_tl } @@ -603,7 +613,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_vref_pagenum:Nn #1#2 { - \exp_args:NNNo \exp_args:NNo \tl_set:Nn #1 + \exp_args:NNNo \exp_args:NNo \def #1 { \zref@extractdefault {#2} { page } { ?? } } } \cs_new_protected:Npn \@@_vrefpagenum:Nn #1#2 diff --git a/macros/latex/contrib/zref-vario/zref-vario.pdf b/macros/latex/contrib/zref-vario/zref-vario.pdf Binary files differindex df3d54ed30..c0f262ac85 100644 --- a/macros/latex/contrib/zref-vario/zref-vario.pdf +++ b/macros/latex/contrib/zref-vario/zref-vario.pdf |