summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/babel-contrib/swedish/swedish.dtx
blob: 6beb68787b587b73e3eb629cc55cd0e25b5f9bcf (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
% \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
% \CheckSum{272}
% \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}
        [2005/03/31 v2.3d 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}
\declare@shorthand{swedish}{"|}{%
  \textormath{\nobreak\discretionary{-}{}{\kern.03em}%
              \bbl@allowhyphens}{}}
\declare@shorthand{swedish}{""}{\hskip\z@skip}
\declare@shorthand{swedish}{"~}{%
  \textormath{\leavevmode\hbox{-}\bbl@allowhyphens}{-}}
\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