texlive[63765] Master/texmf-dist: crefthe (30jun22)
commits+karl at tug.org
commits+karl at tug.org
Thu Jun 30 22:37:35 CEST 2022
Revision: 63765
http://tug.org/svn/texlive?view=revision&revision=63765
Author: karl
Date: 2022-06-30 22:37:34 +0200 (Thu, 30 Jun 2022)
Log Message:
-----------
crefthe (30jun22)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.pdf
trunk/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex
trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty
Modified: trunk/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex 2022-06-29 23:49:21 UTC (rev 63764)
+++ trunk/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex 2022-06-30 20:37:34 UTC (rev 63765)
@@ -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,7 +253,15 @@
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}}
\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.
@@ -259,6 +268,7 @@
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}
Modified: trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty 2022-06-29 23:49:21 UTC (rev 63764)
+++ trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty 2022-06-30 20:37:34 UTC (rev 63765)
@@ -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 at name } { \crefthemark { \crefthe_empty_adjust:n {} } }
+ \tl_gput_left:cn { cref@#1 at name@plural } { \crefthemark { \crefthe_empty_adjust:n {} } }
+ \tl_gput_left:cn { Cref@#1 at name } { \crefthemark { \crefthe_empty_adjust:n {} } }
+ \tl_gput_left:cn { Cref@#1 at name@plural } { \crefthemark { \crefthe_empty_adjust:n {} } }
+ }
+
\hook_gput_code:nnn { begindocument/end } { crefthe }
{
\bool_if:NT \l__crefthe_overwrite_bool
More information about the tex-live-commits
mailing list.