summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-06-30 20:37:34 +0000
committerKarl Berry <karl@freefriends.org>2022-06-30 20:37:34 +0000
commitc7010a7ace2aa8d5be646f465bbd4df437e4fce5 (patch)
tree7f0736c7c94e6a62ff6f0e5690d515d017ccfe06
parent195b27363e259b66bac08a536de31354726fea9f (diff)
crefthe (30jun22)
git-svn-id: svn://tug.org/texlive/trunk@63765 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/crefthe/crefthe-doc.pdfbin114833 -> 53184 bytes
-rw-r--r--Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex12
-rw-r--r--Master/texmf-dist/tex/latex/crefthe/crefthe.sty44
3 files changed, 46 insertions, 10 deletions
diff --git a/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.pdf b/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.pdf
index 57189c0a065..996f3029150 100644
--- a/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.pdf
+++ b/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex b/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex
index f738d30107a..5d02b6d9d58 100644
--- a/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex
+++ b/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex
@@ -47,6 +47,7 @@
crefthe,crefthename,
Crefthe,Crefthename,
crefthemark,
+ crefthepatchname,
selectlanguage,
}
}
@@ -111,7 +112,7 @@
\begin{document}
-\def\PackageVersion{2022/05/13}
+\def\PackageVersion{2022/06/30}
\title{\crefthepackage{}\\\smallskip\itshape Cross referencing with proper definite articles}
\author{Jinwen XU}
@@ -252,6 +253,14 @@ Of course you will have to define the \lstinline|\Crefthename|s separately, for
To place hyperlinks at the right place, \lstinline|\crefthename| touches the corresponding \lstinline|\crefformat| internally, which makes the format language-dependent. If you are writing multi-language documents, you may consider putting \lstinline|\crefthename| inside your language configuration so as to reset it each time you select a new language.
+\section{Dealing with existed \texttt{cref} / \texttt{Cref} names}
+
+For those preset names defined with \lstinline|\crefname|\,/\,\lstinline|\Crefname|, such as the ones for \texttt{chapter}, \texttt{section} and \texttt{subsection}, etc., the optional argument of \lstinline|\crefthe|\,/\,\lstinline|\Crefthe| shall be useless: names defined with \lstinline|\crefthename|\,/\,\lstinline|\Crefthename| have a \lstinline|\crefthemark| marking the definite articles, which also deals with the given preposition ; without \lstinline|\crefthemark|, the preposition is simply ignored.
+
+\lstinline|\crefthepatchname{|\meta{counters}\lstinline|}| is provided for this purpose. With this, an empty mark shall be added before the existed singular and plural names. However, it is still recommended to simply redefine the names with \lstinline|\crefthename|\,/\,\lstinline|\Crefthename|, especially in multilingual documents.
+
+% For multilingual documents, you may need to add this to your language configuration so as to reapply it each time you select a new language.
+
\section{The relationship with \textsf{cleveref}}
@@ -259,6 +268,7 @@ To place hyperlinks at the right place, \lstinline|\crefthename| touches the cor
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|.
+
\clearpage
\section{Known issues}
diff --git a/Master/texmf-dist/tex/latex/crefthe/crefthe.sty b/Master/texmf-dist/tex/latex/crefthe/crefthe.sty
index 286a5dac86d..f993302d76b 100644
--- a/Master/texmf-dist/tex/latex/crefthe/crefthe.sty
+++ b/Master/texmf-dist/tex/latex/crefthe/crefthe.sty
@@ -9,11 +9,10 @@
%%
%% http://www.latex-project.org/lppl.txt
%%
-\NeedsTeXFormat{LaTeX2e}[2020-10-01]
-\RequirePackage{l3keys2e}
+\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplPackage
{crefthe}
- {2022/05/13} {}
+ {2022/06/30} {}
{Cross referencing with proper definite articles}
\keys_define:nn { crefthe }
@@ -25,7 +24,7 @@
, unknown .code:n =
{ \PassOptionsToPackage { \CurrentOption } { cleveref } }
}
-\ProcessKeysOptions { crefthe }
+\ProcessKeyOptions [ crefthe ]
\bool_if:NT \l__crefthe_nameinlink_bool
{
@@ -116,18 +115,29 @@
\__crefthe_name_general:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { C }
}
-\cs_new_protected:Nn \__crefthe_name_general:nnnnnn
+\cs_new:Nn \crefthe_empty_adjust:n
{
- % #6 is c or C
- \tl_if_blank:nTF { #2 }
+ \tl_if_blank:nTF { #1 }
{
- \__crefthe_name_general_do:nnnnnn { #1 } {} { #3 } {} { #5 } { #6 }
+ \skip_horizontal:n { -.75ex }
}
{
- \__crefthe_name_general_do:nnnnnn { #1 } { \crefthemark { #2 } } { #3 } { \crefthemark { #4 } } { #5 } { #6 }
+ #1
}
}
+\cs_new_protected:Nn \__crefthe_name_general:nnnnnn
+ {
+ % #6 is c or C
+ \__crefthe_name_general_do:nnnnnn
+ { #1 }
+ { \crefthemark { \crefthe_empty_adjust:n { #2 } } }
+ { \crefthe_empty_adjust:n { #3 } }
+ { \crefthemark { \crefthe_empty_adjust:n { #4 } } }
+ { \crefthe_empty_adjust:n { #5 } }
+ { #6 }
+ }
+
\cs_new_protected:Nn \__crefthe_name_general_do:nnnnnn
{
\use:c { crefthe_#6refname_original:w } { #1 } { #2 #3 } { #4 #5 }
@@ -215,6 +225,22 @@
{ #1 }
}
+\NewDocumentCommand \crefthepatchname { m }
+ {
+ \clist_map_inline:nn { #1 }
+ {
+ \crefthe_patch_name:n { ##1 }
+ }
+ }
+
+\cs_new:Nn \crefthe_patch_name:n
+ {
+ \tl_gput_left:cn { cref@#1@name } { \crefthemark { \crefthe_empty_adjust:n {} } }
+ \tl_gput_left:cn { cref@#1@name@plural } { \crefthemark { \crefthe_empty_adjust:n {} } }
+ \tl_gput_left:cn { Cref@#1@name } { \crefthemark { \crefthe_empty_adjust:n {} } }
+ \tl_gput_left:cn { Cref@#1@name@plural } { \crefthemark { \crefthe_empty_adjust:n {} } }
+ }
+
\hook_gput_code:nnn { begindocument/end } { crefthe }
{
\bool_if:NT \l__crefthe_overwrite_bool