The Linux Danish HOWTO <author>Thomas Petersen, <tt/petersen@post1.tele.dk/ <date>v1.1, 2 June 1996 <abstract> 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. </abstract> <toc> <sect>Introduction <p> 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 <tt/xmodmap/ and <tt/loadkeys/. <tt/loadkeys/ will modify the keyboard for plain Linux while <tt/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 <tt>sunsite.unc.edu</tt> while the ISO 8859-1 FAQ is available from <tt>ftp.vlsivie.tuwien.ac.at</tt> in <tt>/pub/8bit/FAQ-ISO-8859-1</tt>. <p> 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 <tt/gettext-0.9.tar.gz/ or a later version from your favourite mirror of <tt/prep.ai.mit.edu/. This project needs volunteers for the translations. Send a mail to <tt/da-request@li.org/ with the body "subscribe" if you want to contribute to the Danish part of the project. <p> <sect>Keyboard setup <p> <sect1>Loading a Danish key-table<label id="loadkbd"> <p> You have two tools for configuring your keyboard. Under plain Linux you need <tt/loadkeys/ and under X11 you need <tt/xmodmap/ To try out <tt/loadkeys/ try typing one of these two commands: <tscreen><verb> loadkeys /usr/lib/kbd/keytables/dk.map loadkeys /usr/lib/kbd/keytables/dk-latin1.map </verb></tscreen> The difference between the two lines is that <tt>dk-latin1.map</tt> uses `dead' keys while <tt>dk.map</tt> doesn't. Dead keys are explained in the <ref id="deadkeys" name="section on dead keys">. The program <tt/loadkeys/ and the keytables are part of the package <tt/kbd-0.90.tar.gz/ which (with differing version numbers) is available with all Linux distributions. Usually <tt/loadkeys/ is run at boot-time from one of the scripts in the directory <tt>/etc/rc.d/</tt>. Details vary widely between distributions but it's a good idea to look for a file called <tt/rc.keymap/. (Note for non-Danish users: Support for other languages is enabled similarly. Use <tt/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 <tt/xmodmap/. Usually the X11 initialization process will run this command atuomatically if you have a file called <tt>.Xmodmap</tt> in your home directory. <sect1>Getting the <tt>AltGr</tt> key to work under X <p> Edit the file <tt>/etc/Xconfig</tt> (under XFree86 2.0) or <tt>/etc/X11/XF86Config</tt> or <tt>/etc/XF86Config</tt> (under XFree86 3.x) and make sure the line <tscreen><verb> RightAlt ModeShift </verb></tscreen> appears in the <tt>Keyboard</tt> section. Usually you can do this by uncommenting the appropriate line. <sect1>Dead keys and accented characters<label id="deadkeys"> <p> 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 <tt>dk-latin1.map</tt> key map. This is the default behaviour under Microsoft Windows as well. <sect2>Removing dead key functionality <p> Under plain Linux log on as root and type <tscreen><verb> loadkeys dk.map </verb></tscreen> <sect2>Invoking dead key functionality <p> <itemize> <item>Invoking dead key functionality under plain Linux <p> Under plain Linux log on as root and type <tscreen><verb> loadkeys dk-latin1.map </verb></tscreen> <item>Invoking dead key functionality under X11R5 sessions <p> Insert the following lines in a file <tt>˜/.Xmodmap</tt> or <tt>/etc/X11/Xmodmap</tt> <tscreen><verb> keycode 21 = acute Dgrave_accent bar keycode 35 = Ddiaeresis Dcircumflex_accent Dtilde </verb></tscreen> You can now make the dead keys work by typing (e.g.) <tt>xmodmap ˜/.Xmodmap</tt>. 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 <tt/xev/ - it displays a little window and prints out all events it sees including key-codes for use with <tt/xmodmap/.) <item>Invoking dead key functionality under X11R6 sessions <p> 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 <tt/emacs/ version 19.30 (or higher) or the version of <tt>xterm</tt> available at <tt>ftp://ftp.x.org/contrib/applications/</tt> as <tt/xterm-R6-sb_right-ansi-3d.tar.gz/. <p> Next you'll have to map some key to <tt>Compose</tt> or (equivalently) <tt/Multi_Key/. The <tt>Scroll Lock</tt> key is most likely already mapped thus (you can verify this with <tt/xev/,) and you can easily map the right <tt/Control/ key by uncommenting the appropriate line in the XFree86 configuration file (often <tt>/etc/XF86Config</tt>). If you wish to use some other key you should put something like <tscreen><verb> keycode 96 = Multi_key </verb></tscreen> in your <tt>˜/.Xmodmap</tt> file. <p> Finally make sure your shell and/or application is set up for iso-latin-1 compatibility as described in <ref id="apps" name="section on specific applications"> and you should be all set. You can e.g. get ã by typing <tt>Compose - a - ˜</tt>. And if dead keys work under plain Linux they ought also to work under X11 now. The available keystroke combinations are listed in <tt>/etc/X11/locale/iso8859-1/Compose</tt>. <p> 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. <p> </itemize> <sect1>Making <tt/ø/ (oslash) <tt/Ø/ (Oslash) and <tt/$/ (the dollar sign) work <p> <sect2>The dollar sign <p> In older versions of loadkeys there's a bug causing the dollar sign to be accessed with <tt/Shift-4/ instead of <tt/AltGr-4/ by default. You can fix this by changing the line <tscreen><verb> keycode 5 = four dollar dollar </verb></tscreen> in the keymap file to e.g. <tscreen><verb> keycode 5 = four asciicircum dollar </verb></tscreen> It doesn't matter if you use something else instead of <tt>asciicircum</tt> if it is a valid symbol name. See section on <ref id="glyphs" name="characters you can display under Linux"> for a list of valid symbols. <p> A similar bug appears in some versions of XFree86 and can be fixed by adding <tscreen><verb> keycode 13 = 4 dollar dollar </verb></tscreen> to your <tt>˜/.Xmodmap</tt> or <tt>/etc/X11/Xmodmap</tt> file. <sect2> <tt/ø/ (oslash) and <tt/Ø/ (Oslash) <p> 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 <tt>/etc/rc.d/</tt> or simply by paying attention to what happens at boot-up. On my computer the keymap is called <tt>/usr/lib/kbd/keytables/dk-latin1.map</tt>. Find the line for keycode 40 in this file and change it from <tscreen><verb> keycode 40 = cent yen </verb></tscreen> to <tscreen><verb> keycode 40 = oslash Ooblique </verb></tscreen> and load the keytable as described in section on <ref id="loadkbd" name="loading keytables">. Note: This bug appears to have been fixed in version 0.88 of the international keytable package. <sect>Display and application setup <p> 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 <tt/LC_CTYPE/ to <tt/iso_8859_1/ right away. You should put this definition both in <tt>/etc/profile</tt> (for <tt/bash/ users) and also in <tt>/etc/csh.cshrc</tt> (for <tt/tcsh/ users.) Similarly you should (for the sake of principle) put something like this in your <tt>.Xdefaults</tt> or <tt>.Xresources</tt> file: <tscreen><verb> *basicLocale: C *timeFormat: C *numeric: C *displayLang: iso_8859_1 *inputLang: iso_8859_1 </verb></tscreen> <sect1>International character sets in specific applications<label id="apps"> <p> A number of applications demand special attention. This section describes how to set up configuration files for them. <descrip> <tag/<tt>bash</tt> v.1.13+ :/ Put the following in your <tt>/etc/inputrc</tt> or your <tt>˜/.inputrc </tt> file <tscreen><verb> set meta-flag on set convert-meta off set output-meta on </verb></tscreen> <tag/<tt>tcsh</tt> :/ Put the following in your <tt>/etc/csh.cshrc</tt> or <tt>.tcshrc</tt> file <tscreen><verb> setenv LC_CTYPE iso_8859_1 stty pass8 </verb></tscreen> Note: If this doesn't work your copy of <tt/tcsh/ was probably not compiled with NLS support or possibly it's version 6.03 or lower. <tag/<tt>ls</tt> :/ Issue the command as <tscreen><verb> ls -N </verb></tscreen> or possibly <tscreen><verb> ls --8bit </verb></tscreen> <tag/<tt>less</tt> :/ Set the following environment variable <tscreen><verb> LESSCHARSET=latin1 </verb></tscreen> <tag/<tt>elm</tt> :/ Set the following environment variables <tscreen><verb> LANG=C LC_CTYPE=iso_8859_1 </verb></tscreen> Some versions of <tt/elm/ require that your put the following definitions in your <tt>~/.elm/elmrc/</tt> file: <tscreen><verb> charset = iso-8859-1 displaycharset = iso-8859-1 textencoding = 8bit </verb></tscreen> <tag/<tt>telnet</tt> :/ Put the following line in your <tt>~/.telnetrc</tt> file <tscreen><verb> set binary true </verb></tscreen> <tag/<tt>kermit</tt> :/ This is as close as I can get, but not completely satisfying yet: Put the following in your <tt>~/.emacs</tt> file <tscreen><verb> 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 </verb></tscreen> 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. <tag/<tt>emacs</tt> :/ In version 19.26 or later of GNU emacs you can simply set the environment variable <tt/LC_CTYPE/ to <tt/iso_8859_1/ like you do for tcsh and elm. If you use an older version put the following in your <tt>.emacs</tt> or the <tt>/usr/lib/emacs/site-lisp/default.el</tt> file: <tscreen><verb> (standard-display-european t) (set-input-mode (car (current-input-mode)) (nth 1 (current-input-mode)) 0) </verb></tscreen> 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 <tt/remap/ package available from the AUC FTP server (see section <ref id="refs" name="References and FTP sites">.) <tag/<tt>ispell</tt> - Spell checking in Danish :/ First make sure you install version 3.1 instead of version 4.0 of <tt>ispell</tt>. The latter is obsolete and multiply brain-damaged. You can download the sources for <tt>ispell</tt> at the GNU archive at <tt>prep.ai.mit.edu</tt>, and you can get a Danish dictionary via FTP from <tt>ftp.iesd.auc.dk</tt> in <tt>/pub/packages/dkispell/</tt>. 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 <tt/USG/.) (Note for non-Danish readers: You can find dictionaries for most Western languages by reading the file <tt/Where/ included with the sources for <tt/ispell/.) <tag>TeX/LaTeX :</tag> 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. <p> Under LaTeX2e the header should look something like this: <tscreen><verb> \documentclass{article} \usepackage{a4} \usepackage{isolatin1} \usepackage[danish]{babel} </verb></tscreen> The first <tt>usepackage</tt> 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 <tt>usepackage</tt> 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 <tt>ftp://ftp.iesd.auc.dk/pub/packages/</tt>. The files you need are <tt>dkhyphen.tex</tt>, <tt>dkcommon.tex</tt> and <tt>dkspecial.tex</tt>. 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 <tt/language.dat/) and finally rebuild LaTeX with <tt>initex</tt>. 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. <enum> <item> Find out where you have the hyphenation patterns. Under N-TeX this is <tt>/usr/lib/texmf/tex/hyphenation/</tt>, under teTeX it's <tt>/usr/lib/texmf/texmf/tex/generic/hyphen/</tt>. Try issuing a command <tt>find /usr/lib/ -iname '*hyph*'</tt> if you can't find the directory. <item> Check if the hyphenation patterns are already there. If not put the hyphenation patterns mentioned above in this directory. <item> Edit the file (probably) called <tt>language.dat</tt>. In the teTeX distribution you can just uncomment the appropriate line. If you downloaded the hyphenation pattern insert a line reading <tscreen><verb> danish dkhyphen.tex </verb></tscreen> If you have difficulty finding <tt/language.dat/ try issuing the command <tt>find /usr/lib/ -name language.dat</tt> <item> Back up the file <tt>latex.fmt</tt>. It could be in a variety of places. Use <tt>find /usr/lib/ -name latex.fmt</tt> to find it. <item> Change to the directory where you found <tt>latex.fmt</tt>. Issue the command <tt>initex latex.ltx</tt>. Pray. If everything went well you now have a new version of <tt/latex.fmt/. <item>You can now use <tscreen><verb>\usepackage[danish]{babel}</verb></tscreen> 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. </enum> If you use N-TeX you will have a configuration script called <tt>ntm-ltx.cfg</tt> located in <tt>/usr/lib/texmf/tools/</tt>. In that case simply put the hyphenation patterns in the the relevant directory (most likely called <tt>/usr/lib/texmf/tex/hyphenation/</tt>) 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 <tt>/usr/lib/texmf/tools/ntm-ltx.cfg</tt> and following the instructions will be enough for almost all major Western languages.) In LaTeX 2.09, use <tscreen><verb> \documentstyle[a4,isolatin]{article} </verb></tscreen> to include support for ISO latin1 characters and European paper-sizes. <tt>isolatin.sty</tt> is available from all DANTE (see servers and from URL <tt>ftp://ftp.vlsivie.tuwien.ac.at/pub/8bit</tt>. 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. </descrip> <sect1>What characters you can display under Linux<label id="glyphs"> <p> Type <tt>dumpkeys -l | less</tt> at the prompt to find out what is readily available. You can map them to your keyboard via the keymap files mentioned in section <ref id="loadkbd" name="loading a keytable">. 0 X11R5 Note: The dead keys don't get the correct names under X11R5 with this scheme. Generally <tscreen> <tt>dead_*</tt> (under plain Linux) => <tt>D*</tt> or <tt>D*_accent</tt> (under X11R5) </tscreen> (i.e. the tilde may be <tt/dead_tilde/ in <tt/dk-latin1.map/ but X11R5 expects the dead tilde to be called <tt/Dtilde/.) This does not apply to X11R6. <sect1>Loading the Latin-1 character set on the console <p> Execute the following commands under the <tt>bash</tt> shell: <tscreen><verb> setfont /usr/lib/kbd/consolefonts/lat1-16.psf mapscrn /usr/lib/kbd/consoletrans/trivial echo -ne '\033(K' </verb></tscreen> Note: This only has effect under plain Linux on the console. <sect>Miscellaneous problems <sect1>Time zone. <p> 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 <tt>/usr/lib/zoneinfo/localtime</tt> and the file in <tt>/usr/lib/zoneinfo/</tt> with a name corresponding to your zone. Danes will want to execute the command <tscreen><verb> ln -sf /usr/lib/zoneinfo/MET /usr/lib/zoneinfo/localtime </verb></tscreen> You synchronize the system time with the CMOS clock by issuing the command <tt/clock/. If your CMOS clock is set to Greenwich time (the standard on proper Unix systems) use <tscreen><verb> clock -u -s </verb></tscreen> or if your CMOS clock is set to local time use <tscreen><verb> clock -s </verb></tscreen> <sect1>A4 papersize <p> <itemize> <item> - in <tt>ghostscript</tt>: Add the command line option <tt>-sPAPERSIZE=a4</tt>. <item> - in <tt>ghostview</tt>: Define the following Xresource: <tscreen><verb> Ghostview.pageMedia: A4 </verb></tscreen> <item> - in dvips: Edit the file <tt>/usr/lib/texmf/dvips/config.ps</tt> or <tt>.dvips</tt>. <item> - in xdvi: Define the Xresource <tscreen><verb> XDvi.paper: a4 </verb></tscreen> <item> - in TeX/LaTeX: See the entry for TeX/LaTeX in section on <ref id="apps" name="specific applications">. </itemize> <sect1>Text file formats and other platforms. <p> You can translate files between an ISO-8859-1 formatted text file and e.g. a DOS text file using codepage 850 with the <tt/recode/ package. A DOS file called <tt>foo.txt</tt> would be translated into a proper Unix file with the command <tscreen><verb> recode cp850:latin1 foo.txt </verb></tscreen> <tt/recode/ is available as <tt/recode-3.4.tar.gz/ from all mirrors of <tt/prep.ai.mit.edu/. <sect>References and FTP sites<label id="refs"> <p> <sect1>Other documents of relevance <p> The HOWTOs ought to be available from all mirrors of <tt/sunsite.unc.edu/ and <tt/tsx-11.mit.edu/. A good close and fast mirror is the ftp site <tt/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 <url url="ftp://ftp.vlsivie.tuwien.ac.at/pub/8bit/" name="His FTP site">. <sect1>FTP and Web sites <p> <url url="ftp://ftp.iesd.auc.dk/pub/packages/" name="FTP site at Aalborg University Centre"> (AUC) Danish hyphenation tables, dictionary for ispell, the remap package for emacs etc. <url url="ftp://src.doc.ic.ac.uk/computing/" name="FTP site at Imperial College"> mirrors all the sites below and gives much better access for Europeans. <url url="ftp://sunsite.unc.edu/pub/linux/" name="Sunsite"> and mirrors. <tt>doc/howto</tt> has the above mentioned HOWTOs. <tt>utils/nls</tt> and subdirectories contains files related to National Language Support. Developers should take a look at <tt>locale-tutorial-0.8.txt.gz</tt>, <tt>locale-pack-0.8.tar.gz</tt>, <tt/cat-pack.tar.gz/ and <tt/cat-pack.tar.gz/. <url url="ftp://prep.ai.mit.edu/pub/gnu/" name="The GNU archives"> has the <tt/recode/ package for character table conversion, the <tt/gettext/ package for locale support of some GNU applications and (of course) the latest versions of GNU emacs. <url url="ftp://ftp.dante.de/" name="The DANTE FTP site"> Everything needed for TeX and LaTeX support. <sect>Post-amble: Acknowledgments and Copyright <p> 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 <tt/gregh@sunsite.unc.edu/. You may finger this address for phone number and additional contact information. </article>