Unexpected BibTeX quote behavior

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
jsteeger
Posts: 9
Joined: Mon Apr 21, 2014 4:12 pm

Unexpected BibTeX quote behavior

Post by jsteeger »

Hey, bought this on the App Store so I am still working with 12.1.2. I am eagerly awaiting the 12.2 update, which looks brilliant. In the meantime:

When I enter a quotation mark (U+0022 " quotation mark) in the title field at either...
(1) the very beginning of a title, or...
(2) at the close of any quotation,
the quote is changed to four apostrophes (U+0027 ') in the BibTeX output, rather than two graves (U+0060 ``) as expected in case (1) or two apostrophes as expected in case (2). If the quote does not start at the very beginning of the title, it is outputted as two graves as expected. So, the faux-sample-title

Code: Select all

"Patterns of Discovery": An Inquiry into the "Conceptual Foundations" of Science
is rendered as

Code: Select all

title = {''''Patterns of Discovery'''': An Inquiry into the ``Conceptual Foundations'''' of Science},
Additionally,
(3) a single apostrophe (single quote) at the beginning of a title
is rendered as a closed curly quote (’ U+2019) rather than either a single grave or a single left curly quote (‘ U+2018) -- either is parsed appropriately in LaTeX. So, the title

Code: Select all

'Patterns of Discovery': An Inquiry into the 'Conceptual Foundations' of Science
is rendered as

Code: Select all

title = {’Patterns of Discovery’: An Inquiry into the ‘Conceptual Foundations’ of Science},
Last edited by jsteeger on Thu May 29, 2014 11:00 pm, edited 1 time in total.
Jon
Site Admin
Posts: 10292
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Unexpected BibTeX quote behavior

Post by Jon »

There seems to be a more general problem with handling of quote marks at the beginning of the field. I'll take a look and see what's up.

Jon
Sonny Software
Jon
Site Admin
Posts: 10292
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Unexpected BibTeX quote behavior

Post by Jon »

Well, one issue has nothing to do with BibTeX, and that's how, when using automatic smart quotes, Bookends decides to change a dumb quote to a smart open or smart close quote. In your case, you have two dumb quotes at the beginning of the text (one in the reference title field, one in the format, around the title field, like this: "t"). So Bookends treats the first as an open quote and the second as a close quote. I could build in additional logic that would output another open quote when the first char was an open quote, but then you couldn't indicate an "empty" quote properly, e.g. “”.

You may want to turn off smart quotes and either use dumb ones, or handle the smart quotes yourself, leaving Bookends out of the equation. To enter a smart open and close quote on a US keyboard, use

Option-[ -> “

and

Shift-Option-[ -> ”

respectively.

Jon
Sonny Software
jsteeger
Posts: 9
Joined: Mon Apr 21, 2014 4:12 pm

Re: Unexpected BibTeX quote behavior

Post by jsteeger »

Cool; turning off smart quotes in Scan & Bib in Preferences and doing smart quotes myself solves almost all of my problems. However, it turns out that problem (2) above still holds for closed smart double quotes ” (closed smart single quotes behave appropriately universally). So the title

Code: Select all

A Reply to Churchland's “Perceptual Plasticity and Theoretical Neutrality”
is still rendered as

Code: Select all

title = {A Reply to Churchland's ``Perceptual Plasticity and Theoretical Neutrality''''},
when it should be rendered as either

Code: Select all

title = {A Reply to Churchland's ``Perceptual Plasticity and Theoretical Neutrality''},
or

Code: Select all

title = {A Reply to Churchland's “Perceptual Plasticity and Theoretical Neutrality”},
Last edited by jsteeger on Thu May 29, 2014 11:00 pm, edited 1 time in total.
jsteeger
Posts: 9
Joined: Mon Apr 21, 2014 4:12 pm

Re: Unexpected BibTeX quote behavior

Post by jsteeger »

Apologies for the double post:
Is there a way to find and replace all the dumb quotes in my library? I tried to do a global change to make all apostrophes ' in the title field into ’, but I got 0 results.
Jon
Site Admin
Posts: 10292
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Unexpected BibTeX quote behavior

Post by Jon »

To your first point, I can't tell if it's correct or not, it depends on the instruction in the format. So check that. And also forget BibTeX and output as Styled Text. Once you see that's correct, switch back to BibTeX output and see if the conversion is correct.

As to the second point, it works for me. Global Change -> Find and Replace -> ' to ’

Jon
Sonny Software
jsteeger
Posts: 9
Joined: Mon Apr 21, 2014 4:12 pm

Re: Unexpected BibTeX quote behavior

Post by jsteeger »

Issue 1:
The error is not with the format but somewhere in the BibTeX parser; my current format for the BibTeX title is the default -- that is,

Code: Select all

title = $`{`t`}`, $
Outputting to BibTeX format as Plain Text / Styled Text works totally fine, as expected -- that is, in either case, I obtain

Code: Select all

title = {A Reply to Churchland's “Perceptual Plasticity and Theoretical Neutrality”},
I would just switch to this, but then I would have to manually insert/change italicizations, among other things. A parse option that changes any occurrence of ” to '' (instead of '''') would fix this I think.

Issue 2 (Sorted):
Derp. I did not have "entire library" selected.
Jon
Site Admin
Posts: 10292
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Unexpected BibTeX quote behavior

Post by Jon »

The problem with the extra apostrophes when outputting BibTeX is fixed for the next update.

Jon
Sonny Software
jsteeger
Posts: 9
Joined: Mon Apr 21, 2014 4:12 pm

Re: Unexpected BibTeX quote behavior

Post by jsteeger »

Thanks Jon!
Post Reply