texlive[67721] Master/texmf-dist: crefthe (24jul23)

commits+karl at tug.org commits+karl at tug.org
Mon Jul 24 22:21:59 CEST 2023


Revision: 67721
          http://tug.org/svn/texlive?view=revision&revision=67721
Author:   karl
Date:     2023-07-24 22:21:58 +0200 (Mon, 24 Jul 2023)
Log Message:
-----------
crefthe (24jul23)

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	2023-07-23 23:43:41 UTC (rev 67720)
+++ trunk/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex	2023-07-24 20:21:58 UTC (rev 67721)
@@ -49,6 +49,7 @@
         crefthe,crefthename,
         Crefthe,Crefthename,
         crefthevariantname,Crefthevariantname,
+        setcrefname,setCrefname,
         namecrefthe,namecrefsthe,
         nameCrefthe,nameCrefsthe,
         crefthemark,
@@ -118,10 +119,11 @@
 \begin{document}
 
 \def\PackageVersion{2023/07/23}
+\def\PackageSubVersion{a}
 
 \title{\crefthepackage{}\\\smallskip\itshape Cross referencing with proper definite articles}
 \author{Jinwen XU}
-\thanks{Corresponding to: \texttt{\crefthepackage{} \PackageVersion}}
+\thanks{Corresponding to: \texttt{\crefthepackage{} \PackageVersion\PackageSubVersion}}
 \date{\TheDate{\PackageVersion}[only-year-month], in Beijing}
 
 \maketitle
@@ -242,7 +244,7 @@
 
 Voilà !
 
-\section{What about German}
+\section{For language with declensions}
 
 In German, there are four declensions: nominative (\texttt{Nominativ}), genitive (\texttt{Genitiv}), dative (\texttt{Dativ}) and accusative (\texttt{Akkusativ}), making the previously presented mechanism insufficient. For such situation, we introduce the command \lstinline|\crefthevariantname| to specify the referencing name for the correspond environment. Below is an example of usage:
 
@@ -258,7 +260,10 @@
 \end{code}
 
 \begin{tip}
-    The first line in the configuration is the default set of names when no variant is specified. It is recommended, though not required.
+    \begin{itemize}
+        \item The first line in the configuration is the default set of names when no variant is specified. It is recommended, though not required.
+        \item There is also an equivalent but shorter name \lstinline|\setcrefname| for this command.
+    \end{itemize}
 \end{tip}
 
 After this, you may refer to a theorem via
@@ -280,10 +285,10 @@
 
 \section{Using abbreviation form}
 
-There is another usage of \lstinline|\crefthevariantname|: setting the abbreviation form. This allows you to use both the full form and the abbreviation form in the same document. For example, you may set
+There is another usage of \lstinline|\crefthevariantname| (or equivalently, \lstinline|\setcrefname|): setting the abbreviation form. This allows you to use both the full form and the abbreviation form within the same document. For example, you may set
 
 \begin{code}
-\crefthevariantname{theorem}
+\setcrefname{theorem}
   {
     {theorem}{theorems}
     , abbr. = {th.}{ths.}
@@ -290,16 +295,22 @@
   }
 \end{code}
 
-Then, when referencing, you can use the command option \commandoption{abbr.} to enable the abbreviation form:
+Then, when referencing, you can use the command option \commandoption{abbr.} to enable abbreviation:
 
 \begin{code}
 \crefthe[(*\commandoption{abbr.}*)]{(*\meta{label}*)}
 \end{code}
 
+\begin{tip}[Attention]
+    Please note that \commandoption{abbr.} has more priority than the option(s) for specifying declensions. This means that when \commandoption{abbr.} is enabled, the declensions are simply ignored.
+\end{tip}
+
 \section{Regarding the upper and lower cases}
 
-As in \textsf{cleveref}, these commands have corresponding uppercased version: \lstinline|\Crefthename|,\linebreak \lstinline|\Crefthe|, \lstinline|\nameCrefthe| and \lstinline|\nameCrefsthe|, similar to \lstinline|\Crefname|, \lstinline|\Cref|, \lstinline|\nameCref|\linebreak and \lstinline|\nameCrefs|, reserved for using at the beginning of a sentence. For languages with declensions, such as German, there is also a \lstinline|\Crefthevariantname|, whose usage is similar to the \lstinline|\crefthevariantname| introduced above.
+As in \textsf{cleveref}, these commands have corresponding uppercased version: \lstinline|\Crefthename|,\linebreak \lstinline|\Crefthe|, \lstinline|\nameCrefthe| and \lstinline|\nameCrefsthe|, similar to \lstinline|\Crefname|, \lstinline|\Cref|, \lstinline|\nameCref|\linebreak and \lstinline|\nameCrefs|, reserved for using at the beginning of a sentence.
 
+For languages with declensions, such as German, there is also a \lstinline|\Crefthevariantname| (or equivalently, \lstinline|\setCrefname|), corresponding to the above \lstinline|\crefthevariantname|.
+
 \lstinline|\Crefthe| (and the name-only relatives) can handle case changing automatically: for example, with \lstinline|\Crefthe[À]{thm1,thm2,prop3}|, you will get something like
 
 \begin{demo}
@@ -332,7 +343,6 @@
 
 But then of course you shall need to write the word \textquote{Ce/Cet/Cette} (these are all different forms of \textquote{This} in French) by yourself --- and if you later decide to change the type of the environment to which this \meta{label} refers, don't forget to change this word accordingly.
 
-\pagebreak
 \section{For writing multi-language documents}
 
 To place hyperlinks at the correct place, \lstinline|\crefthename| touches the corresponding format macro \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.
@@ -368,8 +378,7 @@
 \end{itemize}
 
 
-% \clearpage
-
+\bigskip
 \section{Known issues}
 \begin{itemize}
     \item \crefthepackage{} currently works for French, German, Italian, Portuguese (European and Brazilian) and Spanish --- certainly more languages would be added to this list in the future.

Modified: trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty	2023-07-23 23:43:41 UTC (rev 67720)
+++ trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty	2023-07-24 20:21:58 UTC (rev 67721)
@@ -12,7 +12,7 @@
 \NeedsTeXFormat{LaTeX2e}[2022-06-01]
 \ProvidesExplPackage
   {crefthe}
-  {2023/07/23} {}
+  {2023/07/23a} {}
   {Cross referencing with proper definite articles}
 
 \keys_define:nn { crefthe }
@@ -93,37 +93,54 @@
     \__crefthe_cref_general:NNNnnN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_nameCrefs_original:w
   }
 
-\keys_define:nn { crefthe-setting }
+\keys_define:nn { crefthe-command }
   {
     , noun          .code:n             = { \RenewDocumentCommand \crefthemark { m } {} }
 
     , variant       .tl_set:N           = \l__crefthe_variant_tl
 
-    % , nom           .meta:n             = { variant = Nominativ }
-    % , nom.          .meta:n             = { variant = Nominativ }
-    % , Nom           .meta:n             = { variant = Nominativ }
-    % , Nom.          .meta:n             = { variant = Nominativ }
-    % , gen           .meta:n             = { variant = Genitiv   }
-    % , gen.          .meta:n             = { variant = Genitiv   }
-    % , Gen           .meta:n             = { variant = Genitiv   }
-    % , Gen.          .meta:n             = { variant = Genitiv   }
-    % , dat           .meta:n             = { variant = Dativ     }
-    % , dat.          .meta:n             = { variant = Dativ     }
-    % , Dat           .meta:n             = { variant = Dativ     }
-    % , Dat.          .meta:n             = { variant = Dativ     }
-    % , akk           .meta:n             = { variant = Akkusativ }
-    % , akk.          .meta:n             = { variant = Akkusativ }
-    % , Akk           .meta:n             = { variant = Akkusativ }
-    % , Akk.          .meta:n             = { variant = Akkusativ }
+    , abbr          .bool_set:N         = \l__crefthe_abbr_bool
+    , abbr.         .bool_set:N         = \l__crefthe_abbr_bool
 
-    % , unknown       .code:n             = {
-    %                                         \bool_gset_true:N \g__crefthe_has_prep_bool
-    %                                         \tl_set:No \l__crefthe_prep_tl { \l_keys_key_tl }
-    %                                       }
-
     , unknown       .code:n             = {}
   }
+\clist_const:Nn \c__crefthe_command_known_keys_clist { noun, abbr, abbr. }
 
+\cs_new:Nn \__crefthe_command_key_parser:n
+  {
+    \bool_set_false:N \l__crefthe_variant_matched_bool
+    \clist_if_in:NnF \c__crefthe_command_known_keys_clist { #1 }
+      {
+        \str_if_eq:VnT \languagename { ngerman }
+          {
+            \str_case:nnT { #1 }
+              {
+                { nom  } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } }
+                { nom. } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } }
+                { Nom  } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } }
+                { Nom. } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } }
+                { gen  } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv }   }
+                { gen. } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv }   }
+                { Gen  } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv }   }
+                { Gen. } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv }   }
+                { dat  } { \tl_set:Nn \l__crefthe_variant_tl { Dativ }     }
+                { dat. } { \tl_set:Nn \l__crefthe_variant_tl { Dativ }     }
+                { Dat  } { \tl_set:Nn \l__crefthe_variant_tl { Dativ }     }
+                { Dat. } { \tl_set:Nn \l__crefthe_variant_tl { Dativ }     }
+                { akk  } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } }
+                { akk. } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } }
+                { Akk  } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } }
+                { Akk. } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } }
+              } { \bool_set_true:N \l__crefthe_variant_matched_bool }
+          }
+        \bool_if:NF \l__crefthe_variant_matched_bool
+          {
+            \bool_gset_true:N \g__crefthe_has_prep_bool
+            \tl_set:Nn \l__crefthe_prep_tl { #1 }
+          }
+      }
+  }
+
 \bool_new:N \l__crefthe_variant_matched_bool
 \cs_new_protected:Nn \__crefthe_cref_general:NNNnnN
   % #1 = star or not
@@ -136,50 +153,16 @@
     \group_begin:
 
     \tl_set:Nn \l__crefthe_variant_tl {}
+    \bool_set_false:N \l__crefthe_abbr_bool
+
     \bool_gset_false:N \g__crefthe_has_prep_bool
     \tl_set:Nn \l__crefthe_prep_tl {}
 
-    \keys_set:nn { crefthe-setting } { #4 }
+    \keys_set:nn { crefthe-command } { #4 }
+    % Below is for getting the preposition
+    \keyval_parse:NNn \__crefthe_command_key_parser:n \use_none:nn { #4 }
 
-    % This should actually be part of the keys parsing
-    \clist_map_inline:nn { #4 }
-      {
-        \bool_set_false:N \l__crefthe_variant_matched_bool
-        \str_if_in:nnF { ##1 } { = }
-          {% for keys without values
-            \str_case:nnT { ##1 }
-              {
-                { abbr  } { \tl_set:Nn \l__crefthe_variant_tl { abbr. } }
-                { abbr. } { \tl_set:Nn \l__crefthe_variant_tl { abbr. } }
-              } { \bool_set_true:N \l__crefthe_variant_matched_bool }
-            \str_if_eq:VnT \languagename { ngerman }
-              {
-                \str_case:nnT { ##1 }
-                  {
-                    { nom  } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } }
-                    { nom. } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } }
-                    { Nom  } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } }
-                    { Nom. } { \tl_set:Nn \l__crefthe_variant_tl { Nominativ } }
-                    { gen  } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv }   }
-                    { gen. } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv }   }
-                    { Gen  } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv }   }
-                    { Gen. } { \tl_set:Nn \l__crefthe_variant_tl { Genitiv }   }
-                    { dat  } { \tl_set:Nn \l__crefthe_variant_tl { Dativ }     }
-                    { dat. } { \tl_set:Nn \l__crefthe_variant_tl { Dativ }     }
-                    { Dat  } { \tl_set:Nn \l__crefthe_variant_tl { Dativ }     }
-                    { Dat. } { \tl_set:Nn \l__crefthe_variant_tl { Dativ }     }
-                    { akk  } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } }
-                    { akk. } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } }
-                    { Akk  } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } }
-                    { Akk. } { \tl_set:Nn \l__crefthe_variant_tl { Akkusativ } }
-                  } { \bool_set_true:N \l__crefthe_variant_matched_bool }
-              }
-            \bool_if:NF \l__crefthe_variant_matched_bool
-              {
-                \tl_set:Nn \l__crefthe_prep_tl { ##1 }
-              }
-          }
-      }
+    \bool_if:NT \l__crefthe_abbr_bool { \tl_set:Nn \l__crefthe_variant_tl { abbr. } }
 
     \bool_if:NTF #2
       { \tl_set:No \l__crefthe_prep_once_tl { \l__crefthe_prep_tl } }
@@ -286,6 +269,9 @@
     \crefthe_pass_variant_to:n { \Crefthename { #1 } }
   }
 
+\NewCommandCopy \setcrefname \crefthevariantname
+\NewCommandCopy \setCrefname \Crefthevariantname
+
 \tl_new:N \l__crefthe_variant_noun_singular_tl
 \tl_new:N \l__crefthe_variant_noun_plural_tl
 \tl_new:N \l__crefthe_variant_article_singular_tl
@@ -326,7 +312,7 @@
 \cs_new_protected:Npn \__crefthe_parse_variant_default:n #1
   {
     \bool_set_true:N \l__crefthe_variant_default_bool
-    \__crefthe_variant_parser:w #1 \q_stop
+    \__crefthe_variant_parser:w #1 {} {} \q_stop
     \tl_set:Nx \l__crefthe_variant_default_article_singular_tl
       { \tl_item:Nn \l__crefthe_parsed_tl { 1 } }
     \tl_set:Nx \l__crefthe_variant_default_noun_singular_tl
@@ -338,7 +324,7 @@
   }
 \cs_new_protected:Npn \__crefthe_parse_variant_value:nn #1#2
   {
-    \__crefthe_variant_parser:w #2 \q_stop
+    \__crefthe_variant_parser:w #2 {} {} \q_stop
     \tl_put_right:Nx \l__crefthe_variant_article_singular_tl
       { { \tl_to_str:n { #1 } } { \tl_item:Nn \l__crefthe_parsed_tl { 1 } } }
     \tl_put_right:Nx \l__crefthe_variant_noun_singular_tl
@@ -509,8 +495,11 @@
     { De~les }     { Des }
   }
 
-\bool_if:NF \l__crefthe_disable_contractions_for_german_bool
+\bool_if:NTF \l__crefthe_disable_contractions_for_german_bool
   {
+    \tl_const:Nn \c_crefthe_contraction_rule_ngerman_tl {}
+  }
+  {
     \tl_const:Nn \c_crefthe_contraction_rule_ngerman_tl
       {
         { an~dem  }     { am   }



More information about the tex-live-commits mailing list.