texlive[70156] Master/texmf-dist: crefthe (25feb24)

commits+karl at tug.org commits+karl at tug.org
Sun Feb 25 22:06:50 CET 2024


Revision: 70156
          https://tug.org/svn/texlive?view=revision&revision=70156
Author:   karl
Date:     2024-02-25 22:06:50 +0100 (Sun, 25 Feb 2024)
Log Message:
-----------
crefthe (25feb24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/crefthe/README.md
    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/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/crefthe/README.md	2024-02-25 21:06:41 UTC (rev 70155)
+++ trunk/Master/texmf-dist/doc/latex/crefthe/README.md	2024-02-25 21:06:50 UTC (rev 70156)
@@ -1,12 +1,12 @@
 <!-- Copyright (C) 2021-2024 by Jinwen XU -->
 
-# crefthe - cross referencing with proper definite articles
+# crefthe — cross referencing with proper definite articles and declensions
 
-"crefthe" is a LaTeX package aimed at helping `\cref` addressing the definite articles properly (especially for the article contractions in many European languages).
+"crefthe" is a LaTeX package aimed at helping `\cref` to handle the definite articles and declensions properly (especially for the phenomenon of article contractions in many European languages, such as French and German).
 
 ## Motivation
 
-By default, when using cleveref's `\cref` to reference theorem-like environments, the names do not contain definite articles. This may be acceptable for English, but 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, when using cleveref's `\cref` to reference theorem-like environments, the names do not contain definite articles. This may be acceptable for English, but 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.
 
 As an example, if we define the French names to be:
 ```latex

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	2024-02-25 21:06:41 UTC (rev 70155)
+++ trunk/Master/texmf-dist/doc/latex/crefthe/crefthe-doc.tex	2024-02-25 21:06:50 UTC (rev 70156)
@@ -5,6 +5,8 @@
 
 \usepackage{ProjLib}
 
+\setmonofont[Scale=.9]{Iosevka}
+
 %%================================
 %% For typesetting code
 %%================================
@@ -26,7 +28,7 @@
     breaklines = true,
     frame = lines,
     backgroundcolor = \color{code-background},
-    flexiblecolumns = true,
+    basewidth = .5em,
     escapeinside = {(*}{*)},
     alsoletter = {_,:},
     % numbers = left,
@@ -69,8 +71,8 @@
 \lstnewenvironment{code}{\setstretch{1.05}\LocallyStopLineNumbers}{\ResumeLineNumbers\vspace{-.3\baselineskip}\vspace{-.5\parskip}}
 \lstnewenvironment{code*}{\setstretch{1.05}\lstset{numbers=left}\LocallyStopLineNumbers}{\ResumeLineNumbers\vspace{-.3\baselineskip}\vspace{-.5\parskip}}
 
-\newcommand{\packageoption}[1]{\texttt{\textcolor{code-option}{#1}}}
-\newcommand{\commandoption}[1]{\texttt{\textcolor{code-keys}{#1}}}
+\newcommand{\packageoption}[1]{\textcolor{code-option}{\texttt{#1}}}
+\newcommand{\commandoption}[1]{\textcolor{code-keys}{\texttt{#1}}}
 
 %%================================
 %% tip
@@ -120,12 +122,12 @@
 
 \begin{document}
 
-\def\PackageVersion{2024/02/24}
+\def\PackageVersion{2024/02/25}
 \def\PackageSubVersion{}
 
-\title{\crefthepackage{}\\\smallskip\itshape Cross referencing with proper definite articles}
+\title{\crefthepackage{}\\\smallskip\itshape Cross referencing with proper definite articles and declensions}
 \author{Jinwen XU}
-\thanks{Corresponding to: \texttt{\crefthepackage{} \PackageVersion\PackageSubVersion}}
+\thanks{Corresponding to: \texttt{\crefthepackage{} \PackageVersion\PackageSubVersion}.}
 \date{\TheDate{\PackageVersion}[only-year-month], in Paris}
 
 \maketitle
@@ -132,7 +134,7 @@
 
 \begin{abstract}
     \raggedleft
-    The package \crefthepackage{} provides a command \lstinline|\crefthe| parallel to \textsf{cleveref}'s \lstinline|\cref| for handling definite articles properly (especially for the article contractions in some European languages).
+    The package \crefthepackage{} provides a command \lstinline|\crefthe| parallel to \textsf{cleveref}'s \lstinline|\cref| for handling definite articles and declensions properly (especially for the phenomenon of article contractions in some European languages, such as French and German).
 \end{abstract}
 
 \section{The motivation}
@@ -224,6 +226,7 @@
 % \end{code}
 
 
+\enlargethispage*{\baselineskip}
 \section{Example}
 
 Let us come back to the example at the beginning, now you can do this:
@@ -310,7 +313,7 @@
 
 \section{Regarding the upper and lower cases}
 
-As in \textsf{cleveref}, these commands have corresponding uppercased version: \lstinline|\Crefthename|,\linebreak \lstinline|\Crefthe|, \lstinline|\nameCrefthe|, \lstinline|\nameCrefsthe| and \lstinline|\Cpagerefthe|, similar to \lstinline|\Crefname|,\linebreak \lstinline|\Cref|, \lstinline|\nameCref|, \lstinline|\nameCrefs| and \lstinline|\Cpageref|, reserved for using at the beginning of a sentence. Their usage is essentially the same as the corresponding lowercase version.
+As with \textsf{cleveref}, these commands have corresponding uppercased version: \lstinline|\Crefthename|, \lstinline|\Crefthe|, \lstinline|\nameCrefthe|, \lstinline|\nameCrefsthe| and \lstinline|\Cpagerefthe|, similar to \lstinline|\Crefname|, \lstinline|\Cref|, \lstinline|\nameCref|, \lstinline|\nameCrefs| and \lstinline|\Cpageref|, reserved for using at the beginning of a sentence. Their usage is essentially the same as the corresponding lowercase version.
 
 For languages with declensions, such as German, there is also a \lstinline|\Crefthevariantname| (or equivalently, \lstinline|\setCrefname|), corresponding to the above \lstinline|\crefthevariantname|.
 

Modified: trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty	2024-02-25 21:06:41 UTC (rev 70155)
+++ trunk/Master/texmf-dist/tex/latex/crefthe/crefthe.sty	2024-02-25 21:06:50 UTC (rev 70156)
@@ -12,8 +12,8 @@
 \NeedsTeXFormat{LaTeX2e}[2022-06-01]
 \ProvidesExplPackage
   {crefthe}
-  {2024/02/24} {}
-  {Cross referencing with proper definite articles}
+  {2024/02/25} {}
+  {Cross referencing with proper definite articles and declensions}
 
 \keys_define:nn { crefthe }
   {
@@ -41,6 +41,59 @@
 \RequirePackage { regexpatch }
 \@namedef{ver at xpatch.sty}{}
 
+% Fix for cleveref in order to work with long range of pages
+% See https://tex.stackexchange.com/a/620066
+\providecommand*{\@setcpagerefrange}[3]{%
+    \@@setcpagerefrange{#1}{#2}{cref}{#3}}
+\providecommand*{\@setCpagerefrange}[3]{%
+    \@@setcpagerefrange{#1}{#2}{Cref}{#3}}
+\providecommand*{\@setlabelcpagerefrange}[3]{%
+    \@@setcpagerefrange{#1}{#2}{labelcref}{#3}}
+
+% Fix for cleveref in order to work with xr-hyper
+% See https://tex.stackexchange.com/a/708445
+\def\cref at getref#1#2{%
+  \expandafter\let\expandafter#2\csname r@#1 at cref\endcsname%
+  \expandafter\expandafter\expandafter\def%
+    \expandafter\expandafter\expandafter#2%
+    \expandafter\expandafter\expandafter{%
+      \expandafter\@firstoffive#2}}% <-------- five
+\def\cpageref at getref#1#2{%
+  \expandafter\let\expandafter#2\csname r@#1 at cref\endcsname%
+  \expandafter\expandafter\expandafter\def%
+    \expandafter\expandafter\expandafter#2%
+    \expandafter\expandafter\expandafter{%
+      \expandafter\@secondoffive#2}}% <----------- five
+\AtBeginDocument{%
+  \def\label at noarg#1{%
+    \cref at old@label{#1}%
+    \@bsphack%
+    \edef\@tempa{{page}{\the\c at page}}%
+    \setcounter{page}{1}%
+    \edef\@tempb{\thepage}%
+    \expandafter\setcounter\@tempa%
+    \cref at constructprefix{page}{\cref at result}%
+    \protected at write\@auxout{}%
+      {\string\newlabel{#1 at cref}{{\cref at currentlabel}%
+      {[\@tempb][\arabic{page}][\cref at result]\thepage}{}{}{}}}% <----- five
+    \@esphack}%
+  \def\label at optarg[#1]#2{%
+    \cref at old@label{#2}%
+    \@bsphack%
+    \edef\@tempa{{page}{\the\c at page}}%
+    \setcounter{page}{1}%
+    \edef\@tempb{\thepage}%
+    \expandafter\setcounter\@tempa%
+    \cref at constructprefix{page}{\cref at result}%
+    \protected at edef\cref at currentlabel{%
+      \expandafter\cref at override@label at type%
+        \cref at currentlabel\@nil{#1}}%
+    \protected at write\@auxout{}%
+      {\string\newlabel{#2 at cref}{{\cref at currentlabel}%
+      {[\@tempb][\arabic{page}][\cref at result]\thepage}{}{}{}}}% <------- five
+    \@esphack}%
+}
+
 \NewCommandCopy \crefthe_cref_original:w      \cref
 \NewCommandCopy \crefthe_Cref_original:w      \Cref
 \NewCommandCopy \crefthe_crefname_original:w  \crefname
@@ -109,15 +162,39 @@
 \keys_define:nn { crefthe-command }
   {
     , noun          .code:n             = { \RenewDocumentCommand \crefthemark { m } {} }
+    , only-noun     .meta:n             = { noun }
+    , only~noun     .meta:n             = { noun }
+    , only noun     .meta:n             = { noun }
+    , no-prep       .meta:n             = { noun }
+    , no~prep       .meta:n             = { noun }
+    , no prep       .meta:n             = { noun }
+    , hide-prep     .meta:n             = { noun }
+    , hide~prep     .meta:n             = { noun }
+    , hide prep     .meta:n             = { noun }
+    , no-preposition       .meta:n      = { noun }
+    , no~preposition       .meta:n      = { noun }
+    , no preposition       .meta:n      = { noun }
+    , hide-preposition     .meta:n      = { noun }
+    , hide~preposition     .meta:n      = { noun }
+    , hide preposition     .meta:n      = { noun }
 
     , variant       .tl_set:N           = \l__crefthe_variant_tl
+    , declension    .tl_set:N           = \l__crefthe_variant_tl
+    , D             .tl_set:N           = \l__crefthe_variant_tl
 
     , abbr          .bool_set:N         = \l__crefthe_abbr_bool
     , abbr.         .bool_set:N         = \l__crefthe_abbr_bool
+    , abbreviation  .bool_set:N         = \l__crefthe_abbr_bool
 
     , unknown       .code:n             = {}
   }
-\clist_const:Nn \c__crefthe_command_known_keys_clist { noun, abbr, abbr. }
+\clist_const:Nn \c__crefthe_command_known_keys_clist
+  {
+    noun, only-noun, only~noun, only noun,
+    no-prep, no~prep, no prep, no-preposition, no~preposition, no preposition,
+    hide-prep, hide~prep, hide prep, hide-preposition, hide~preposition, hide preposition,
+    abbr, abbr., abbreviation,
+  }
 
 \cs_new:Nn \__crefthe_command_key_parser:n
   {



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