emacs-pretest-bug
[Top][All Lists]
Advanced

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

[tex-mode.el] Subscript in math not fully matched


From: Ralf Angeli
Subject: [tex-mode.el] Subscript in math not fully matched
Date: Sun, 16 Apr 2006 19:50:19 +0200

An AUCTeX user reported that the last brace in the following
expression is not being displayed as subscript by font-lock:

$x_{\sqrt{\sqrt{2}}}$

AUCTeX uses the same regular expression as tex-mode.el for matching
these things, so this bug is present in Emacs as well.

I am intending to fix this in AUCTeX by finding the end of the
expression in braces by means of a function instead of a regexp, like
this:

(defun font-latex-match-script (limit)
  "Match subscript and superscript patterns up to LIMIT."
  (when (and font-latex-fontify-script
             (re-search-forward
              "[_^] *\\([^\n\\{}]\\|\\\\\\(address@hidden|[^ \t\n]\\)\\|{\\)"
              limit t))
    (when (string= (match-string 1) "{")
      (let ((beg1 (match-beginning 1))
            (end (TeX-find-closing-brace)))
        (if end
            (store-match-data (list (match-beginning 0) end beg1 end))
          (store-match-data (list beg1 beg1 beg1 beg1)))))
    t))

I guess I could come up with a similar fix for tex-mode.el if somebody
is interested.


In GNU Emacs 22.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.8.16)
 of 2006-04-12 on neutrino
X server distributor `The X.Org Foundation', version 11.0.60802000
configured using `configure '--with-gtk''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US
  locale-coding-system: iso-8859-1
  default-enable-multibyte-characters: t

Major mode: LaTeX

Minor modes in effect:
  tooltip-mode: t
  auto-compression-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  line-number-mode: t

Recent input:
M-x r e p o r <tab> <return>

Recent messages:
(emacs -Q /data/tmp/scratch/math-test.tex)
For information about the GNU Project and its goals, type C-h C-p.
Loading latexenc...done
Loading tex-mode...
Loading regexp-opt...done
Loading tex-mode...done
Loading emacsbug...done





reply via email to

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