summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/babel-contrib/norsk/norsk.dtx
blob: ab541701b8202150de039289e839bb5247bf40e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
% \iffalse meta-comment
%
% Copyright 1989-2024 Johannes L. Braams and any individual authors
% listed elsewhere in this file.  All rights reserved.
% 
% This file is part of the Babel system.
% --------------------------------------
% 
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
% 
% This work has the LPPL maintenance status "maintained".
% 
% The Current Maintainer of this work is Javier Bezos.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
% \fi
% \iffalse
%    Tell the \LaTeX\ system who we are and write an entry on the
%    transcript.
%<*dtx>
\ProvidesFile{norsk.dtx}
%</dtx>
%<code>\ProvidesLanguage{norwegian}
%<nynorsk>\ProvidesLanguage{nynorsk}
%<norsk>\ProvidesLanguage{norsk}
%\fi
%\ProvidesFile{norsk.dtx}
        [2024/01/26 v2.0j Norwegian support from the babel system]
%\iffalse
%%File `norsk.dtx'
%% Babel package for LaTeX version 2e
%% Copyright (C) 1989 - 2024
%%           by Johannes Braams, TeXniek
%%           by Javier Bezos
%
%    This file is part of the babel system, it provides the source
%    code for the Norwegian language definition file.  Contributions
%    were made by Haavard Helstrup (HAAVARD@CERNVM) and Alv Kjetil
%    Holme (HOLMEA@CERNVM); the `nynorsk' variant has been supplied by
%    Per Steinar Iversen (iversen@vxcern.cern.ch) and Terje Engeset
%    Petterst (TERJEEP@VSFYS1.FI.UIB.NO)
%
%    Rune Kleveland (runekl at math.uio.no) added the shorthand
%    definitions 
%<*filedriver>
\documentclass{ltxdoc}
\newcommand*\TeXhax{\TeX hax}
\newcommand*\babel{\textsf{babel}}
\newcommand*\langvar{$\langle \it lang \rangle$}
\newcommand*\note[1]{}
\newcommand*\Lopt[1]{\textsf{#1}}
\newcommand*\file[1]{\texttt{#1}}
\begin{document}
 \DocInput{norsk.dtx}
\end{document}
%</filedriver>
%\fi
% \GetFileInfo{norsk.dtx}
%
% \changes{norsk-1.0a}{1991/07/15}{Renamed \file{babel.sty} in
%    \file{babel.com}}
% \changes{norsk-1.1a}{1992/02/16}{Brought up-to-date with babel 3.2a}
% \changes{norsk-1.1c}{1993/11/11}{Added a couple of translations
%    (from Per Norman Oma, TeX@itk.unit.no)}
% \changes{norsk-1.2a}{1994/02/27}{Update for \LaTeXe}
% \changes{norsk-1.2d}{1994/06/26}{Removed the use of \cs{filedate}
%    and moved identification after the loading of \file{babel.def}}
% \changes{norsk-1.2h}{1996/07/12}{Replaced \cs{undefined} with
%    \cs{@undefined} and \cs{empty} with \cs{@empty} for consistency
%    with \LaTeX} 
% \changes{norsk-1.2h}{1996/10/10}{Moved the definition of
%    \cs{atcatcode} right to the beginning.}
% \changes{norsk-2.0j}{2024/01/23}{Dual load norwegian/norsk}
%
%
%  \section{The Norwegian language}
%
%    The file \file{\filename}\footnote{The file described in this
%    section has version number \fileversion\ and was last revised on
%    \filedate.  Contributions were made by Haavard Helstrup
%    (\texttt{HAAVARD@CERNVM)} and Alv Kjetil Holme
%    (\texttt{HOLMEA@CERNVM}); the `nynorsk' variant has been supplied
%    by Per Steinar Iversen \texttt{iversen@vxcern.cern.ch}) and Terje
%    Engeset Petterst (\texttt{TERJEEP@VSFYS1.FI.UIB.NO)}; the
%    shorthand definitions were provided by Rune Kleveland
%    (\texttt{runekl@math.uio.no}).} defines all the language definition
%    macros for the Norwegian language as well as for an alternative
%    variant `nynorsk' of this language. 
%
%    For this language the character |"| is made active. In
%    table~\ref{tab:norsk-quote} an overview is given of its purpose.
%    \begin{table}[htb]
%     \begin{center}
%     \begin{tabular}{lp{.7\textwidth}}
%      |"ff|& for |ff| to be hyphenated as |ff-f|,
%             this is also implemented for b, d, f, g, l, m, n,
%             p, r, s, and t. (|o"ppussing|)                        \\
%      |"ee|& Hyphenate |"ee| as |\'e-e|. (|komit"een|)             \\
%      |"-| & an explicit hyphen sign, allowing hyphenation in the
%             composing words. Use this for compound words when the
%             hyphenation patterns fail to hyphenate
%             properly. (|alpin"-anlegg|)                           \\
%      \verb="|= & Like |"-|, but inserts 0.03em space.  Use it if
%             the compound point is spanned by a ligature.
%             (\verb=hoff"|intriger=)                               \\
%      |""| & Like |"-|, but producing no hyphen sign.
%             (|i""g\aa{}r|)                                        \\
%      |"~| & Like |-|, but allows no hyphenation at all. (|E"~cup|)\\
%      |"=| & Like |-|, but allowing hyphenation in the composing
%             words. (|marksistisk"=leninistisk|)                   \\
%      |"<| & for French left double quotes (similar to $<<$).      \\
%      |">| & for French right double quotes (similar to $>>$).     \\
%     \end{tabular}
%     \caption{The extra definitions made
%              by \file{norsk.sty}}\label{tab:norsk-quote}
%     \end{center}
%    \end{table}
% \changes{norsk-2.0a}{1998/06/24}{Describe the use of double quote as
%    active character}
%
%    Rune Kleveland distributes a Norwegian dictionary for ispell
%    (570000 words). It can be found at
%    |http://www.uio.no/~runekl/dictionary.html|. 
%
%    This dictionary supports the spellings |spi"sslede| for
%    `spisslede' (hyphenated spiss-slede) and other such words, and
%    also suggest the spelling |spi"sslede| for `spisslede' and
%    `spissslede'.
%
% \StopEventually{}
%
%    The macro |\LdfInit| takes care of preventing that this file is
%    loaded more than once, checking the category code of the
%    \texttt{@} sign, etc.
% \changes{norsk-1.2h}{1996/11/03}{Now use \cs{LdfInit} to perform
%    initial checks} 
%    \begin{macrocode}
%<*code>
\LdfInit\CurrentOption{captions\CurrentOption}
%    \end{macrocode}
%
%    When this file is read as an option, i.e. by the |\usepackage|
%    command, \texttt{norsk} will be an `unknown' language in which
%    case we have to make it known.  So we check for the existence of
%    |\l@norsk| to see whether we have to do something here.
%
% \changes{norsk-1.0c}{1991/10/29}{Removed use of \cs{@ifundefined}}
% \changes{norsk-1.1a}{1992/02/16}{Added a warning when no hyphenation
%    patterns were loaded.}
% \changes{norsk-1.2d}{1994/06/26}{Now use \cs{@nopatterns} to produce
%    the warning}
%    \begin{macrocode}
\expandafter\ifx\csname l@\CurrentOption\endcsname\relax
  \def\bbl@tempa#1{% 
    \ifx#1\@undefined\else
      \expandafter\adddialect\csname l@\CurrentOption\endcsname#1%
    \fi}% Last wins:
  \bbl@tempa\l@nynorsk
  \bbl@tempa\l@norsk
  \bbl@tempa\l@norwegian
\fi
\expandafter\ifx\csname l@\CurrentOption\endcsname\relax
  \@nopatterns{\CurrentOption}
  \expandafter\adddialect\csname l@\CurrentOption\endcsname\z@
\fi
%    \end{macrocode}
%
%  \begin{macro}{\norskhyphenmins}
%     Some sets of Norwegian hyphenation patterns can be used with
%     |\lefthyphenmin| set to~1 and |\righthyphenmin| set to~2, but
%     the most common set |nohyph.tex| can't.  So we use
%     |\lefthyphenmin=2| by default.
% \changes{norsk-1.2f}{1995/07/02}{Added setting of hyphenmin
%    parameters}
% \changes{norsk-2.0a}{1998/06/24}{Changed setting of hyphenmin
%    parameters to 2~2} 
% \changes{norsk-2.0e}{2000/09/22}{Now use \cs{providehyphenmins} to
%    provide a default value}
%    \begin{macrocode}
\providehyphenmins{\CurrentOption}{\tw@\tw@}
%    \end{macrocode}
%  \end{macro}
%
%    Now we have to decide which version of the captions should be
%    made available. This can be done by checking the contents of
%    |\CurrentOption|. 
%
%    The next step consists of defining commands to switch to (and
%    from) the Norwegian language.
%
% \begin{macro}{\captionsnorsk}
%    The macro |\captionsnorsk| defines all strings used
%    in the four standard documentclasses provided with \LaTeX.
% \changes{norsk-1.1a}{1992/02/16}{Added \cs{seename}, \cs{alsoname} and
%    \cs{prefacename}}
% \changes{norsk-1.1b}{1993/07/15}{\cs{headpagename} should be
%    \cs{pagename}}
% \changes{norsk-1.2f}{1995/07/02}{Added \cs{proofname} for
%    AMS-\LaTeX}
% \changes{norsk-1.2g}{1996/04/01}{Replaced `Proof' by its
%    translation} 
% \changes{norsk-2.0e}{2000/09/20}{Added \cs{glossaryname}}
% \changes{norsk-2.0g}{1996/04/01}{Replaced `Glossary' by its
%    translation} 
%    \begin{macrocode}
\def\bbl@tempa{nynorsk}
\ifx\CurrentOption\bbl@tempa
  \def\captionsnynorsk{%
    \def\prefacename{Forord}%
    \def\refname{Referansar}%
    \def\abstractname{Samandrag}%
    \def\bibname{Litteratur}%     or Litteraturoversyn
     %                             or Referansar
    \def\chaptername{Kapittel}%
    \def\appendixname{Tillegg}%   or Appendiks
    \def\contentsname{Innhald}%
    \def\listfigurename{Figurar}% or Figurliste
    \def\listtablename{Tabellar}% or Tabelliste
    \def\indexname{Register}%
    \def\figurename{Figur}%
    \def\tablename{Tabell}%
    \def\partname{Del}%
    \def\enclname{Vedlegg}%
    \def\ccname{Kopi til}%
    \def\headtoname{Til}% in letter
    \def\pagename{Side}%
    \def\seename{Sj\aa{}}%
    \def\alsoname{Sj\aa{} \`{o}g}%
    \def\proofname{Bevis}%
    \def\glossaryname{Ordliste}%
    }
\else
  \@namedef{captions\CurrentOption}{%
    \def\prefacename{Forord}%
    \def\refname{Referanser}%
    \def\abstractname{Sammendrag}%
    \def\bibname{Bibliografi}%     or Litteraturoversikt
    %                              or Litteratur or Referanser
    \def\chaptername{Kapittel}%
    \def\appendixname{Tillegg}%    or Appendiks
    \def\contentsname{Innhold}%
    \def\listfigurename{Figurer}%  or Figurliste
    \def\listtablename{Tabeller}%  or Tabelliste
    \def\indexname{Register}%
    \def\figurename{Figur}%
    \def\tablename{Tabell}%
    \def\partname{Del}%
    \def\enclname{Vedlegg}%
    \def\ccname{Kopi sendt}%
    \def\headtoname{Til}% in letter
    \def\pagename{Side}%
    \def\seename{Se}%
    \def\alsoname{Se ogs\aa{}}%
    \def\proofname{Bevis}%
    \def\glossaryname{Ordliste}%
    }
\fi
%    \end{macrocode}
% \end{macro}
%
%    For the `nynorsk' version of these definitions we just add a
%    ``dialect''.
%    \begin{macrocode}
%    \end{macrocode}
%
% \begin{macro}{\captionsnynorsk}
%    The macro |\captionsnynorsk| defines all strings used in the four
%    standard documentclasses provided with \LaTeX, but using a
%    different spelling than in the command |\captionsnorsk|.
% \changes{norsk-1.1a}{1992/02/16}{Added \cs{seename}, \cs{alsoname} and
%    \cs{prefacename}}
% \changes{norsk-1.1b}{1993/07/15}{\cs{headpagename} should be
%    \cs{pagename}}
% \changes{norsk-1.2g}{1996/04/01}{Replaced `Proof' by its
%    translation} 
% \changes{norsk-2.0e}{2000/09/20}{Added \cs{glossaryname}}
% \changes{norsk-2.0g}{1996/04/01}{Replaced `Glossary' by its
%    translation} 
% \changes{norks-2.0h}{2001/01/12}{Changed \cs{ccname} and \cs{alsoname}}
%
% \end{macro}
%
% \begin{macro}{\datenorsk}
%    The macro |\datenorsk| redefines the command |\today| to produce
%    Norwegian dates.
% \changes{norsk-1.2i}{1997/10/01}{Use \cs{edef} to define
%    \cs{today} to save memory}
% \changes{norsk-1.2i}{1998/03/28}{use \cs{def} instead of \cs{edef}}
% \changes{norsk-2.0i}{2012/08/06}{Removed extra space after `desember'}
%    \begin{macrocode}
\@namedef{date\CurrentOption}{%
  \def\today{\number\day.~\ifcase\month\or
    januar\or februar\or mars\or april\or mai\or juni\or
    juli\or august\or september\or oktober\or november\or
    desember\fi
    \space\number\year}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\extrasnorsk}
% \begin{macro}{\extrasnynorsk}
%    The macro |\extrasnorsk| will perform all the extra definitions
%    needed for the Norwegian language. The macro |\noextrasnorsk| is
%    used to cancel the actions of |\extrasnorsk|.  
%
%    Norwegian typesetting requires |\frencspacing| to be in effect.
%    \begin{macrocode}
\@namedef{extras\CurrentOption}{\bbl@frenchspacing}
\@namedef{noextras\CurrentOption}{\bbl@nonfrenchspacing}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    For Norsk the \texttt{"} character is made active. This is done
%    once, later on its definition may vary.
% \changes{norsk-2.0a}{1998/06/24}{Made double quote character active}
%    \begin{macrocode}
\initiate@active@char{"}
\expandafter\addto\csname extras\CurrentOption\endcsname{%
  \languageshorthands{norsk}}
\expandafter\addto\csname extras\CurrentOption\endcsname{%
  \bbl@activate{"}}
%    \end{macrocode}
%    Don't forget to turn the shorthands off again.
% \changes{norsk-2.0c}{1999/12/17}{Deactivate shorthands ouside of
%    Norsk}
%    \begin{macrocode}
\expandafter\addto\csname noextras\CurrentOption\endcsname{%
  \bbl@deactivate{"}}
%    \end{macrocode}
%
%    The code above is necessary because we need to define a number of
%    shorthand commands. These sharthand commands are then used as
%    indicated in table~\ref{tab:norsk-quote}.
%
%    To be able to define the function of |"|, we first define a
%    couple of `support' macros.
%
%  \begin{macro}{\dq}
%    We save the original double quote character in |\dq| to keep
%    it available, the math accent |\"| can now be typed as |"|.
%    \begin{macrocode}
\begingroup \catcode`\"12
\def\x{\endgroup
  \def\@SS{\mathchar"7019 }
  \def\dq{"}}
\x
%    \end{macrocode}
%  \end{macro}
%
%    Now we can define the discretionary shorthand commands.
%    The number of words where such hyphenation is required is for
%    each character
%    \begin{center}
%      \begin{tabular}{*{11}c}
%        b&d&f &g&k &l &n&p &r&s &t \\
%        4&4&15&3&43&30&8&12&1&33&35
%       \end{tabular}
%    \end{center}
%    taken from a list of 83000 ispell-roots.
%
% \changes{norsk-2.0d}{2000/02/29}{Shorthands are the same for both
%    spelling variants, no need to use \cs{CurrentOption}}
%    \begin{macrocode}
\declare@shorthand{norsk}{"b}{\textormath{\bbl@disc b{bb}}{b}}
\declare@shorthand{norsk}{"B}{\textormath{\bbl@disc B{BB}}{B}}
\declare@shorthand{norsk}{"d}{\textormath{\bbl@disc d{dd}}{d}}
\declare@shorthand{norsk}{"D}{\textormath{\bbl@disc D{DD}}{D}}
\declare@shorthand{norsk}{"e}{\textormath{\bbl@disc e{\'e}}{}}
\declare@shorthand{norsk}{"E}{\textormath{\bbl@disc E{\'E}}{}}
\declare@shorthand{norsk}{"F}{\textormath{\bbl@disc F{FF}}{F}}
\declare@shorthand{norsk}{"g}{\textormath{\bbl@disc g{gg}}{g}}
\declare@shorthand{norsk}{"G}{\textormath{\bbl@disc G{GG}}{G}}
\declare@shorthand{norsk}{"k}{\textormath{\bbl@disc k{kk}}{k}}
\declare@shorthand{norsk}{"K}{\textormath{\bbl@disc K{KK}}{K}}
\declare@shorthand{norsk}{"l}{\textormath{\bbl@disc l{ll}}{l}}
\declare@shorthand{norsk}{"L}{\textormath{\bbl@disc L{LL}}{L}}
\declare@shorthand{norsk}{"n}{\textormath{\bbl@disc n{nn}}{n}}
\declare@shorthand{norsk}{"N}{\textormath{\bbl@disc N{NN}}{N}}
\declare@shorthand{norsk}{"p}{\textormath{\bbl@disc p{pp}}{p}}
\declare@shorthand{norsk}{"P}{\textormath{\bbl@disc P{PP}}{P}}
\declare@shorthand{norsk}{"r}{\textormath{\bbl@disc r{rr}}{r}}
\declare@shorthand{norsk}{"R}{\textormath{\bbl@disc R{RR}}{R}}
\declare@shorthand{norsk}{"s}{\textormath{\bbl@disc s{ss}}{s}}
\declare@shorthand{norsk}{"S}{\textormath{\bbl@disc S{SS}}{S}}
\declare@shorthand{norsk}{"t}{\textormath{\bbl@disc t{tt}}{t}}
\declare@shorthand{norsk}{"T}{\textormath{\bbl@disc T{TT}}{T}}
%    \end{macrocode}
%    We need to treat |"f| a bit differently in order to preserve the
%    ff-ligature. 
% \changes{norsk-2.0b}{1999/11/19}{Copied the coding for \texttt{"f}
%    from germanb.dtx version 2.6g} 
%    \begin{macrocode}
\declare@shorthand{norsk}{"f}{\textormath{\bbl@discff}{f}}
\def\bbl@discff{\penalty\@M
  \afterassignment\bbl@insertff \let\bbl@nextff= }
\def\bbl@insertff{%
  \if f\bbl@nextff
    \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
  {\relax\discretionary{ff-}{f}{ff}\allowhyphens}{f\bbl@nextff}}
\let\bbl@nextff=f
%    \end{macrocode}
%    We now  define the French double quotes and some commands 
%    concerning hyphenation:
% \changes{norsk-2.0b}{1999/11/22}{added the french double quotes}
% \changes{norsk-2.0d}{2000/01/28}{Use \cs{bbl@allowhyphens} in
%    \texttt{"-}}
%    \begin{macrocode}
\declare@shorthand{norsk}{"<}{\flqq}
\declare@shorthand{norsk}{">}{\frqq}
\declare@shorthand{norsk}{"-}{\penalty\@M\-\bbl@allowhyphens}
\declare@shorthand{norsk}{"|}{%
  \textormath{\penalty\@M\discretionary{-}{}{\kern.03em}%
              \allowhyphens}{}}
\declare@shorthand{norsk}{""}{\hskip\z@skip}
\declare@shorthand{norsk}{"~}{\textormath{\leavevmode\hbox{-}}{-}}
\declare@shorthand{norsk}{"=}{\penalty\@M-\hskip\z@skip}
%    \end{macrocode}
%
%    The macro |\ldf@finish| takes care of looking for a
%    configuration file, setting the main language to be switched on
%    at |\begin{document}| and resetting the category code of
%    \texttt{@} to its original value.
% \changes{norsk-1.2h}{1996/11/03}{Now use \cs{ldf@finish} to wrap up}
%    \begin{macrocode}
\ldf@finish\CurrentOption
%</code>
% Finally, We create  a few proxy files.
%
%    \begin{macrocode}
%<*norsk|nynorsk>
\input norwegian.ldf\relax
%</norsk|nynorsk>
%    \end{macrocode}
%
% \Finale
\endinput