unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23102: Wrong usage of underscore in .tex files
@ 2016-03-23 23:30 Angelo Graziosi
  2016-03-27  0:40 ` John Wiegley
  2022-01-24 11:39 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 8+ messages in thread
From: Angelo Graziosi @ 2016-03-23 23:30 UTC (permalink / raw)
  To: 23102

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

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

[-- Attachment #2: emacs_wrong.png --]
[-- Type: image/png, Size: 5130 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#23102: Wrong usage of underscore in .tex files
  2016-03-23 23:30 bug#23102: Wrong usage of underscore in .tex files Angelo Graziosi
@ 2016-03-27  0:40 ` John Wiegley
  2016-03-27 19:53   ` Angelo Graziosi
  2022-01-24 11:39 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 8+ messages in thread
From: John Wiegley @ 2016-03-27  0:40 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: 23102

>>>>> Angelo Graziosi <angelo.graziosi@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#23102: Wrong usage of underscore in .tex files
  2016-03-27  0:40 ` John Wiegley
@ 2016-03-27 19:53   ` Angelo Graziosi
  2016-03-28  9:46     ` Tassilo Horn
  2016-03-29  6:52     ` John Wiegley
  0 siblings, 2 replies; 8+ messages in thread
From: Angelo Graziosi @ 2016-03-27 19:53 UTC (permalink / raw)
  To: John Wiegley; +Cc: 23102

[-- Attachment #1: Type: text/plain, Size: 834 bytes --]



Il 27/03/2016 01:40, John Wiegley ha scritto:
>>>>>> Angelo Graziosi <angelo.graziosi@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

[-- Attachment #2: atom_latex.png --]
[-- Type: image/png, Size: 6875 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#23102: Wrong usage of underscore in .tex files
  2016-03-27 19:53   ` Angelo Graziosi
@ 2016-03-28  9:46     ` Tassilo Horn
  2016-03-29  8:44       ` Angelo Graziosi
  2016-03-29  6:52     ` John Wiegley
  1 sibling, 1 reply; 8+ messages in thread
From: Tassilo Horn @ 2016-03-28  9:46 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: John Wiegley, 23102

[-- Attachment #1: Type: text/plain, Size: 1202 bytes --]

Angelo Graziosi <angelo.graziosi@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.

[-- Attachment #2: math, \url, and \href in GNU AUCTeX --]
[-- Type: image/png, Size: 6284 bytes --]

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


Bye,
Tassilo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#23102: Wrong usage of underscore in .tex files
  2016-03-27 19:53   ` Angelo Graziosi
  2016-03-28  9:46     ` Tassilo Horn
@ 2016-03-29  6:52     ` John Wiegley
  2016-03-29  8:42       ` Angelo Graziosi
  1 sibling, 1 reply; 8+ messages in thread
From: John Wiegley @ 2016-03-29  6:52 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: 23102

>>>>> Angelo Graziosi <angelo.graziosi@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#23102: Wrong usage of underscore in .tex files
  2016-03-29  6:52     ` John Wiegley
@ 2016-03-29  8:42       ` Angelo Graziosi
  0 siblings, 0 replies; 8+ messages in thread
From: Angelo Graziosi @ 2016-03-29  8:42 UTC (permalink / raw)
  To: John Wiegley; +Cc: 23102

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]


Il 29/03/2016 08:52, John Wiegley ha scritto:
>>>>>> Angelo Graziosi <angelo.graziosi@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

[-- Attachment #2: another_example.png --]
[-- Type: image/png, Size: 2466 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#23102: Wrong usage of underscore in .tex files
  2016-03-28  9:46     ` Tassilo Horn
@ 2016-03-29  8:44       ` Angelo Graziosi
  0 siblings, 0 replies; 8+ messages in thread
From: Angelo Graziosi @ 2016-03-29  8:44 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: John Wiegley, 23102

(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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#23102: Wrong usage of underscore in .tex files
  2016-03-23 23:30 bug#23102: Wrong usage of underscore in .tex files Angelo Graziosi
  2016-03-27  0:40 ` John Wiegley
@ 2022-01-24 11:39 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-24 11:39 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: 23102

Angelo Graziosi <angelo.graziosi@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-01-24 11:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-23 23:30 bug#23102: Wrong usage of underscore in .tex files Angelo Graziosi
2016-03-27  0:40 ` John Wiegley
2016-03-27 19:53   ` Angelo Graziosi
2016-03-28  9:46     ` Tassilo Horn
2016-03-29  8:44       ` Angelo Graziosi
2016-03-29  6:52     ` John Wiegley
2016-03-29  8:42       ` Angelo Graziosi
2022-01-24 11:39 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).