[Top][All Lists]

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

Re: port x-symbol to GNU emacs 24.

From: Tassilo Horn
Subject: Re: port x-symbol to GNU emacs 24.
Date: Wed, 19 Aug 2015 09:33:29 +0200
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> I just started to define a `prettify-symbols-alist--TeX' by checking
>> what Quail provides.
> Hmm... the name sounds suspect.  It should have "tex" in the prefix,
> not in the suffix.

No problem, I can change that.  I guess it should then go into

>> However, there is a problem in that (la)tex-mode and their AUCTeX
>> counterparts don't give \ symbol syntax.  Therefore, an entry like
>> ("\\alpha" . ?α) will never match.  And omitting the backslash isn't
>> possible because then we'd have many false positives for entries like
>> ("in" . ?∈).
> prettify-symbols-alist does currently handle non-symbol chars.
> Whether it handles this specific case, I'm not completely sure (tho
> I'm pretty sure it'll mishandle "\alpha2", in any case).  But we
> should make prettify-symbols-alist handle the needs of TeX, so feel
> free to suggest extensions to prettify-symbols-alist if that's needed.

Well, it's actually not as simple as I've thought before.  It does in
fact handle some non-symbol things but it depends on the syntax before
and after the matched thing.

With `prettify-symbols-alist' set to just (("\\alpha" . ?α) ("\\beta"
. ?β)), that's what I get when using AUCTeX (yes means that the greek
letter is displayed, no means the literal tex macro is displayed):

\alpha                %% yes
\[\alpha\]            %% yes
$\alpha$              %% no
$ \alpha$             %% no
$ \alpha $            %% no
\(\alpha\)            %% no
\( \alpha\)           %% yes
\( \alpha \)          %% yes
\(\alpha\cdot\beta\)  %% alpha: no, beta: yes
\( \alpha\cdot\beta\) %% alpha: yes, beta: yes

With Emacs' built-in (la)tex-mode, all occurrences are displayed with
the greek letters, so it seems to be more or less an AUCTeX problem.

The only syntax differences I could find between the standard
(la)tex-mode and AUCTeX's modes is that in the former, ?\\ has charquote
syntax whereas it has escape syntax in the latter.  And $ has "math
syntax, matches $" in the former and only math syntax in the latter.
However, even after

  (modify-syntax-entry ?\\ "/")
  (modify-syntax-entry ?$ "$$")

in the AUCTeX buffer and disabling and re-enabling
`prettify-symbols-mode', the results stay the same as above...


reply via email to

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