all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Plain TeX mode
@ 2003-12-02 20:07 Emil Hedevang Lohse
  2003-12-03  2:05 ` Tim Heaney
  2003-12-03  2:32 ` Sean Richards
  0 siblings, 2 replies; 8+ messages in thread
From: Emil Hedevang Lohse @ 2003-12-02 20:07 UTC (permalink / raw)


Hello,

When I write Plain TeX in Emacs I use the Plain TeX mode, but it has a
bad habit of showing text that follows \sl and \bf in italic and bold
letters respectively. How do I turn it off? (I don't mind the
colouring of the text, though.)

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Plain TeX mode
  2003-12-02 20:07 Plain TeX mode Emil Hedevang Lohse
@ 2003-12-03  2:05 ` Tim Heaney
  2003-12-03  3:13   ` Emil Hedevang Lohse
  2003-12-03  2:32 ` Sean Richards
  1 sibling, 1 reply; 8+ messages in thread
From: Tim Heaney @ 2003-12-03  2:05 UTC (permalink / raw)


Emil Hedevang Lohse <emil@imf.au.dk> writes:
>
> When I write Plain TeX in Emacs I use the Plain TeX mode, but it has a
> bad habit of showing text that follows \sl and \bf in italic and bold
> letters respectively. How do I turn it off? (I don't mind the
> colouring of the text, though.)

You can change the Italic and Bold faces with 

  Options -> Customize Emacs -> Specific Face...

Click on Show to see the properties you can adjust. Deselect weight
for bold and deselect slant for Italic. If you like, you can adjust
the colors by changing the values for the different Font Lock faces
this way as well.

I hope this helps,

Tim

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Plain TeX mode
  2003-12-02 20:07 Plain TeX mode Emil Hedevang Lohse
  2003-12-03  2:05 ` Tim Heaney
@ 2003-12-03  2:32 ` Sean Richards
  1 sibling, 0 replies; 8+ messages in thread
From: Sean Richards @ 2003-12-03  2:32 UTC (permalink / raw)


Emil Hedevang Lohse <emil@imf.au.dk> writes:

> Hello,
>
> When I write Plain TeX in Emacs I use the Plain TeX mode, but it has a
> bad habit of showing text that follows \sl and \bf in italic and bold
> letters respectively. How do I turn it off? (I don't mind the
> colouring of the text, though.)

Here is a brutal solution ;) You will never see another bold
font displayed in Emacs if you use it (which may not be what you
want). I don't like to see bold fonts anywhere so I find it useful.
Original author unknown usual conditions apply.


(defun unbold-all-faces ()
  "Clear the `bold' flag from all faces."
  (interactive)
  (dolist (f (face-list))
    (if (face-bold-p f) (set-face-bold-p f nil))))

Sean

-- 
"Hver sin smak", sa vintapperen, han drakk mens de andre sloss.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Plain TeX mode
  2003-12-03  2:05 ` Tim Heaney
@ 2003-12-03  3:13   ` Emil Hedevang Lohse
  2003-12-03 16:14     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Emil Hedevang Lohse @ 2003-12-03  3:13 UTC (permalink / raw)


Tim Heaney <theaney@cablespeed.com> writes:

> Emil Hedevang Lohse <emil@imf.au.dk> writes:
>>
>> When I write Plain TeX in Emacs I use the Plain TeX mode, but it
>> has a bad habit of showing text that follows \sl and \bf in italic
>> and bold letters respectively. How do I turn it off? (I don't mind
>> the colouring of the text, though.)
>
> You can change the Italic and Bold faces with 
>
>   Options -> Customize Emacs -> Specific Face...
>
> Click on Show to see the properties you can adjust. Deselect weight
> for bold and deselect slant for Italic. If you like, you can adjust
> the colors by changing the values for the different Font Lock faces
> this way as well.

Thank you, it helped a lot!

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?

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Plain TeX mode
  2003-12-03  3:13   ` Emil Hedevang Lohse
@ 2003-12-03 16:14     ` Stefan Monnier
  2003-12-04  6:57       ` Emil Hedevang Lohse
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2003-12-03 16:14 UTC (permalink / raw)


> 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.

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.


        Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Plain TeX mode
  2003-12-03 16:14     ` Stefan Monnier
@ 2003-12-04  6:57       ` Emil Hedevang Lohse
  2003-12-04 19:05         ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Emil Hedevang Lohse @ 2003-12-04  6:57 UTC (permalink / raw)


Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Plain TeX mode
  2003-12-04  6:57       ` Emil Hedevang Lohse
@ 2003-12-04 19:05         ` Stefan Monnier
  2003-12-04 23:43           ` Emil Hedevang Lohse
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2003-12-04 19:05 UTC (permalink / raw)


>> Change the font-lock-keywords patterns.
>> It's not very convenient, tho.
> Can I get a hint on how to do that?

In latex-mode, do C-h v font-lock-keywords RET to find the current value.
Then in your .emacs do

   (add-hook 'latex-mode-hook 'my-latex-mode-hook)
   (defun my-latex-mode-hook ()
     ;; (font-lock-mode 1)
     (setq font-lock-keywords <the-changed-value>))

I commented out the call to font-lock-mode because I'm not sure whether
it's harmful or necessary.
Now as to how to come up with a new value, you'll have to look through
the regexps and replace the ones that say "\\\\[a-z]" or some such to
also include the chars whose catcode you've set to 11.

> 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

Oh, I see, so it's not part of what the `inputenc' package does.


        Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Plain TeX mode
  2003-12-04 19:05         ` Stefan Monnier
@ 2003-12-04 23:43           ` Emil Hedevang Lohse
  0 siblings, 0 replies; 8+ messages in thread
From: Emil Hedevang Lohse @ 2003-12-04 23:43 UTC (permalink / raw)


Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> Change the font-lock-keywords patterns.  It's not very convenient,
>>> tho.
>> Can I get a hint on how to do that?
>
> In latex-mode, do C-h v font-lock-keywords RET to find the current value.
> Then in your .emacs do
>
>    (add-hook 'latex-mode-hook 'my-latex-mode-hook)
>    (defun my-latex-mode-hook ()
>      ;; (font-lock-mode 1)
>      (setq font-lock-keywords <the-changed-value>))

I thank you for the reply. The keyword "font-lock-keywords" helped me
find the right pages in the help system, and so after a few tries I
came up with the following code which seems to do the job.

(add-hook 'tex-mode-hook 'my-tex-mode-hook)
(defun my-tex-mode-hook ()
  (font-lock-add-keywords nil
			  '(("\\\\[a-zA-Z@æøåÆØÅ]+" . font-lock-keyword-face))
			  ))

> Oh, I see, so it's not part of what the `inputenc' package does.

I cannot remember, quite some time has passed since I last used LaTeX.

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-12-04 23:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-02 20:07 Plain TeX mode Emil Hedevang Lohse
2003-12-03  2:05 ` Tim Heaney
2003-12-03  3:13   ` Emil Hedevang Lohse
2003-12-03 16:14     ` Stefan Monnier
2003-12-04  6:57       ` Emil Hedevang Lohse
2003-12-04 19:05         ` Stefan Monnier
2003-12-04 23:43           ` Emil Hedevang Lohse
2003-12-03  2:32 ` Sean Richards

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.