Debian Codegraph @

texmf-dist/doc/latex/cleveref-icelandic/cleveref-icelandic-doc.tex

raw
1 \documentclass{article}
2 \usepackage[utf8]{inputenc}
3 \usepackage[T1]{fontenc}
4 \usepackage[english]{babel}
5 \usepackage[hidelinks]{hyperref}
6 \usepackage{cleveref}
7 \usepackage{cleveref-icelandic}
8 \usepackage{booktabs}
9 \usepackage{listings}
10 \usepackage{xcolor}
11
12 \lstset{
13 language=[LaTeX]TeX,
14 basicstyle=\ttfamily\small,
15 keywordstyle=\color{blue},
16 commentstyle=\color{gray},
17 breaklines=true,
18 frame=single,
19 literate=
20 {á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1 {ý}{{\'y}}1
21 {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1 {Ý}{{\'Y}}1
22 {ð}{{\dh}}1 {Ð}{{\DH}}1 {þ}{{\th}}1 {Þ}{{\TH}}1
23 {ö}{{\"o}}1 {Ö}{{\"O}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1
24 {→}{{$\rightarrow$}}1
25 }
26
27 \title{\texttt{cleveref-icelandic} --- Icelandic declension for cleveref\\
28 \large v0.1}
29 \author{Sindri Smárason}
30 \date{1 April 2026}
31
32 \begin{document}
33 \maketitle
34
35 \begin{abstract}
36 The \texttt{cleveref-icelandic} package adds Icelandic grammatical declension to
37 cross-references produced by \texttt{cleveref}. It allows references
38 to figures, tables, equations, and sections to appear in the correct
39 grammatical case --- nominative, accusative, dative, or genitive ---
40 in both singular and plural, with automatic case selection from
41 prepositions.
42 \end{abstract}
43
44 \tableofcontents
45 \newpage
46
47 %%% -----------------------------------------------------------------------
48 \section{Introduction}
49
50 The \texttt{cleveref} package automates cross-reference formatting in
51 LaTeX but has no Icelandic language support and can only produce the
52 nominative case. Icelandic is a heavily inflected language with four
53 grammatical cases, and reference nouns such as \textit{mynd} (figure),
54 \textit{tafla} (table), \textit{jafna} (equation), and \textit{kafli}
55 (section) must be declined according to their grammatical role in the
56 sentence. \texttt{cleveref-icelandic} solves this by storing declension tables for
57 each reference type and allowing the user to specify the case via a
58 simple optional argument.
59
60 Icelandic has four cases:
61 \begin{itemize}
62 \item \textbf{Nominative} (\textit{nefnifall}) --- subject position
63 \item \textbf{Accusative} (\textit{þolfall}) --- direct object, some prepositions
64 \item \textbf{Dative} (\textit{þágufall}) --- indirect object, most locative prepositions
65 \item \textbf{Genitive} (\textit{eignarfall}) --- possession, some prepositions
66 \end{itemize}
67
68 %%% -----------------------------------------------------------------------
69 \section{Requirements and loading}
70
71 \texttt{cleveref-icelandic} automatically loads the following packages:
72
73 \begin{itemize}
74 \item \texttt{hyperref}
75 \item \texttt{cleveref}
76 \item \texttt{xparse}
77 \end{itemize}
78
79 Load the packages in the following order in your preamble:
80
81 \begin{lstlisting}
82 \usepackage[hidelinks]{hyperref} % or colorlinks=true
83 \usepackage{cleveref}
84 \usepackage{cleveref-icelandic}
85 \end{lstlisting}
86
87 %%% -----------------------------------------------------------------------
88 \section{Main commands}
89
90 \subsection{\texttt{\textbackslash icref}}
91
92 \begin{lstlisting}
93 \icref[<case>]{<label>}
94 \end{lstlisting}
95
96 Produces a declined reference noun followed by the number, with the
97 number hyperlinked to its target. The optional \texttt{<case>} argument
98 accepts the following inputs:
99
100 \begin{center}
101 \begin{tabular}{lll}
102 \toprule
103 Input & Case & Example \\
104 \midrule
105 (none) & nominative & \verb|\icref{fig:a}| \\
106 \texttt{nom} or \texttt{nf} or \texttt{0} & nominative & \verb|\icref[nom]{fig:a}| \\
107 \texttt{acc} or \texttt{þf} or \texttt{1} & accusative & \verb|\icref[acc]{fig:a}| \\
108 \texttt{dat} or \texttt{þgf} or \texttt{2} & dative & \verb|\icref[dat]{fig:a}| \\
109 \texttt{gen} or \texttt{ef} or \texttt{3} & genitive & \verb|\icref[gen]{fig:a}| \\
110 preposition & automatic & \verb|\icref[í]{fig:a}| \\
111 \bottomrule
112 \end{tabular}
113 \end{center}
114
115 When a preposition is given, the command outputs the preposition
116 followed by the declined noun:
117
118 \begin{lstlisting}
119 \icref[í]{fig:a} % → í mynd 1
120 \icref[vegna]{fig:a} % → vegna myndar 1
121 \icref[um]{eq:a} % → um jöfnu (1)
122 \end{lstlisting}
123
124 If an unrecognised argument is passed, the package issues a warning and
125 falls back to the nominative.
126
127 \subsection{\texttt{\textbackslash Icref}}
128
129 \begin{lstlisting}
130 \Icref[<case>]{<label>}
131 \end{lstlisting}
132
133 Identical to \verb|\icref| but produces a capitalised form for use at
134 the start of a sentence:
135
136 \begin{lstlisting}
137 \Icref{fig:a} % → Mynd 1
138 \Icref[dat]{fig:a} % → Mynd 1
139 \end{lstlisting}
140
141 \subsection{Plural references}
142
143 Both \verb|\icref| and \verb|\Icref| handle plurals automatically when
144 more than one label is given:
145
146 \begin{lstlisting}
147 \icref{fig:a,fig:b} % → myndir 1 og 2
148 \icref[dat]{fig:a,fig:b} % → myndum 1 og 2
149 \end{lstlisting}
150
151 Numerically consecutive labels are compressed automatically:
152
153 \begin{lstlisting}
154 \icref{eq:a,eq:b,eq:c} % → jöfnur (1) til (3)
155 \end{lstlisting}
156
157 %%% -----------------------------------------------------------------------
158 \section{Declaring reference types}
159
160 \subsection{\texttt{\textbackslash DeclareIcrefType}}
161
162 \begin{lstlisting}
163 \DeclareIcrefType{<type>}
164 {nom sg}{acc sg}{dat sg}{gen sg}
165 {nom pl}{acc pl}{dat pl}{gen pl}
166 \end{lstlisting}
167
168 Declares the eight declined forms for a reference type. \texttt{<type>}
169 is the internal cleveref counter name --- \texttt{figure},
170 \texttt{table}, \texttt{equation}, \texttt{section}, etc.
171
172 \begin{lstlisting}
173 \DeclareIcrefType{figure}
174 {mynd}{mynd}{mynd}{myndar}
175 {myndir}{myndir}{myndum}{mynda}
176 \end{lstlisting}
177
178 \subsection{\texttt{\textbackslash DeclareIcrefTypeCapital}}
179
180 Identical syntax to \verb|\DeclareIcrefType| but declares the
181 capitalised forms used by \verb|\Icref|:
182
183 \begin{lstlisting}
184 \DeclareIcrefTypeCapital{figure}
185 {Mynd}{Mynd}{Mynd}{Myndar}
186 {Myndir}{Myndir}{Myndum}{Mynda}
187 \end{lstlisting}
188
189 Both commands should be called together for every custom type. If
190 \verb|\DeclareIcrefTypeCapital| is not called, \verb|\Icref| will fall
191 back to \verb|\Cref| with a package warning.
192
193 %%% -----------------------------------------------------------------------
194 \section{Preposition table}
195
196 \subsection{\texttt{\textbackslash DeclareIscrefPreposition}}
197
198 Users can add new prepositions or override existing ones:
199
200 \begin{lstlisting}
201 \DeclareIscrefPreposition{<preposition>}{<case>}
202 \end{lstlisting}
203
204 Where \texttt{<case>} is \texttt{acc}, \texttt{dat}, or \texttt{gen}.
205 For example, to override "\texttt{á}" to accusative:
206
207 \begin{lstlisting}
208 \DeclareIscrefPreposition{á}{acc}
209 \end{lstlisting}
210
211 \subsection{Built-in prepositions}
212
213 \begin{center}
214 \begin{tabular}{ll}
215 \toprule
216 Case & Prepositions \\
217 \midrule
218 Accusative & um, gegnum, kringum, umfram, umhverfis \\
219 \midrule
220 Dative & frá, að, af, andspænis, ásamt, gagnvart, gegn, gegnt, \\
221 & handa, hjá, meðfram, nálægt, undan, úr, \\
222 & [á, í, fyrir, undir, yfir, við, með, eftir]$^*$ \\
223 \midrule
224 Genitive & til, auk, austan, án, handan, innan, meðal, megin, \\
225 & milli, millum, neðan, norðan, ofan, sakir, sunnan, \\
226 & sökum, utan, vegna, vestan \\
227 \bottomrule
228 \end{tabular}
229 \end{center}
230
231 \noindent$^*$ These prepositions can govern either accusative or dative
232 depending on context (motion vs.\ location). Dative is the default as
233 locative readings are most common in technical documents. This can be
234 overridden with \verb|\DeclareIscrefPreposition|.
235
236 %%% -----------------------------------------------------------------------
237 \section{Built-in reference types}
238
239 The following types are built in with full declension tables, singular:
240
241 \begin{center}
242 \begin{tabular}{lllll}
243 \toprule
244 Type & Nom. & Acc. & Dat. & Gen. \\
245 \midrule
246 \texttt{figure} & mynd & mynd & mynd & myndar \\
247 \texttt{table} & tafla & töflu & töflu & töflu \\
248 \texttt{equation} & jafna & jöfnu & jöfnu & jöfnu \\
249 \texttt{section} & kafli & kafla & kafla & kafla \\
250 \bottomrule
251 \end{tabular}
252 \end{center}
253
254 and plural:
255
256 \begin{center}
257 \begin{tabular}{lllll}
258 \toprule
259 Type & Nom. & Acc. & Dat. & Gen. \\
260 \midrule
261 \texttt{figure} & myndir & myndir & myndum & mynda \\
262 \texttt{table} & töflur & töflur & töflum & taflna \\
263 \texttt{equation} & jöfnur & jöfnur & jöfnum & jafna \\
264 \texttt{section} & kaflar & kafla & köflum & kafla \\
265 \bottomrule
266 \end{tabular}
267 \end{center}
268
269 %%% -----------------------------------------------------------------------
270 \section{Complete example}
271
272 \begin{lstlisting}
273 \documentclass{article}
274 \usepackage[icelandic]{babel}
275 \usepackage[hidelinks]{hyperref}
276 \usepackage{cleveref}
277 \usepackage{cleveref-icelandic}
278
279 \begin{document}
280
281 \begin{figure}
282 \caption{Yfirlit}
283 \label{fig:yfirlit}
284 \end{figure}
285
286 Niðurstöður eru sýndar í \icref{fig:yfirlit}.
287 Fjallað er um \icref[acc]{fig:yfirlit} í næsta kafla.
288 Sjá má frekari upplýsingar \icref[í]{fig:yfirlit}.
289 \Icref{fig:yfirlit} sýnir samantekt á gögnum.
290
291 \end{document}
292 \end{lstlisting}
293
294 %%% -----------------------------------------------------------------------
295 \section{Acknowledgements}
296
297 This package builds on \texttt{cleveref} by Toby Cubitt. The preposition
298 system was inspired by \texttt{crefthe} and \texttt{xcref}.
299
300 \end{document}