GNU bug report logs - #23102
Wrong usage of underscore in .tex files

Previous Next

Package: emacs;

Reported by: Angelo Graziosi <angelo.graziosi <at> alice.it>

Date: Wed, 23 Mar 2016 23:32:01 UTC

Severity: minor

Fixed in version 29.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 23102 in the body.
You can then email your comments to 23102 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#23102; Package emacs. (Wed, 23 Mar 2016 23:32:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Angelo Graziosi <angelo.graziosi <at> alice.it>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 23 Mar 2016 23:32:01 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: bug-gnu-emacs <at> gnu.org
Subject: Wrong usage of underscore in .tex files
Date: Thu, 24 Mar 2016 00:30:48 +0100
[Message part 1 (text/plain, inline)]
Attached is how Emacs displays the usage of underscore out of 
mathematics and friends, for example:

\href{http://www.foo.it/bla_bla.html}{BLA_BLA}

here the underscore is not used to display a subscript as in $A_n$ so 
the result, in my opinion, is wrong. At first sight, it is also almost 
unreadable...

 Angelo
[emacs_wrong.png (image/png, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23102; Package emacs. (Sun, 27 Mar 2016 00:42:02 GMT) Full text and rfc822 format available.

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

From: John Wiegley <jwiegley <at> gmail.com>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: 23102 <at> debbugs.gnu.org
Subject: Re: bug#23102: Wrong usage of underscore in .tex files
Date: Sat, 26 Mar 2016 17:40:48 -0700
>>>>> Angelo Graziosi <angelo.graziosi <at> alice.it> writes:

> Attached is how Emacs displays the usage of underscore out of mathematics
> and friends, for example:

> \href{http://www.foo.it/bla_bla.html}{BLA_BLA}

I'm pretty sure that the underscore in BLA_BLA here is incorrect LaTeX.
Shouldn't it be BLA\_BLA, which does display correct in latex-mode?

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23102; Package emacs. (Sun, 27 Mar 2016 19:54:02 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: John Wiegley <jwiegley <at> gmail.com>
Cc: 23102 <at> debbugs.gnu.org
Subject: Re: bug#23102: Wrong usage of underscore in .tex files
Date: Sun, 27 Mar 2016 21:53:33 +0200
[Message part 1 (text/plain, inline)]

Il 27/03/2016 01:40, John Wiegley ha scritto:
>>>>>> Angelo Graziosi <angelo.graziosi <at> alice.it> writes:
>
>> Attached is how Emacs displays the usage of underscore out of mathematics
>> and friends, for example:
>
>> \href{http://www.foo.it/bla_bla.html}{BLA_BLA}
>
> I'm pretty sure that the underscore in BLA_BLA here is incorrect LaTeX.
> Shouldn't it be BLA\_BLA, which does display correct in latex-mode?
>

Yes, it works but it is only a workaround in my opinion: treating an url 
string as in mathematics seems wrong to me.

I found no example suggesting to use \_ in \href{}{} or \url{} commands.

I tried with Atom Editor and its language-latex package, and the above 
example (BLA_BLA...) is displayed as expected from me. See attachment.

Anyway, if you think it is OK to use \_, you can close this bug report.

 Angelo
[atom_latex.png (image/png, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23102; Package emacs. (Mon, 28 Mar 2016 09:47:02 GMT) Full text and rfc822 format available.

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

From: Tassilo Horn <tsdh <at> gnu.org>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: John Wiegley <jwiegley <at> gmail.com>, 23102 <at> debbugs.gnu.org
Subject: Re: bug#23102: Wrong usage of underscore in .tex files
Date: Mon, 28 Mar 2016 11:46:18 +0200
[Message part 1 (text/plain, inline)]
Angelo Graziosi <angelo.graziosi <at> alice.it> writes:

Hi Angelo and John,

>>> Attached is how Emacs displays the usage of underscore out of
>>> mathematics and friends, for example:
>>
>>> \href{http://www.foo.it/bla_bla.html}{BLA_BLA}
>>
>> I'm pretty sure that the underscore in BLA_BLA here is incorrect LaTeX.
>> Shouldn't it be BLA\_BLA, which does display correct in latex-mode?

Well, the plain underscore in BLA_BLA is indeed wrong but the plain
underscore in the URL *is* correct though escaping it with \ is also
permitted.

> Yes, it works but it is only a workaround in my opinion: treating an
> url string as in mathematics seems wrong to me.
>
> I found no example suggesting to use \_ in \href{}{} or \url{} commands.

Right, you don't need to use \_ in \url{} or \href's 1st argument.
Interestingly, stock `latex-mode' displays the argument of \url{} as
verbatim without subscripting the character after the _.  It should do
the same with the first argument of \href.

> I tried with Atom Editor and its language-latex package, and the above example
> (BLA_BLA...) is displayed as expected from me. See attachment.

GNU AUCTeX does the same: _ has only subscript semantics in math mode.
[Screenshot from 2016-03-28 11-35-18.png (image/png, attachment)]
[Message part 3 (text/plain, inline)]
Bye,
Tassilo

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23102; Package emacs. (Tue, 29 Mar 2016 06:53:01 GMT) Full text and rfc822 format available.

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

From: John Wiegley <jwiegley <at> gmail.com>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: 23102 <at> debbugs.gnu.org
Subject: Re: bug#23102: Wrong usage of underscore in .tex files
Date: Mon, 28 Mar 2016 23:52:16 -0700
>>>>> Angelo Graziosi <angelo.graziosi <at> alice.it> writes:

> I found no example suggesting to use \_ in \href{}{} or \url{} commands.

I guess those commands are special, which means latex-mode aught to treat them
as special as well, so I'll leave this open.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23102; Package emacs. (Tue, 29 Mar 2016 08:43:01 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: John Wiegley <jwiegley <at> gmail.com>
Cc: 23102 <at> debbugs.gnu.org
Subject: Re: bug#23102: Wrong usage of underscore in .tex files
Date: Tue, 29 Mar 2016 10:42:04 +0200
[Message part 1 (text/plain, inline)]
Il 29/03/2016 08:52, John Wiegley ha scritto:
>>>>>> Angelo Graziosi <angelo.graziosi <at> alice.it> writes:
>
>> I found no example suggesting to use \_ in \href{}{} or \url{} commands.
>
> I guess those commands are special, which means latex-mode aught to treat them
> as special as well, so I'll leave this open.
>

Maybe there are other commands with this issue. For example:

\ProvidesFile{bla_bla.tex}[2016/03/23 v.0.0 BLA_BLA]

Now, see as Emacs displays it in the attachment..


 Angelo
[another_example.png (image/png, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23102; Package emacs. (Tue, 29 Mar 2016 08:46:01 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.graziosi <at> alice.it>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: John Wiegley <jwiegley <at> gmail.com>, 23102 <at> debbugs.gnu.org
Subject: Re: bug#23102: Wrong usage of underscore in .tex files
Date: Tue, 29 Mar 2016 10:44:47 +0200
(resend because failed)

Ciao Tassilo, thanks for clarification..

Il 28/03/2016 11:46, Tassilo Horn ha scritto:
>
> GNU AUCTeX does the same: _ has only subscript semantics in math mode.

Emacs should conform to what AUCTeX does.. I think.

 Angelo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23102; Package emacs. (Mon, 24 Jan 2022 11:41:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Angelo Graziosi <angelo.graziosi <at> alice.it>
Cc: 23102 <at> debbugs.gnu.org
Subject: Re: bug#23102: Wrong usage of underscore in .tex files
Date: Mon, 24 Jan 2022 12:39:50 +0100
Angelo Graziosi <angelo.graziosi <at> alice.it> writes:

> Attached is how Emacs displays the usage of underscore out of
> mathematics and friends, for example:
>
> \href{http://www.foo.it/bla_bla.html}{BLA_BLA}
>
> here the underscore is not used to display a subscript as in $A_n$ so
> the result, in my opinion, is wrong. At first sight, it is also almost
> unreadable...

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I've now fixed this in Emacs 29, but it's a kind of gross hack.
tex-mode doesn't seem to have that much infrastructure for handling
stuff like this, but I may be missing something.

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




bug marked as fixed in version 29.1, send any further explanations to 23102 <at> debbugs.gnu.org and Angelo Graziosi <angelo.graziosi <at> alice.it> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 24 Jan 2022 11:41: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. (Mon, 21 Feb 2022 12:24:05 GMT) Full text and rfc822 format available.

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

Previous Next


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