texlive[60527] Master/texmf-dist: zref-check (17sep21)

commits+karl at tug.org commits+karl at tug.org
Sat Sep 18 00:07:41 CEST 2021


Revision: 60527
          http://tug.org/svn/texlive?view=revision&revision=60527
Author:   karl
Date:     2021-09-18 00:07:40 +0200 (Sat, 18 Sep 2021)
Log Message:
-----------
zref-check (17sep21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/zref-check/CHANGELOG.md
    trunk/Master/texmf-dist/doc/latex/zref-check/zref-check-code.pdf
    trunk/Master/texmf-dist/doc/latex/zref-check/zref-check.pdf
    trunk/Master/texmf-dist/source/latex/zref-check/zref-check.dtx
    trunk/Master/texmf-dist/tex/latex/zref-check/zref-check.sty

Modified: trunk/Master/texmf-dist/doc/latex/zref-check/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/zref-check/CHANGELOG.md	2021-09-17 22:07:10 UTC (rev 60526)
+++ trunk/Master/texmf-dist/doc/latex/zref-check/CHANGELOG.md	2021-09-17 22:07:40 UTC (rev 60527)
@@ -1,7 +1,20 @@
 # Changelog
 
-## [Unreleased](https://github.com/gusbrs/zref-check/compare/v0.2.0...HEAD)
+## [Unreleased](https://github.com/gusbrs/zref-check/compare/v0.2.1...HEAD)
 
+## [v0.2.1](https://github.com/gusbrs/zref-check/compare/v0.2.0...v0.2.1) (2021-09-16)
+
+### Changed
+- Use `\msg_line_context:` instead of `\msg_line_number:` for messages.
+- Use more efficient way to set checks as option keys in `\zcheck`.
+- Spare setting end label in `\zcheck` for checks which don't need it.
+- Separate `zref` property lists for checks and targets, so that only the
+  minimum set of required properties for each are used.
+
+### Added
+- New `pagegap` check.
+- Provide infrastructure for integration with `zref-clever`.
+
 ## [v0.2.0](https://github.com/gusbrs/zref-check/compare/v0.1.0...v0.2.0) (2021-08-17)
 
 ### Changed

Modified: trunk/Master/texmf-dist/doc/latex/zref-check/zref-check-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/zref-check/zref-check.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/zref-check/zref-check.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/zref-check/zref-check.dtx	2021-09-17 22:07:10 UTC (rev 60526)
+++ trunk/Master/texmf-dist/source/latex/zref-check/zref-check.dtx	2021-09-17 22:07:40 UTC (rev 60527)
@@ -231,6 +231,10 @@
 % \item[nextpage] \meta{label} occurs on the next page relative to
 %   \cs{zcheck}.
 %
+% \item[pagegap] There is a page gap between \meta{label} and \cs{zcheck}, in
+%   other words, \meta{label} does \emph{not} occur on \opt{thispage},
+%   \opt{prevpage} or \opt{nextpage}.
+%
 % \item[facing] On a \texttt{twoside} document, both \meta{label} and
 %   \cs{zcheck} fall onto a double spread, each on one of the two facing
 %   pages.
@@ -512,6 +516,16 @@
 % may be needed for these checks to work as expected.
 %
 %
+%
+% \section{Change history}
+%
+% A change log with relevant changes for each version, eventual upgrade
+% instructions, and upcoming changes, is maintained in the package's
+% repository, at
+% \url{https://github.com/gusbrs/zref-check/blob/main/CHANGELOG.md}.
+%
+%
+%
 % \end{documentation}
 %
 %
@@ -549,7 +563,7 @@
 %
 % Identify the package.
 %    \begin{macrocode}
-\ProvidesExplPackage {zref-check} {2021-08-17} {0.2.0}
+\ProvidesExplPackage {zref-check} {2021-09-16} {0.2.1}
   {Flexible cross-references with contextual checks based on zref}
 %    \end{macrocode}
 %
@@ -600,18 +614,33 @@
 %    \end{macrocode}
 %
 %
-% This is the list of properties to be used by \pkg{zref-check}, that is, the
-% list of properties the references and targets store.  This is the minimum
-% set required, more properties may be added according to options.
+% These are the lists of properties to be used by \pkg{zref-check}, that is,
+% the list of properties the references and targets store.  This is the
+% minimum set required, more properties may be added according to options.
 %    \begin{macrocode}
-\zref at newlist { zrefcheck }
-\zref at addprops { zrefcheck }
+\zref at newlist { zrefcheck-check }
+\zref at addprops { zrefcheck-check }
   {
-    page ,
+    page , % for messages
     abspage ,
     zc at abschap ,
     zc at abssec
   }
+\zref at newlist { zrefcheck-target }
+\zref at addprops { zrefcheck-target }
+  {
+    page , % so that \zpageref can refer to it
+    abspage ,
+    zc at abschap ,
+    zc at abssec
+  }
+\zref at newlist { zrefcheck-end }
+\zref at addprops { zrefcheck-end }
+  {
+    abspage ,
+    zc at abschap ,
+    zc at abssec
+  }
 %    \end{macrocode}
 %
 %
@@ -621,7 +650,7 @@
 %
 % \begin{macro}{\@@_message:nnnn, \@@_message:nnnx}
 %    \begin{macrocode}
-\cs_new:Npn \@@_message:nnnn #1#2#3#4
+\cs_new_protected:Npn \@@_message:nnnn #1#2#3#4
   {
     \use:c { msg_ \l_@@_msglevel_tl :nnnnn }
       { zref-check } {#1} {#2} {#3} {#4}
@@ -632,29 +661,20 @@
 %
 %    \begin{macrocode}
 \msg_new:nnn { zref-check } { check-failed }
-  {
-    Failed~check~'#1'~for~label~'#2' \iow_newline:
-    on~page~#3~on~input~line~\msg_line_number:.
-  }
+  { Failed~check~'#1'~for~label~'#2'~on~page~#3~\msg_line_context:. }
 \msg_new:nnn { zref-check } { double-check }
-  {
-    Double-check~'#1'~for~label~'#2' \iow_newline:
-    on~page~#3~on~input~line~\msg_line_number:.
-  }
+  { Double-check~'#1'~for~label~'#2'~on~page~#3~\msg_line_context:. }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
 \msg_new:nnn { zref-check } { check-missing }
-  { Check~'#1'~not~defined~on~input~line~\msg_line_number:. }
+  { Check~'#1'~not~defined~\msg_line_context:. }
 \msg_new:nnn { zref-check } { property-undefined }
-  { Property~'#1'~not~defined~on~input~line~\msg_line_number:. }
+  { Property~'#1'~not~defined~\msg_line_context:. }
 \msg_new:nnn { zref-check } { property-not-in-label }
-  { Label~'#1'~has~no~property~'#2'~on~input~line~\msg_line_number:. }
+  { Label~'#1'~has~no~property~'#2'~\msg_line_context:. }
 \msg_new:nnn { zref-check } { property-not-integer }
-  {
-    Property~'#1'~for~label~'#2'~not~an~integer \iow_newline:
-    on~input~line~\msg_line_number:.
-  }
+  { Property~'#1'~for~label~'#2'~not~an~integer~\msg_line_context:. }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -671,14 +691,11 @@
     Use~option~'msglevel'~instead.
   }
 \msg_new:nnn { zref-check } { option-preamble-only }
-  {
-    Option~'#1'~only~available~in~the~preamble \iow_newline:
-    on~input~line~\msg_line_number:.
-  }
+  { Option~'#1'~only~available~in~the~preamble~\msg_line_context:. }
 \msg_new:nnn { zref-check } { closerange-not-positive-integer }
   {
-    Option~'closerange'~not~a~positive~integer \iow_newline:
-    on~input~line~\msg_line_number:.~Using~default~value.
+    Option~'closerange'~not~a~positive~integer~\msg_line_context:.~
+    Using~default~value.
   }
 \msg_new:nnn { zref-check } { labelcmd-undefined }
   {
@@ -781,7 +798,7 @@
         \bool_if:NT \l_@@_use_hyperref_bool
           {
             \RequirePackage { zref-hyperref }
-            \zref at addprop { zrefcheck } { anchor }
+            \zref at addprop { zrefcheck-target } { anchor }
           }
       }
       {
@@ -930,8 +947,8 @@
 %   and \texttt{zcregion}.  It may be redefined at \texttt{begindocument}
 %   according to option \opt{labelcmd}.
 %    \begin{macrocode}
-\cs_new:Npn \@@_target_label:n #1
-  { \zref at labelbylist {#1} { zrefcheck } }
+\cs_new_protected:Npn \@@_target_label:n #1
+  { \zref at labelbylist {#1} { zrefcheck-target } }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -944,7 +961,7 @@
           { \tl_clear:N \l_@@_target_label_tl }
         \cs_if_exist:cTF { \l_@@_target_label_tl }
           {
-            \cs_set:Npx \@@_target_label:n #1
+            \cs_set_protected:Npx \@@_target_label:n #1
               {
                 \exp_not:o
                   { \cs:w \l_@@_target_label_tl \cs_end: }
@@ -952,7 +969,7 @@
               }
           }
           {
-            \exp_args:NnnV \msg_warning:nnn { zref-check }
+            \exp_args:Nnno \msg_warning:nnn { zref-check }
               { labelcmd-undefined } { \l_@@_target_label_tl }
           }
       }
@@ -1214,9 +1231,11 @@
 %   property values as arguments in the checks, however we use here a number
 %   of non-expandable operations.  Hence, we receive a local \texttt{tl/int}
 %   variable as third argument and set that, so that it is available (and
-%   expandable) at the place of use.  For this reason, we do not group here,
-%   because we are passing a local variable around, but it is expected this
-%   function will be called within a group.
+%   expandable) at the place of use, and also make these functions `protected'
+%   (see egreg's \url{https://tex.stackexchange.com/a/572903}: ``a function
+%   that performs assignments should be \texttt{protected}'').  For this
+%   reason, we do not group here, because we are passing a local variable
+%   around, but it is expected this function will be called within a group.
 %
 %   We're returning \cs{c_empty_tl} in case of failure to find the intended
 %   property value (explicitly in \cs{zref at extractdefault}, but that is also
@@ -1226,7 +1245,7 @@
 %     \cs{zrefcheck_get_astl:nnn} \Arg{label} \Arg{prop} \Arg{tl var}
 %   \end{syntax}
 %    \begin{macrocode}
-\cs_new:Npn \zrefcheck_get_astl:nnn #1#2#3
+\cs_new_protected:Npn \zrefcheck_get_astl:nnn #1#2#3
   {
     \tl_clear:N #3
     \tl_if_eq:nnTF {#2} { lblseq }
@@ -1308,7 +1327,7 @@
 %     \cs{zrefcheck_get_asint:nnn} \Arg{label} \Arg{prop} \Arg{int var}
 %   \end{syntax}
 %    \begin{macrocode}
-\cs_new:Npn \zrefcheck_get_asint:nnn #1#2#3
+\cs_new_protected:Npn \zrefcheck_get_asint:nnn #1#2#3
   {
     \zrefcheck_get_astl:nnn {#1} {#2} { \l_@@_propval_tl }
     \@@_is_integer:nTF { \l_@@_propval_tl }
@@ -1357,8 +1376,7 @@
 %   \end{syntax}
 %
 %    \begin{macrocode}
-\NewDocumentCommand \zcheck
-  { s O { } > { \SplitList { , } } m m }
+\NewDocumentCommand \zcheck { s O { } m m }
   { \zref at wrapper@babel \@@_zcheck:nnnn {#3} {#1} {#2} {#4} }
 %    \end{macrocode}
 % \end{macro}
@@ -1366,17 +1384,17 @@
 %
 % \begin{variable}
 %   {
+%     \l_@@_zcheck_labels_seq ,
 %     \g_@@_id_int ,
 %     \l_@@_checkbeg_tl ,
-%     \l_@@_checkend_tl ,
 %     \l_@@_link_label_tl ,
 %     \l_@@_link_anchor_tl ,
 %     \l_@@_link_star_bool
 %   }
 %    \begin{macrocode}
+\seq_new:N \l_@@_zcheck_labels_seq
 \int_new:N \g_@@_id_int
 \tl_new:N \l_@@_checkbeg_tl
-\tl_new:N \l_@@_checkend_tl
 \tl_new:N \l_@@_link_label_tl
 \tl_new:N \l_@@_link_anchor_tl
 \bool_new:N \l_@@_link_star_bool
@@ -1395,29 +1413,24 @@
 %   \end{syntax}
 %
 %    \begin{macrocode}
-\cs_new:Npn \@@_zcheck:nnnn #1#2#3#4
+\cs_new_protected:Npn \@@_zcheck:nnnn #1#2#3#4
   {
     \group_begin:
 %    \end{macrocode}
-% Set checks keys.
-%    \begin{macrocode}
-      \@@_set_checks_keys:
-%    \end{macrocode}
 % Process local options and checks.
 %    \begin{macrocode}
-      \keys_set:nn { zref-check } {#3}
+      \keys_set:nn { zref-check / zcheck } {#3}
+      \seq_set_from_clist:Nn \l_@@_zcheck_labels_seq {#1}
 %    \end{macrocode}
-% Names of the labels for this zrefcheck call.
+% Names of the labels for this zcheck call.
 %    \begin{macrocode}
       \int_gincr:N \g_@@_id_int
       \tl_set:Nx \l_@@_checkbeg_tl
         { \@@_check_lblfmt:n { \g_@@_id_int } }
-      \tl_set:Nx \l_@@_checkend_tl
-        { \@@_end_lblfmt:n { \l_@@_checkbeg_tl } }
 %    \end{macrocode}
 % Set checkbeg label.
 %    \begin{macrocode}
-      \zref at labelbylist { \l_@@_checkbeg_tl } { zrefcheck }
+      \zref at labelbylist { \l_@@_checkbeg_tl } { zrefcheck-check }
 %    \end{macrocode}
 % Typeset \marg{text}, with hyperlink when appropriate.  Even though the first
 % argument can receive a list of labels, there is no meaningful way to set
@@ -1424,7 +1437,7 @@
 % links to multiple targets.  Hence, only the first one is considered for
 % hyperlinking.
 %    \begin{macrocode}
-      \tl_set:Nn \l_@@_link_label_tl { \tl_head:n {#1} }
+      \seq_get:NN \l_@@_zcheck_labels_seq \l_@@_link_label_tl
       \bool_set:Nn \l_@@_link_star_bool {#2}
       \zref at ifrefundefined { \l_@@_link_label_tl }
 %    \end{macrocode}
@@ -1448,16 +1461,21 @@
 %    \end{macrocode}
 % Set checkend label.
 %    \begin{macrocode}
-      \zref at labelbylist { \l_@@_checkend_tl } { zrefcheck }
+      \bool_if:NT \l_@@_zcheck_end_label_bool
+        {
+          \zref at labelbylist
+            { \@@_end_lblfmt:n { \l_@@_checkbeg_tl } }
+            { zrefcheck-end }
+        }
 %    \end{macrocode}
 % Check if \meta{labels} are defined.
 %    \begin{macrocode}
-      \tl_map_function:nN {#1} \zref at refused
+      \seq_map_function:NN \l_@@_zcheck_labels_seq \zref at refused
 %    \end{macrocode}
 % Run the checks.
 %    \begin{macrocode}
-      \@@_run_checks:nnv
-        { \l_@@_zcheck_checks_seq } {#1} { l_@@_checkbeg_tl }
+      \@@_run_checks:nnx { \l_@@_zcheck_checks_seq }
+        { \l_@@_zcheck_labels_seq } { \l_@@_checkbeg_tl }
     \group_end:
   }
 %    \end{macrocode}
@@ -1483,7 +1501,7 @@
     \zref at wrapper@babel \@@_target_label:n {#1}
     #2
     \zref at wrapper@babel
-      \zref at labelbylist { \@@_end_lblfmt:n {#1} } { zrefcheck }
+      \zref at labelbylist { \@@_end_lblfmt:n {#1} } { zrefcheck-end }
     \group_end:
   }
 %    \end{macrocode}
@@ -1503,7 +1521,7 @@
   }
   {
     \zref at wrapper@babel
-      \zref at labelbylist { \@@_end_lblfmt:n {#1} } { zrefcheck }
+      \zref at labelbylist { \@@_end_lblfmt:n {#1} } { zrefcheck-end }
   }
 %    \end{macrocode}
 % \end{macro}
@@ -1516,7 +1534,7 @@
 %
 % First, a conditional function defined with:
 %
-% \cs{prg_new_conditional:Npnn} \cs{@@_check_\meta{check}:nn} |#1#2 { F }|
+% \cs{prg_new_protected_conditional:Npnn} \cs{@@_check_\meta{check}:nn} |#1#2 { F }|
 %
 % \noindent where \meta{check} is the name of the check, the first argument is
 % the \Arg{label} and the second the \Arg{reference}.  The existence of the
@@ -1545,138 +1563,115 @@
 % \cs{zref at addprop} and friends, as usual.
 %
 % Third, the check must be registered as a key which gets setup in
-% \cs{zcheck} by \cs{@@_set_checks_keys:}.
+% \cs{zcheck} by the \texttt{ zref-check / zcheck } key set.
 %
+% Fourth, if the check requires only a single label to work, it should be
+% registered in \cs{c_@@_single_label_checks_seq}.
 %
+%
+% \subsection{Single label checks}
+%
+%
+% Some checks do not require an ``end label'' in \cs{zcheck}, notably the
+% sectioning ones, which don't rely on page boundaries.  Hence, in case
+% \cs{zcheck} only calls checks in this set, we can spare the setting of the
+% end label.
+%
+% \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
+  {
+    thischap ,
+    prevchap ,
+    nextchap ,
+    chapsbefore ,
+    chapsafter ,
+    thissec ,
+    prevsec ,
+    nextsec ,
+    secsbefore ,
+    secsafter ,
+  }
+%    \end{macrocode}
+% \end{variable}
+%
+%
+%
 % \subsection{Setup}
 %
-% \begin{variable}{\l_@@_zcheck_checks_seq}
+% \begin{variable}{\l_@@_zcheck_checks_seq,\l_@@_end_label_required_bool}
 %    \begin{macrocode}
 \seq_new:N \l_@@_zcheck_checks_seq
+\bool_new:N \l_@@_zcheck_end_label_bool
 %    \end{macrocode}
 % \end{variable}
 %
-% \begin{macro}{\@@_set_checks_keys:}
+%
+% First, we inherit all the main options into the keys of \texttt{zref-check /
+% zcheck}.
 %    \begin{macrocode}
-\cs_new:Npn \@@_set_checks_keys:
+\keys_define:nn { } { zref-check / zcheck .inherit:n = zref-check }
+%    \end{macrocode}
+%
+% Then we add the checks to it.
+%    \begin{macrocode}
+\clist_map_inline:nn
   {
-    \keys_define:nn  { zref-check }
+    thispage ,
+    prevpage ,
+    nextpage ,
+    facing ,
+    pagegap ,
+    above ,
+    below ,
+    pagesbefore ,
+    ppbefore ,
+    pagesafter ,
+    ppafter ,
+    before ,
+    after ,
+    thischap ,
+    prevchap ,
+    nextchap ,
+    chapsbefore ,
+    chapsafter ,
+    thissec ,
+    prevsec ,
+    nextsec ,
+    secsbefore ,
+    secsafter ,
+    close ,
+    far ,
+  }
+  {
+    \keys_define:nn { zref-check / zcheck }
       {
-        thispage .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { thispage } } ,
-        thispage .value_forbidden:n = true ,
-
-        prevpage .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { prevpage } } ,
-        prevpage .value_forbidden:n = true ,
-
-        nextpage .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { nextpage } } ,
-        nextpage .value_forbidden:n = true ,
-
-        facing .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { facing } } ,
-        facing .value_forbidden:n = true ,
-
-        above .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { above } } ,
-        above .value_forbidden:n = true ,
-
-        below .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { below } } ,
-        below .value_forbidden:n = true ,
-
-        pagesbefore .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { pagesbefore } } ,
-        pagesbefore .value_forbidden:n = true ,
-
-        ppbefore .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { ppbefore } } ,
-        ppbefore .value_forbidden:n = true ,
-
-        pagesafter .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { pagesafter } } ,
-        pagesafter .value_forbidden:n = true ,
-
-        ppafter .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { ppafter } } ,
-        ppafter .value_forbidden:n = true ,
-
-        before .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { before } } ,
-        before .value_forbidden:n = true ,
-
-        after .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { after } } ,
-        after .value_forbidden:n = true ,
-
-        thischap .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { thischap } } ,
-        thischap .value_forbidden:n = true ,
-
-        prevchap .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { prevchap } } ,
-        prevchap .value_forbidden:n = true ,
-
-        nextchap .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { nextchap } } ,
-        nextchap .value_forbidden:n = true ,
-
-        chapsbefore .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { chapsbefore } } ,
-        chapsbefore .value_forbidden:n = true ,
-
-        chapsafter .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { chapsafter } } ,
-        chapsafter .value_forbidden:n = true ,
-
-        thissec .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { thissec } } ,
-        thissec .value_forbidden:n = true ,
-
-        prevsec .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { prevsec } } ,
-        prevsec .value_forbidden:n = true ,
-
-        nextsec .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { nextsec } } ,
-        nextsec .value_forbidden:n = true ,
-
-        secsbefore .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { secsbefore } } ,
-        secsbefore .value_forbidden:n = true ,
-
-        secsafter .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { secsafter } } ,
-        secsafter .value_forbidden:n = true ,
-
-        close .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { close } } ,
-        close .value_forbidden:n = true ,
-
-        far .code:n =
-          { \seq_put_right:Nn \l_@@_zcheck_checks_seq { far } } ,
-        far .value_forbidden:n = true ,
-      }
+        #1 .code:n =
+          {
+            \seq_put_right:Nn \l_@@_zcheck_checks_seq {#1}
+            \seq_if_in:NnF \c_@@_single_label_checks_seq {#1}
+              { \bool_set_true:N \l_@@_zcheck_end_label_bool }
+          } ,
+        #1 .value_forbidden:n = true ,
+     }
   }
 %    \end{macrocode}
-% \end{macro}
 %
 %
 %
-%
 % \subsection{Running}
 %
-% \begin{macro}{\@@_run_checks:nnn, \@@_run_checks:nnv}
+% \begin{macro}{\@@_run_checks:nnn}
 %   \begin{syntax}
 %     \cs{@@_run_checks:nnn} \Arg{checks} \Arg{labels} \Arg{reference}
 %   \end{syntax}
 %   \meta{checks} are expected to be received as a sequence variable.
 %    \begin{macrocode}
-\cs_new:Npn \@@_run_checks:nnn #1#2#3
+\cs_new_protected:Npn \@@_run_checks:nnn #1#2#3
   {
     \group_begin:
-      \tl_map_inline:nn {#2}
+      \seq_map_inline:Nn #2
         {
           \seq_map_inline:Nn #1
             { \@@_do_check:nnn {####1} {##1} {#3} }
@@ -1683,7 +1678,7 @@
         }
     \group_end:
   }
-\cs_generate_variant:Nn \@@_run_checks:nnn { nnv }
+\cs_generate_variant:Nn \@@_run_checks:nnn { nnx }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1714,7 +1709,7 @@
 %     \cs{@@_do_check:nnn} \Arg{check} \Arg{label beg} \Arg{reference beg}
 %   \end{syntax}
 %    \begin{macrocode}
-\cs_new:Npn \@@_do_check:nnn #1#2#3
+\cs_new_protected:Npn \@@_do_check:nnn #1#2#3
   {
     \group_begin:
 %    \end{macrocode}
@@ -1732,37 +1727,45 @@
               \bool_set_false:N \l_@@_onpage_bool
               \cs_if_exist:cTF { @@_check_ #1 :nnF }
                 {
-%    \end{macrocode}
-% ``label beg'' vs ``reference beg''.
-%    \begin{macrocode}
+                  % ``label beg'' vs ``reference beg''.
                   \use:c { @@_check_ #1 :nnF }
                     {#2} {#3}
                     { \bool_set_false:N \l_@@_passedcheck_bool }
-%    \end{macrocode}
-% ``label beg'' vs ``reference end''.
-%    \begin{macrocode}
-                  \exp_args:Nnno \use:c { @@_check_ #1 :nnF }
-                    {#2} { \@@_end_lblfmt:n {#3} }
-                    { \bool_set_false:N \l_@@_passedcheck_bool }
-%    \end{macrocode}
-% ``label end'' \emph{may} have been created by the target commands.
-%    \begin{macrocode}
-                  \zref at ifrefundefined { \@@_end_lblfmt:n {#2} }
-                    {}
+                  % ``reference end'' \emph{may} exist or not depending on the
+                  % checks.
+                  \zref at ifrefundefined { \@@_end_lblfmt:n {#3} }
                     {
-%    \end{macrocode}
-% ``label end'' vs ``reference beg''.
-%    \begin{macrocode}
-                      \exp_args:Nno \use:c { @@_check_ #1 :nnF }
-                        { \@@_end_lblfmt:n {#2} } {#3}
+                      % ``label end'' \emph{may} have been created by the
+                      % target commands.
+                      \zref at ifrefundefined { \@@_end_lblfmt:n {#2} }
+                        {}
+                        {
+                          % ``label end'' vs ``reference beg''.
+                          \exp_args:Nno \use:c { @@_check_ #1 :nnF }
+                            { \@@_end_lblfmt:n {#2} } {#3}
+                            { \bool_set_false:N \l_@@_passedcheck_bool }
+                        }
+                    }
+                    {
+                      % ``label beg'' vs ``reference end''.
+                      \exp_args:Nnno \use:c { @@_check_ #1 :nnF }
+                        {#2} { \@@_end_lblfmt:n {#3} }
                         { \bool_set_false:N \l_@@_passedcheck_bool }
-%    \end{macrocode}
-% ``label end'' vs ``reference end''.
-%    \begin{macrocode}
-                      \exp_args:Nnoo \use:c { @@_check_ #1 :nnF }
-                        { \@@_end_lblfmt:n {#2} }
-                        { \@@_end_lblfmt:n {#3} }
-                        { \bool_set_false:N \l_@@_passedcheck_bool }
+                      % ``label end'' \emph{may} have been created by the
+                      % target commands.
+                      \zref at ifrefundefined { \@@_end_lblfmt:n {#2} }
+                        {}
+                        {
+                          % ``label end'' vs ``reference beg''.
+                          \exp_args:Nno \use:c { @@_check_ #1 :nnF }
+                            { \@@_end_lblfmt:n {#2} } {#3}
+                            { \bool_set_false:N \l_@@_passedcheck_bool }
+                          % ``label end'' vs ``reference end''.
+                          \exp_args:Nnoo \use:c { @@_check_ #1 :nnF }
+                            { \@@_end_lblfmt:n {#2} }
+                            { \@@_end_lblfmt:n {#3} }
+                            { \bool_set_false:N \l_@@_passedcheck_bool }
+                        }
                     }
 %    \end{macrocode}
 % Handle option \opt{onpage=msg}.  This is only granted for tests which
@@ -1839,7 +1842,7 @@
 %
 % \begin{macro}{\@@_check_thispage:nn}
 %    \begin{macrocode}
-\prg_new_conditional:Npnn \@@_check_thispage:nn #1#2 { T , F , TF }
+\prg_new_protected_conditional:Npnn \@@_check_thispage:nn #1#2 { T , F , TF }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -1871,7 +1874,7 @@
 %
 % \begin{macro}{\@@_check_above:nn, \@@_check_below:nn}
 %    \begin{macrocode}
-\prg_new_conditional:Npnn \@@_check_above:nn #1#2 { F , TF }
+\prg_new_protected_conditional:Npnn \@@_check_above:nn #1#2 { F , TF }
   {
     \group_begin:
       \@@_check_thispage:nnTF {#1} {#2}
@@ -1893,7 +1896,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \@@_check_below:nn #1#2 { F , TF }
+\prg_new_protected_conditional:Npnn \@@_check_below:nn #1#2 { F , TF }
   {
     \@@_check_thispage:nnTF {#1} {#2}
       {
@@ -1911,7 +1914,7 @@
 %
 % \begin{macro}{\@@_check_before:nn, \@@_check_after:nn}
 %    \begin{macrocode}
-\prg_new_conditional:Npnn \@@_check_before:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_before:nn #1#2 { F }
   {
     \@@_check_pagesbefore:nnTF {#1} {#2}
       { \prg_return_true: }
@@ -1921,7 +1924,7 @@
           { \prg_return_false: }
       }
   }
-\prg_new_conditional:Npnn \@@_check_after:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_after:nn #1#2 { F }
   {
     \@@_check_pagesafter:nnTF {#1} {#2}
       { \prg_return_true: }
@@ -1945,10 +1948,11 @@
 %     \@@_check_ppbefore:nn ,
 %     \@@_check_pagesafter:nn ,
 %     \@@_check_ppafter:nn ,
+%     \@@_check_pagegap:nn ,
 %     \@@_check_facing:nn
 %   }
 %    \begin{macrocode}
-\prg_new_conditional:Npnn \@@_check_nextpage:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_nextpage:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -1966,7 +1970,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \@@_check_prevpage:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_prevpage:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -1984,7 +1988,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \@@_check_pagesbefore:nn #1#2 { F , TF }
+\prg_new_protected_conditional:Npnn \@@_check_pagesbefore:nn #1#2 { F , TF }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2003,7 +2007,7 @@
     \group_end:
   }
 \cs_new_eq:NN \@@_check_ppbefore:nnF \@@_check_pagesbefore:nnF
-\prg_new_conditional:Npnn \@@_check_pagesafter:nn #1#2 { F , TF }
+\prg_new_protected_conditional:Npnn \@@_check_pagesafter:nn #1#2 { F , TF }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2022,7 +2026,7 @@
     \group_end:
   }
 \cs_new_eq:NN \@@_check_ppafter:nnF \@@_check_pagesafter:nnF
-\prg_new_conditional:Npnn \@@_check_facing:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_pagegap:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2031,6 +2035,24 @@
       \bool_lazy_and:nnTF
         { \l_@@_integer_bool }
         {
+          \int_compare_p:nNn
+            { \int_abs:n { \l_@@_lbl_int - \l_@@_ref_int } } > { 1 } &&
+          ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+          ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+        }
+        { \group_insert_after:N \prg_return_true:  }
+        { \group_insert_after:N \prg_return_false: }
+    \group_end:
+  }
+\prg_new_protected_conditional:Npnn \@@_check_facing:nn #1#2 { F }
+  {
+    \group_begin:
+      \bool_set_true:N \l_@@_integer_bool
+      \zrefcheck_get_asint:nnn {#1} { abspage } { \l_@@_lbl_int }
+      \zrefcheck_get_asint:nnn {#2} { abspage } { \l_@@_ref_int }
+      \bool_lazy_and:nnTF
+        { \l_@@_integer_bool }
+        {
 %    \end{macrocode}
 % There exists no ``facing'' page if the document is not twoside.
 %    \begin{macrocode}
@@ -2065,7 +2087,7 @@
 %
 % \begin{macro}{\@@_check_close:nn, \@@_check_far:nn}
 %    \begin{macrocode}
-\prg_new_conditional:Npnn \@@_check_close:nn #1#2 { F , TF }
+\prg_new_protected_conditional:Npnn \@@_check_close:nn #1#2 { F , TF }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2085,7 +2107,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \@@_check_far:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_far:nn #1#2 { F }
   {
     \@@_check_close:nnTF {#1} {#2}
       { \prg_return_false: }
@@ -2106,7 +2128,7 @@
 %     \@@_check_chapsbefore:nn
 %   }
 %    \begin{macrocode}
-\prg_new_conditional:Npnn \@@_check_thischap:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_thischap:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2132,7 +2154,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \@@_check_nextchap:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_nextchap:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2149,7 +2171,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \@@_check_prevchap:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_prevchap:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2167,7 +2189,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \@@_check_chapsafter:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_chapsafter:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2184,7 +2206,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \@@_check_chapsbefore:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_chapsbefore:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2217,7 +2239,7 @@
 %     \@@_check_secsbefore:nn
 %   }
 %    \begin{macrocode}
-\prg_new_conditional:Npnn \@@_check_thissec:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_thissec:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2247,7 +2269,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \@@_check_nextsec:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_nextsec:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2268,7 +2290,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \@@_check_prevsec:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_prevsec:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2290,7 +2312,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \@@_check_secsafter:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_secsafter:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2311,7 +2333,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \@@_check_secsbefore:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \@@_check_secsbefore:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l_@@_integer_bool
@@ -2337,7 +2359,51 @@
 % \end{macro}
 %
 %
+%
+% \section{\pkg{zref-clever} integration}
+%
+%
+% There are four tasks \pkg{zref-clever} needs to do, in order to offer
+% integration with \pkg{zref-check} from the options of \cs{zcref}: i) set the
+% ``beg label''; ii) set the checks options; iii) run the checks; iv)
+% (possibly) set the ``end label''.  Since `ii)' can be done directly by
+% running |\keys_set:nn { zref-check / zcheck }| on the options received, we
+% provide convenience functions for the other three tasks.
+%
+%
+% \begin{macro}
+%   {
+%     \zrefcheck_zcref_beg_label: ,
+%     \zrefcheck_zcref_end_label_maybe: ,
+%     \zrefcheck_zcref_run_checks_on_labels:n
+%   }
 %    \begin{macrocode}
+\cs_new_protected:Npn \zrefcheck_zcref_beg_label:
+  {
+    \int_gincr:N \g_@@_id_int
+    \tl_set:Nx \l_@@_checkbeg_tl
+      { \@@_check_lblfmt:n { \g_@@_id_int } }
+    \zref at labelbylist { \l_@@_checkbeg_tl } { zrefcheck-check }
+  }
+\cs_new_protected:Npn \zrefcheck_zcref_end_label_maybe:
+  {
+    \bool_if:NT \l_@@_zcheck_end_label_bool
+      {
+        \zref at labelbylist
+          { \@@_end_lblfmt:n { \l_@@_checkbeg_tl } }
+          { zrefcheck-end }
+      }
+  }
+\cs_new_protected:Npn \zrefcheck_zcref_run_checks_on_labels:n #1
+  {
+    \@@_run_checks:nnx
+      { \l_@@_zcheck_checks_seq } {#1} { \l_@@_checkbeg_tl }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%    \begin{macrocode}
 %</package>
 %    \end{macrocode}
 %

Modified: trunk/Master/texmf-dist/tex/latex/zref-check/zref-check.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/zref-check/zref-check.sty	2021-09-17 22:07:10 UTC (rev 60526)
+++ trunk/Master/texmf-dist/tex/latex/zref-check/zref-check.sty	2021-09-17 22:07:40 UTC (rev 60527)
@@ -55,7 +55,7 @@
       }%
     \endinput
   }%
-\ProvidesExplPackage {zref-check} {2021-08-17} {0.2.0}
+\ProvidesExplPackage {zref-check} {2021-09-16} {0.2.1}
   {Flexible cross-references with contextual checks based on zref}
 \RequirePackage { zref-user }
 \RequirePackage { zref-abspage }
@@ -73,41 +73,47 @@
   { \int_gincr:N \g__zrefcheck_abssec_int }
 \zref at newprop { zc at abssec } [0] { \int_use:N \g__zrefcheck_abssec_int }
 \zref at addprop \ZREF at mainlist { zc at abssec }
-\zref at newlist { zrefcheck }
-\zref at addprops { zrefcheck }
+\zref at newlist { zrefcheck-check }
+\zref at addprops { zrefcheck-check }
   {
-    page ,
+    page , % for messages
     abspage ,
     zc at abschap ,
     zc at abssec
   }
-\cs_new:Npn \__zrefcheck_message:nnnn #1#2#3#4
+\zref at newlist { zrefcheck-target }
+\zref at addprops { zrefcheck-target }
   {
+    page , % so that \zpageref can refer to it
+    abspage ,
+    zc at abschap ,
+    zc at abssec
+  }
+\zref at newlist { zrefcheck-end }
+\zref at addprops { zrefcheck-end }
+  {
+    abspage ,
+    zc at abschap ,
+    zc at abssec
+  }
+\cs_new_protected:Npn \__zrefcheck_message:nnnn #1#2#3#4
+  {
     \use:c { msg_ \l__zrefcheck_msglevel_tl :nnnnn }
       { zref-check } {#1} {#2} {#3} {#4}
   }
 \cs_generate_variant:Nn \__zrefcheck_message:nnnn { nnnx }
 \msg_new:nnn { zref-check } { check-failed }
-  {
-    Failed~check~'#1'~for~label~'#2' \iow_newline:
-    on~page~#3~on~input~line~\msg_line_number:.
-  }
+  { Failed~check~'#1'~for~label~'#2'~on~page~#3~\msg_line_context:. }
 \msg_new:nnn { zref-check } { double-check }
-  {
-    Double-check~'#1'~for~label~'#2' \iow_newline:
-    on~page~#3~on~input~line~\msg_line_number:.
-  }
+  { Double-check~'#1'~for~label~'#2'~on~page~#3~\msg_line_context:. }
 \msg_new:nnn { zref-check } { check-missing }
-  { Check~'#1'~not~defined~on~input~line~\msg_line_number:. }
+  { Check~'#1'~not~defined~\msg_line_context:. }
 \msg_new:nnn { zref-check } { property-undefined }
-  { Property~'#1'~not~defined~on~input~line~\msg_line_number:. }
+  { Property~'#1'~not~defined~\msg_line_context:. }
 \msg_new:nnn { zref-check } { property-not-in-label }
-  { Label~'#1'~has~no~property~'#2'~on~input~line~\msg_line_number:. }
+  { Label~'#1'~has~no~property~'#2'~\msg_line_context:. }
 \msg_new:nnn { zref-check } { property-not-integer }
-  {
-    Property~'#1'~for~label~'#2'~not~an~integer \iow_newline:
-    on~input~line~\msg_line_number:.
-  }
+  { Property~'#1'~for~label~'#2'~not~an~integer~\msg_line_context:. }
 \msg_new:nnn { zref-check } { hyperref-preamble-only }
   {
     Option~'hyperref'~only~available~in~the~preamble. \iow_newline:
@@ -121,14 +127,11 @@
     Use~option~'msglevel'~instead.
   }
 \msg_new:nnn { zref-check } { option-preamble-only }
-  {
-    Option~'#1'~only~available~in~the~preamble \iow_newline:
-    on~input~line~\msg_line_number:.
-  }
+  { Option~'#1'~only~available~in~the~preamble~\msg_line_context:. }
 \msg_new:nnn { zref-check } { closerange-not-positive-integer }
   {
-    Option~'closerange'~not~a~positive~integer \iow_newline:
-    on~input~line~\msg_line_number:.~Using~default~value.
+    Option~'closerange'~not~a~positive~integer~\msg_line_context:.~
+    Using~default~value.
   }
 \msg_new:nnn { zref-check } { labelcmd-undefined }
   {
@@ -182,7 +185,7 @@
         \bool_if:NT \l__zrefcheck_use_hyperref_bool
           {
             \RequirePackage { zref-hyperref }
-            \zref at addprop { zrefcheck } { anchor }
+            \zref at addprop { zrefcheck-target } { anchor }
           }
       }
       {
@@ -282,8 +285,8 @@
       } ,
     labelcmd .value_required:n = true ,
   }
-\cs_new:Npn \__zrefcheck_target_label:n #1
-  { \zref at labelbylist {#1} { zrefcheck } }
+\cs_new_protected:Npn \__zrefcheck_target_label:n #1
+  { \zref at labelbylist {#1} { zrefcheck-target } }
 \AddToHook { begindocument }
   {
     \bool_if:NT \l__zrefcheck_target_label_bool
@@ -292,7 +295,7 @@
           { \tl_clear:N \l__zrefcheck_target_label_tl }
         \cs_if_exist:cTF { \l__zrefcheck_target_label_tl }
           {
-            \cs_set:Npx \__zrefcheck_target_label:n #1
+            \cs_set_protected:Npx \__zrefcheck_target_label:n #1
               {
                 \exp_not:o
                   { \cs:w \l__zrefcheck_target_label_tl \cs_end: }
@@ -300,7 +303,7 @@
               }
           }
           {
-            \exp_args:NnnV \msg_warning:nnn { zref-check }
+            \exp_args:Nnno \msg_warning:nnn { zref-check }
               { labelcmd-undefined } { \l__zrefcheck_target_label_tl }
           }
       }
@@ -359,7 +362,7 @@
 \setcounter { zrefcheck } { 0 }
 \cs_new:Npn \__zrefcheck_check_lblfmt:n #1 { zrefcheck@ \int_use:N #1 }
 \cs_new:Npn \__zrefcheck_end_lblfmt:n #1 { #1 @zrefcheck }
-\cs_new:Npn \zrefcheck_get_astl:nnn #1#2#3
+\cs_new_protected:Npn \zrefcheck_get_astl:nnn #1#2#3
   {
     \tl_clear:N #3
     \tl_if_eq:nnTF {#2} { lblseq }
@@ -392,7 +395,7 @@
   }
 \bool_new:N \l__zrefcheck_integer_bool
 \tl_new:N \l__zrefcheck_propval_tl
-\cs_new:Npn \zrefcheck_get_asint:nnn #1#2#3
+\cs_new_protected:Npn \zrefcheck_get_asint:nnn #1#2#3
   {
     \zrefcheck_get_astl:nnn {#1} {#2} { \l__zrefcheck_propval_tl }
     \__zrefcheck_is_integer:nTF { \l__zrefcheck_propval_tl }
@@ -409,27 +412,24 @@
           }
       }
   }
-\NewDocumentCommand \zcheck
-  { s O { } > { \SplitList { , } } m m }
+\NewDocumentCommand \zcheck { s O { } m m }
   { \zref at wrapper@babel \__zrefcheck_zcheck:nnnn {#3} {#1} {#2} {#4} }
+\seq_new:N \l__zrefcheck_zcheck_labels_seq
 \int_new:N \g__zrefcheck_id_int
 \tl_new:N \l__zrefcheck_checkbeg_tl
-\tl_new:N \l__zrefcheck_checkend_tl
 \tl_new:N \l__zrefcheck_link_label_tl
 \tl_new:N \l__zrefcheck_link_anchor_tl
 \bool_new:N \l__zrefcheck_link_star_bool
-\cs_new:Npn \__zrefcheck_zcheck:nnnn #1#2#3#4
+\cs_new_protected:Npn \__zrefcheck_zcheck:nnnn #1#2#3#4
   {
     \group_begin:
-      \__zrefcheck_set_checks_keys:
-      \keys_set:nn { zref-check } {#3}
+      \keys_set:nn { zref-check / zcheck } {#3}
+      \seq_set_from_clist:Nn \l__zrefcheck_zcheck_labels_seq {#1}
       \int_gincr:N \g__zrefcheck_id_int
       \tl_set:Nx \l__zrefcheck_checkbeg_tl
         { \__zrefcheck_check_lblfmt:n { \g__zrefcheck_id_int } }
-      \tl_set:Nx \l__zrefcheck_checkend_tl
-        { \__zrefcheck_end_lblfmt:n { \l__zrefcheck_checkbeg_tl } }
-      \zref at labelbylist { \l__zrefcheck_checkbeg_tl } { zrefcheck }
-      \tl_set:Nn \l__zrefcheck_link_label_tl { \tl_head:n {#1} }
+      \zref at labelbylist { \l__zrefcheck_checkbeg_tl } { zrefcheck-check }
+      \seq_get:NN \l__zrefcheck_zcheck_labels_seq \l__zrefcheck_link_label_tl
       \bool_set:Nn \l__zrefcheck_link_star_bool {#2}
       \zref at ifrefundefined { \l__zrefcheck_link_label_tl }
         {#4}
@@ -447,10 +447,15 @@
             }
             {#4}
         }
-      \zref at labelbylist { \l__zrefcheck_checkend_tl } { zrefcheck }
-      \tl_map_function:nN {#1} \zref at refused
-      \__zrefcheck_run_checks:nnv
-        { \l__zrefcheck_zcheck_checks_seq } {#1} { l__zrefcheck_checkbeg_tl }
+      \bool_if:NT \l__zrefcheck_zcheck_end_label_bool
+        {
+          \zref at labelbylist
+            { \__zrefcheck_end_lblfmt:n { \l__zrefcheck_checkbeg_tl } }
+            { zrefcheck-end }
+        }
+      \seq_map_function:NN \l__zrefcheck_zcheck_labels_seq \zref at refused
+      \__zrefcheck_run_checks:nnx { \l__zrefcheck_zcheck_checks_seq }
+        { \l__zrefcheck_zcheck_labels_seq } { \l__zrefcheck_checkbeg_tl }
     \group_end:
   }
 \NewDocumentCommand \zctarget { m +m }
@@ -460,7 +465,7 @@
     \zref at wrapper@babel \__zrefcheck_target_label:n {#1}
     #2
     \zref at wrapper@babel
-      \zref at labelbylist { \__zrefcheck_end_lblfmt:n {#1} } { zrefcheck }
+      \zref at labelbylist { \__zrefcheck_end_lblfmt:n {#1} } { zrefcheck-end }
     \group_end:
   }
 \NewDocumentEnvironment {zcregion} { m }
@@ -470,114 +475,69 @@
   }
   {
     \zref at wrapper@babel
-      \zref at labelbylist { \__zrefcheck_end_lblfmt:n {#1} } { zrefcheck }
+      \zref at labelbylist { \__zrefcheck_end_lblfmt:n {#1} } { zrefcheck-end }
   }
+\seq_new:N \c__zrefcheck_single_label_checks_seq
+\seq_set_from_clist:Nn \c__zrefcheck_single_label_checks_seq
+  {
+    thischap ,
+    prevchap ,
+    nextchap ,
+    chapsbefore ,
+    chapsafter ,
+    thissec ,
+    prevsec ,
+    nextsec ,
+    secsbefore ,
+    secsafter ,
+  }
 \seq_new:N \l__zrefcheck_zcheck_checks_seq
-\cs_new:Npn \__zrefcheck_set_checks_keys:
+\bool_new:N \l__zrefcheck_zcheck_end_label_bool
+\keys_define:nn { } { zref-check / zcheck .inherit:n = zref-check }
+\clist_map_inline:nn
   {
-    \keys_define:nn  { zref-check }
+    thispage ,
+    prevpage ,
+    nextpage ,
+    facing ,
+    pagegap ,
+    above ,
+    below ,
+    pagesbefore ,
+    ppbefore ,
+    pagesafter ,
+    ppafter ,
+    before ,
+    after ,
+    thischap ,
+    prevchap ,
+    nextchap ,
+    chapsbefore ,
+    chapsafter ,
+    thissec ,
+    prevsec ,
+    nextsec ,
+    secsbefore ,
+    secsafter ,
+    close ,
+    far ,
+  }
+  {
+    \keys_define:nn { zref-check / zcheck }
       {
-        thispage .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { thispage } } ,
-        thispage .value_forbidden:n = true ,
-
-        prevpage .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { prevpage } } ,
-        prevpage .value_forbidden:n = true ,
-
-        nextpage .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { nextpage } } ,
-        nextpage .value_forbidden:n = true ,
-
-        facing .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { facing } } ,
-        facing .value_forbidden:n = true ,
-
-        above .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { above } } ,
-        above .value_forbidden:n = true ,
-
-        below .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { below } } ,
-        below .value_forbidden:n = true ,
-
-        pagesbefore .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { pagesbefore } } ,
-        pagesbefore .value_forbidden:n = true ,
-
-        ppbefore .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { ppbefore } } ,
-        ppbefore .value_forbidden:n = true ,
-
-        pagesafter .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { pagesafter } } ,
-        pagesafter .value_forbidden:n = true ,
-
-        ppafter .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { ppafter } } ,
-        ppafter .value_forbidden:n = true ,
-
-        before .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { before } } ,
-        before .value_forbidden:n = true ,
-
-        after .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { after } } ,
-        after .value_forbidden:n = true ,
-
-        thischap .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { thischap } } ,
-        thischap .value_forbidden:n = true ,
-
-        prevchap .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { prevchap } } ,
-        prevchap .value_forbidden:n = true ,
-
-        nextchap .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { nextchap } } ,
-        nextchap .value_forbidden:n = true ,
-
-        chapsbefore .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { chapsbefore } } ,
-        chapsbefore .value_forbidden:n = true ,
-
-        chapsafter .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { chapsafter } } ,
-        chapsafter .value_forbidden:n = true ,
-
-        thissec .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { thissec } } ,
-        thissec .value_forbidden:n = true ,
-
-        prevsec .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { prevsec } } ,
-        prevsec .value_forbidden:n = true ,
-
-        nextsec .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { nextsec } } ,
-        nextsec .value_forbidden:n = true ,
-
-        secsbefore .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { secsbefore } } ,
-        secsbefore .value_forbidden:n = true ,
-
-        secsafter .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { secsafter } } ,
-        secsafter .value_forbidden:n = true ,
-
-        close .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { close } } ,
-        close .value_forbidden:n = true ,
-
-        far .code:n =
-          { \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq { far } } ,
-        far .value_forbidden:n = true ,
-      }
+        #1 .code:n =
+          {
+            \seq_put_right:Nn \l__zrefcheck_zcheck_checks_seq {#1}
+            \seq_if_in:NnF \c__zrefcheck_single_label_checks_seq {#1}
+              { \bool_set_true:N \l__zrefcheck_zcheck_end_label_bool }
+          } ,
+        #1 .value_forbidden:n = true ,
+     }
   }
-\cs_new:Npn \__zrefcheck_run_checks:nnn #1#2#3
+\cs_new_protected:Npn \__zrefcheck_run_checks:nnn #1#2#3
   {
     \group_begin:
-      \tl_map_inline:nn {#2}
+      \seq_map_inline:Nn #2
         {
           \seq_map_inline:Nn #1
             { \__zrefcheck_do_check:nnn {####1} {##1} {#3} }
@@ -584,7 +544,7 @@
         }
     \group_end:
   }
-\cs_generate_variant:Nn \__zrefcheck_run_checks:nnn { nnv }
+\cs_generate_variant:Nn \__zrefcheck_run_checks:nnn { nnx }
 \bool_new:N \l__zrefcheck_passedcheck_bool
 \bool_new:N \l__zrefcheck_onpage_bool
 \seq_new:N \c__zrefcheck_onpage_checks_seq
@@ -591,7 +551,7 @@
 \seq_set_from_clist:Nn \c__zrefcheck_onpage_checks_seq
   { above , below , before , after }
 \cs_generate_variant:Nn \exp_args:Nnno { Nnoo }
-\cs_new:Npn \__zrefcheck_do_check:nnn #1#2#3
+\cs_new_protected:Npn \__zrefcheck_do_check:nnn #1#2#3
   {
     \group_begin:
       \zref at ifrefundefined {#2}
@@ -603,22 +563,45 @@
               \bool_set_false:N \l__zrefcheck_onpage_bool
               \cs_if_exist:cTF { __zrefcheck_check_ #1 :nnF }
                 {
+                  % ``label beg'' vs ``reference beg''.
                   \use:c { __zrefcheck_check_ #1 :nnF }
                     {#2} {#3}
                     { \bool_set_false:N \l__zrefcheck_passedcheck_bool }
-                  \exp_args:Nnno \use:c { __zrefcheck_check_ #1 :nnF }
-                    {#2} { \__zrefcheck_end_lblfmt:n {#3} }
-                    { \bool_set_false:N \l__zrefcheck_passedcheck_bool }
-                  \zref at ifrefundefined { \__zrefcheck_end_lblfmt:n {#2} }
-                    {}
+                  % ``reference end'' \emph{may} exist or not depending on the
+                  % checks.
+                  \zref at ifrefundefined { \__zrefcheck_end_lblfmt:n {#3} }
                     {
-                      \exp_args:Nno \use:c { __zrefcheck_check_ #1 :nnF }
-                        { \__zrefcheck_end_lblfmt:n {#2} } {#3}
+                      % ``label end'' \emph{may} have been created by the
+                      % target commands.
+                      \zref at ifrefundefined { \__zrefcheck_end_lblfmt:n {#2} }
+                        {}
+                        {
+                          % ``label end'' vs ``reference beg''.
+                          \exp_args:Nno \use:c { __zrefcheck_check_ #1 :nnF }
+                            { \__zrefcheck_end_lblfmt:n {#2} } {#3}
+                            { \bool_set_false:N \l__zrefcheck_passedcheck_bool }
+                        }
+                    }
+                    {
+                      % ``label beg'' vs ``reference end''.
+                      \exp_args:Nnno \use:c { __zrefcheck_check_ #1 :nnF }
+                        {#2} { \__zrefcheck_end_lblfmt:n {#3} }
                         { \bool_set_false:N \l__zrefcheck_passedcheck_bool }
-                      \exp_args:Nnoo \use:c { __zrefcheck_check_ #1 :nnF }
-                        { \__zrefcheck_end_lblfmt:n {#2} }
-                        { \__zrefcheck_end_lblfmt:n {#3} }
-                        { \bool_set_false:N \l__zrefcheck_passedcheck_bool }
+                      % ``label end'' \emph{may} have been created by the
+                      % target commands.
+                      \zref at ifrefundefined { \__zrefcheck_end_lblfmt:n {#2} }
+                        {}
+                        {
+                          % ``label end'' vs ``reference beg''.
+                          \exp_args:Nno \use:c { __zrefcheck_check_ #1 :nnF }
+                            { \__zrefcheck_end_lblfmt:n {#2} } {#3}
+                            { \bool_set_false:N \l__zrefcheck_passedcheck_bool }
+                          % ``label end'' vs ``reference end''.
+                          \exp_args:Nnoo \use:c { __zrefcheck_check_ #1 :nnF }
+                            { \__zrefcheck_end_lblfmt:n {#2} }
+                            { \__zrefcheck_end_lblfmt:n {#3} }
+                            { \bool_set_false:N \l__zrefcheck_passedcheck_bool }
+                        }
                     }
                   \seq_if_in:NnT \c__zrefcheck_onpage_checks_seq {#1}
                     {
@@ -666,7 +649,7 @@
 \int_new:N \l__zrefcheck_ref_int
 \int_new:N \l__zrefcheck_lbl_b_int
 \int_new:N \l__zrefcheck_ref_b_int
-\prg_new_conditional:Npnn \__zrefcheck_check_thispage:nn #1#2 { T , F , TF }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_thispage:nn #1#2 { T , F , TF }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -684,7 +667,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_above:nn #1#2 { F , TF }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_above:nn #1#2 { F , TF }
   {
     \group_begin:
       \__zrefcheck_check_thispage:nnTF {#1} {#2}
@@ -706,7 +689,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_below:nn #1#2 { F , TF }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_below:nn #1#2 { F , TF }
   {
     \__zrefcheck_check_thispage:nnTF {#1} {#2}
       {
@@ -716,7 +699,7 @@
       }
       { \prg_return_false: }
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_before:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_before:nn #1#2 { F }
   {
     \__zrefcheck_check_pagesbefore:nnTF {#1} {#2}
       { \prg_return_true: }
@@ -726,7 +709,7 @@
           { \prg_return_false: }
       }
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_after:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_after:nn #1#2 { F }
   {
     \__zrefcheck_check_pagesafter:nnTF {#1} {#2}
       { \prg_return_true: }
@@ -736,7 +719,7 @@
           { \prg_return_false: }
       }
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_nextpage:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_nextpage:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -754,7 +737,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_prevpage:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_prevpage:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -772,7 +755,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_pagesbefore:nn #1#2 { F , TF }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_pagesbefore:nn #1#2 { F , TF }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -791,7 +774,7 @@
     \group_end:
   }
 \cs_new_eq:NN \__zrefcheck_check_ppbefore:nnF \__zrefcheck_check_pagesbefore:nnF
-\prg_new_conditional:Npnn \__zrefcheck_check_pagesafter:nn #1#2 { F , TF }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_pagesafter:nn #1#2 { F , TF }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -810,7 +793,7 @@
     \group_end:
   }
 \cs_new_eq:NN \__zrefcheck_check_ppafter:nnF \__zrefcheck_check_pagesafter:nnF
-\prg_new_conditional:Npnn \__zrefcheck_check_facing:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_pagegap:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -819,6 +802,24 @@
       \bool_lazy_and:nnTF
         { \l__zrefcheck_integer_bool }
         {
+          \int_compare_p:nNn
+            { \int_abs:n { \l__zrefcheck_lbl_int - \l__zrefcheck_ref_int } } > { 1 } &&
+          ! \int_compare_p:nNn { \l__zrefcheck_lbl_int } = { 0 } &&
+          ! \int_compare_p:nNn { \l__zrefcheck_ref_int } = { 0 }
+        }
+        { \group_insert_after:N \prg_return_true:  }
+        { \group_insert_after:N \prg_return_false: }
+    \group_end:
+  }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_facing:nn #1#2 { F }
+  {
+    \group_begin:
+      \bool_set_true:N \l__zrefcheck_integer_bool
+      \zrefcheck_get_asint:nnn {#1} { abspage } { \l__zrefcheck_lbl_int }
+      \zrefcheck_get_asint:nnn {#2} { abspage } { \l__zrefcheck_ref_int }
+      \bool_lazy_and:nnTF
+        { \l__zrefcheck_integer_bool }
+        {
           \legacy_if_p:n { @twoside } &&
           (
             (
@@ -839,7 +840,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_close:nn #1#2 { F , TF }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_close:nn #1#2 { F , TF }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -859,13 +860,13 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_far:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_far:nn #1#2 { F }
   {
     \__zrefcheck_check_close:nnTF {#1} {#2}
       { \prg_return_false: }
       { \prg_return_true:  }
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_thischap:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_thischap:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -883,7 +884,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_nextchap:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_nextchap:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -900,7 +901,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_prevchap:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_prevchap:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -918,7 +919,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_chapsafter:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_chapsafter:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -935,7 +936,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_chapsbefore:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_chapsbefore:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -953,7 +954,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_thissec:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_thissec:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -975,7 +976,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_nextsec:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_nextsec:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -996,7 +997,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_prevsec:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_prevsec:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -1018,7 +1019,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_secsafter:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_secsafter:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -1039,7 +1040,7 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
-\prg_new_conditional:Npnn \__zrefcheck_check_secsbefore:nn #1#2 { F }
+\prg_new_protected_conditional:Npnn \__zrefcheck_check_secsbefore:nn #1#2 { F }
   {
     \group_begin:
       \bool_set_true:N \l__zrefcheck_integer_bool
@@ -1061,6 +1062,27 @@
         { \group_insert_after:N \prg_return_false: }
     \group_end:
   }
+\cs_new_protected:Npn \zrefcheck_zcref_beg_label:
+  {
+    \int_gincr:N \g__zrefcheck_id_int
+    \tl_set:Nx \l__zrefcheck_checkbeg_tl
+      { \__zrefcheck_check_lblfmt:n { \g__zrefcheck_id_int } }
+    \zref at labelbylist { \l__zrefcheck_checkbeg_tl } { zrefcheck-check }
+  }
+\cs_new_protected:Npn \zrefcheck_zcref_end_label_maybe:
+  {
+    \bool_if:NT \l__zrefcheck_zcheck_end_label_bool
+      {
+        \zref at labelbylist
+          { \__zrefcheck_end_lblfmt:n { \l__zrefcheck_checkbeg_tl } }
+          { zrefcheck-end }
+      }
+  }
+\cs_new_protected:Npn \zrefcheck_zcref_run_checks_on_labels:n #1
+  {
+    \__zrefcheck_run_checks:nnx
+      { \l__zrefcheck_zcheck_checks_seq } {#1} { \l__zrefcheck_checkbeg_tl }
+  }
 %% 
 %%
 %% End of file `zref-check.sty'.



More information about the tex-live-commits mailing list.