GNU bug report logs - #28277
tex-mode font-lock of \it escapes math mode

Previous Next

Package: emacs;

Reported by: richard.banach <at> manchester.ac.uk (Richard Banach)

Date: Tue, 29 Aug 2017 15:13:02 UTC

Severity: minor

Tags: fixed, patch

Found in version 25.2

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28277 in the body.
You can then email your comments to 28277 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28277; Package emacs. (Tue, 29 Aug 2017 15:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to richard.banach <at> manchester.ac.uk (Richard Banach):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 29 Aug 2017 15:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: richard.banach <at> manchester.ac.uk (Richard Banach)
To: bug-gnu-emacs <at> gnu.org, richard.banach <at> manchester.ac.uk
Subject: emacs -nw bug?
Date: Tue, 29 Aug 2017 13:46:23 +0100
hi,

I use   emacs -nw  and see what looks like a bug

* in tex mode, if I type   $\it identifiername$   it doesn't recognise
the second $ as closing the scope of \it ... and wants to underline
everything that follows ... i haven't found how to turn this off

regards,

richard.




Changed bug title to 'tex-mode font-lock of \it escapes math mode' from 'emacs -nw bug?' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 29 Aug 2017 15:50:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28277; Package emacs. (Tue, 29 Aug 2017 15:57:01 GMT) Full text and rfc822 format available.

Message #10 received at 28277 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: richard.banach <at> manchester.ac.uk (Richard Banach)
Cc: 28277 <at> debbugs.gnu.org
Subject: Re: bug#28277: emacs -nw bug?
Date: Tue, 29 Aug 2017 11:56:05 -0400
Richard Banach wrote:

> I use   emacs -nw  and see what looks like a bug
>
> * in tex mode, if I type   $\it identifiername$   it doesn't recognise
> the second $ as closing the scope of \it ... and wants to underline
> everything that follows ... i haven't found how to turn this off

Thanks for the report. This is not specific to emacs -nw.
Relevant forms that tex-mode does understand are:

$foo$
\textit{foo}
{\it foo}

I'm not sure what you are trying to achieve with an \it inside math mode?
I don't think I've seen that form used before.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28277; Package emacs. (Tue, 29 Aug 2017 16:39:02 GMT) Full text and rfc822 format available.

Message #13 received at 28277 <at> debbugs.gnu.org (full text, mbox):

From: richard.banach <at> manchester.ac.uk (Richard Banach)
To: richard.banach <at> manchester.ac.uk, rgm <at> gnu.org
Cc: 28277 <at> debbugs.gnu.org
Subject: Re: bug#28277: emacs -nw bug?
Date: Tue, 29 Aug 2017 17:36:10 +0100
Glenn Morris <rgm <at> gnu.org> wrote:

| Richard Banach wrote:
|
| > I use   emacs -nw  and see what looks like a bug
| >
| > * in tex mode, if I type   $\it identifiername$   it doesn't recognise
| > the second $ as closing the scope of \it ... and wants to underline
| > everything that follows ... i haven't found how to turn this off
|
| Thanks for the report. This is not specific to emacs -nw.
| Relevant forms that tex-mode does understand are:
|
| $foo$
| \textit{foo}
| {\it foo}
|
| I'm not sure what you are trying to achieve with an \it inside math mode?
| I don't think I've seen that form used before.


hi,

here's the explanation .....

ideally, you could use

  \usepackage{oz}

which gives exactly the result i'd like inside any  $_math_scope_$

unfortunately, publishers (springer, elsevier,etc) as a rule don't
recognise oz and remove it, without compensating ... result ugly

you can do it the hard way ....

  $\mathit{identifiername}$

or slightly less good

  $\textit{identifiername}$

or (same)

  ${\it identifiername}$

or (lazy way)

  $\it identifiername$

the last three of which give basically the same results, but
the last of which requires the least typing (if, like me, you're
a bit annoyed at not being able to have \usepackage{oz})

cheers,

richard.

ps. in ordinary emacs (i.e. not -nw) it doesn't try to underline
\it stuff, so the problem doesn't arise visually (in my installation)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28277; Package emacs. (Tue, 29 Aug 2017 16:54:02 GMT) Full text and rfc822 format available.

Message #16 received at 28277 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: richard.banach <at> manchester.ac.uk (Richard Banach)
Cc: 28277 <at> debbugs.gnu.org
Subject: Re: bug#28277: emacs -nw bug?
Date: Tue, 29 Aug 2017 12:53:22 -0400
Richard Banach wrote:

> or (lazy way)
>
>   $\it identifiername$

If you want to be lazy :), it seems that AUCTeX (available from
elpa.gnu.org) handles that form. Otherwise I'd use one of the
non-deprecated formats.




bug Marked as found in versions 25.2. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 29 Aug 2017 16:55:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28277; Package emacs. (Wed, 30 Aug 2017 09:46:01 GMT) Full text and rfc822 format available.

Message #21 received at 28277 <at> debbugs.gnu.org (full text, mbox):

From: richard.banach <at> manchester.ac.uk (Richard Banach)
To: richard.banach <at> manchester.ac.uk, rgm <at> gnu.org
Cc: 28277 <at> debbugs.gnu.org
Subject: Re: bug#28277: emacs -nw bug?
Date: Wed, 30 Aug 2017 10:45:30 +0100
Glenn Morris <rgm <at> gnu.org> wrote:

| Richard Banach wrote:
|
| > or (lazy way)
| >
| >   $\it identifiername$
|
| If you want to be lazy :), it seems that AUCTeX (available from
| elpa.gnu.org) handles that form. Otherwise I'd use one of the
| non-deprecated formats.

it seems a little overzealous that the editor is more politically correct
than the implementation .... :-)

but anyway, is there an easy way of simply turning off all underlining?
... i mean ... who needs it anyway ..... ?????

cheers,

richard.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28277; Package emacs. (Wed, 30 Aug 2017 16:50:01 GMT) Full text and rfc822 format available.

Message #24 received at 28277 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: richard.banach <at> manchester.ac.uk (Richard Banach)
Cc: 28277 <at> debbugs.gnu.org
Subject: Re: bug#28277: emacs -nw bug?
Date: Wed, 30 Aug 2017 12:48:53 -0400
Richard Banach wrote:

> it seems a little overzealous that the editor is more politically correct
> than the implementation .... :-)

It's only accidentally stricter through laziness/oversight.
Maybe someone will fix it, but it doesn't seem very important.

> but anyway, is there an easy way of simply turning off all underlining?
> ... i mean ... who needs it anyway ..... ?????

I guess you can M-x customize-face italic.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28277; Package emacs. (Wed, 30 Oct 2019 16:44:01 GMT) Full text and rfc822 format available.

Message #27 received at 28277 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: richard.banach <at> manchester.ac.uk (Richard Banach)
Cc: 28277 <at> debbugs.gnu.org
Subject: Re: emacs -nw bug?
Date: Wed, 30 Oct 2019 17:43:33 +0100
richard.banach <at> manchester.ac.uk (Richard Banach) writes:

> I use   emacs -nw  and see what looks like a bug
>
> * in tex mode, if I type   $\it identifiername$   it doesn't recognise
> the second $ as closing the scope of \it ... and wants to underline
> everything that follows ... i haven't found how to turn this off

The following patch fixes the problem -- but I'm not sure whether it
could cause any regressions.

Is

\it foobar $math-stuff$

or something like it possible?  It's been a while since I wrote any TeX.


diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index f277defecf..9d9490602a 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -593,7 +593,7 @@ tex-font-lock-keywords-2
 	    ;; Miscellany.
 	    (slash "\\\\")
 	    (opt " *\\(\\[[^]]*\\] *\\)*")
-	    (args "\\(\\(?:[^{}&\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")
+	    (args "\\(\\(?:[^${}&\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")
 	    (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)"))
        (list
 	;;


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 30 Oct 2019 21:34:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28277; Package emacs. (Mon, 04 Nov 2019 14:54:01 GMT) Full text and rfc822 format available.

Message #32 received at 28277 <at> debbugs.gnu.org (full text, mbox):

From: richard.banach <at> manchester.ac.uk (Richard Banach)
To: richard.banach <at> manchester.ac.uk, larsi <at> gnus.org
Cc: 28277 <at> debbugs.gnu.org
Subject: Re: emacs -nw bug?
Date: Mon, 04 Nov 2019 14:53:39 +0000
hi,

thanks for the suggestion .......

ages ago, someone suggested

===============================================

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(custom-enabled-themes nil))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(italic ((t (:underline nil))))
 '(underline ((t (:underline t)))))

===============================================

... and it seems to work fine :-)

richard.

===============================================
===============================================

Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

| richard.banach <at> manchester.ac.uk (Richard Banach) writes:
|
| > I use   emacs -nw  and see what looks like a bug
| >
| > * in tex mode, if I type   $\it identifiername$   it doesn't recognise
| > the second $ as closing the scope of \it ... and wants to underline
| > everything that follows ... i haven't found how to turn this off
|
| The following patch fixes the problem -- but I'm not sure whether it
| could cause any regressions.
|
| Is
|
| \it foobar $math-stuff$
|
| or something like it possible?  It's been a while since I wrote any TeX.
|
|
| diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
| index f277defecf..9d9490602a 100644
| --- a/lisp/textmodes/tex-mode.el
| +++ b/lisp/textmodes/tex-mode.el
| @@ -593,7 +593,7 @@ tex-font-lock-keywords-2
|  	    ;; Miscellany.
|  	    (slash "\\\\")
|  	    (opt " *\\(\\[[^]]*\\] *\\)*")
| -	    (args "\\(\\(?:[^{}&\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")
| +	    (args "\\(\\(?:[^${}&\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")
|  	    (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)"))
|         (list
|  	;;
|
|
| -- 
| (domestic pets only, the antidote for overdose, milk.)
|    bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28277; Package emacs. (Mon, 10 Aug 2020 14:29:02 GMT) Full text and rfc822 format available.

Message #35 received at 28277 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: richard.banach <at> manchester.ac.uk (Richard Banach)
Cc: 28277 <at> debbugs.gnu.org
Subject: Re: bug#28277: emacs -nw bug?
Date: Mon, 10 Aug 2020 16:28:26 +0200
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> -	    (args "\\(\\(?:[^{}&\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")
> +	    (args "\\(\\(?:[^${}&\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")

I've now applied this patch.  It changes this:

[Message part 2 (image/png, inline)]
[Message part 3 (text/plain, inline)]
into this:

[Message part 4 (image/png, inline)]
[Message part 5 (text/plain, inline)]
(Note final $.)

There's no regressions in the test cases, but we don't have great
coverage here, either...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 10 Aug 2020 14:29:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 28277 <at> debbugs.gnu.org and richard.banach <at> manchester.ac.uk (Richard Banach) Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 10 Aug 2020 14:29:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 08 Sep 2020 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 229 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.