summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/zref-check/zref-check.sty390
1 files changed, 206 insertions, 184 deletions
diff --git a/Master/texmf-dist/tex/latex/zref-check/zref-check.sty b/Master/texmf-dist/tex/latex/zref-check/zref-check.sty
index ea26b0766bc..bd1e9ccb2d0 100644
--- a/Master/texmf-dist/tex/latex/zref-check/zref-check.sty
+++ b/Master/texmf-dist/tex/latex/zref-check/zref-check.sty
@@ -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@newprop { zc@abssec } [0] { \int_use:N \g__zrefcheck_abssec_int }
\zref@addprop \ZREF@mainlist { zc@abssec }
-\zref@newlist { zrefcheck }
-\zref@addprops { zrefcheck }
+\zref@newlist { zrefcheck-check }
+\zref@addprops { zrefcheck-check }
{
- page ,
+ page , % for messages
abspage ,
zc@abschap ,
zc@abssec
}
-\cs_new:Npn \__zrefcheck_message:nnnn #1#2#3#4
+\zref@newlist { zrefcheck-target }
+\zref@addprops { zrefcheck-target }
+ {
+ page , % so that \zpageref can refer to it
+ abspage ,
+ zc@abschap ,
+ zc@abssec
+ }
+\zref@newlist { zrefcheck-end }
+\zref@addprops { zrefcheck-end }
+ {
+ abspage ,
+ zc@abschap ,
+ zc@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@addprop { zrefcheck } { anchor }
+ \zref@addprop { zrefcheck-target } { anchor }
}
}
{
@@ -282,8 +285,8 @@
} ,
labelcmd .value_required:n = true ,
}
-\cs_new:Npn \__zrefcheck_target_label:n #1
- { \zref@labelbylist {#1} { zrefcheck } }
+\cs_new_protected:Npn \__zrefcheck_target_label:n #1
+ { \zref@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@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@labelbylist { \l__zrefcheck_checkbeg_tl } { zrefcheck }
- \tl_set:Nn \l__zrefcheck_link_label_tl { \tl_head:n {#1} }
+ \zref@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@ifrefundefined { \l__zrefcheck_link_label_tl }
{#4}
@@ -447,10 +447,15 @@
}
{#4}
}
- \zref@labelbylist { \l__zrefcheck_checkend_tl } { zrefcheck }
- \tl_map_function:nN {#1} \zref@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@labelbylist
+ { \__zrefcheck_end_lblfmt:n { \l__zrefcheck_checkbeg_tl } }
+ { zrefcheck-end }
+ }
+ \seq_map_function:NN \l__zrefcheck_zcheck_labels_seq \zref@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@wrapper@babel \__zrefcheck_target_label:n {#1}
#2
\zref@wrapper@babel
- \zref@labelbylist { \__zrefcheck_end_lblfmt:n {#1} } { zrefcheck }
+ \zref@labelbylist { \__zrefcheck_end_lblfmt:n {#1} } { zrefcheck-end }
\group_end:
}
\NewDocumentEnvironment {zcregion} { m }
@@ -470,128 +475,83 @@
}
{
\zref@wrapper@babel
- \zref@labelbylist { \__zrefcheck_end_lblfmt:n {#1} } { zrefcheck }
+ \zref@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
+ {
+ 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 }
+ \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} }
}
\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
\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@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@ifrefundefined { \__zrefcheck_end_lblfmt:n {#2} }
- {}
+ % ``reference end'' \emph{may} exist or not depending on the
+ % checks.
+ \zref@ifrefundefined { \__zrefcheck_end_lblfmt:n {#3} }
{
- \exp_args:Nno \use:c { __zrefcheck_check_ #1 :nnF }
- { \__zrefcheck_end_lblfmt:n {#2} } {#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} }
+ % ``label end'' \emph{may} have been created by the
+ % target commands.
+ \zref@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 }
+ % ``label end'' \emph{may} have been created by the
+ % target commands.
+ \zref@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,25 @@
\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
+ \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 }
+ {
+ \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
@@ -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@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@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'.