An update on the babel system

Johannes Braams

Abstract

This article describes the changes that have been made to the babel system, since the article describing the system appeared in TUGboat Volume 12, number 2. This article announces the release of a new version of the babel system.

1 Introduction

Since the publication of the babel system in TUGboat [1] several changes have occurred. With the new release of L^{A}TEX – which appeared at the end of 1991 – the internationalised version IL^{A}TEX, prepared by Joachim Schrod [2] was withdrawn. But some of its functionality was still needed, so a modification of the babel system was necessary.

Besides this a couple of bugs were reported and had to be fixed. The major problem was that the language changing commands were not ‘local’, they contained global definitions. In the current version these commands obey grouping correctly.

Some macros that formerly were in languagespecific files have been moved to the core of the system, because they are being used in several languagespecific files.

2 Changes to the core of babel

The changes to the core of the babel system are the most extensive.

2.1 \selectlanguage

The babel user-command \selectlanguage now also accepts a control sequence as its argument. This was included to provide compatibility for users who were used to the syntax of the original german.tex, but wanted to switch to babel. The escape character is ‘peeled off’ and the name of the control sequence is then used as the name of the language to select.

Another change to the \selectlanguage macro is that it now stores the name of the current language in the control sequence \languagename. The contents of this control sequence could be tested in the following way:

\edef\tmp{\string english}
\ifx\languagename\tmp
...
\else
...
\fi

The construction with \string is necessary because \languagename returns the name with characters of category code 12 (other).

2.2 Saving macro definitions

A new way of handling macros that are temporarily redefined was developed by Bernd Raichle and included in the core of the babel system. Two new macros, for use in the language-specific files have been introduced. These macros, \babel@savevariable⟨register⟩ and

\babel@save⟨macro⟩, append code to \originalTeX.

This code restores the value (or meaning) of what was saved when \originalTeX was executed.

2.3 Special characters

Some of the language-specific files introduce one or more characters that are special in some way. Such characters have to be added to \dospecials (and \@sanitize too for L^{A}TEX) whenever their special meaning is activated. But, they may have to be removed again when another language, which doesn’t use them, is in effect.

To this end two new control sequences, that are meant to be used in the language-specific files are introduced. They are \babel@add@special and \babel@remove@special and perform the necessary tasks.

2.4 Additional facilities

A specific request from Joachim Schrod for babel, was the possibility to extend the definition of a control sequence on the fly. It should, for instance, be possible that the user adds a macro of his own to the definition of \extrasenglish.

This feature is now provided by the macro \addto{⟨control sequence⟩}{⟨TEX code⟩}. It is now used throughout the language-specific files to build the macros \extras⟨lang⟩ and \noextras⟨lang⟩.

The support macros \allowhyphens,

\set@low@box and \save@sf@q have been moved

from the language-specific files to the core of the babel system.

2.5 The files

In the previous release a file called latexhax.com was provided. This was needed to provide some macros normally defined by L^{A}TEX, to plain TEX users. The need for this file has been removed in the current release of the babel system.

In the previous release of the system, four different files were provided (all derived from hyphen.doc that were needed for different combinations of versions of TEX and plain.tex or lplain.tex. This has been changed. In the current version only two different files are derived from hyphen.doc. They

are babel.switch and babel.hyphen.

The file babel.switch is needed for people who can’t build a new format or don’t have TEX version 3. The file babel.hyphen should be loaded into the format by iniTEX. It provides the macros from babel.switch, but additionally it reads the file language.dat, which specifies the languages for which hyphenation patterns should be loaded.

In the previous release the file babel.com contained redefinitions for a lot of L^{A}TEX macros to replace texts with control sequences. This has been removed, because it is no longer necessary for releases of L^{A}TEX dated december 1991 or later. Those who still have an older release of L^{A}TEX can produce a special version of babel.com by including the docstrip option ⟨names⟩ when stripping the file

babel.doc.

With the release of the new version of Frank Mittelbach’s doc package the stripped files are no longer distributed. The distribution of babel now includes a file install.babel with which you can produce them (give the command tex install.babel).

3 Changes to the language specific files

Bernd Raichle has invented a solution for things like \char"45 when the " is active. His solution (from german 2.3e) has been included in germanb and is copied for other language specific files that have an active ".

A few terms have been added to the \captions⟨...⟩ macros, again following german.tex. These terms

are \prefacename, \seename and \seealsoname. I

don’t have the correct translations for all languages yet, but that will be repaired as soon as someone provides them to me.

For the dutch language the behaviour of the active double quote has been slightly modified. It has been noted that there is a difference between "e, where a ‘trema’ should be produced and \"u, where we should get an ‘umlaut’. The difference between the two is that the ‘trema’ should disappear at a hyphenation point, whereas the ‘umlaut’ should not.

References

[1] Johannes Braams, Babel, a multilingual styleoption system for use with L^{A}TEX’s standard document styles, TUGboat 12 (1991) #2, p. 291– 301.

[2] Joachim Schrod, International L^{A}TEX is ready to use, TUGboat 11 (1990) #1, p. 87–90.