summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/crefthe/crefthe.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-03-02 03:03:38 +0000
committerNorbert Preining <norbert@preining.info>2022-03-02 03:03:38 +0000
commit1769d3d8842ef66919943128931e647de9756adb (patch)
tree46df94f2204cba9384cccf5ab6ca8cbbcd49bcad /macros/latex/contrib/crefthe/crefthe.sty
parent3e9a44ea155766214d8657ed79db2206592b6e8e (diff)
CTAN sync 202203020303
Diffstat (limited to 'macros/latex/contrib/crefthe/crefthe.sty')
-rw-r--r--macros/latex/contrib/crefthe/crefthe.sty35
1 files changed, 17 insertions, 18 deletions
diff --git a/macros/latex/contrib/crefthe/crefthe.sty b/macros/latex/contrib/crefthe/crefthe.sty
index 213f3d2e60..dd3ea31b1d 100644
--- a/macros/latex/contrib/crefthe/crefthe.sty
+++ b/macros/latex/contrib/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 }
}
}