% \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/03/18 v2.0k 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}
% \changes{norsk-2.0k}{2024/03/18}{Fix bug with missing language in
%    language.dat}
%
%
%  \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}
\def\bbl@tempa#1{%
  \ifx#1\@undefined\else
    \expandafter\ifx\csname l@\CurrentOption\endcsname\relax
      \expandafter\adddialect\csname l@\CurrentOption\endcsname#1%
    \fi
  \fi}% First wins:
\bbl@tempa\l@norwegian
\bbl@tempa\l@norsk
\bbl@tempa\l@nynorsk
\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
