Subject: Re: bug#57712: 29.0.50; bibtex.el: Should `bibtex-parse-entry' handle curly braces inside fields?

From: Ihor Radchenko <[email-masked]>
Date: Wed, 14 Sep 2022 10:07:13 +0800

Roland Winkler <[email-masked]> writes:

>> will return
>>
>> '("Introduction " (mathmode "$3^5$") " to Markȯv Chain " (braces
>> "{MOnte}") "Carlo" (latex "\LaTeX"))
>>
>> that is
>> 1. Escaped symbols are replaced by their unicode
>> 2. Braces are indicated by (braces "string")
>> 3. LaTeX math is indicated by (mathmode "math string")
>> 4. LaTeX commands are indicated by (latex "command")
>> 5. @strings are replaced appropriately
>
> I believe this is much beyond BibTeX mode and yet more beyond
> bibtex-parse-entry.  It is mostly about parsing LaTeX while BibTeX plays
> only a marginal role (adding support for @string's will be cheap once you
> get the rest of this parser working).  Then, you also need to deal with
> the question: what do you want to do with a return value you illustrated
> above?  From what I vaguely understood, your real goal is to convert
> this into something human-readable.

> This is a fairly substantial project.  I am not sure whether it would be
> worth the effort.  And I would not want to bury such a pretty complex
> machinery in a new optional arg of a function that is intended to do
> something very different.

I am looking at this differently. Similar to BibTeX fields, text in the
fields is a subject of a specific format. That format is _not_ exactly
the same with TeX (e.g. see
https://tex.stackexchange.com/questions/26338/how-to-code-%C3%9F-german-sharp-s-in-bibtex)

I expect bibtex.el to handle all the peculiarities of BibTeX format, so
that external packages do not need to perform extra parsing.

If you dislike modifying bibtex-parse-entry, bibtex-parse-field-text
looks like a reasonable place to handle field text parsing.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92