unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Angelo Graziosi <angelo.graziosi@alice.it>
Cc: John Wiegley <jwiegley@gmail.com>, 23102@debbugs.gnu.org
Subject: bug#23102: Wrong usage of underscore in .tex files
Date: Mon, 28 Mar 2016 11:46:18 +0200	[thread overview]
Message-ID: <87vb47c4ut.fsf@gnu.org> (raw)
In-Reply-To: <56F83A3D.5050404@alice.it> (Angelo Graziosi's message of "Sun, 27 Mar 2016 21:53:33 +0200")

[-- 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

  reply	other threads:[~2016-03-28  9:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vb47c4ut.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=23102@debbugs.gnu.org \
    --cc=angelo.graziosi@alice.it \
    --cc=jwiegley@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).