texlive[67713] Master/texmf-dist: crefthe (23jul23)

commits+karl at tug.org commits+karl at tug.org
Sun Jul 23 22:46:21 CEST 2023


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

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 20:46:09 UTC (rev 67712)
+++ trunk/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex	2023-07-23 20:46:21 UTC (rev 67713)
@@ -117,7 +117,7 @@
 
 \begin{document}
 
-\def\PackageVersion{2023/07/22}
+\def\PackageVersion{2023/07/23}
 
 \title{\crefthepackage{}\\\smallskip\itshape Cross referencing with proper definite articles}
 \author{Jinwen XU}
@@ -133,7 +133,7 @@
 
 \section{The motivation}
 
-By default, with \textsf{cleveref}'s \lstinline|\cref| to reference theorem-like environments, the names do not contain definite articles. While this might be acceptable for English, it is certainly not good enough for languages such as French, Italian, Portuguese, Spanish, etc. --- in these cases there shall be grammatical errors and would give you a strong feeling that it is machine-generated.
+By default, with \textsf{cleveref}'s \lstinline|\cref| to reference theorem-like environments, the names do not contain definite articles. While this might be acceptable for English, it is certainly not good enough for languages such as French, German, Italian, Portuguese, Spanish, etc. --- in these cases there shall be grammatical errors and would give you a strong feeling that it is machine-generated.
 
 However, even if we manually add the definite articles to the names, there would still be other problems. As an example, if we define the French names to be:
 
@@ -257,32 +257,56 @@
   }
 \end{code}
 
-The first line in the configuration is the default set of names when no variant is specified. It is recommended, though not required.
+\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.
+\end{tip}
 
 After this, you may refer to a theorem via
 
 \begin{code}
-\crefthe[(*\meta{prep}*),variant=(*\meta{declension}*)]{(*\meta{label}*)}
+\crefthe[(*\meta{prep}*),(*\commandoption{variant}*)=(*\meta{declension}*)]{(*\meta{label}*)}
 \end{code}
 
 You may also use the shortcuts (\texttt{nom.}, \texttt{gen.}, \texttt{dat.} and \texttt{akk.}), such as:
 
 \begin{code}
-\crefthe[(*\meta{prep}*),Nom]{(*\meta{label}*)}     \crefthe[(*\meta{prep}*),Nom.]{(*\meta{label}*)}
-\crefthe[(*\meta{prep}*),nom]{(*\meta{label}*)}     \crefthe[(*\meta{prep}*),nom.]{(*\meta{label}*)}
+\crefthe[(*\meta{prep}*),(*\commandoption{Nom}*)]{(*\meta{label}*)}     \crefthe[(*\meta{prep}*),(*\commandoption{Nom.}*)]{(*\meta{label}*)}
+\crefthe[(*\meta{prep}*),(*\commandoption{nom}*)]{(*\meta{label}*)}     \crefthe[(*\meta{prep}*),(*\commandoption{nom.}*)]{(*\meta{label}*)}
 \end{code}
 
 These four are all equivalent and you may choose one to use according to your preference.
 
+Article contractions are by default enabled for German, but if you don't want this, you may use the package option \packageoption{disable german article contractions}.
+
+\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
+
+\begin{code}
+\crefthevariantname{theorem}
+  {
+    {theorem}{theorems}
+    , abbr. = {th.}{ths.}
+  }
+\end{code}
+
+Then, when referencing, you can use the command option \commandoption{abbr.} to enable the abbreviation form:
+
+\begin{code}
+\crefthe[(*\commandoption{abbr.}*)]{(*\meta{label}*)}
+\end{code}
+
 \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. \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
+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.
 
+\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}
     \textbf{Aux} théorèmes 1 et 2 et \textbf{à la} proposition 3
 \end{demo}
 
-Of course you will have to define the \lstinline|\Crefthename|s separately, for example as:
+Of course, you would have to define the \lstinline|\Crefthename|s separately, for example as:
 
 \begin{code}
 \Crefthename{theorem}[Le]{théorème}[Les]{théorèmes}
@@ -289,6 +313,26 @@
 \Crefthename{proposition}[La]{proposition}[Les]{propositions}
 \end{code}
 
+\section{On the coordination of gender and number}
+
+In many languages, adjectives and verbs need to be properly inflected for the gender and singular or plural of the noun. Take French as example, you may see the following expressions:
+\begin{itemize}
+    \item La proposition précédent\textbf{e}/suivant\textbf{e}... (The previous/next proposition...)
+    \item La proposition est illustré\textbf{e} par... (The proposition is illustrated by...)
+\end{itemize}
+Thus if you later decide to change this proposition (feminine) into a theorem (masculine), you would have to modify the adjectives and verbs accordingly. Similar things happens in many other languages, and it is not quite realistic to fully automate such modifications.
+
+The name-only relatives \lstinline|\namecrefthe|, \lstinline|\nameCrefthe| etc. are designed for this purpose. They do not automatically solve these kinds of problems, but you may later search for the \meta{label} of the environment that changes, and modify the surrounding context manually --- in other words, these commands serve as recorders: if you write the word like \textquote{theorem} or \textquote{proposition} directly in the text, then later it would be unclear which part of your text needs to be update when the environment itself changes.
+
+There is another case. For example, if you wish to say \textquote{ce théorème} (\textquote{this theorem}), the pre-defined set of names that contains definite articles would be somewhat redundant. In such situation, you may use the command option \commandoption{noun} to show only the noun:
+
+\begin{code}
+\namecref[(*\commandoption{noun}*)]{(*\meta{label}*)}
+\end{code}
+
+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.
@@ -329,8 +373,8 @@
 \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.
-    \item For now, you cannot specify the masculine/masculine/... of words. This means, for instance, that you cannot make the suffix adjective automatically adopted to the word when using \lstinline|\namecref| --- as an example, if you wish to say \textquote{la proposition suivante} (in French), you would have to write the feminine adjective manually. The situation should be improved with the introduction of a new key-value configuration system, which is currently on the todo-list.
-    Meanwhile, you may consider the package \textsf{zref-clever}, which has a much more powerful and sophisticated interface for configuring cross referencing.
+    % \item For now, you cannot specify the masculine/masculine/... of words. This means, for instance, that you cannot make the suffix adjective automatically adopted to the word when using \lstinline|\namecref| --- as an example, if you wish to say \textquote{la proposition suivante} (in French), you would have to write the feminine adjective manually. The situation should be improved with the introduction of a new key-value configuration system, which is currently on the todo-list.
+    % Meanwhile, you may consider the package \textsf{zref-clever}, which has a much more powerful and sophisticated interface for configuring cross referencing.
     \item The names of theorem-like environments are not provided here, you need to define them by yourself. However, users are encouraged to use the \ProjLib{} toolkit (more specifically, the internal package \textsf{create-theorem}), which already handles everything for you.
 \end{itemize}
 

Modified: trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty	2023-07-23 20:46:09 UTC (rev 67712)
+++ trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty	2023-07-23 20:46:21 UTC (rev 67713)
@@ -12,7 +12,7 @@
 \NeedsTeXFormat{LaTeX2e}[2022-06-01]
 \ProvidesExplPackage
   {crefthe}
-  {2023/07/22} {}
+  {2023/07/23} {}
   {Cross referencing with proper definite articles}
 
 \keys_define:nn { crefthe }
@@ -21,6 +21,12 @@
     , overwrite  .initial:n  = { false }
     , nameinlink .bool_set:N = \l__crefthe_nameinlink_bool
     , nameinlink .initial:n  = { false }
+
+    , disable-german-article-contractions .bool_set:N = \l__crefthe_disable_contractions_for_german_bool
+    , disable-german-article-contractions .initial:n  = { false }
+    , disable~german~article~contractions .bool_set:N = \l__crefthe_disable_contractions_for_german_bool
+    , disable german article contractions .bool_set:N = \l__crefthe_disable_contractions_for_german_bool
+
     , unknown    .code:n     =
         { \PassOptionsToPackage { \CurrentOption } { cleveref } }
   }
@@ -89,6 +95,8 @@
 
 \keys_define:nn { crefthe-setting }
   {
+    , noun          .code:n             = { \RenewDocumentCommand \crefthemark { m } {} }
+
     , variant       .tl_set:N           = \l__crefthe_variant_tl
 
     % , nom           .meta:n             = { variant = Nominativ }
@@ -125,6 +133,8 @@
   % #5 = label
   % #6 = original command, such as \crefthe_cref_original:w or \crefthe_Cref_original:w
   {
+    \group_begin:
+
     \tl_set:Nn \l__crefthe_variant_tl {}
     \bool_gset_false:N \g__crefthe_has_prep_bool
     \tl_set:Nn \l__crefthe_prep_tl {}
@@ -137,6 +147,11 @@
         \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 }
@@ -182,12 +197,12 @@
               }
           }
       }
-    \group_begin:
     \bool_if:NTF #1
       { #6 * { #5 } }
       { #6   { #5 } }
+    \tl_gclear:N \l__crefthe_prep_each_tl
+
     \group_end:
-    \tl_gclear:N \l__crefthe_prep_each_tl
   }
 
 % \__crefthe_prep_mode: defines the default mode for supported languages
@@ -493,25 +508,30 @@
     { De~le  }     { Du  }
     { De~les }     { Des }
   }
-\tl_const:Nn \c_crefthe_contraction_rule_ngerman_tl
+
+\bool_if:NF \l__crefthe_disable_contractions_for_german_bool
   {
-    { an~dem  }     { am   }
-    { an~das  }     { ans  }
-    { bei~dem }     { beim }
-    { in~dem  }     { im   }
-    { in~das  }     { ins  }
-    { von~dem }     { vom  }
-    { zu~dem  }     { zum  }
-    { zu~der  }     { zur  }
-    { An~dem  }     { Am   }
-    { An~das  }     { Ans  }
-    { Bei~dem }     { Beim }
-    { In~dem  }     { Im   }
-    { In~das  }     { Ins  }
-    { Von~dem }     { Vom  }
-    { Zu~dem  }     { Zum  }
-    { Zu~der  }     { Zur  }
+    \tl_const:Nn \c_crefthe_contraction_rule_ngerman_tl
+      {
+        { an~dem  }     { am   }
+        { an~das  }     { ans  }
+        { bei~dem }     { beim }
+        { in~dem  }     { im   }
+        { in~das  }     { ins  }
+        { von~dem }     { vom  }
+        { zu~dem  }     { zum  }
+        { zu~der  }     { zur  }
+        { An~dem  }     { Am   }
+        { An~das  }     { Ans  }
+        { Bei~dem }     { Beim }
+        { In~dem  }     { Im   }
+        { In~das  }     { Ins  }
+        { Von~dem }     { Vom  }
+        { Zu~dem  }     { Zum  }
+        { Zu~der  }     { Zur  }
+      }
   }
+
 \tl_const:Nn \c_crefthe_contraction_rule_italian_tl
   {
     { a~il   }     { al    }
@@ -585,6 +605,7 @@
     { Su~gli }     { Sugli }
     { Su~le  }     { Sulle }
   }
+
 \tl_const:Nn \c_crefthe_contraction_rule_spanish_tl
   {
     { a~el  }      { al  }
@@ -592,6 +613,7 @@
     { A~el  }      { Al  }
     { De~el }      { Del }
   }
+
 \tl_const:Nn \c_crefthe_contraction_rule_portuguese_tl
   {
     { a~o   }      { ao  }



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