% $Id: deutsch.doc,v 1.4 1995/07/30 13:23:56 schrod Exp $ %---------------------------------------------------------------------- % Written by Joachim Schrod . % 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 % js: Joachim Schrod %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Local Variables: mode: plain-TeX TeX-master: t TeX-brace-indent-level: 4 End: