Debian Codegraph @

texmf-dist/doc/latex/crefthe/README.md

raw
1 <!-- Copyright (C) 2021-2024 by Jinwen XU -->
2
3 # crefthe — cross referencing with proper definite articles and declensions
4
5 "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).
6
7 ## Motivation
8
9 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.
10
11 As an example, if we define the French names to be:
12 ```latex
13 \crefname{theorem}{le théorème}{les théorèmes}
14 \crefname{proposition}{la proposition}{les propositions}
15 ```
16 Then when one writes (which means "*We can deduce this from ...*"):
17 ```latex
18 On peut le déduire de \cref{thm1,thm2,prop3}.
19 ```
20 the result would be:
21 > On peut le déduire **de les** théorèmes 1 et 2 et **la** proposition 3.
22
23 which is wrong, as the correct result should be:
24 > On peut le déduire **des** théorèmes 1 et 2 et **de la** proposition 3.
25
26 `\cref` would not be able to handle such cases correctly.
27
28 ### The solution
29
30 Thus, it would be better to have a new command `\crefthe[<prep>]{<labels>}`, and to use it like
31 ```latex
32 \crefthe[de]{thm1,thm2,prop3}
33 ```
34 in order to get "*des théorèmes 1 et 2 et de la proposition 3*".
35
36 ## Usage
37
38 Simply load the package with:
39 ```latex
40 \usepackage{crefthe}
41 ```
42 > "crefthe" uses "cleveref" internally, thus it should usually be placed at the last of your preamble.
43
44 > With the package option `overwrite`, you may simply use `\cref` for `\crefthe`, and similarly for other commands.
45
46 Before everything, you need to define the names, which can be done with `\crefthename`. Its syntax is similar to `\crefname`, but now you can specify the definite articles, for example (in French):
47 ```latex
48 \crefthename{theorem}[le]{théorème}[les]{théorèmes}
49 ```
50
51 Then you can use the command `\crefthe` as follows:
52 - `\crefthe[<prep>]{<labels>}`
53 - This will pass the preposition `<prep>` to the definite articles that follows. Its behavior depends on the current language (for example, in Spanish, `<prep>` is passed only to the first definite article, while in French it is passed to everyone).
54 - `\crefthe-[<prep>]{<labels>}` and `\crefthe+[<prep>]{<labels>}`
55 - In case the automatic version does not meet your needs, here are two manual ones. The `-` version passes the preposition `<prep>` only to the first definite article, while the `+` version passes `<prep>` to every definite article.
56
57 > - There is also a stared version `\crefthe*` for generating the same text but without hyperlinks.
58 > - The name-only relatives are also available: `\namecrefthe` and `\namecrefsthe`.
59 > - `\cpagerefthe` and `\Cpagerefthe` are provided as well.
60
61 ### Regarding language with declensions
62
63 In German, there are four declensions: nominative (`Nominativ`), genitive (`Genitiv`), dative (`Dativ`) and accusative (`Akkusativ`). For such situation, we introduce the command `\crefthevariantname` to specify the referencing name for the correspond environment. Below is an example of usage:
64 ```latex
65 \crefthevariantname{theorem}
66 {
67 {Satz}{Sätze}
68 , Nominativ = [der]{Satz}[die]{Sätze}
69 , Genitiv = [des]{Satzes}[der]{Sätze}
70 , Dativ = [dem]{Satz}[den]{Sätzen}
71 , Akkusativ = [den]{Satz}[die]{Sätze}
72 }
73 ```
74 The first line in the configuration is the default set of names when no variant is specified. It is recommended, though not required.
75
76 After this, you may refer to a theorem via
77
78 ```latex
79 \crefthe[<prep>,variant=<declension>]{<label>}
80 ```
81
82 You may also use the shortcuts (`nom.`, `gen.`, `dat.` and `akk.`), such as:
83
84 ```latex
85 \crefthe[<prep>,Nom]{<label>} \crefthe[<prep>,Nom.]{<label>}
86 \crefthe[<prep>,nom]{<label>} \crefthe[<prep>,nom.]{<label>}
87 ```
88
89 These four are all equivalent and you may choose one to use according to your preference.
90
91 > *For more information, please refer to the documentation.*
92
93 ## Acknowledgement
94
95 There are so many people I wish to express my gratitude to during the development of this package, including:
96
97 - Patrick Bideault, without whose advice and careful explanation, this package probably would never have been born. Merci !
98
99 - Enrico Gregorio, Phelype Oleinik and Joseph Wright (in alphabetical order). They made valuable suggestions in the early development of this package and even edited some of the code themselves.
100
101 - Jonathan P. Spratte, without whose help the German support would probably take much longer to complete.
102
103 ## License
104
105 This work is released under the LaTeX Project Public License, v1.3c or later.