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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fontifying latex.ltx


From: Harald Hanche-Olsen
Subject: Fontifying latex.ltx
Date: Mon, 17 Jan 2011 01:06:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (darwin)

Whenever I visit latex.ltx, I encounter two rather annoying problems
with the resulting fontification via font-lock-mode:

1. In the definition \def\verb{...,
   everything from there to the end of the buffer is fontified as if it
   were the argument of \verb. (Sometimes only up to the next left curly
   brace.)
2. A bit later, a macro definition includes a single dollar sign:

   \def\@argarraycr[#1]{%
     \ifnum0=`{\fi}${}\ifdim #1>\z@ \@xargarraycr{#1}\else
      \@yargarraycr{#1}\fi}

   and so the rest of the file is fontified as math (in those cases
   where #1 does not affect the rest of the file, or when I have
   cured #1 by the method below).

After a bit of experimentation I managed to cure #1 by doing this:

(defadvice tex-common-initialization (after nopropertize activate)
  (when (string= (file-name-nondirectory (buffer-file-name)) "latex.ltx")
    (setq syntax-propertize-function nil)))

To cure #2, I thought I would disable the fontification of math
altogether in latex.ltx. But neither changing the character syntax of
the dollar nor removing the pair

(font-lock-syntactic-face-function . tex-font-lock-syntactic-face-function)

from font-lock-defaults has the slightest effect.

Maybe my approach to this is wrong. Any suggestions?

Followups set to gnu.emacs.help.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell


reply via email to

[Prev in Thread] Current Thread [Next in Thread]