% \iffalse meta-comment
%
% Copyright 1989-2005 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 Johannes Braams.
%
% The list of all files belonging to the Babel system is
% given in the file `manifest.bbl. See also `legal.bbl' for additional
% information.
%
% 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{swedish.dtx}
%</dtx>
%<code>\ProvidesLanguage{swedish}
%\fi
%\ProvidesFile{swedish.dtx}
        [2021/02/06 v2.3e Swedish support from the babel system]
%\iffalse
%% File `swedish.dtx'
%% Babel package for LaTeX version 2e
%% Copyright (C) 1989 - 2005
%%           by Johannes Braams, TeXniek
%
%% Please report errors to: J.L. Braams
%%                          babel at braams.cistron.nl
%
%    This file is part of the babel system, it provides the source
%    code for the Swedish language definition file.  A contribution
%    was made by Sten Hellman HELLMAN@CERNVM.CERN.CH
%
%    Further enhancements for version 2.0 were provided by
%    Erik "Osthols <erik\_osthols@yahoo.com>
%<*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{swedish.dtx}
\end{document}
%</filedriver>
%\fi
% \GetFileInfo{swedish.dtx}
%
% \changes{swedish-1.0a}{1991/07/15}{Renamed \file{babel.sty} in
%    \file{babel.com}}
% \changes{swedish-1.1}{1992/02/16}{Brought up-to-date with babel 3.2a}
% \changes{swedish-1.2}{1994/02/27}{Update for LaTeX2e}
% \changes{swedish-1.3d}{1994/06/26}{Removed the use of \cs{filedate}
%    and moved identification after the loading of \file{babel.def}}
% \changes{swedish-1.3e}{1995/05/28}{Update for release 3.5}
% \changes{swedish-2.0}{1996/01/24}{Introduced active double quote}
% \changes{swedish-2.1}{1996/10/10}{Replaced \cs{undefined} with
%    \cs{@undefined} and \cs{empty} with \cs{@empty} for consistency
%    with \LaTeX, moved the definition of \cs{atcatcode} right to the
%    beginning.}
% \changes{swedish-2.3d}{2001/11/16}{Fixed a \cs{changes} entry}
%
%  \section{The Swedish 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 Sten Hellman
%    (\texttt{HELLMAN@CERNVM.CERN.CH}) and Erik \"Osthols
%    (\texttt{erik\_osthols@yahoo.com}).} defines all the
%    language-specific macros for the Swedish language. This
%    file has borrowed heavily from |finnish.dtx| and |germanb.dtx|.
%
%    For this language the character |"| is made active. In
%    table~\ref{tab:swedish-quote} an overview is given of its
%    purpose. The vertical placement of the "umlaut" in some letters
%    can be controlled this way.
%    \begin{table}[htb]
%     \begin{center}
%     \begin{tabular}{lp{8cm}}
%      |"a| & Gives \"a, also implemented for |"A|, |"o| and |"O|. \\
%      |"w|, |"W| & gives {\aa} and {\AA}.                         \\
%      |"ff| & for |ff| to be hyphenated as |ff-f|. Used for compound
%              words, such as \texttt{stra|"|ff{\aa}nge}, which
%              should be hyphenated as \texttt{straff-f{\aa}nge}.
%              This is also implemented for b, d, f, g, l, m, n,
%              p, r, s, and t.                                     \\
%      \verb="|= & disable ligature at this position. This should be
%              used for compound words, such as
%              ``\texttt{stra|"|ffinr\"attning}'',
%              which should not have the ligature ``ffi''.         \\
%      |"-| & an explicit hyphen sign, allowing hyphenation
%             in the rest of the word, such as e. g. in
%             ``x|"-|axeln''.                                      \\
%      |""| & like |"-|, but producing no hyphen sign
%             (for words that should break at some sign such as
%             \texttt{och/|""|eller}).                             \\
%      |"~| & for an explicit hyphen without a breakpoint; useful for
%             expressions such as ``2|"~|3 veckor'' where no linebreak
%             is desirable.                                        \\
%      |"=| & an explicit hyphen sign allowing subsequent hyphenation,
%             for expressions such as ``studiebidrag och \newline
%             -l{\aa}n''.                                          \\
%      |\-| & like the old |\-|, but allowing hyphenation
%             in the rest of the word.                             \\
%     \end{tabular}
%     \caption{The extra definitions made
%              by \file{swedish.sty}}\label{tab:swedish-quote}
%     \end{center}
%    \end{table}
%
%    Two variations for formatting of dates are added. \cs{datesymd}
%    makes \cs{today} output dates formatted as YYYY-MM-DD, which is
%    commonly used in Sweden today. \cs{datesdmy} formats the date as
%    D/M YYYY, which is also very common in Sweden. These commands
%    should be issued after \cs{begin{document}}.
%
% \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{swedish-2.1}{1996/11/03}{Now use \cs{LdfInit} to perform
%    initial checks}
%    \begin{macrocode}
%<*code>
\LdfInit{swedish}\captionsswedish
%    \end{macrocode}
%
%    When this file is read as an option, i.e. by the |\usepackage|
%    command, \texttt{swedish} will be an `unknown' language in which
%    case we have to make it known. So we check for the existence of
%    |\l@swedish| to see whether we have to do something here.
%
% \changes{swedish-1.0c}{1991/10/29}{Removed use of \cs{@ifundefined}}
% \changes{swedish-1.1}{1992/02/16}{Added a warning when no hyphenation
%    patterns were loaded.}
% \changes{swedish-1.3d}{1994/06/26}{Now use \cs{@nopatterns} to
%    producew the warning}
%    \begin{macrocode}
\ifx\l@swedish\@undefined
    \@nopatterns{Swedish}
    \adddialect\l@swedish0\fi
%    \end{macrocode}
%
%    The next step consists of defining commands to switch to the
%    Swedish language. The reason for this is that a user might want
%    to switch back and forth between languages.
%
% \begin{macro}{\captionsswedish}
%    The macro |\captionsswedish| defines all strings used in the four
%    standard documentclasses provided with \LaTeX.
% \changes{swedish-1.0b}{1991/08/21}{removed type in definition of
%    \cs{contentsname}}
% \changes{swedish-1.0b}{1991/08/21}{added definition for \cs{enclname}}
% \changes{swedish-1.0b}{1991/08/21}{made definition of \cs{refname}
%    pluralis}
% \changes{swedish-1.1}{1992/02/16}{Added \cs{seename}, \cs{alsoname}
%    and \cs{prefacename}}
% \changes{swedish-1.1}{1993/07/15}{\cs{headpagename} should be
%    \cs{pagename}}
% \changes{swedish-1.1b}{1993/09/16}{Added translations}
% \changes{swedish-1.3d}{1994/07/27}{Changed \cs{aa} to
%    \cs{csname}\texttt{ aa}\cs{endcsname}, to make \cs{uppercase} do
%    the right thing}
% \changes{swedish-1.3f}{1995/07/04}{Added \cs{proofname} for
%    AMS-\LaTeX}
%    \begin{macrocode}
\addto\captionsswedish{%
  \def\prefacename{F\"orord}%
  \def\refname{Referenser}%
  \def\abstractname{Sammanfattning}%
  \def\bibname{Litteraturf\"orteckning}%
  \def\chaptername{Kapitel}%
  \def\appendixname{Bilaga}%
  \def\contentsname{Inneh\csname aa\endcsname ll}%
  \def\listfigurename{Figurer}%
  \def\listtablename{Tabeller}%
  \def\indexname{Sakregister}%
  \def\figurename{Figur}%
  \def\tablename{Tabell}%
  \def\partname{Del}%
%    \end{macrocode}
% \changes{swedish-2.3a}{2000/01/19}{Added full stop after ``Bil''}
%    \begin{macrocode}
  \def\enclname{Bil.}%
  \def\ccname{Kopia f\"or k\"annedom}%
  \def\headtoname{Till}% in letter
  \def\pagename{Sida}%
  \def\seename{se}%
%    \end{macrocode}
% \changes{swedish-1.3e}{1995/05/29}{Changed \cs{alsoname} from
%    `\texttt{se ocks\aa}'}
%    \begin{macrocode}
  \def\alsoname{se \"aven}%
%    \end{macrocode}
% \changes{swedish-1.3g}{1995/11/03}{Replaced `Proof' by its
%    translation}
% \changes{swedish-2.3b}{2000/09/26}{Added \cs{glossaryname}}
% \changes{swedish-2.3c}{2001/03/12}{Provided translation for
%    Glossary}
%    \begin{macrocode}
  \def\proofname{Bevis}%
  \def\glossaryname{Ordlista}%
  }%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dateswedish}
%    The macro |\dateswedish| redefines the command |\today| to
%    produce Swedish dates.
% \changes{swedish-2.2}{1997/10/01}{Use \cs{edef} to define
%    \cs{today} to save memory}
% \changes{swedish-2.2}{1998/03/28}{use \cs{def} instead of
%    \cs{edef}}
%    \begin{macrocode}
\def\dateswedish{%
  \def\today{%
    \number\day~\ifcase\month\or
    januari\or februari\or mars\or april\or maj\or juni\or
    juli\or augusti\or september\or oktober\or november\or
    december\fi
    \space\number\year}}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\datesymd}
% \changes{swedish-2.3a}{2000/01/20}{Command added}
%    The macro |\datesymd| redefines the command |\today| to
%    produce dates in the format YYYY-MM-DD, common in Sweden.
%    \begin{macrocode}
\def\datesymd{%
  \def\today{\number\year-\two@digits\month-\two@digits\day}%
  }
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\datesdmy}
% \changes{swedish-2.3a}{2000/01/20}{Command added}
%    The macro |\datesdmy| redefines the command |\today| to
%    produce Swedish dates in the format DD/MM YYYY, also common in
%    Sweden.
%    \begin{macrocode}
\def\datesdmy{%
  \def\today{\number\day/\number\month\space\number\year}%
  }
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\swedishhyphenmins}
%    The swedish hyphenation patterns can be used with |\lefthyphenmin|
%    set to~2 and |\righthyphenmin| set to~2.
% \changes{swedish-1.3e}{1995/06/02}{use \cs{swedishhyphenmins} to
%    store the correct values}
%    \begin{macrocode}
\providehyphenmins{swedish}{\tw@\tw@}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\extrasswedish}
% \changes{swedish-1.3e}{1995/05/29}{Added \cs{bbl@frenchspacing}}
% \begin{macro}{\noextrasswedish}
% \changes{swedish-1.3e}{1995/05/29}{Added \cs{bbl@nonfrenchspacing}}
%    The macro |\extrasswedish| performs all the extra definitions
%    needed for the Swedish language. The macro |\noextrasswedish| is
%    used to cancel the actions of |\extrasswedish|.
%
%    For Swedish texts |\frenchspacing| should be in effect.  We make
%    sure this is the case and reset it if necessary.
%
%    \begin{macrocode}
\addto\extrasswedish{\bbl@frenchspacing}
\addto\noextrasswedish{\bbl@nonfrenchspacing}
%    \end{macrocode}
%
%    For Swedish the \texttt{"} character is made active. This is done
%    once, later on its definition may vary.
% \changes{swedish-2.0}{1996/01/24}{Added active double quote
%    character}
%
%    \begin{macrocode}
\initiate@active@char{"}
\addto\extrasswedish{\languageshorthands{swedish}}
\addto\extrasswedish{\bbl@activate{"}}
%    \end{macrocode}
%    Don't forget to turn the shorthands off again.
% \changes{swedish-2.2b}{1999/12/17}{Deactivate shorthands ouside of
%    Swedish}
%    \begin{macrocode}
\addto\noextrasswedish{\bbl@deactivate{"}}
%    \end{macrocode}
%    The ``umlaut'' accent macro |\"| is changed to lower the
%    ``umlaut'' dots. The redefinition is done with the help of
%    |\umlautlow|.
%^^A    PROBLEM:
%^^A    What happens to ``umlaut''
%^^A    characters entered using e. g. latin input encoding? They should
%^^A    be lowered as well.
%    \begin{macrocode}
\addto\extrasswedish{\babel@save\"\umlautlow}
\addto\noextrasswedish{\umlauthigh}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    The code above is necessary because we need an extra active
%    character. This character is then used as indicated in
%    table~\ref{tab:swedish-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 doublequote macros: the umlauts and {\aa}.
% \changes{swedish-2.3a}{2000/01/20}{added \cs{allowhyphens}}
%    \begin{macrocode}
\declare@shorthand{swedish}{"w}{\textormath{{\aa}\allowhyphens}{\ddot w}}
\declare@shorthand{swedish}{"a}{\textormath{\"{a}\allowhyphens}{\ddot a}}
\declare@shorthand{swedish}{"o}{\textormath{\"{o}\allowhyphens}{\ddot o}}
\declare@shorthand{swedish}{"W}{\textormath{{\AA}\allowhyphens}{\ddot W}}
\declare@shorthand{swedish}{"A}{\textormath{\"{A}\allowhyphens}{\ddot A}}
\declare@shorthand{swedish}{"O}{\textormath{\"{O}\allowhyphens}{\ddot O}}
%    \end{macrocode}
%    discretionary commands
%^^A PROBLEM:
%^^A Will these allow subsequent hyphenation? Perhaps we need to
%^^A add \cs{allowhyphens} here as well?
%    \begin{macrocode}
\declare@shorthand{swedish}{"b}{\textormath{\bbl@disc b{bb}}{b}}
\declare@shorthand{swedish}{"B}{\textormath{\bbl@disc B{BB}}{B}}
\declare@shorthand{swedish}{"d}{\textormath{\bbl@disc d{dd}}{d}}
\declare@shorthand{swedish}{"D}{\textormath{\bbl@disc D{DD}}{D}}
\declare@shorthand{swedish}{"f}{\textormath{\bbl@disc f{ff}}{f}}
\declare@shorthand{swedish}{"F}{\textormath{\bbl@disc F{FF}}{F}}
\declare@shorthand{swedish}{"g}{\textormath{\bbl@disc g{gg}}{g}}
\declare@shorthand{swedish}{"G}{\textormath{\bbl@disc G{GG}}{G}}
\declare@shorthand{swedish}{"l}{\textormath{\bbl@disc l{ll}}{l}}
\declare@shorthand{swedish}{"L}{\textormath{\bbl@disc L{LL}}{L}}
\declare@shorthand{swedish}{"m}{\textormath{\bbl@disc m{mm}}{m}}
\declare@shorthand{swedish}{"M}{\textormath{\bbl@disc M{MM}}{M}}
\declare@shorthand{swedish}{"n}{\textormath{\bbl@disc n{nn}}{n}}
\declare@shorthand{swedish}{"N}{\textormath{\bbl@disc N{NN}}{N}}
\declare@shorthand{swedish}{"p}{\textormath{\bbl@disc p{pp}}{p}}
\declare@shorthand{swedish}{"P}{\textormath{\bbl@disc P{PP}}{P}}
\declare@shorthand{swedish}{"r}{\textormath{\bbl@disc r{rr}}{r}}
\declare@shorthand{swedish}{"R}{\textormath{\bbl@disc R{RR}}{R}}
\declare@shorthand{swedish}{"s}{\textormath{\bbl@disc s{ss}}{s}}
\declare@shorthand{swedish}{"S}{\textormath{\bbl@disc S{SS}}{S}}
\declare@shorthand{swedish}{"t}{\textormath{\bbl@disc t{tt}}{t}}
\declare@shorthand{swedish}{"T}{\textormath{\bbl@disc T{TT}}{T}}
%    \end{macrocode}
%    and some additional commands:
% \def\indexeqs{=}
% \changes{swedish-2.3a}{2000/01/28}{changed definition of
%    \texttt{"\protect\indexeqs}, \cs{-} and \texttt{"~}}
%    \begin{macrocode}
\declare@shorthand{swedish}{"-}{\nobreak-\bbl@allowhyphens}
%    \end{macrocode}
% \changes{swedish-2.3e}{2021/02/06}{Adapted some shorthands to changes in hyperref}
% To avoid problems in bookmarks some shorthands should be hyperref aware.
%    \begin{macrocode}
\providecommand\texorpdfstring[2]{#1}
\declare@shorthand{swedish}{"|}{%
  \texorpdfstring{\textormath{\nobreak\discretionary{-}{}{\kern.03em}%
              \bbl@allowhyphens}{}}{}}
\declare@shorthand{swedish}{"~}{%
  \texorpdfstring{\textormath{\leavevmode\hbox{-}\bbl@allowhyphens}{-}}{-}}
\declare@shorthand{swedish}{""}{\hskip\z@skip}
\declare@shorthand{swedish}{"=}{\hbox{-}\allowhyphens}
%    \end{macrocode}
%
%  \begin{macro}{\-}
%    Redefinition of |\-|. The new version of |\-| should indicate an
%    extra hyphenation position, while allowing other hyphenation
%    positions to be generated  automatically. The standard behaviour
%    of \TeX\ in this respect is very unfortunate for languages such
%    as Dutch, Finnish, German and Swedish, where long compound words
%    are quite normal and all one needs is a means to indicate an
%    extra hyphenation position on top of the ones that \TeX\ can
%    generate from the hyphenation patterns.
%    \begin{macrocode}
\addto\extrasswedish{\babel@save\-}
\addto\extrasswedish{\def\-{\allowhyphens
                          \discretionary{-}{}{}\allowhyphens}}
%    \end{macrocode}
%  \end{macro}
%
%    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{swedish-2.1}{1996/11/03}{Now use \cs{ldf@finish} to wrap up}
%    \begin{macrocode}
\ldf@finish{swedish}
%</code>
%    \end{macrocode}
%
%\Finale
%%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\endinput