%% %% This is file `zref-vario.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% zref-vario.dtx (with options: `package') %% %% This file was generated from file(s) of the LaTeX package "zref-vario". %% %% Copyright (C) 2022 Gustavo Barros %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this %% license or (at your option) any later version. The latest version %% of this license is in the file: %% %% https://www.latex-project.org/lppl.txt %% %% and version 1.3 or later is part of all distributions of LaTeX %% version 2005/12/01 or later. %% %% %% This work is "maintained" (as per LPPL maintenance status) by %% Gustavo Barros. %% %% This work consists of the files zref-vario.dtx, %% zref-vario.ins, %% zref-vario.tex, %% zref-vario-code.tex, %% and the files listed in MANIFEST.md. %% %% The released version of this package is available from CTAN. %% %% ----------------------------------------------------------------------- %% %% The development version of the package can be found at %% %% https://github.com/gusbrs/zref-vario %% %% for those people who are interested. %% %% ----------------------------------------------------------------------- %% \ProvidesExplPackage {zref-vario} {2022-02-01} {0.1.1-alpha} {Extended LaTeX page cross-references with varioref and zref-clever} \AddToHook { begindocument/before } { \RequirePackage { varioref } \RequirePackage { zref-clever } [ 2022-01-28 ] % v0.2.0-alpha } \cs_new:Npn \__zrefvario_ref_opt_default_cs:nn #1#2 { __zrefvario_ref_opt_default_ #1 : #2 } \cs_new:Npn \__zrefvario_base_lang:n #1 { \zrefclever_language_if_declared:nTF {#1} { \tl_use:c { \zrefclever_language_varname:n {#1} } } { zv_unknown_language } } \cs_generate_variant:Nn \__zrefvario_base_lang:n { e } \tl_new:N \l__zrefvario_ref_language_tl \tl_set:Nn \l__zrefvario_ref_language_tl { \l_zrefclever_ref_language_tl } \cs_new:Npn \__zrefvario_ref_opt_name_lang_tl:nn #1#2 { g__zrefvario_ref_opt_lang_ \__zrefvario_base_lang:n {#1} _ #2 _tl } \cs_generate_variant:Nn \__zrefvario_ref_opt_name_lang_tl:nn { en } \cs_new:Npn \__zrefvario_ref_opt_name_lang_cs:nnn #1#2#3 { __zrefvario_ref_opt_lang_ \__zrefvario_base_lang:n {#1} _ #2 : #3 } \cs_generate_variant:Nn \__zrefvario_ref_opt_name_lang_cs:nnn { enn } \cs_new_protected:Npn \__zrefvario_ref_opt_tl_get:nnN #1#2#3 { \tl_if_exist:cTF { \__zrefvario_ref_opt_name_lang_tl:nn {#1} {#2} } { \tl_set_eq:Nc #3 { \__zrefvario_ref_opt_name_lang_tl:nn {#1} {#2} } } { \tl_set_eq:Nc #3 { \__zrefvario_ref_opt_name_lang_tl:nn { zv_unknown_language } {#2} } } } \cs_generate_variant:Nn \__zrefvario_ref_opt_tl_get:nnN { xnN } \cs_new_protected:Npn \__zrefvario_ref_opt_cs_get:nnnN #1#2#3#4 { \cs_if_exist:cTF { \__zrefvario_ref_opt_name_lang_cs:nnn {#1} {#2} {#3} } { \cs_set_eq:Nc #4 { \__zrefvario_ref_opt_name_lang_cs:nnn {#1} {#2} {#3} } } { \cs_if_exist:cTF { \__zrefvario_ref_opt_default_cs:nn {#2} {#3} } { \cs_set_eq:Nc #4 { \__zrefvario_ref_opt_default_cs:nn {#2} {#3} } } { \cs_set_eq:Nc #4 { \__zrefvario_ref_opt_name_lang_cs:nnn { zv_unknown_language } {#2} {#3} } } } } \cs_generate_variant:Nn \__zrefvario_ref_opt_cs_get:nnnN { xnnN } \tl_new:N \l__zrefvario_reftextcurrent_tl \tl_set:Nn \l__zrefvario_reftextcurrent_tl { \reftextcurrent } \tl_new:N \l__zrefvario_vref_reftextcurrent_tl \tl_new:N \l__zrefvario_reftextother_tl \keys_define:nn { zref-vario/current } { vcurrent .code:n = { \tl_set:Nn \l__zrefvario_reftextcurrent_tl {#1} \tl_set:Nn \l__zrefvario_vref_reftextcurrent_tl {#1} } , vcurrent .value_required:n = true , } \keys_define:nn { zref-vario/other } { vother .tl_set:N = \l__zrefvario_reftextother_tl , vother .value_required:n = true , } \keys_define:nn { } { zref-vario/ref .inherit:n = { zref-clever/reference } , zref-vario/ref-oneoptarg .inherit:n = { zref-clever/reference , zref-vario/current } , zref-vario/ref-twooptargs .inherit:n = { zref-clever/reference , zref-vario/current , zref-vario/other } , } \tl_new:N \l__zrefvario_setup_language_tl \seq_new:N \g__zrefvario_setup_languages_seq \NewDocumentCommand \zvLanguageSetup { m m } { \AddToHook { begindocument/before } { \group_begin: \zrefclever_language_if_declared:nTF {#1} { \tl_set:Nn \l__zrefvario_setup_language_tl {#1} \keys_set:nn { zref-vario/langsetup } {#2} \seq_gput_right:Nx \g__zrefvario_setup_languages_seq { \__zrefvario_base_lang:n {#1} } } { \msg_warning:nnn { zref-vario } { unknown-language-setup } {#1} } \group_end: } } \msg_new:nnn { zref-vario } { unknown-language-setup } { Language~'#1'~is~unknown~\msg_line_context:.~Can't~set~it~up.~ The~language~must~be~declared~for~'zref-clever',~see~its~documentation. } \@onlypreamble \zvLanguageSetup \keys_define:nn { zref-vario/langsetup } { reftextfaceafter .code:n = { \tl_gset:cn { \__zrefvario_ref_opt_name_lang_tl:en { \l__zrefvario_setup_language_tl } { reftextfaceafter } } {#1} } , reftextfacebefore .code:n = { \tl_gset:cn { \__zrefvario_ref_opt_name_lang_tl:en { \l__zrefvario_setup_language_tl } { reftextfacebefore } } {#1} } , reftextafter .code:n = { \tl_gset:cn { \__zrefvario_ref_opt_name_lang_tl:en { \l__zrefvario_setup_language_tl } { reftextafter } } {#1} } , reftextbefore .code:n = { \tl_gset:cn { \__zrefvario_ref_opt_name_lang_tl:en { \l__zrefvario_setup_language_tl } { reftextbefore } } {#1} } , reftextcurrent .code:n = { \tl_gset:cn { \__zrefvario_ref_opt_name_lang_tl:en { \l__zrefvario_setup_language_tl } { reftextcurrent } } {#1} } , reftextfaraway .code:n = { \cs_gset_nopar:cpn { \__zrefvario_ref_opt_name_lang_cs:enn { \l__zrefvario_setup_language_tl } { reftextfaraway } { n } } ##1 {#1} } , reftextpagerange .code:n = { \cs_gset_nopar:cpn { \__zrefvario_ref_opt_name_lang_cs:enn { \l__zrefvario_setup_language_tl } { reftextpagerange } { nn } } ##1##2 {#1} } , reftextlabelrange .code:n = { \cs_gset_nopar:cpn { \__zrefvario_ref_opt_name_lang_cs:enn { \l__zrefvario_setup_language_tl } { reftextlabelrange } { nn } } ##1##2 {#1} } , vrefformat .code:n = { \cs_gset_nopar:cpn { \__zrefvario_ref_opt_name_lang_cs:enn { \l__zrefvario_setup_language_tl } { vrefformat } { nn } } ##1##2 {#1} } , vrefrangeformat .code:n = { \cs_gset_nopar:cpn { \__zrefvario_ref_opt_name_lang_cs:enn { \l__zrefvario_setup_language_tl } { vrefrangeformat } { nnn } } ##1##2##3 {#1} } , fullrefformat .code:n = { \cs_gset_nopar:cpn { \__zrefvario_ref_opt_name_lang_cs:enn { \l__zrefvario_setup_language_tl } { fullrefformat } { n } } ##1 {#1} } , } \cs_new_nopar:cpn { \__zrefvario_ref_opt_default_cs:nn { vrefformat } { nn } } #1#2 { \zcref {#2} ~ \zvpageref [ S=false, typeset=both, vcurrent={#1} ] {#2} } \cs_new_nopar:cpn { \__zrefvario_ref_opt_default_cs:nn { vrefrangeformat } { nnn } } #1#2#3 { \reftextlabelrange {#2} {#3} ~ \zvpagerefrange [ S=false, typeset=both, vcurrent={#1} ] {#2} {#3} } \cs_new_nopar:cpn { \__zrefvario_ref_opt_default_cs:nn { fullrefformat } { n } } #1 { \zcref {#1} ~ \zreftextfaraway [ S=false, typeset=both ] {#1} } \NewDocumentCommand \zreftextfaraway { s O { } m } { \zref@wrapper@babel \__zrefvario_zreftextfaraway:nnn {#3} {#1} {#2} } \cs_new_protected:Npn \__zrefvario_zreftextfaraway:nnn #1#2#3 { \group_begin: \keys_set:nn { zref-vario/ref } {#3} \bool_if:nT {#2} { \keys_set:nn { zref-vario/ref } { nohyperref } } \__zrefvario_varioref_setup: \reftextfaraway {#1} \group_end: } \group_begin: \tl_set:Nn \l__zrefvario_setup_language_tl { zv_unknown_language } \AddToHook { begindocument/before } { \keys_set:nn { zref-vario/langsetup } { reftextfaceafter = { \msg_warning:nnxx { zref-vario } { missing-string } { reftextfaceafter } { \l__zrefvario_ref_language_tl } \zref@default } , reftextfacebefore = { \msg_warning:nnxx { zref-vario } { missing-string } { reftextfacebefore } { \l__zrefvario_ref_language_tl } \zref@default } , reftextafter = { \msg_warning:nnxx { zref-vario } { missing-string } { reftextafter } { \l__zrefvario_ref_language_tl } \zref@default } , reftextbefore = { \msg_warning:nnxx { zref-vario } { missing-string } { reftextbefore } { \l__zrefvario_ref_language_tl } \zref@default } , reftextcurrent = { \msg_warning:nnxx { zref-vario } { missing-string } { reftextcurrent } { \l__zrefvario_ref_language_tl } \zref@default } , reftextfaraway = { \msg_warning:nnxx { zref-vario } { missing-string } { reftextfaraway } { \l__zrefvario_ref_language_tl } \zref@default } , reftextpagerange = { \msg_warning:nnxx { zref-vario } { missing-string } { reftextpagerange } { \l__zrefvario_ref_language_tl } \zref@default } , reftextlabelrange = { \msg_warning:nnxx { zref-vario } { missing-string } { reftextlabelrange } { \l__zrefvario_ref_language_tl } \zref@default } , } } \group_end: \msg_new:nnn { zref-vario } { missing-string } { Missing~'#1'~string~for~language~'#2'~\msg_line_context:. } \AddToHook { begindocument/before } { \AddToHook { begindocument } { \seq_if_in:NxF \g__zrefvario_setup_languages_seq { \__zrefvario_base_lang:e { \l__zrefvario_ref_language_tl } } { \msg_warning:nnx { zref-vario } { language-not-setup } { \l__zrefvario_ref_language_tl } } } } \msg_new:nnn { zref-vario } { language-not-setup } { Language~'#1'~is~not~set~up~for~'zref-vario'.~ See~documentation~for~'\iow_char:N\\zvLanguageSetup'. } \cs_new_protected:Npn \__zrefvario_vref_pagenum:Nn #1#2 { \exp_args:NNNo \exp_args:NNo \tl_set:Nn #1 { \zref@extractdefault {#2} { page } { ?? } } } \cs_new_protected:Npn \__zrefvario_vrefpagenum:Nn #1#2 { \zref@refused {#2} \__zrefvario_vref_pagenum:Nn #1 {#2} } \cs_new_protected:Npn \__zrefvario_vref_label:n #1 { \zref@labelbyprops {#1} { page } } \bool_new:N \l__zrefvario_varioref_setup_bool \cs_new_protected:Npn \__zrefvario_varioref_setup: { \bool_if:NF \l__zrefvario_varioref_setup_bool { \bool_set_true:N \l__zrefvario_varioref_setup_bool \@vrefhandlespacefalse \cs_set_eq:NN \vref@pagenum \__zrefvario_vref_pagenum:Nn \cs_set_eq:NN \vrefpagenum \__zrefvario_vrefpagenum:Nn \cs_set_eq:NN \vref@label \__zrefvario_vref_label:n \__zrefvario_ref_opt_tl_get:xnN { \l__zrefvario_ref_language_tl } { reftextfaceafter } \reftextfaceafter \__zrefvario_ref_opt_tl_get:xnN { \l__zrefvario_ref_language_tl } { reftextfacebefore } \reftextfacebefore \__zrefvario_ref_opt_tl_get:xnN { \l__zrefvario_ref_language_tl } { reftextafter } \reftextafter \__zrefvario_ref_opt_tl_get:xnN { \l__zrefvario_ref_language_tl } { reftextbefore } \reftextbefore \__zrefvario_ref_opt_tl_get:xnN { \l__zrefvario_ref_language_tl } { reftextcurrent } \reftextcurrent \__zrefvario_ref_opt_cs_get:xnnN { \l__zrefvario_ref_language_tl } { reftextfaraway } { n } \reftextfaraway \__zrefvario_ref_opt_cs_get:xnnN { \l__zrefvario_ref_language_tl } { reftextpagerange } { nn } \reftextpagerange \__zrefvario_ref_opt_cs_get:xnnN { \l__zrefvario_ref_language_tl } { reftextlabelrange } { nn } \reftextlabelrange \__zrefvario_ref_opt_cs_get:xnnN { \l__zrefvario_ref_language_tl } { vrefformat } { nn } \vrefformat \__zrefvario_ref_opt_cs_get:xnnN { \l__zrefvario_ref_language_tl } { vrefrangeformat } { nnn } \vrefrangeformat \__zrefvario_ref_opt_cs_get:xnnN { \l__zrefvario_ref_language_tl } { fullrefformat } { n } \fullrefformat } } \NewDocumentCommand \zvref { s O { } m } { \zref@wrapper@babel \__zrefvario_zvref:nnn {#3} {#1} {#2} } \cs_new_protected:Npn \__zrefvario_zvref:nnn #1#2#3 { \group_begin: \keys_set:nn { zref-vario/ref-oneoptarg } {#3} \bool_if:nT {#2} { \keys_set:nn { zref-vario/ref } { nohyperref } } \__zrefvario_varioref_setup: \__zrefvario_vref:Vn \l__zrefvario_vref_reftextcurrent_tl {#1} \group_end: } \cs_new_protected:Npn \__zrefvario_vref:nn #1#2 { \vrefformat {#1} {#2} } \cs_generate_variant:Nn \__zrefvario_vref:nn { Vn } \NewDocumentCommand \zvpageref { s O { } m } { \zref@wrapper@babel \__zrefvario_zvpageref:nnn {#3} {#1} {#2} } \cs_new_protected:Npn \__zrefvario_zvpageref:nnn #1#2#3 { \group_begin: \keys_set:nn { zref-vario/ref-twooptargs } {#3} \bool_if:nT {#2} { \keys_set:nn { zref-vario/ref } { nohyperref } } \__zrefvario_varioref_setup: \__zrefvario_vpageref:VVn \l__zrefvario_reftextcurrent_tl \l__zrefvario_reftextother_tl {#1} \group_end: } \cs_new_protected:Npn \__zrefvario_vpageref:nnn #1#2#3 { \vpageref [{#1}] [#2] {#3} } \cs_generate_variant:Nn \__zrefvario_vpageref:nnn { VVn } \NewDocumentCommand \zvrefrange { s O { } m m } { \zref@wrapper@babel { \zref@wrapper@babel \__zrefvario_zvrefrange:nnnn {#3} } {#4} {#1} {#2} } \cs_new_protected:Npn \__zrefvario_zvrefrange:nnnn #1#2#3#4 { \group_begin: \keys_set:nn { zref-vario/ref-oneoptarg } {#4} \bool_if:nT {#3} { \keys_set:nn { zref-vario/ref } { nohyperref } } \__zrefvario_varioref_setup: \__zrefvario_vrefrange:Vnn \l__zrefvario_reftextcurrent_tl {#1} {#2} \group_end: } \cs_new_protected:Npn \__zrefvario_vrefrange:nnn #1#2#3 { \vrefrange [{#1}] {#2} {#3} } \cs_generate_variant:Nn \__zrefvario_vrefrange:nnn { Vnn } \NewDocumentCommand \zvpagerefrange { s O { } m m } { \zref@wrapper@babel { \zref@wrapper@babel \__zrefvario_zvpagerefrange:nnnn {#3} } {#4} {#1} {#2} } \cs_new_protected:Npn \__zrefvario_zvpagerefrange:nnnn #1#2#3#4 { \group_begin: \keys_set:nn { zref-vario/ref-oneoptarg } {#4} \bool_if:nT {#3} { \keys_set:nn { zref-vario/ref } { nohyperref } } \__zrefvario_varioref_setup: \__zrefvario_vpagerefrange:Vnn \l__zrefvario_reftextcurrent_tl {#1} {#2} \group_end: } \cs_new_protected:Npn \__zrefvario_vpagerefrange:nnn #1#2#3 { \vpagerefrange [{#1}] {#2} {#3} } \cs_generate_variant:Nn \__zrefvario_vpagerefrange:nnn { Vnn } \NewDocumentCommand \zfullref { s O { } m } { \zref@wrapper@babel \__zrefvario_zfullref:nnn {#3} {#1} {#2} } \cs_new_protected:Npn \__zrefvario_zfullref:nnn #1#2#3 { \group_begin: \keys_set:nn { zref-vario/ref } {#3} \bool_if:nT {#2} { \keys_set:nn { zref-vario/ref } { nohyperref } } \__zrefvario_varioref_setup: \fullref {#1} \group_end: } \zvLanguageSetup { english } { reftextfaceafter = {on~the~\reftextvario{facing}{next}~page} , reftextfacebefore = {on~the~\reftextvario{facing}{preceding}~page} , reftextafter = {on~the~\reftextvario{following}{next}~page} , reftextbefore = {on~the~\reftextvario{preceding}{previous}~page} , reftextcurrent = {on~\reftextvario{this}{the~current}~page} , reftextfaraway = {on~\zcpageref{#1}} , reftextpagerange = {on~\zcpageref[range]{#1,#2}} , reftextlabelrange = {\zcref[range]{#1,#2}} , } \zvLanguageSetup { german } { reftextfaceafter = {auf~der~nächsten~Seite} , reftextfacebefore = {auf~der~vorherigen~Seite} , reftextafter = {auf~der~nächsten~Seite} , reftextbefore = {auf~der~vorherigen~Seite} , reftextcurrent = {auf~dieser~Seite} , reftextfaraway = {auf~\zcpageref[d=D,g=f]{#1}} , reftextpagerange = {auf~den~\zcpageref[range,d=D,g=f]{#1,#2}} , reftextlabelrange = {\zcref[range]{#1,#2}} , } \zvLanguageSetup { french } { reftextfaceafter = {page~\reftextvario{ci-contre}{suivante}} , reftextfacebefore = {page~\reftextvario{ci-contre}{précédente}} , reftextafter = {page~suivante} , reftextbefore = {page~précédente} , reftextcurrent = {de~la~présente~page} , reftextfaraway = {\zcpageref[g=f]{#1}} , reftextpagerange = {\zcpageref[range,g=f]{#1,#2}} , reftextlabelrange = {\zcref[range]{#1,#2}} , } \zvLanguageSetup { portuguese } { reftextfaceafter = {na~\reftextvario{página~oposta}{próxima~página}} , reftextfacebefore = {na~página~\reftextvario{oposta}{anterior}} , reftextafter = {na~\reftextvario{página~seguinte}{próxima~página}} , reftextbefore = {na~página~\reftextvario{anterior}{precedente}} , reftextcurrent = {nesta~página} , reftextfaraway = {na~\zcpageref[g=f]{#1}} , reftextpagerange = {nas~\zcpageref[range,g=f]{#1,#2}} , reftextlabelrange = {\zcref[range]{#1,#2}} , } \zvLanguageSetup { spanish } { reftextfaceafter = {en~la~página~siguiente} , reftextfacebefore = {en~la~página~anterior} , reftextafter = {en~la~página~siguiente} , reftextbefore = {en~la~página~anterior} , reftextcurrent = {en~esta~página} , reftextfaraway = {en~la~\zcpageref[g=f]{#1}} , reftextpagerange = {en~las~\zcpageref[range,g=f]{#1,#2}} , reftextlabelrange = {\zcref[range]{#1,#2}} , } \zvLanguageSetup { dutch } { reftextfaceafter = {op~de~\reftextvario{rechter~pagina}{pagina~hiernaast}} , reftextfacebefore = {op~de~\reftextvario{linker~pagina}{pagina~hiernaast}} , reftextafter = {op~de~\reftextvario{volgende~pagina}{pagina~hierna}} , reftextbefore = {op~de~\reftextvario{vorige~pagina}{pagina~hiervoor}} , reftextcurrent = {op~deze~pagina} , reftextfaraway = {op~\zcpageref[g=f]{#1}} , reftextpagerange = {op~\zcpageref[range,g=f]{#1,#2}} , reftextlabelrange = {\zcref[range]{#1,#2}} , } %% %% %% End of file `zref-vario.sty'.