emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Citations: strip braces {} in titles in bibliographies in basic style?
@ 2023-12-13  1:42 William Denton
  2023-12-13 10:49 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: William Denton @ 2023-12-13  1:42 UTC (permalink / raw)
  To: emacs-orgmode

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

Let's say we have a file Basic.bib, like so, with one or two pairs of braces 
around words that need special case preservation:

@book{friends,
   title = {{LaTeX} and Friends},
   author = {van Dongen, M.R.C.},
   date = {2012},
   location = {Berlin},
   publisher = {Springer},
   doi = {10.1007/978-3-642-23816-1},
   isbn = {9783642238161}
}

@book{lispandc,
   title = {Lisp and {C}},
   author = {Example, Example},
   publisher = {Example},
   date = {2023}
}

Either one or two braces works and could well be used.  The Zotero extension 
Better Bibtex has a FAQ explaining why it uses two by default: "because the 
Bib(La)TeX case protection rules are incredibly convoluted."¹

We also have an Org file (where "/n" means no citation but the work 
stills goes in the bibliography; note that the basic citation style is set):

# ---------
#+bibliography: Basic.bib
#+cite_export: basic

[cite/n:@friends] [cite/n:@lispandc]

#+print_bibliography:
# ----------

Exporting to text (C-c C-e t A) gives this:

# ----------
Example, Example (2023). /Lisp and {C}/, Example.

van Dongen, M.R.C. (2012). /{{LaTeX}} and Friends/, Springer.
# ----------

The braces are there.  The're also visible in the HTML and ODT exports.  In 
LaTeX, in this example, they're exported but ultimately invisible because of how 
LaTeX handles "\textit{Lisp and {C}}".

Should they be stripped?  I suggest they should.

The basic style is very basic and doesn't do anything fancy in 
bibliographies---just some italics on titles, which it's showing in the text 
export with slashes, and does nicely in the others---but I wonder if it should 
remove the braces.  They are used to preserve case in titles, but the basic 
exporter doesn't change case.  Passing the braces through means people will have 
to edit them out in every basic export.


Bill

¹ https://retorque.re/zotero-better-bibtex/support/faq/#why-the-double-braces

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada
CO₂: 421.66 ppm (Mauna Loa Observatory, 2023-12-11)

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

* Re: Citations: strip braces {} in titles in bibliographies in basic style?
  2023-12-13  1:42 Citations: strip braces {} in titles in bibliographies in basic style? William Denton
@ 2023-12-13 10:49 ` Ihor Radchenko
  2023-12-13 17:12   ` William Denton
  2024-05-04 19:19   ` Ihor Radchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Ihor Radchenko @ 2023-12-13 10:49 UTC (permalink / raw)
  To: William Denton; +Cc: emacs-orgmode

William Denton <wtd@pobox.com> writes:

> Let's say we have a file Basic.bib, like so, with one or two pairs of braces 
> around words that need special case preservation:
>
> @book{friends,
>    title = {{LaTeX} and Friends},
> ...
> Either one or two braces works and could well be used.  The Zotero extension 
> Better Bibtex has a FAQ explaining why it uses two by default: "because the 
> Bib(La)TeX case protection rules are incredibly convoluted."¹
> ...
> van Dongen, M.R.C. (2012). /{{LaTeX}} and Friends/, Springer.
>
> The braces are there.  The're also visible in the HTML and ODT exports.  In 
> LaTeX, in this example, they're exported but ultimately invisible because of how 
> LaTeX handles "\textit{Lisp and {C}}".
>
> Should they be stripped?  I suggest they should.

This is a more difficult problem actually, because Bibtex allows more
than just curly braces - see https://www.bibtex.org/SpecialSymbols/ and
https://www.bibtex.org/Format/.

I tried to ask for bibtex.el to handle the accurate parsing in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57712, but it looks like
it is not of interest upstream. So, we may have to implement a Bibtex
entry parser according to the spec.

Patches welcome!

-- 
Ihor Radchenko // yantar92,
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>


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

* Re: Citations: strip braces {} in titles in bibliographies in basic style?
  2023-12-13 10:49 ` Ihor Radchenko
@ 2023-12-13 17:12   ` William Denton
  2024-05-04 19:19   ` Ihor Radchenko
  1 sibling, 0 replies; 5+ messages in thread
From: William Denton @ 2023-12-13 17:12 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

On 13 December 2023, Ihor Radchenko wrote:

> This is a more difficult problem actually, because Bibtex allows more
> than just curly braces - see https://www.bibtex.org/SpecialSymbols/ and
> https://www.bibtex.org/Format/.
>
> I tried to ask for bibtex.el to handle the accurate parsing in
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57712, but it looks like
> it is not of interest upstream. So, we may have to implement a Bibtex
> entry parser according to the spec.

Wow, I didn't see any of that when I was looking at this.  I should have guessed 
there was more under the surface---there always is with LaTeX.  Thanks for the 
history.

"If this doesn't fit your needs for org mode, I suggest you develop a LaTeX 
parser that can process LaTeX code according to your needs."  Ah well.

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada
CO₂: 421.99 ppm (Mauna Loa Observatory, 2023-12-12)

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

* Re: Citations: strip braces {} in titles in bibliographies in basic style?
  2023-12-13 10:49 ` Ihor Radchenko
  2023-12-13 17:12   ` William Denton
@ 2024-05-04 19:19   ` Ihor Radchenko
  2024-05-06 17:02     ` William Denton
  1 sibling, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2024-05-04 19:19 UTC (permalink / raw)
  To: William Denton; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

>> Should they be stripped?  I suggest they should.
> ...
> This is a more difficult problem actually, because Bibtex allows more
> than just curly braces - see https://www.bibtex.org/SpecialSymbols/ and
> https://www.bibtex.org/Format/.
>
> I tried to ask for bibtex.el to handle the accurate parsing in
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57712, but it looks like
> it is not of interest upstream. So, we may have to implement a Bibtex
> entry parser according to the spec.
>
> Patches welcome!

Fixed, on main.
There is no formal Bibtex format reference, so approximate parsing has to do.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d2df9624c

-- 
Ihor Radchenko // yantar92,
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>


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

* Re: Citations: strip braces {} in titles in bibliographies in basic style?
  2024-05-04 19:19   ` Ihor Radchenko
@ 2024-05-06 17:02     ` William Denton
  0 siblings, 0 replies; 5+ messages in thread
From: William Denton @ 2024-05-06 17:02 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

On Saturday, May 4th, 2024 at 15:19, Ihor Radchenko <yantar92@posteo.net> wrote:

> > I tried to ask for bibtex.el to handle the accurate parsing in
> > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57712, but it looks like
> > it is not of interest upstream. So, we may have to implement a Bibtex
> > entry parser according to the spec.
> 
> Fixed, on main.
> There is no formal Bibtex format reference, so approximate parsing has to do.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d2df9624c

Thanks for coming back to this months later and making it better.

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada




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

end of thread, other threads:[~2024-05-06 17:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-13  1:42 Citations: strip braces {} in titles in bibliographies in basic style? William Denton
2023-12-13 10:49 ` Ihor Radchenko
2023-12-13 17:12   ` William Denton
2024-05-04 19:19   ` Ihor Radchenko
2024-05-06 17:02     ` William Denton

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).