Re: Citations: strip braces {} in titles in bibliographies in basic style?

2024-05-06 Thread William Denton
On Saturday, May 4th, 2024 at 15:19, Ihor Radchenko  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





Re: Citations: strip braces {} in titles in bibliographies in basic style?

2024-05-04 Thread Ihor Radchenko
Ihor Radchenko  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 .
Support Org development at ,
or support my work at 



Re: Citations: strip braces {} in titles in bibliographies in basic style?

2023-12-13 Thread William Denton

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)

Re: Citations: strip braces {} in titles in bibliographies in basic style?

2023-12-13 Thread Ihor Radchenko
William Denton  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 .
Support Org development at ,
or support my work at 



Citations: strip braces {} in titles in bibliographies in basic style?

2023-12-12 Thread William Denton
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)