bug-auctex
[Top][All Lists]
Advanced

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

bug#25309: 11.89.8; multi-level script fontification stacks incorrectly


From: Tassilo Horn
Subject: bug#25309: 11.89.8; multi-level script fontification stacks incorrectly
Date: Mon, 02 Jan 2017 18:47:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Uwe Brauer <address@hidden> writes:

Hi Uwe,

> I have seen his shots, these are border line cases, which are used very
> little. Look I have written mathematics with latex over the last 25
> years and in countless occasions I have used ^or   but never nested
> expressions and this is also true for the publications and writings I
> have seen in these years. I reckon that 95 % of the people writing
> mathematics never use nested ^. So I could understand your argument if
> there were 50 % non nested and 50 % nested but it is the case.

That might indicate that you are working in a field of math where there
are few exponentiated expressions which are already exponentiated.  But
I don't think that exponents have grown out of vogue in general. ;-)

> Please don't move us back to the middle age.

Come on, reverting this broken feature doesn't move us back to the
middle ages.

>    > There are examples where its completely confusing with
>    > `multi-level' and would definitely make you read something else
>    > than what has been written with `invisible'.
>
> What's about the following compromise:
>
> Remove multi-level, but leave invisible and add to the docstring
> something like
>
> Please note that invisible only works for a simple sub and
> superscripts.  Nested constructions are not supported, in fact those
> can be displayed in a confusing way.

"In fact, those will be displayed in a completely wrong way!" would be
more correct.

> If you need those constructs please do not use the invisible option.

Let's use this compromise: I have already removed the feature but you
are free to put

--8<---------------cut here---------------start------------->8---
(require 'font-latex)
(defun font-latex-match-script-chars (limit)
  (let ((p (point)))
    (and (re-search-forward "[_^]" limit t)
         (let ((pos (match-beginning 0)))
           (and (font-latex-faces-present-p 'font-latex-math-face pos)
                (not (font-latex-faces-present-p '(font-lock-constant-face
                                                   font-lock-builtin-face
                                                   font-lock-comment-face
                                                   font-latex-verbatim-face) 
pos))
                ;; Check for backslash quoting
                (not (let ((odd nil)
                           (pos pos))
                       (while (eq (char-before pos) ?\\)
                         (setq pos (1- pos) odd (not odd)))
                       odd)))))))

(add-to-list 'font-latex-keywords-2
             '(font-latex-match-script-chars
               (0 '(face font-latex-math-face invisible t)))
             t)
--8<---------------cut here---------------end--------------->8---

into your ~/.emacs, and then scripts will be hidden again.  (You don't
need to configure `font-latex-fontify-script'.  Just let it on its
default value of t for Emacs.)

Bye,
Tassilo





reply via email to

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