unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Roland Winkler <winkler@gnu.org>
To: Arash Esbati <arash@gnu.org>
Cc: Ihor Radchenko <yantar92@posteo.net>, 69266@debbugs.gnu.org
Subject: bug#69266: 30.0.50; bibtex-parse-entry misreads escaped \}
Date: Fri, 23 Feb 2024 09:25:52 -0600	[thread overview]
Message-ID: <87a5nr9p8f.fsf@gnu.org> (raw)
In-Reply-To: <m28r3bl6y0.fsf@macmutant.fritz.box> (Arash Esbati's message of "Fri, 23 Feb 2024 13:07:51 +0100")

Ihor Radchenko <yantar92@posteo.net> writes:
> According to https://www.bibtex.org/SpecialSymbols/, characters that
> conflict with Bibtex format description can be \-escaped.

I believe the above webpage is incorrect.  If I put something like \}
into a BibTeX field, BibTeX complains about unbalanced braces.
This is with BibTeX, Version 0.99d (TeX Live 2022/Debian).
The parsing algoritm used by BibTeX is very simple.  Generally,
BibTeX fields should contain valid LaTeX code.  So something
like
     title = "$\}$tex",

should work with BibTeX, but it gives the same error message
"unbalanced braces".

Emacs bibtex mode follows the capabilities of BibTeX itself.  I believe
it would not make sense to try to be smarter than that if, in the end,
this is not compatible anymore with BibTeX itself.

I guess one could submit here a bug report / feature request for BibTeX.
But BibTeX has been around for many decades with this limited feature set.

Nowadays, there is also biblatex.  It's intended as a successor for
BibTeX.  But it is something I know little to nothing about because in
my world (physics), everyone I know still uses BibTeX.  Essentially,
biblatex entries still use the same format as BibTeX entries.  I do not
know whether biblatex would deal with something like the above in a
smarter way.  

These BibTeX fields should contain valid LaTeX code.  But from (La)TeX's
perspective, in the string "$\}$" the backslash is not an escape
character for what follows, but \} is a macro that's defined inside TeX
math mode.  Also, the meaning of the statement "valid LaTeX code" can be
heavily redefined within (La)TeX.  Take a look at texinfo files that TeX
can digest.  So a smart BibTeX parser would require (La)TeX itself working
in the background.

In practical terms (for many years) I have never experienced this to be
a constraint when working with BibTeX.  So changing / improving this may
have a low priority among BibTeX / biblatex maintainers.





  reply	other threads:[~2024-02-23 15:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19  9:14 bug#69266: 30.0.50; bibtex-parse-entry misreads escaped \} Ihor Radchenko
2024-02-23 12:07 ` Arash Esbati
2024-02-23 15:25   ` Roland Winkler [this message]
2024-02-24 12:19     ` Ihor Radchenko
2024-02-24 16:05       ` Roland Winkler
2024-02-25 17:50         ` Arash Esbati
2024-02-26  0:50           ` Roland Winkler
2024-02-26 14:42             ` Arash Esbati
2024-02-26 17:08             ` Ihor Radchenko
2024-02-26 18:56               ` Roland Winkler

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=87a5nr9p8f.fsf@gnu.org \
    --to=winkler@gnu.org \
    --cc=69266@debbugs.gnu.org \
    --cc=arash@gnu.org \
    --cc=yantar92@posteo.net \
    /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).