summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/plain/jsmisc/deutsch.doc
blob: 8285a980c3c0c5d07bf5e9f395a2878cf2ae8de8 (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
% $Id: deutsch.doc,v 1.4 1995/07/30 13:23:56 schrod Exp $
%----------------------------------------------------------------------
% Written by Joachim Schrod <schrod@iti.informatik.th-darmstadt.de>.
% This file is distributed without any copyright restriction.

%
% deutsch.doc  --  typeset German documents with plain TeX.
%
% [TeX in MAKEPROG]
% (history at end)


\input progdoc

\input names.sty
\def\babel{{\sf babel}}



\title{Typesetting German Documents with Plain \TeX{}}



\chap Introduction.

There are several defencies of plain \TeX{} if used for German
documents:

\item{---} Mappings of national characters (`umlauts' and `sharp~s')
to macros or to other character codes (if special fonts are available)
are missing.

\item{---} \TeX{} produces lots of overfull hboxes for German texts.
That's because the words there are usually longer than English ones.
Furthermore we have to use much more hyphenation for German texts than
for English ones, narrow typesetting is more important than few
hyphenations.  In particular, words with umlauts are not hyphenated
often anyhow, even with the `multiple-word' approach from |german.sty|.

\item{---} It is typographic usage that between compound words
ligatures are not built. Plain~\TeX{} has no easy, readable way to
provide this.

\noindent This file does the according definitions. They are quite
often only a kludge. But it is hard to make the restrictions
disappear, sometimes it is even impossible within the current
implementation of \TeX{}---and there will never be any other
implementation. So we must live with these kludges.


\sect Of course, there is more to German typesetting.  Hyphenation,
also for words with umlauts and sharp~s, etc.  This basic
functionality is supplied by the \babel{} system and DANTE's
|german.sty|, we have to load the appropriate module.

There's one problem, though. \babel{}~3.5 defines
|\DeclareTextSymbol|, a symbol used by |german.sty| to decide if it
shall use NFSS code to access symbols. But that usage will lead to an
endless recursion, because some text symbols are defined by
themselves. I don't know if that problem is caused by \babel{}'s code
or by its usage in |german.sty| -- turning it off seems to be an
appropriate fix.

\beginprog
\let\DeclareTextSymbol\undefined
\input german.sty
\endprog


\sect But before we start we declare some shorthands for category
codes. By declaring the at sign~(`|@|') as well as the
underscore~`(|_|)' as letters we can use them in our macros. (I
agree with D.~Knuth that |\identifier_several_words_long| is more
readable than |\IdentifierSeveralWordsLong| and in every case better
than |\p@@@s|.) With the at sign we can use the ``private'' Plain
macros and with the underscore we can make our own macros more
readable. But as we have to restore these category codes at the end
of this macro file we store their former values in control
sequences. This method is better than to use
a group because not all macros have to be defined global this way.

\beginprog
\ifx \CatEscape\undefined
    \chardef\CatEscape=0
    \chardef\CatOpen=1
    \chardef\CatClose=2
    \chardef\CatIgnore=9
    \chardef\CatLetter=11
    \chardef\CatOther=12
    \chardef\CatActive=13               % \active of plain.tex
    \chardef\CatInvalid=15

    \chardef\CatAtCode=\catcode`\@
    \chardef\CatUsCode=\catcode`\_
\fi

\catcode`\@=\CatLetter                  % top level macro file
\catcode`\_=\CatLetter
\endprog


\sect Let's identify this macro file against the user and in the Log file.

\beginprog
\begingroup
    \catcode`\$=\CatIgnore
    \catcode`\:=\CatIgnore
    \message{Support for German documents, $Revision: 1.4 $}
\endgroup
\endprog



\chap National Characters.

By default no extended characters are available, except those defined
below.  I.e., we start to treat all characters from |"7F| to |"FF| as
invalid characters.

\beginprog
\count@="7F
\loop
    \catcode \the\count@ = \CatInvalid
    \advance\count@ by 1
  \ifnum \count@ < "100
\repeat
\endprog


\sect We provide a command for the definition of non-ASCII characters:
|\ExtendChar|. A sample definition of an ``Umlaut-a''~(\"a) in the
extended code of an IBM~PC (hex code~|"84|) is:
$$
    |\ExtendChar\^^84: {^^84}{\"a}|
$$
First the hex code is given as a control sequence, followed by a
colon. Afterwards come two parameters, the first is again the hex
code, the second is the token list which should be used instead of the
hex code.

The macro definition is rather easy, we just have to make the
respective character active and bind it to it's new meaning.

\beginprog
\def\ExtendChar #1:{%
    \catcode`#1 \CatActive
    \extend_char
    }
\def\extend_char #1#2{%
    \def #1{#2}%
    }
\endprog


\sect Now we can define some replacements.

The braces after the control sequences are needed when characters from
the extended character set are written to an auxiliary file and read
in later. During the |\write| they are expanded and following white
space would be gobbled if the braces would not be there.

\beginprog
% ISO-Latin-1
\ExtendChar\^^c4: {^^c4}{\"A}
\ExtendChar\^^d6: {^^d6}{\"O}
\ExtendChar\^^dc: {^^dc}{\"U}
\ExtendChar\^^df: {^^df}{\ss{}}
\ExtendChar\^^e4: {^^e4}{\"a}
\ExtendChar\^^f6: {^^f6}{\"o}
\ExtendChar\^^fc: {^^fc}{\"u}

% IBM PC (code page 850)
\ExtendChar\^^81: {^^81}{\"u}
\ExtendChar\^^84: {^^84}{\"a}
\ExtendChar\^^8e: {^^8e}{\"A}
\ExtendChar\^^94: {^^94}{\"o}
\ExtendChar\^^99: {^^99}{\"O}
\ExtendChar\^^9a: {^^9a}{\"U}
\ExtendChar\^^e1: {^^e1}{\ss{}} % actually \beta, used as \ss in Germany

% Atari ST (like IBM PC, but with a real `sharp~s')
\ExtendChar\^^9e: {^^9e}{\ss{}}
\endprog



\chap Paragraph Breaking.

As outlined in the introduction, we allow longer interword spaces.  A
line now may have a badness up to 2500, over 1500 a warning is to be
given. Furthermore the penalties for hyphenation are lowered because a
narrow typesetting is preferred against few hyphenations.

These values are still experimental and should be tuned.

As |german.sty| uses \babel{} compatible structure, the german
language hook is a good place to store such definitions. But to
use \babel{}'s convenient macros, too, we have to assure that it's
kernel code is loaded first.

\beginprog
\ifx \babel@core@loaded\undefined
    \input babel.def
\fi
\addto\extrasgerman{%
    \babel@savevariable\tolerance
    \babel@savevariable\hbadness
    \babel@savevariable\doublehyphendemerits
    \babel@savevariable\finalhyphendemerits
    \babel@savevariable\adjdemerits
    \tolerance 2500  \hbadness 1500
    \doublehyphendemerits 50000
    \finalhyphendemerits 25000
    \adjdemerits 50000
    }
\endprog


\sect In some languages ligatures should not appear between compound
words. We use {\tt \string\|\/} to mark those places. This is only
done within text mode, in math mode {\tt \string\|\/} is still
`$\|$'. But it is sure that one can always hyphenate between compound
words, so we insert |\-|. To allow the hyphenation in other parts of
the word though, we use |\allowhyphens| again.

\beginprog
\def\|{%                % break open a ligature (if not in math mode)
    \relax
    \ifmmode  \Vert
    \else  \allowhyphens\-\allowhyphens
    \fi
    }
\endprog


\sect Don't use the dreaded `double quote special meaning' stuff of
|german.sty|. And use original umlauts. Already in M\"unster I voted
against it\dots

\beginprog
\addto\extrasgerman{%
    \mdqoff
    \umlautlow
    }
\endprog


\sect Define |\SwitchtoLanguage| for upward compatibility.  It does
not really do the same, the old definition was more similar to
|\selectlanguage|.  But other languages have to be declared
explicitely, that's not done by this macro file.  So we just want to
make old documents processable.

\beginprog
\def\SwitchtoLanguage#1{\language \csname l@#1\endcsname}
\endprog


\sect We are finished; switch to german language (to enable the new
extras defined above), restore the catcodes and prevent from following
garbage.

\beginprog
\selectlanguage{german}

\catcode`\@=\CatAtCode
\catcode`\_=\CatUsCode

\endinput
\endprog


%% \sect {\it Acknowledgements:}\quad I would like to thank XXX


\bye


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% $Log: deutsch.doc,v $
% Revision 1.4  1995/07/30  13:23:56  schrod
%     Discard babel definition of \DeclareTextCommand before including
% german.sty, they are incompatible.
%
% Revision 1.3  1995/07/29  17:58:24  schrod
%     Use german.sty, not germanb.sty. (babel 3.5 is not functional for
% plain TeX any more.) But we still want to use babel's macros, we have
% to load it's kernel for that.
%
% Revision 1.2  1995/03/13  23:18:10  schrod
%     Started to manage this package with CVS. Made minor code cleanup.
%
% Revision 1.1  1994/10/16  16:57:30  schrod
%     Merged macros from local.tex, codes.tex, and language.tex.  This
% new file is mainly there to provide upward compatibility for our old
% documents.
%
%
%
% pre-CVS Version History:
%
% DATE     WHO REMARKS
% 91-01-18 js  set all extended characters to code invalid
% 90-12-23 js  added the definition of \ExtendChar for usage in codes.tex.
% 90-10-06 js  renamed from dlocal to local, it's now international,
%              adapted to TeX 3:
%                 included codes.tex and langdef.tex if they exist,
%                 assumed that language.tex is already loaded,
%                 defined German parameters as a language hook,
%              removed first \allowhyphens in \uml@ut,
%              documented it with MAKEPROG.
% 89-10-27 js  was reworked for ILaTeX
% 89-05-31 js  defined \| as a separator for ligatures in text mode
% 87-10-01 js  introduced \protect,
%              set parameters for German page makeup
% 87-??-?? kg  first release
%
% kg: Klaus Guntermann <gunterma@<schrod@iti.informatik.th-darmstadt.de>
% js: Joachim Schrod <schrod@iti.informatik.th-darmstadt.de>



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Local Variables:
mode: plain-TeX
TeX-master: t
TeX-brace-indent-level: 4
End: