summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/babel/tb1604.tex
blob: 0538716f82a2e8a0ee274776866c94725be5dcdf (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
443
444
445
446
447
448
% \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
%%% ====================================================================
%%%  @TeX-file{
%%%     author          = "Johannes",
%%%     version         = "1.0",
%%%     date            = "05 December 1995",
%%%     time            = "22:43:54 MET",
%%%     filename        = "tbstatus.tex",
%%%     address         = "TeXniek,
%%%                        Kersengaarde 33
%%%                        2723 BP Zoetermeer
%%%                        The Netherlands",
%%%     telephone       = "+31 79 352 28 19",
%%%     FAX             = "+31 70 343 23 95",
%%%     checksum        = "",
%%%     email           = "babel@braams.cistron.nl (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "",
%%%     supported       = "yes",
%%%     abstract        = "",
%%%     docstring       = "This article is derived from my
%%%                        presentation at the EuroTeX'95 conference
%%%                        and will appear in a future issue of
%%%                        TuGboat.
%%%
%%%                        The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility.",
%%%  }
%%% ====================================================================
\NeedsTeXFormat{LaTeX2e}
\IfFileExists{ltugboat.cls}{%
  \documentclass{ltugboat}
  \def\rtitlex{TUGboat, Volume 16 (1995), No. 4}
  %\def\midrtitle{}
  %\def\PrelimDraftfooter{}
  %\let\TBmaketitle\maketitle
  %\SelfDocumenting
  \setcounter{page}{1}
  }{%
  \documentclass{article}
  \newcommand\address[1]{}
  \newcommand\netaddress[1]{}
  \newcommand\TUB{\textsl{TUGboat\/}}
  \newcommand\TeXhax{\TeX hax}}
\usepackage{shortvrb}
\MakeShortVerb{\|}

\newcommand\figrule{\kern3pt\hrule\kern3pt}
\newcommand*{\file}[1]{\texttt{#1}}
\newcommand*{\cls}[1]{\texttt{#1}}
\newcommand*{\pkg}[1]{\texttt{#1}}
\newcommand*{\Lenv}[1]{\textsf{#1}}
\newcommand*{\opt}[1]{\textsf{#1}}
\newcommand*{\meta}[1]{\mbox{$\langle$\it #1\/$\rangle$}}
\newcommand*\babel{\textsf{babel}}
\newcommand*\bs{\char'134}
\let\osn\oldstylenums

\begin{document}

\title{The status of \babel}
\author{Johannes L. Braams}
\address{%
  \TeX niek\\
  Kersengaarde 33\\
  2723 BP Zoetermeer\\
  The Netherlands}
\netaddress{babel@braams.cistron.nl}
\date{september 1995}
\maketitle

\begin{abstract}
  In this article I will give an overview of what has happened to
  \babel\ lately. First I will briefly describe the history of \babel;
  then I will introduce the concept of `shorthands'. New ways of
  changing the `language' have been introduced and \babel\ can now
  easily be adapted for local needs. Finally I will discuss some
  compatibility issues.
\end{abstract}

\section{A brief history of \babel}

The first ideas of developing a set of macros to support typesetting
documents with \TeX\ in languages other than English developed around
the time of the Euro\TeX\ conference in Karls\-ruhe (\osn{1989}). Back
then I had created support for typesetting in Dutch by stealing
\file{german.tex} (by Hubert Partl c.s.) and modifying it for Dutch
conventions. This worked, but I was not completely satisfied as I hate
the duplication of code. Soon after that I found that more `copies' of
\file{german.tex} existed to support other languages. This led me to
the idea of creating a package that combined these kind of language
support packages. It would have to consist of at least two `layers':
all the code the various copies of \file{german.tex} had in common in
one place, loaded only once by \TeX, and a set of files with the code
needed to support language specific needs. During the Karlsruhe
conference the name `\babel' came up in discussions I had. It seemed
an appropriate name and I sticked to it.

\begin{table}[hbt]
  \begin{center}
    \begin{tabular}{l}
      \hline
      First ideas at Euro\protect\TeX'89 Karlsruhe\\
      First published in TUGboat 12--2\\
      Update article in TUGboat 14--1\\
      Presentation of new release at Euro\protect\TeX'95\\
      \hline
    \end{tabular}
    \caption{A brief history of \babel}
  \end{center}
\end{table}

After the conference I started to work on ``\babel, a multilingual
style-option system for use with \LaTeX' standard document styles''.
The first release with support for about half a dozen languages
appeared in the first half of \osn{1990}. In TUGboat volume \osn{12}
number \osn{2} an article appeared describing \babel.  Soon thereafter
people started contributing translations for the `standard terms' for
languages not yet present in \babel. The next big update appeared in
\osn{1992}, accompanied by an article in TUGboat volume \osn{14}
number \osn{1}. The main new features were that an interface was added
to `push' and `pop' macro definitions and values of registers. Also
some code was moved from language files to the core of \babel. In
\osn{1994} some changes were needed to get \babel\ to work with
\LaTeXe. As it turned out a lot of problems were still unsolved,
amongst which the incompatibility between \babel\ and the use of
\textsc{T}\osn{1} encoded fonts was most important.

\noindent Therefore \babel\ version \osn{3}.\osn{5} has appeared.
It's main features are:

\begin{itemize}
\item complete rewrite of the way active characters are dealt with;
\item new ways to switch the language;
\item A language switch is also written to the \file{.aux} file;
\item possibility to `configure' the language specific files;
\item extended syntax of \file{language.dat};
\item compatibility with both the \pkg{inputenc} and\\
  \pkg{fontenc} packages; 
\item new languages (breton, estonian, irish, scottish, lower and
  upper sorbian).
\end{itemize}

\noindent These changes are described in the remainder of this article.

\section{Shorthands and active characters}

During \babel's lifetime the number of languages for which one or more
characters were made active has grown. Until \babel\ release
\osn{3}.\osn{4} this needed a lot of duplication of code for each
extra active character. A situation with which I obviously was not
very happy as I hate the duplication of code. Another problematic
aspect of the way \babel\ dealt with active characters was the way
\babel\ made it possible to still use them in the arguments of cross
referencing commands. \textsf{Babel} did this with a trick that
involves the use of |\meaning|. This resulted in the fact that the
argument of |\label| was no longer expanded by \TeX.

Because of these problems I set out to find a different implementation
of active characters. A starting point was that a character that is
made active should remain active for the rest of the document; only
it's definition should change. During the development of this new
implementation it was suggested in discussions I had within the
\LaTeX3 team to devise a way to have `different kinds' of active
characters. Out of this discussion came the current `shorthands'.

\begin{quote}
  \textsl{A shorthand is a sequence of one or two characters that
    expands to arbitrary \TeX\ code.}
\end{quote}

These shorthands are implemented in such a way that there are three
levels of shorthands:

\begin{itemize}
\item user level
\item language level
\item system level
\end{itemize}

\noindent Shorthands can be used for different kinds of things:
\begin{itemize}
\item the character \verb=~= is redefined by \babel\ as a one
  character, system level shorthand;
\item In some languages shorthands such as \verb="a= are defined to be
  able to hyphenate the word;
\item In some languages shorthands such as \verb=!= are used to insert
  the right amount of white space.
\end{itemize}

When you want to use or define shorthands you should keep the
following in mind:
\begin{itemize}
\item User level takes precedence over language level;
\item Language level takes precedence over system level;
\item One character shorthands take precedence over two character
  shorthands;
\item Shorthands are written unexpanded to \file{.aux} files.
\end{itemize}

\noindent In table~\ref{tab:sh-ov} an overview is given of the
various shorthand characters that are used for different languages.

\begin{table}[ht]
  \begin{center}
    \begin{tabular}{ll}
      \hline
      \texttt{\char'176} & system, catalan, estonian, galician, spanish \\
      \texttt{:} & breton, francais, turkish \\
      \texttt{;} & breton, francais \\
      \texttt{!} & breton, francais, turkish \\
      \texttt{?} & breton, francais \\
      \texttt{"} & catalan, danish, dutch, estonian, finnish\\
                 & galician, german, polish, portuguese, slovene\\
                 & spanish, upper~sorbian\\
      \texttt{`} & catalan (optional)\\
      \texttt{'} & catalan, galician, spanish (optional)\\
      \texttt{\char'136} & esperanto\\
      \texttt{=} & turkish \\
      \hline
    \end{tabular}
    \caption{Overview of shorthands}\label{tab:sh-ov}
  \end{center}
\end{table}

Note that the acute and grave characters are only used as shorthand
characters when the options \opt{activeacute} and \opt{activegrave}
are used.

On the user level three additional commands are available to deal with
shorthands:
\begin{description}
\item[\texttt{\bs useshorthands}] This command takes one argument, the
  character that should become a shorthand character.
\item[\texttt{\bs defineshorthand}] This command takes two arguments,
  the first argument being the shorthand character sequence, the
  second argument being the code the shorthand should expand to.
\item[\texttt{\bs languageshorthands}] This last command (which takes
  one argument, the name of a language) can be used to switch to the
  shorthands of another language, \emph{not} switching other language
  facilities. Of course this only works if both languages were
  specified as an option when loading the package \babel.
\end{description}

On the level of the language definition files four new commands are
introduced to interface with the shorthand code.
\begin{description}
\item[\texttt{\bs initiate@active@char}] This command is used to tell
  \LaTeX\ that the character in its argument is going to be used as a
  shorthand character. It makes the character active, but lets it
  expand to its non-active self.
\item[\texttt{\bs bbl@activate}] This can be used to switch
  the expansion of an active character to its active code.
\item[\texttt{\bs bbl@deactivate}] This command resets the expansion
  of an active character to expand to its non-active self.
\item[\texttt{\bs declare@shorthand}] This command is the internal
  command for (and also used by) |\defineshorthand|; it has
  \emph{three} arguments: the first argument is the name of the
  language for which to define the shorthands, the other two are the
  same as for |\defineshorthand|.
\end{description}

One of the goals of the introduction of shorthands was to reduce the
amount of code needed in the language definition files to support
active characters. This goal has been reached; when a language needs
the double quote character (\texttt{"}) to be active all one has to
put into the language definition file are code fragments such as shown
in figure~\ref{fig:dq}.

\begin{figure}[ht]
  \figrule
\begin{verbatim}
\initiate@active@char{"}
\addto\extrasdutch{%
  \languageshorthands{dutch}%
  \bbl@activate{"}}
...
\declare@shorthand{dutch}{"`}{%
  \textormath{\quotedblbase{}}%
             {\mbox{\quotedblbase}}}
...
\end{verbatim}
  \figrule
  \caption{Example of defining a shorthand}\label{fig:dq}
\end{figure}

Apart from removing a lot of code from language definition files by
introducing shorthands, some other code has been moved to
\file{babel.def} as well. In some language definition files it was
necessary to provide access to glyphs that are not normally easily
available (such as the |\quotedblbase| in the example in
figure~\ref{fig:dq}. Some of these glyphs have to be `constructed' for
\textsc{ot}\osn{1} encoding while they are present in
\textsc{t}\osn{1} encoded fonts. Having all such (encoding dependent)
code together in one place has the advantage these glyphs are the same
for all the language definition files of \babel; also maintenance is
easier this way.

\section{Switching the language}

Until release \osn{3}.\osn{5} \babel\ only had \emph{one} command to
switch between languages: |\selectlanguage|. It takes the name of the
language to switch to as an argument; the command is used as a
declaration and always switches everything\footnote{that means the
  hyphenation pattern, the \texttt{\bs lefthyphenmin} and \texttt{\bs
    righthyphenmin} parameters, the translations of the words, the
  date and the specials}. Two new ways to switch to another language
have now been introduced.

\begin{description}
\item[\texttt{\bs selectlanguage}] This command was available in
  \babel\ from the start.
\item[\texttt{\bs foreignlanguage}] This new command is meant to be
  used when a short piece of text (such as a quote) comes from another
  language. This text should not be longer than \emph{one} paragraph.
  For the text the hyphenation patterns and the specials are switched.
  The command has two arguments: the name of the language and the text
  from that language.
\item[environment `otherlanguage'] This new environment switches the
  same aspects as the command |\selectlanguage| does. The difference
  is that the switches are local to the environment whereas one either
  has to use |\selectlanguage| in a group to get the same effect or
  one has to issue multiple |\selectlanguage| commands. Also the
  environment is one of the things needed to enable the development of
  language definition files that support right-to-left typesetting.
\end{description}

An aspect of some multilingual documents might be that they have
section titles or figure captions in different languages. For this to
work properly \babel\ now writes some information on the \file{.aux}
file when a language switch from either |\selectlanguage| or the
\Lenv{otherlanguage} environment occurs.  \textsf{Babel} nows about
the \file{.toc}, \file{.lof} and \file{.lot} files; if you have added
an extra table of contents you should be aware of this.
  
\section{Adapting \babel\ for local usage}

In the past people have had to find ways to adapt \babel\ to document
classes that have been developed locally (implementing house style for
instance). Some have found ways to that without changing any of the
babel files, others have modified language definition files and have
found themselves having to make these changes each time a new release
of \babel\ is made available\footnote{which doesn't happen too often
  \texttt{;-)}.}. It has been suggested to provide an easier way of
doing this. Therefore I have copied the concept of configuration files
from \LaTeXe\ and introduced language configuration files. For each
language definition file that is loaded \LaTeX\ will try to find a
configuration file. Such files have the same name as the language
definition file; except for their extension which has to be
\file{.cfg}.

\section{Loading hyphenation patterns}

An important change to the core of \babel\ is that the syntax of
\file{language.dat} has been extended. This was suggested by Bernard
Gaulle, author of the package \pkg{french}. His package supports an
enhanced version of \file{language.dat} in which one can optionally
indicate that a file with a list of hyphenation excpetions has to be
loaded. It is also possible to have more than one name for the same
hyphenation pattern register.

\begin{figure}[ht]
  \figrule
\begin{verbatim}
% File    : language.dat
% Purpose : specify which hypenation 
%           patterns to load while running
%           iniTeX 
=american
english hyphen.english exceptions.english
=USenglish
french  fr8hyph.tex
english ukhyphen.tex
=UKenglish
=british
dutch   hyphen.dutch
german  hyphen.german 
\end{verbatim}
  \figrule
  \caption{Example of \file{language.dat}}\label{fig:l.d}
\end{figure}

As you can see in the example of \file{language.dat} in
figure~\ref{fig:l.d}, an equals sign ($=$) on the beginning of a line
now has a significant meaning. It tells \LaTeX\ that the name which
follows the equals sign is to be an alternate name for the hyphenation
patterns that were loaded last. As you probably expect, there is one
exception to this rule: when the first (non-comment) line starts with
an equals sign it will be an alternate name for the \emph{next}
hyphenation patterns that will be loaded. Hence, in the example the
hyphenation patterns stored in the file \file{hyphen.english} will be
known to \TeX\ as: `american', `english' and `USenglish'. You can also
see in figuree~\ref{fig:l.d} that for `english' an extra file is
specified. It will be loaded after \file{hyphen.english} and should
contain some hyphenation exceptions.

\section{Compatibility with other formats}

This release of \babel\ has been tested with \LaTeXe; with and
without either of the packages \pkg{inputenc} or \pkg{fontenc}. There
should no longer be any problems using one (or both) of these packages
together with \babel.

\noindent This release has also been tested with \textsc{Plain}~\TeX, it should
not provide any problems when used with that format.  Therefore
\babel~version \osn{3}.\osn{5} should not pose any problems when used
with any format which is based on \textsc{Plain}~\TeX; this has
\emph{not} been tested by me though.  Some provisions are made to make
\babel~\osn{3}.\osn{5} work with \LaTeX$\:$\osn{2}.\osn{09}; but not
all features may work as expected as I haven't tested this fully.

Please note that although it was necessary to copy parts of
\pkg{inputenc} and \pkg{fontenc} this does not mean that you get
\textsc{t}\osn{1} support in \textsc{Plain}~\TeX, simply by adding
\babel. To acheive that much more work is needed.

\end{document}