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 --- .../texmf-dist/doc/latex/crefthe/crefthe-doc.pdf | Bin 115700 -> 114833 bytes .../texmf-dist/doc/latex/crefthe/crefthe-doc.tex | 4 +-- Master/texmf-dist/tex/latex/crefthe/crefthe.sty | 35 ++++++++++++++------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.pdf b/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.pdf index 16dea32970c..57189c0a065 100644 Binary files a/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.pdf and b/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.pdf differ diff --git a/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex b/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex index e7bb3e0977c..f738d30107a 100644 --- a/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex +++ b/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex @@ -111,7 +111,7 @@ \begin{document} -\def\PackageVersion{2022/04/24} +\def\PackageVersion{2022/05/13} \title{\crefthepackage{}\\\smallskip\itshape Cross referencing with proper definite articles} \author{Jinwen XU} @@ -255,7 +255,7 @@ To place hyperlinks at the right place, \lstinline|\crefthename| touches the cor \section{The relationship with \textsf{cleveref}} -\crefthepackage{} loads \textsf{cleveref} automatically and pass all the options to it. All its commands, used without optional arguments, degenerate to those in \textsf{cleveref}. For example, \lstinline|\crefthe{...}| is the same as \lstinline|\cref{...}|, and \lstinline|\crefthename| is the same as \lstinline|\crefname| if the definite articles are not specified. That said, you can safely use the command \lstinline|\crefthe| everywhere in your document without causing extra trouble. +\crefthepackage{} loads \textsf{cleveref} automatically and pass related options to it. All its commands, used without optional arguments, degenerate to those in \textsf{cleveref}. For example, \lstinline|\crefthe{...}| is the same as \lstinline|\cref{...}|, and \lstinline|\crefthename| is the same as \lstinline|\crefname| if the definite articles are not specified. That said, you can safely use the command \lstinline|\crefthe| everywhere in your document without causing extra trouble. With the package option \packageoption{overwrite}, user commands in \textsf{cleveref} will be replaced by those offered here, thus you can simply write \lstinline|\cref| for \lstinline|\crefthe| -- and similarly with \lstinline|\Cref|, \lstinline|\crefname| and \lstinline|\Crefname|. 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