help-gnu-emacs
[Top][All Lists]

## Re: Plain TeX mode

 From: Emil Hedevang Lohse Subject: Re: Plain TeX mode Date: Thu, 04 Dec 2003 07:57:58 +0100 User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/20.7 (gnu/linux)

>> Having successfully gotten an answer I will try to ask another
>> question: I write a lot in danish where we have the letters æ, ø,
>> å, Æ, Ø, Å (in Plain TeX: \ae, \o, \aa, etc.). I do
>> known how to make TeX understand them directly, but I would also
>> like Emacs to properly colour my macro names. Currently "\red" is
>> coloured light blue; but with "\rød" the backslash and "r" are
>> colored light blue but the "ø" and "d" are not. Is there some way
>> I can tell Emacs to include these letters into its colour coding
>> mechanism?
>
> Change the font-lock-keywords patterns.
> It's not very convenient, tho.

Can I get a hint on how to do that?

> But I'm wondering: does TeX understand such a macro name (i.e. does
> it consider Ã¸ to be a letter that can be used inside a macro name)
> ?  If it does, then your problem is not just a preference but a bug
> which I should fix.

Not out of the box. Every character of category code 11 (for example
the letters a-z and A-Z) can be used as a part of a macro name. Other
characters are of category code 12 unless they are not, that is,
unless they have been given another category code. If I recall
correctly (by looking on page 37 of the TeXbook) Plain TeX has the
following assignments of category codes:

\               0
{               1
}               2
\$               3
&               4
<return>        5
#               6
^               7
_               8
<null>          9
<space>        10
a-z and A-Z    11    <--- Usable in a macro name.
other          12
~              13
%              14
<delete>       15

So the characters æøåÆØÅäéöüÄÉÖÜ and so on are of category code 12 and
therefore cannot be a part of a macro name. But by saying

\catcode`æ=11

I change the category code of æ and henceforth I am able to use æ in a
macro name. This is convenient if I would like to give the macros
Danish names and if I do not care about portability.

Regards,

--
Emil Hedevang Lohse <http://home.imf.au.dk/emil/>

Alle spørgsmål er lige dumme.
Og spørgsmålet "Kan ænder flyve?" er ikke dumt.