From e4077068fe9f9e81bbc85b04961c9c1df1fee545 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 14 May 2022 20:31:33 +0000 Subject: crefthe (14may22) git-svn-id: svn://tug.org/texlive/trunk@63296 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/crefthe/crefthe.sty | 35 +++++++++++++++++-------- 1 file changed, 24 insertions(+), 11 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 7c9a58965df..286a5dac86d 100644 --- a/Master/texmf-dist/tex/latex/crefthe/crefthe.sty +++ b/Master/texmf-dist/tex/latex/crefthe/crefthe.sty @@ -13,18 +13,25 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {crefthe} - {2022/04/24} {} + {2022/05/13} {} {Cross referencing with proper definite articles} \keys_define:nn { crefthe } { - , overwrite .bool_set:N = \l__crefthe_overwrite_bool - , overwrite .initial:n = { false } - , unknown .code:n = - { \PassOptionsToPackage { \CurrentOption } { cleveref } } + , overwrite .bool_set:N = \l__crefthe_overwrite_bool + , overwrite .initial:n = { false } + , nameinlink .bool_set:N = \l__crefthe_nameinlink_bool + , nameinlink .initial:n = { false } + , unknown .code:n = + { \PassOptionsToPackage { \CurrentOption } { cleveref } } } \ProcessKeysOptions { crefthe } +\bool_if:NT \l__crefthe_nameinlink_bool + { + \PassOptionsToPackage { nameinlink } { cleveref } + } + \RequirePackage { cleveref } \RequirePackage { regexpatch } @@ -124,12 +131,15 @@ \cs_new_protected:Nn \__crefthe_name_general_do:nnnnnn { \use:c { crefthe_#6refname_original:w } { #1 } { #2 #3 } { #4 #5 } - \hook_gput_code:nnn { begindocument } { crefthe } + \bool_if:NT \l__crefthe_nameinlink_bool { - \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 } + \hook_gput_code:nnn { begindocument } { crefthe } + { + \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 } + } } } @@ -149,12 +159,15 @@ \exp_args:Nc \regexpatchcmd { #1 } { (\cP\# .) \c{ #2 } } { \u{l_tmpa_tl} \1 \u{l_tmpb_tl} } - { } { \PatchFailed } + { } { \msg_warning:nnn { crefthe } { format-patch-failed } { #1 } } \makeatother \seq_gput_right:Nn \g__crefthe_already_patched_seq { #1 - #2 } } } +\msg_new:nnn { crefthe } + { format-patch-failed } + { Failed~to~patch~the~format~"\iow_char:N \\#1"! } \cs_generate_variant:Nn \text_lowercase:n { V } \NewDocumentCommand \crefthemark { m } -- cgit v1.2.3