"Fossies" - the Fresh Open Source Software Archive 
Member "hevea-2.35/cleveref.hva" (16 Jan 2021, 6507 Bytes) of package /linux/www/hevea-2.35.tar.gz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 \ProvidesPackage{cleveref}
2 \RequirePackage{labeltype}
3 \@primitives{cleveref}
4 %%alias mechanism
5 \newcommand{\crefalias}[2]{\def\csname @cr@#1@alias\endcsname{#2}}
6 \newcommand{\@cr@alias}[1]
7 {\ifu\csname @cr@#1@alias\endcsname{}#1\else\csname @cr@#1@alias\endcsname\fi}
8 \crefalias{item}{enumi}
9 %%extend \@deflabeltype from labeltype
10 \let\@cr@old@deflabeltype\@deflabeltype
11 \renewcommand{\@deflabeltype}[2]
12 {\@cr@old@deflabeltype{#1}{#2}%
13 \prim@def\csname @cf@#1@type\endcsname{\@cr@alias{#2}}}
14 %%Use alias mechanism for appendix
15 %%rely on \@base being either article or book
16 \newcommand{\@cr@article@appendix}{%
17 \@auxdowrite{\@print{\crefalias}\{section\}\{appendix\}\newline}%
18 \@auxdowrite{\@print{\crefalias}\{subsection\}\{subappendix\}\newline}%
19 \@auxdowrite{\@print{\crefalias}\{subsubsection\}\{subsubappendix\}\newline}%
20 }
21 \newcommand{\@cr@book@appendix}{%
22 \@auxdowrite{\@print{\crefalias}\{chapter\}\{appendix\}\newline}%
23 \@auxdowrite{\@print{\crefalias}\{section\}\{subappendix\}\newline}%
24 \@auxdowrite{\@print{\crefalias}\{subsection\}\{subsubappendix\}\newline}%
25 }
26 \let\@cr@old@appendix\appendix
27 \renewcommand{\appendix}
28 {\@cr@old@appendix%
29 \csname @cr@\@base{}@appendix\endcsname}
30 %%Some internal conditions, with defaults
31 \newif\if@cref@capitalise\@cref@capitalisefalse
32 \newif\if@cref@abbrev\@cref@abbrevtrue
33 \newif\if@cref@nameinlink\@cref@nameinlinkfalse
34 \DeclareOption{nameinlink}{\@cref@nameinlinktrue}
35 \DeclareOption{capitalise}{\@cref@capitalisetrue}
36 \DeclareOption{capitalize}{\@cref@capitalisetrue}
37 %Ignore multi-language hooks support
38 \newcommand{\cref@addlanguagedefs}[2]
39 {\def\csname cref@language@#1@defs\endcsname{#2}}
40 %Define internal names
41 %#1 cref/Cref #2 type #3 name #4 plural #5 extension (ignored)
42 %%% section names from type
43 \newcommand{\@@crefname}[5]
44 {%\hva@warn{@@crefname '#1' '#2' #3' '#4' '#5'}%
45 \def\csname #1@#2@name\endcsname{#3}%
46 \def\csname #1@#2@name@plural\endcsname{#4}}
47 \newcommand{\@@crefname@nondef}[5]
48 {%\hva@warn{@@crefname@nondef '#1' '#2' #3' '#4' '#5'}%
49 \ifu\csname #1@#2@name\endcsname\def\csname #1@#2@name\endcsname{#3}\else
50 %\hva@warn{NO DEF for '#1' '#2'}
51 \fi%
52 \ifu\csname #1@#2@name@plural\endcsname\def\csname #1@#2@name@plural\endcsname{#4}\fi}
53 %%Define others
54 \def\@cr@cref@other{Cref}
55 \def\@cr@Cref@other{cref}
56 \newcommand{\@cr@other}[1]{\csname @cr@#1@other\endcsname}
57 \let\@cr@cref@othercom\MakeUppercase
58 \def\@cr@Cref@othercom{\if@cref@capitalise\let\@next\relax\else\let\@next\MakeLowercase\fi\@next}
59 \newcommand{\@@crefname@other}[5]{
60 \@@crefname@nondef
61 {\csname @cr@#1@other\endcsname}
62 {#2}
63 {\csname @cr@#1@othercom\endcsname #3}
64 {\csname @cr@#1@othercom\endcsname #4}
65 {#5}}
66 \newcommand{\@crefname}[5]{%
67 \@@crefname{#1}{#2}{#3}{#4}{#5}%
68 \@@crefname@other{#1}{#2}{#3}{#4}{#5}}
69 \newcommand{\crefname}[3]{\@crefname{cref}{#1}{#2}{#3}{}}
70 \newcommand{\Crefname}[3]{\@crefname{Cref}{#1}{#2}{#3}{}}
71 \newcommand{\crefname@preamble}[3]{\@crefname{cref}{#1}{#2}{#3}{@preamble}}
72 \newcommand{\Crefname@preamble}[3]{\@crefname{Cref}{#1}{#2}{#3}{@preamble}}
73 %For some reason all this must be defined...
74 \iftrue
75 \newcommand{\crefrangeconjunction}{ to\nobreakspace}%
76 \newcommand\crefrangepreconjunction{}%
77 \newcommand\crefrangepostconjunction{}%
78 \newcommand{\crefpairconjunction}{ and\nobreakspace}%
79 \newcommand{\crefmiddleconjunction}{, }%
80 \newcommand{\creflastconjunction}{ and\nobreakspace}%
81 \newcommand{\crefpairgroupconjunction}{ and\nobreakspace}%
82 \newcommand{\crefmiddlegroupconjunction}{, }%
83 \newcommand{\creflastgroupconjunction}{, and\nobreakspace}%
84 \fi
85 \input{crlang.hva}
86 %%%
87 \newcommand{\@@cr@secname}[2]
88 {%\hva@warn@prim{SEC: '#1' '#2'}%
89 %\typeout{TYPE: '#2'}%
90 \ifu#2 ??\else\ifu\csname #1@#2@name\endcsname
91 \hva@warn@prim{No name for type #2}??\else
92 \csname #1@#2@name\endcsname\fi\fi}
93 %%
94 \newcommand{\@@cr@secname@plural}[2]
95 {%\hva@warn{SEC: '#1' '#2'}%
96 %\typeout{TYPE: '#2'}%
97 \ifu#2 ??\else\ifu\csname #1@#2@name@plural\endcsname
98 \hva@warn@prim{No name for type #2}??\else
99 \csname #1@#2@name@plural\endcsname\fi\fi}
100 \newcommand{\@cr@secname}[2]{\@@cr@secname{#1}{\csname @cf@#2@type\endcsname}}
101 \newcommand{\@cr@secname@plural}[2]{\@@cr@secname@plural{#1}{\csname @cf@#2@type\endcsname}}
102 \newcommand{\namecref}[1]{\@cr@secname{cref}{#1}}
103 \newcommand{\nameCref}[1]{\@cr@secname{Cref}{#1}}
104 \newcommand{\namecrefs}[1]{\@cr@secname@plural{cref}{#1}}
105 \newcommand{\nameCrefs}[1]{\@cr@secname@plural{Cref}{#1}}
106 \newcommand{\@cr@fmt}[3]{#2#1#3}
107 \newcommand{\@cr@apply@fmt}[1]
108 {\@cr@fmt{\@auxread{#1}}{\@openlocref{#1}}{\@closelocref}}
109 \newcommand{\crefdefaultlabelformat}{\@cr@def{\@cr@fmt}{3}}
110 \newcommand{\@@cr@fmt}[5]
111 {\if@cref@nameinlink
112 \@cr@fmt{\@@cr@secname{#1}{#2}~#3}{#4}{#5}%
113 \else\@@cr@secname{#1}{#2}~\@cr@fmt{#3}{#4}{#5}\fi}
114 \newcommand{\@cr@def@fmt}[2]
115 {\@cr@def@withother
116 {\csname @\@cr@other{#1}@#2@fmt\endcsname}
117 {\csname @cr@#1@othercom\endcsname}
118 {\csname @#1@#2@fmt\endcsname}{3}}
119 \newcommand{\crefformat}[1]{\@cr@def@fmt{cref}{#1}}
120 \newcommand{\Crefformat}[1]{\@cr@def@fmt{Cref}{#1}}
121 \newcommand{\@cr@find@fmt}[2]{%
122 \ifu#2\def\@next{\@@cr@fmt{#1}{#2}}\else
123 \ifu\csname @#1@#2@fmt\endcsname\def\@next{\@@cr@fmt{#1}{#2}}\else
124 \let\@next\csname @#1@#2@fmt\endcsname\fi\fi\@next}
125 \newcommand{\@cr@fmt@one}[2]
126 {\@cr@find@fmt
127 {#1}{\csname @cf@#2@type\endcsname}
128 {\@auxread{#2}}{\@openlocref{#2}}{\@closelocref}}
129 \newcommand{\@cr@fmt@two}[3]
130 {\@cr@secname@plural{#1}{#2}~\@cr@apply@fmt{#2}\crefpairconjunction\@cr@apply@fmt{#3}}
131 \newcommand{\@cr@ref}[2]{\@cr@sort@labels{#1}{#2}}
132 %%%
133 \newcommand{\cref}[1]{\@cr@ref{cref}{#1}}
134 \newcommand{\Cref}[1]{\@cr@ref{Cref}{#1}}
135 %%%%%%%Ranges, much easier no customisation (yet ?)
136 \newcommand{\@cr@range}[3]
137 {\@cr@secname@plural{#1}{#2}~\crefrangepreconjunction\@cr@apply@fmt{#2}\crefrangeconjunction\@cr@apply@fmt{#3}\crefrangepostconjunction}
138 \newcommand{\crefrange}[2]{\@cr@range{cref}{#1}{#2}}
139 \newcommand{\Crefrange}[2]{\@cr@range{Cref}{#1}{#2}}
140 %%%%%%%
141 %%We redefine \AtBeginDocument so as to collect lask invokation
142 %%That way, last language def is executed now
143 %%and preamble \crefname will override it
144 \let\@cr@AtBeginDocument\AtBeginDocument
145 \newtokens{\@cr@at}
146 \renewcommand{\AtBeginDocument}[1]{\addtokens{\@cr@at}{#1}}
147 \ExecuteOptions{english}
148 \ProcessOptions*%
149 \let\AtBeginDocument\@cr@AtBeginDocument
150 \undef\@cr@AtBeginDocument
151 %%%execute option, code, notice that we do execute all of it
152 \@cr@at\csname cref@language@\cref@language{}@defs\endcsname
153 \undef\@cr@at
154 %%%The only problem is the non automatic definition of Capitalized
155 %%%counterparts for \crfename