The Linux Danish HOWTO
Thomas Petersen, petersen@post1.tele.dk
v1.1, 2 June 1996
This document describes how to configure Linux and various Linux
applications for Danish locale standards such as keyboard, font,
paper-size etc. It is hoped that Linux users from other places in
Western Europe will find this document of use too.
1. Introduction
All European users of almost any operating system have two problems:
The first is to tell the computer that you have a non-American
keyboard, and the second is to get the computer to display the special
letters. To make matters worse the applications themselves will also
consider you an exception if you are not an American and require
special options or the setting of environment variables.
Under Linux you change the way your computer interprets the keyboard
with the commands xmodmap and loadkeys. loadkeys will modify the
keyboard for plain Linux while xmodmap makes the modifications
necessary when the handshaking between X11 and Linux is imperfect.
To display the characters you need to tell your applications that you
use the ISO-8859-Latin-1 international set of glyphs. Mostly this is
not necessary, but a number of key applications need special
attention.
This HOWTO is intended to tell Danish users how to do this. If you
continue to have troubles after reading this you should try the German
HOWTO, the Keystroke HOWTO for Linux or the ISO 8859-1 FAQ. Many of
the hints contained herein are cribbed from there. You should also
send me a mail describing your troubles. The HOWTOs are available from
all respectable mirrors of sunsite.unc.edu while the ISO 8859-1 FAQ is
available from ftp.vlsivie.tuwien.ac.at in /pub/8bit/FAQ-ISO-8859-1.
A final problem is that error-messages, menus and documentation of
applications always are in English. There's a GNU project underway to
address this problem. You can see what it's all about by downloading
the file gettext-0.9.tar.gz or a later version from your favourite
mirror of prep.ai.mit.edu. This project needs volunteers for the
translations. Send a mail to da-request@li.org with the body
"subscribe" if you want to contribute to the Danish part of the
project.
2. Keyboard setup
2.1. Loading a Danish key-table
You have two tools for configuring your keyboard. Under plain Linux
you need loadkeys and under X11 you need xmodmap
To try out loadkeys try typing one of these two commands:
loadkeys /usr/lib/kbd/keytables/dk.map
loadkeys /usr/lib/kbd/keytables/dk-latin1.map
The difference between the two lines is that dk-latin1.map uses `dead'
keys while dk.map doesn't. Dead keys are explained in the ``section
on dead keys''. The program loadkeys and the keytables are part of
the package kbd-0.90.tar.gz which (with differing version numbers) is
available with all Linux distributions.
Usually loadkeys is run at boot-time from one of the scripts in the
directory /etc/rc.d/. Details vary widely between distributions but
it's a good idea to look for a file called rc.keymap.
(Note for non-Danish users: Support for other languages is enabled
similarly. Use es.map for Spanish keyboards etc.)
X11 will to the largest possible extent follow the keymap used by
plain Linux, but you can modify keyboard behavior under X11 with
xmodmap. Usually the X11 initialization process will run this command
atuomatically if you have a file called .Xmodmap in your home
directory.
2.2. Getting the AltGr key to work under X
Edit the file /etc/Xconfig (under XFree86 2.0) or /etc/X11/XF86Config
or /etc/XF86Config (under XFree86 3.x) and make sure the line
RightAlt ModeShift
appears in the Keyboard section. Usually you can do this by uncomment
ing the appropriate line.
2.3. Dead keys and accented characters
Dead keys are those who don't type anything until you hit another key.
Tildes and umlauts are like this by default under plain Linux if you
use the dk-latin1.map key map. This is the default behaviour under
Microsoft Windows as well.
2.3.1. Removing dead key functionality
Under plain Linux log on as root and type
loadkeys dk.map
2.3.2. Invoking dead key functionality
· Invoking dead key functionality under plain Linux
Under plain Linux log on as root and type
loadkeys dk-latin1.map
· Invoking dead key functionality under X11R5 sessions
Insert the following lines in a file ~/.Xmodmap or /etc/X11/Xmodmap
keycode 21 = acute Dgrave_accent bar
keycode 35 = Ddiaeresis Dcircumflex_accent Dtilde
You can now make the dead keys work by typing (e.g.) xmodmap
~/.Xmodmap. Mostly this command will be issued automatically when you
start up X. Do not follow this procedure if you use X11R6.
(Note for non-Danish readers: You can find the relevant key-codes for
your own keyboard by using xev - it displays a little window and
prints out all events it sees including key-codes for use with
xmodmap.)
· Invoking dead key functionality under X11R6 sessions
First you must make sure you are running XFree86 v3.1.2 or higher.
Download and install everything related to this release if you have
a lower version number. Dead keys won't work in X11R6
applications unless these were compiled with support for this input
method. A useful example of such an application is emacs version
19.30 (or higher) or the version of xterm available at
ftp://ftp.x.org/contrib/applications/ as xterm-R6-sb_right-
ansi-3d.tar.gz.
Next you'll have to map some key to Compose or (equivalently)
Multi_Key. The Scroll Lock key is most likely already mapped thus
(you can verify this with xev,) and you can easily map the right
Control key by uncommenting the appropriate line in the XFree86
configuration file (often /etc/XF86Config). If you wish to use some
other key you should put something like
keycode 96 = Multi_key
in your ~/.Xmodmap file.
Finally make sure your shell and/or application is set up for iso-
latin-1 compatibility as described in ``section on specific
applications'' and you should be all set. You can e.g. get ã by typing
Compose - a - ~. And if dead keys work under plain Linux they ought
also to work under X11 now. The available keystroke combinations are
listed in /etc/X11/locale/iso8859-1/Compose.
Many X applications do not support this general input method.
Eventually this situation might improve, but until then you can either
hack your applications or submit polite bug reports to their authors.
The latter method is often the most efficient.
2.4. Making ø (oslash) Ø (Oslash) and $ (the dollar sign) work
2.4.1. The dollar sign
In older versions of loadkeys there's a bug causing the dollar sign
to be accessed with Shift-4 instead of AltGr-4 by default. You can fix
this by changing the line
keycode 5 = four dollar dollar
in the keymap file to e.g.
keycode 5 = four asciicircum dollar
It doesn't matter if you use something else instead of asciicircum if
it is a valid symbol name. See section on ``characters you can display
under Linux'' for a list of valid symbols.
A similar bug appears in some versions of XFree86 and can be fixed by
adding
keycode 13 = 4 dollar dollar
to your ~/.Xmodmap or /etc/X11/Xmodmap file.
2.4.2. ø (oslash) and Ø (Oslash)
On some older distributions ø and Ø appear as a cent and a Yen sign.
If you have this problem determine what keymap you load at boot-up.
You should be able to find out by looking around in the directory
/etc/rc.d/ or simply by paying attention to what happens at boot-up.
On my computer the keymap is called /usr/lib/kbd/keytables/dk-
latin1.map. Find the line for keycode 40 in this file and change it
from
keycode 40 = cent yen
to
keycode 40 = oslash Ooblique
and load the keytable as described in section on ``loading keyta
bles''.
Note: This bug appears to have been fixed in version 0.88 of the
international keytable package.
3. Display and application setup
In general applications need to be compiled as "8-bit-clean" to work
well with European charaters. Actually they often need a few extra
hints to get it right. You are advised to define the environment
variable LC_CTYPE to iso_8859_1 right away. You should put this
definition both in /etc/profile (for bash users) and also in
/etc/csh.cshrc (for tcsh users.) Similarly you should (for the sake of
principle) put something like this in your .Xdefaults or .Xresources
file:
*basicLocale: C
*timeFormat: C
*numeric: C
*displayLang: iso_8859_1
*inputLang: iso_8859_1
3.1. International character sets in specific applications
A number of applications demand special attention. This section
describes how to set up configuration files for them.
bash v.1.13+ :
Put the following in your /etc/inputrc or your ~/.inputrc file
set meta-flag on
set convert-meta off
set output-meta on
tcsh :
Put the following in your /etc/csh.cshrc or .tcshrc file
setenv LC_CTYPE iso_8859_1
stty pass8
Note: If this doesn't work your copy of tcsh was probably not com
piled with NLS support or possibly it's version 6.03 or lower.
ls :
Issue the command as
ls -N
or possibly
ls --8bit
less :
Set the following environment variable
LESSCHARSET=latin1
elm :
Set the following environment variables
LANG=C
LC_CTYPE=iso_8859_1
Some versions of elm require that your put the following defini
tions in your ~/.elm/elmrc/ file:
charset = iso-8859-1
displaycharset = iso-8859-1
textencoding = 8bit
telnet :
Put the following line in your ~/.telnetrc file
set binary true
kermit :
This is as close as I can get, but not completely satisfying
yet: Put the following in your ~/.emacs file
set terminal bytesize 8
set command bytesize 8
set file bytesize 8
set language danish
set file character-set latin1-iso
set transfer character-set latin1-iso
set terminal character-set latin1-iso
I think there are more variables to set, but they are hiding. You
would have to modify these settings if the remote system is DOS or
OS/2 based.
emacs :
In version 19.26 or later of GNU emacs you can simply set the
environment variable LC_CTYPE to iso_8859_1 like you do for tcsh
and elm. If you use an older version put the following in your
/usr/lib/emacs/site-lisp/default.el file:
(standard-display-european t)
(set-input-mode (car (current-input-mode))
(nth 1 (current-input-mode))
0)
Dead key functionality should work under GNU emacs provided you use
GNU emacs v19.30 or higher and XFree86 v3.1.2 or higher, so don't
start researching available elisp packages implementing "electric
keys" or anything like that. If you want to implement European
keyboard conventions in emacs without upgrading the best choice is
probably the remap package available from the AUC FTP server (see
section ``References and FTP sites''.)
ispell - Spell checking in Danish :
First make sure you install version 3.1 instead of version 4.0
of ispell. The latter is obsolete and multiply brain-damaged.
You can download the sources for ispell at the GNU archive at
prep.ai.mit.edu, and you can get a Danish dictionary via FTP
from ftp.iesd.auc.dk in /pub/packages/dkispell/. Follow the
compilation instructions and you should have no trouble (One
caveat: When defining the variables necessary for compilation
you should slightly confusingly tell ispell that Linux is a Sys
V type OS by defining the variable USG.)
(Note for non-Danish readers: You can find dictionaries for most
Western languages by reading the file Where included with the
sources for ispell.)
TeX/LaTeX :
There are several problems with TeX/LaTeX: You want LaTeX to
understand the special characters, and you also want the output
to follow Danish conventions and so forth.
Under LaTeX2e the header should look something like this:
\documentclass{article}
\usepackage{a4}
\usepackage{isolatin1}
\usepackage[danish]{babel}
The first usepackage statement obviously sets the paper size to A4.
The second makes sure LaTeX will interpret European characters
correctly, so that you don't have to use pesky escape codes for
European characters. These two packages are likely to be included
in your TeX distribution. The last usepackage statement implements
a range of standards for use in a Danish text. This last bit is
tricky because it will most likely not have been built into your
version of LaTeX and you'll need to do this yourself.
You will need some Danish hyphenation patterns (Dansk: orddeling)
These are available at ftp://ftp.iesd.auc.dk/pub/packages/. The
files you need are dkhyphen.tex, dkcommon.tex and dkspecial.tex. If
you use the teTeX distribution (distributed with e.g. RedHat) you
already have the relevant files. Essentially you need to put these
into the directory containing international hyphenation patterns,
edit the appropriate language dependency file (usually called
language.dat) and finally rebuild LaTeX with initex. Before you do
anything rash please make sure you know what files you are changing
and back them up in advance.
Below is a procedure for enabling danish hyphenation. If it looks
vague it's because TeX/LaTeX installations differ very much in
their choice of path-names.
1. Find out where you have the hyphenation patterns. Under N-TeX
this is /usr/lib/texmf/tex/hyphenation/, under teTeX it's
/usr/lib/texmf/texmf/tex/generic/hyphen/. Try issuing a
command find /usr/lib/ -iname '*hyph*' if you can't find the
directory.
2. Check if the hyphenation patterns are already there. If not
put the hyphenation patterns mentioned above in this
directory.
3. Edit the file (probably) called language.dat. In the teTeX
distribution you can just uncomment the appropriate line. If
you downloaded the hyphenation pattern insert a line reading
danish dkhyphen.tex
If you have difficulty finding language.dat try issuing the com
mand find /usr/lib/ -name language.dat
4. Back up the file latex.fmt. It could be in a variety of
places. Use find /usr/lib/ -name latex.fmt to find it.
5. Change to the directory where you found latex.fmt. Issue the
command initex latex.ltx. Pray. If everything went well you
now have a new version of latex.fmt.
6. You can now use
\usepackage[danish]{babel}
in your LaTeX headers. Hyphenation should now be reasonably
correct, quotation marks follow Danish conventions and chapters
are now called "Kapitel" instead of "Chapter" etc.
If you use N-TeX you will have a configuration script called ntm-
ltx.cfg located in /usr/lib/texmf/tools/. In that case simply put
the hyphenation patterns in the the relevant directory (most likely
called /usr/lib/texmf/tex/hyphenation/) and run the script. It will
the prompt you to do the various steps described above.
(Note for non-Danish readers: The process is similar for other
Western European languages, and the necessary files are mostly
included by default. Simply executing the command
/usr/lib/texmf/tools/ntm-ltx.cfg and following the instructions
will be enough for almost all major Western languages.)
In LaTeX 2.09, use
\documentstyle[a4,isolatin]{article}
to include support for ISO latin1 characters and European paper-
sizes.
isolatin.sty is available from all DANTE (see servers and from URL
ftp://ftp.vlsivie.tuwien.ac.at/pub/8bit. It should also be included
in the standard Linux distributions.
Note: Some people prefer using emacs in a special mode which
translates "special" letters into TeX escape codes, but this method
should be obsolete by now.
3.2. What characters you can display under Linux
Type dumpkeys -l | less at the prompt to find out what is readily
available. You can map them to your keyboard via the keymap files
mentioned in section ``loading a keytable''.
0 X11R5 Note: The dead keys don't get the correct names under X11R5
with this scheme. Generally
dead_* (under plain Linux) => D* or D*_accent (under X11R5)
(i.e. the tilde may be dead_tilde in dk-latin1.map but X11R5 expects
the dead tilde to be called Dtilde.) This does not apply to X11R6.
3.3. Loading the Latin-1 character set on the console
Execute the following commands under the bash shell:
setfont /usr/lib/kbd/consolefonts/lat1-16.psf
mapscrn /usr/lib/kbd/consoletrans/trivial
echo -ne '\033(K'
Note: This only has effect under plain Linux on the console.
4. Miscellaneous problems
4.1. Time zone.
Denmark is placed in the Central European Time zone (CET or MET),
which is equivalent to Greenwich Middle Time plus 1 (GMT+1). You set
the time zone on a Linux system by making a symbolic link between
/usr/lib/zoneinfo/localtime and the file in /usr/lib/zoneinfo/ with a
name corresponding to your zone. Danes will want to execute the
command
ln -sf /usr/lib/zoneinfo/MET /usr/lib/zoneinfo/localtime
You synchronize the system time with the CMOS clock by issuing the
command clock. If your CMOS clock is set to Greenwich time (the stan
dard on proper Unix systems) use
clock -u -s
or if your CMOS clock is set to local time use
clock -s
4.2. A4 papersize
· - in ghostscript: Add the command line option -sPAPERSIZE=a4.
· - in ghostview: Define the following Xresource:
Ghostview.pageMedia: A4
· - in dvips: Edit the file /usr/lib/texmf/dvips/config.ps or .dvips.
· - in xdvi: Define the Xresource
XDvi.paper: a4
· - in TeX/LaTeX: See the entry for TeX/LaTeX in section on
``specific applications''.
4.3. Text file formats and other platforms.
You can translate files between an ISO-8859-1 formatted text file and
e.g. a DOS text file using codepage 850 with the recode package. A
DOS file called foo.txt would be translated into a proper Unix file
with the command
recode cp850:latin1 foo.txt
recode is available as recode-3.4.tar.gz from all mirrors of
prep.ai.mit.edu.
5. References and FTP sites
5.1. Other documents of relevance
The HOWTOs ought to be available from all mirrors of sunsite.unc.edu
and tsx-11.mit.edu. A good close and fast mirror is the ftp site
src.doc.uc.ac.uk.
The German HOWTO (in German) by Thomas Ploss.
The Portugese HOWTO (in Portugese) by Joao Carlos Rodrigues Pereira.
The Keystroke HOWTO by Zenon Fortuna.
The ISO-8859-1 FAQ by Michael Gschwind available from His FTP site
.
5.2. FTP and Web sites
FTP site at Aalborg University Centre
(AUC) Danish hyphenation tables,
dictionary for ispell, the remap package for emacs etc.
FTP site at Imperial College
mirrors all the sites below and gives much better access for
Europeans.
Sunsite and mirrors. doc/howto has
the above mentioned HOWTOs. utils/nls and subdirectories contains
files related to National Language Support. Developers should take a
look at locale-tutorial-0.8.txt.gz, locale-pack-0.8.tar.gz, cat-
pack.tar.gz and cat-pack.tar.gz.
The GNU archives has the recode
package for character table conversion, the gettext package for locale
support of some GNU applications and (of course) the latest versions
of GNU emacs.
The DANTE FTP site Everything needed for TeX and
LaTeX support.
6. Post-amble: Acknowledgments and Copyright
Thanks to Peter Dalgaard, Anders Majland, Jon Haugsand, the authors of
the German HOWTO and Michael Gschwind for suggestions and help with
several questions. And a big thanks to the people at Aalborg
University Center for writing and making available several of the
packages described in this file.
This HOWTO is copyrighted by Thomas Petersen and distributed as other
Linux HOWTOs under the terms described below.
Linux HOWTO documents may be reproduced and distributed in whole or in
part, in any medium physical or electronic, as long as this copyright
notice is retained on all copies. Commercial redistribution is allowed
and encouraged; however, the author would like to be notified of any
such distributions.
All translations, derivative works, or aggregate works incorporating
any Linux HOWTO documents must be covered under this copyright notice.
That is, you may not produce a derivative work from a HOWTO and impose
additional restrictions on its distribution. Exceptions to these rules
may be granted under certain conditions; please contact the Linux
HOWTO coordinator at the address given below.
If you have questions, please contact Greg Hankins, the Linux HOWTO
coordinator, at gregh@sunsite.unc.edu. You may finger this address for
phone number and additional contact information.