bibtex export issue: capital greek in title

Hi,
When using bibtex export, I noticed the following:
Greek letters in the title get converted to lower-case by the IEEE citation style. This is undesired (e.g. \Sigma-\Delta modulator becomes \sigma-\delta modulator). I fixed this by editing bibtex.js:
"\u03A3":"$\\Sigma$", // GREEK Sigma
becomes
"\u03A3":"{$\\Sigma$}", // GREEK Sigma
The curly braces protect the capital letters from being converted to lower case downstream.
I did this for the whole set of capital greek letters from line 1621 through 1630 in bibtex.js
I don't know if this is the proper proper place to fix this, but it worked for me.

Best regards,
Paul
«1
  • edited February 15, 2020
    You can prevent this by editing the title to <span class="nocase">Σ</span>. This will work for both the bibtex export and for Zotero-generated bibliographies in Word/LO (which would otherwise suffer the same problem). Zotero doesn't have math sections, so as far as Zotero is concerned, Σ is just a letter, not a math symbol.
  • To be clear, this wouldn’t be a problem in this case in Word/LO in IEEE because IEEE style doesn’t use Title Case.
  • Ah yes correct, but I was thinking of the more general case. The nocase would make sure it worked with any style, not just styles that happen to not do title casing.
  • This might be good as a checkbox option in BBT maybe, to preserve case for Greek (or maybe all non-Latin letters)?
  • edited February 15, 2020
    I might do that... but I'd prefer to have BBT export output that would render bibliographies (as far as is possible) as they would in Zotero. If Zotero/citeproc would change this behavior I would certainly follow. There's an open BBT issue for it, and it's been discussed before on the forum, but no conclusion on what Zotero/citeproc thinks would be the right course of action for Zotero.

    If I'd diverge from the Zotero behavior, I'm not sure whether I should apply it to non-latin, or non-ascii (are there cases where latin non-ascii is used as a symbol rather than a letter?). It could maybe be done without too much fallout; if a title is actually greek (or something else non-ascii/non-latin), it should have a language marked, and that would disable title-casing anyway.
  • @adamsmith Perhaps this is something that should be addressed in the CSL spec—casing changes should only apply to Latin script words?
  • that sounds right to me -- do you want to create an issue?
  • Hi,
    I tried the Σ method, but I do not get the desired results. Instead, I get:
    @phdthesis{risbo_span_1994,
    address = {Lyngby},
    type = {Ph.{D}. dissertation},
    title = {{\textless}span class="nocase"{\textgreater}$\Sigma${\textless}/span{\textgreater}-{\textless}span class="nocase"{\textgreater}$\Delta${\textless}/span{\textgreater} {Modulators}--{Stability} {Analysis} and {Optimization}},
    ......

    so now the citekey uses the word 'span' as first word in the title and the generated code for the title is equally useless.

    What am I doing wrong?

    Paul
  • Hi, I missed that the 'span' command was actually parsed in the above reply, so what I meant is that when I use the proposed method enclosing the Sigma in 'span' tags, I get gibberish.

    Best regards,
    Paul
  • I didn't know the standard bibtex export doesn't understand <span class="nocase">...</span>. Can you try to install BBT (https://retorque.re/zotero-better-bibtex/installation/) and then export using "Better BibTeX" instead of "BibTeX"?
  • Hi,
    Yes, quite obviously this works.
    However, the question was posted for standard bibtex export using bibtex.js, not better bibtex. Better bibtex has other issues.
    Is there a reason not to implement my suggestion in bibtex.js?
    Best regards,
    Paul
  • edited February 17, 2020
    I didn't know it was for standard bibtex only, the question just said bibtex export. I would guess the standard export doesn't do this and other things because it's complicated to get right. Trust me, it is.

    What other issues does BBT have?
  • I would guess the standard export doesn't do this and other things because it's complicated to get right.
    yup. There's no principled reason, just pragmatic. We'd take a PR if someone is motivated, but it'd have to be well-though out and stable.
  • Hi,
    Well, the original question suggested to edit bibtex.js. I don't think that file is used by better bibtex.
    Better bibtex seems to use a similar trick since it generates {{$\Sigma\Delta$}} in the bib file.

    The suggested better bibtex solution with span for the thesis "Σ-Δ Modulators--Stability Analysis and Optimization", changes the citekey to risbo_cite_1994 . As if the first word of the title is 'span'. The default key without the 'span' trick is: risbo_-_1994. I think this is preferable, but a zotero issue.

    Issues in better bibtex:
    Better bibtex does not replace dashes in the page range like bibtex.js does.
    Better bibtex replaces µ with $\mathrm{\mu}$ instead of \textmu. This does not produce an upright µ for me. (issue already opened)

    Best regards,
    Paul
  • Well, the original question suggested to edit bibtex.js. I don't think that file is used by better bibtex.

    Ah true, I missed that

    Better bibtex seems to use a similar trick since it generates {{$\Sigma\Delta$}} in the bib file.

    Similar in what sense?

    The suggested better bibtex solution with span for the thesis "Σ-Δ Modulators--Stability Analysis and Optimization", changes the citekey to risbo_cite_1994 . As if the first word of the title is 'span'.

    That sounds like a bug. I'd appreciate it if you could open an issue for that on BBT.

    Better bibtex does not replace dashes in the page range like bibtex.js does.

    That is correct -- BBT does replace dashes (including the space replacement you asked about elsewhere), but uses different rules. If those don't work out well for you, I'd appreciate a bug report.

    Better bibtex replaces µ with $\mathrm{\mu}$ instead of \textmu. This does not produce an upright µ for me. (issue already opened)

    Saw it, thanks; I need a bit more input, but I agree it's a bug and that can be fixed today.

  • Hi,
    With similar I meant that BBT adds curly braces around a math environment, which prevents changing of the Sigma and Delta from upper to lower case.
    This is similar to the change in bibtex.js that I suggested:
    "\u03A3":"$\\Sigma$", // GREEK Sigma
    becomes
    "\u03A3":"{$\\Sigma$}", // GREEK Sigma

    With respect to risbo_cite_1994 because 'cite' is the first word in the title: isn't that a zotero bug, instead of a BBT bug?, since i have my key generation set to [zotero:clean].

    Thanks for your replies, I will open a case on the dashes, but need to do some actual work first...
    Paul
  • The [zotero] pattern generates the citekey exactly like Zotero does, but it's still BBT generating it, so this is a BBT bug.

    BBT only generates {$...$} instead of $...$ when it thinks it is in a case-protected section. If you added <span class="nocase">...</span> around that section, that would be correct, otherwise, it's a bug. The similarity would then be the $\Sigma\Delta$; BBT generates extra braces for the nocase span, stock bibtex treats the span as text. Correct? I'm asking because that seems significantly dissimilar to me.
  • Hi,
    I just checked. The title (no`span'-stuff, just the plain greek characters ):
    Σ-Δ Modulators--Stability Analysis and Optimization
    becomes
    title = {{$\Sigma$}-{{$\Delta$ Modulators}}--{{Stability Analysis}} and {{Optimization}}},
    with better bibtex export.
    Somehow every capitalized word seems to be case protected, even without using the span stuff. Is that how it was supposed to work?

    With bibtex.js export, I get
    title = {$\Sigma$-$\Delta$ {Modulators}--{Stability} {Analysis} and {Optimization}},
    No case protection at all, right?.
    The proposed change to bibtex.js would add case protection to $\Sigma$ and $\Delta$. That would then behave similar to BBT. But that's hypothetical, the two are completely different right now.

    Best regards,
    Paul
    PS: how do I insert code in a post (the grey box)? Other forums have some kind of toolbar, but nothing like that on the zotero forum. I also didn't find a forum documentation page.
  • edited February 18, 2020
    Somehow every capitalized word seems to be case protected, even without using the span stuff. Is that how it was supposed to work?
    Yes. Zotero expects titles to be stored in sentence case, so if you capitalize words those are assumed to be words you want to be capitalized; an explanation of the process can be found here. You can right-click a title and select Sentence Case to convert the title to sentence case.
    With bibtex.js export, I get
    title = {$\Sigma$-$\Delta$ {Modulators}--{Stability} {Analysis} and {Optimization}},
    There is some case-protection there -- all capitalized words have brace protection. The math section doesn't have case-protection, but it looks like math sections don't need it.

    You can add code by using <code>...</code> tags. The forums accept most HTML tags; if you use firefox, and you're comfortable with markdown, you can install Markdown Editor for Firefox or Markdown Editor for Chrome, type your markdown there and paste the resulting HTML here; that's how I usually do it.
  • ...which is why I opened this discussion.

    >if you capitalize words those are assumed to be words you want to be capitalized
    The problem here is that most of the items in my database were auto-imported from a web browser, not typed by me. Should I conclude that the zotero import filter(s) do not follow zotero recommendations?

    Paul
  • edited February 18, 2020
    Yes. Well, either that, or the website offering it is presenting it in a way that the translator must assume it's already sentence-cased. But as far as I can tell, only PubMed XML does sentence casing, so it seems that most import translators do assume the input is sentence cased. BBT will sentence case on import (unless you turn it off), but that will only spring into action if the site in question offers bibtex, and it is also the selected import translator.

    You can turn off BBT's export title casing and brace protection. Turning it off means that what BBT exports does not mean the same as it does in Zotero, and the fact that it usually works is an accident, depending on the style chosen. But you can turn it off.
  • Ok, after a bit more reading, I think there are two problems in the bibtex.js export filter. Consider the earlier export example
    title = {$\Sigma$-$\Delta$ {Modulators}--{Stability} {Analysis} and {Optimization}},
    - Greek letters are not case protected
    - the rest of the title is case protected.
    When applying IEEEtran citation style, I get
    L. Risbo, “σ-δ Modulators–Stability Analysis and Optimization,”
    The greek letters should have been case protected, whereas the rest of the title should not have been case protected, since sentence case is IEEE citation style.

    On the other hand, zotero recommends to store titles in sentence case, so probably the filter is expecting this and thinks that any explicit casing is intended by the user and thus should be preserved.
    Is this correct?

    Is there a bulk conversion option then?
    Paul
  • On the other hand, zotero recommends to store titles in sentence case, so probably the filter is expecting this and thinks that any explicit casing is intended by the user and thus should be preserved.
    Is this correct?
    That's correct, yes.And as Emiliano says, we can't import sentence case from sites that don't offer it. That's not a bug, it's a metadata limitation.

    There's no bulk conversion, no (it's also not possible to convert error free automatically given proper nouns). There is a pseudo-sentence case option for individual items by right-clicking on their title.
  • BBT has some heuristic tests in its quality report that try to detect titles that are in Title Case in Zotero, but it's far from perfect.
  • The span showing up in the citekey has been fixed on BBT master (not yet released), as has the treatment of µ. But for dashes in the pages field -- I see you have 123 ---- 432 in the pages field, which becomes 123---- 432 when Zotero generates a bibliography from it. BBT exports it as pages = {123 ---- 432}, -- currently, if you have dashes there, I assume you want them. I do translate en-dashes and em-dashes to their LaTeX counterparts, and <spaces><number><spaces><hyphen><spaces><number><spaces> to <number><en-dash><number>.
  • Hi
    The 123 ---- 432 is obviously a test case
    Your translation to <number><en-dash><number> exactly how I like it. Thanks!
    Please send a notification when it is released.

    Paul
  • I'm still running tests to see whether it breaks existing behavior. The pages field with that content also doesn't render properly in Word/LO BTW, so the best course of action would be to clean up the items in Zotero (same goes for sentence casing, really). BBT cannot / will not clean up all possible mishaps, and at the end of the day, Zotero helps you get items in easily, but the final responsibility for quality of the data that feeds into the bibliography is the user, not Zotero.
  • Hi
    I do appreciate the work being done on better bibtex, but the original suggestion seems to be ignored. Just to repeat:
    Is it a good way to fix the capital-greek casing issue by changing
    "\u03A3":"$\\Sigma$", // GREEK Sigma
    to
    "\u03A3":"{$\\Sigma$}", // GREEK Sigma
    in Bibtex.js?

    Paul
Sign In or Register to comment.