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.

Full log


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

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

Previous Next


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