[comp.text.tex] 8 bit in TeX3.0, how to do it with

massa@uni-paderborn.de (Michael Janich) (11/19/90)

Hi TeX-freaks,

We have an 8 bit emacs and we want to run TeX3.0 to use German specific
codes. I tried the following, but it don't runs. Can anybody help me?

%%------cut-here-----------------------------------------------
%% LAST EDIT: Tue Nov 13 16:46:19 1990 by Michael Janich (massa) 
\def'228{\"a}
\def'246{\"o}
\def'252{\"u}
\def'223{{\ss}}
\def'196{\"A}
\def'214{\"O}
\def'202{\"U}
\catcode228\active
\catcode246\active
\catcode252\active
\catcode223\active
\catcode196\active
\catcode214\active
\catcode202\active

Mit freundlichen Gr|_en % here in is 8 bit code you can't see
\bye
%%------cut-here-----------------------------------------------

It wont run. I tried it with the catcode block first, no success. I tried
to use the 'normal' letters of emacs8, no success. I get spaces instead
of the codes.


-- 


   Michael Janich, Uni Paderborn, United Germany
-- 


   Michael Janich, Uni Paderborn, United Germany

kris@rimfaxe.diku.dk (Kristoffer H. Holm) (11/19/90)

massa@uni-paderborn.de (Michael Janich) writes:
>Hi TeX-freaks,

>We have an 8 bit emacs and we want to run TeX3.0 to use German specific
>codes. I tried the following, but it don't runs. Can anybody help me?

>%%------cut-here-----------------------------------------------
>%% LAST EDIT: Tue Nov 13 16:46:19 1990 by Michael Janich (massa) 
>\def'228{\"a}
>\def'246{\"o}
>\def'252{\"u}
>\def'223{{\ss}}
>\def'196{\"A}
>\def'214{\"O}
>\def'202{\"U}
>\catcode228\active
>\catcode246\active
>\catcode252\active
>\catcode223\active
>\catcode196\active
>\catcode214\active
>\catcode202\active

It does not work because

1) The character ' introduces an OCTAL constant to TeX.  So
you should give the constants in octal.

2) You need to tell that these constants should be
interpreted as characters.

Here is what I use to get various "accented" characters; the
undersores (_) denote the actual 8-bit characters given as
octal to the right:

\catcode`\_=\active \def_{\`a}	% \340
\catcode`\_=\active \def_{\c C}	% \277
\catcode`\_=\active \def_{\c c}	% \347
\catcode`\_=\active \def_{\'e}	% \351
\catcode`\_=\active \def_{\"\i}	% \357

Regards,
Kristoffer H{\o}gsbro Holm                            <kris@diku.dk>
Computer Science Dept. (TOPPS group), University of Copenhagen
Work: Universitetsparken 1, DK-2100 Copenhagen {\O}     +45 31396466
Home: c/o Hornstrup, Reventlowsgade 30 5th, DK-1651 V   +45 31233331

eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (11/20/90)

massa@uni-paderborn.de (Michael Janich) writes:


>\def'228{\"a}

This is 228 octal.

>\catcode228\active

This is 228 decimal.

Victor.

leif@control.lth.se (Leif Andersson) (11/20/90)

Provided you run the web2c-version of TeX-3.0, the reason you can't
make it work is that US programmers simply don't understand the
concept of eight bit clean programs. (It's true, too many of them don't). The
following patch to tex-3.0/web2c/tex/extra.c will fix the problem.

*** O.extra.c	Mon Sep 17 12:53:36 1990
--- extra.c	Mon Sep 17 12:56:23 1990
***************
*** 390,400 ****
      if (f == stdin) clearerr(stdin);
  #endif
      while ( last < bufsize && ((i = getc(f)) != EOF) && i != '\n') {
! #ifdef	NONASCII
! 	buffer[last++] = i;
! #else
! 	buffer[last++] = (i > 127 || i < 0)?' ':i;
! #endif
      }
      if (i == EOF && last == first)
  	return(false);
--- 390,396 ----
      if (f == stdin) clearerr(stdin);
  #endif
      while ( last < bufsize && ((i = getc(f)) != EOF) && i != '\n') {
!       buffer[last++] = i;
      }
      if (i == EOF && last == first)
  	return(false);

--------------------------------------------------------------------

It could of course be argued that a patch is not needed, there is an
#ifdef NONASCII, but in my opinion this is wrong, because NONASCII
refers to things like EBCDIC. The README file of the whole package
mentions 8-bit ASCII, which is a bit of a contradiction, but it
supports my view, so we'll let it pass :-)

-------------------------------------------------------------------------------
 Leif Andersson				Internet: leif@Control.LTH.Se
 Dept. of Automatic Control             Bitnet:   BODELA@SELDC51
 Lund Institute of Technology           Phone:    +46 46 109742
 P.O. Box 118                           Fax:      +46 46 138118
 S-221 00 Lund, Sweden
-------------------------------------------------------------------------------

raichle@azu.informatik.uni-stuttgart.de (Bernd Raichle) (11/20/90)

> \def'228{\"a}

\def requires a `command sequence' or an `active char' as first
argument, otherwise ==> error  "! Missing control sequence inserted."
(Victor: It's not an octal number, it's a simple quote, then 3 digits,
etc. and TeX doesn't expect a number after the \def token)

Try something like this:
    \catcode228\active \def^^e4{\"a}  % hex e4 = dez 228

The "^^e4" is read as one character, which is active at this place.


> I tried to use the 'normal' letters of emacs8, no success. I get
> spaces instead of the codes.

Get a newer version of web2c (or change the "(c > 127 || i < 0)" in
the function zinputln(), file extra.c to "(c > 255 || i < 0)").


	bernd raichle