From 6674b483369c574577214459f1ef6f5fd15b2cbd Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 2 Mar 2022 21:36:58 +0000 Subject: crefthe (2mar22) (branch) git-svn-id: svn://tug.org/texlive/branches/branch2021.final@62350 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/crefthe/crefthe.sty | 35 ++++++++++++------------- 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/crefthe/crefthe.sty b/Master/texmf-dist/tex/latex/crefthe/crefthe.sty index 213f3d2e609..dd3ea31b1d8 100644 --- a/Master/texmf-dist/tex/latex/crefthe/crefthe.sty +++ b/Master/texmf-dist/tex/latex/crefthe/crefthe.sty @@ -13,7 +13,7 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {crefthe} - {2022/02/27} {} + {2022/03/01} {} {Cross referencing with proper definite articles} \keys_define:nn { crefthe } @@ -126,33 +126,32 @@ \use:c { crefthe_#6refname_original:w } { #1 } { #2 #3 } { #4 #5 } \hook_gput_code:nnn { begindocument } { crefthe } { - \crefthe_patch_format:nnnnn { 2 } { #6ref@#1@format } { #6ref@#1@name } { #2 } { #3 } - \crefthe_patch_format:nnnnn { 2 } { #6ref@#1@format@first } { #6ref@#1@name@plural } { #4 } { #5 } - \crefthe_patch_format:nnnnn { 3 } { #6refrange@#1@format } { #6ref@#1@name@plural } { #4 } { #5 } - \crefthe_patch_format:nnnnn { 3 } { #6refrange@#1@format@first } { #6ref@#1@name@plural } { #4 } { #5 } + \crefthe_patch_format:nnnn { #6ref@#1@format } { #6ref@#1@name } { #2 } { #3 } + \crefthe_patch_format:nnnn { #6ref@#1@format@first } { #6ref@#1@name@plural } { #4 } { #5 } + \crefthe_patch_format:nnnn { #6refrange@#1@format } { #6ref@#1@name@plural } { #4 } { #5 } + \crefthe_patch_format:nnnn { #6refrange@#1@format@first } { #6ref@#1@name@plural } { #4 } { #5 } } } \seq_new:N \g__crefthe_already_patched_seq -\cs_new_protected:Nn \crefthe_patch_format:nnnnn - % #1 = the # number for the beginning mark of hyperlink - % #2 = name of the format command - % #3 = name of the command after hyperlink mark - % #4 = new content before the mark - % #5 = new content after the mark +\cs_new_protected:Nn \crefthe_patch_format:nnnn + % #1 = name of the format command + % #2 = name of the command after the hyperlink beginning mark + % #3 = new content before the mark + % #4 = new content after the mark { - \seq_if_in:NnF \g__crefthe_already_patched_seq { #2 - #3 } + \seq_if_in:NnF \g__crefthe_already_patched_seq { #1 - #2 } { \makeatletter - \tl_set:Nn \l_tmpa_tl { #4 } - \tl_set:Nn \l_tmpb_tl { #5 } - \exp_args:Nc \regexpatchcmd { #2 } - { \cP. #1 \c{ #3 } } - { \u{l_tmpa_tl} \cP\# #1 \u{l_tmpb_tl} } + \tl_set:No \l_tmpa_tl { #3 } + \tl_set:No \l_tmpb_tl { #4 } + \exp_args:Nc \regexpatchcmd { #1 } + { (\cP\# .) \c{ #2 } } + { \u{l_tmpa_tl} \1 \u{l_tmpb_tl} } { } { \PatchFailed } \makeatother - \seq_gput_right:Nn \g__crefthe_already_patched_seq { #2 - #3 } + \seq_gput_right:Nn \g__crefthe_already_patched_seq { #1 - #2 } } } -- cgit v1.2.3