Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Title capitalization and bibtex exports

Help
2008-11-06
2013-05-28
  • Hi all,

    Sorry to bother again. I am trying to integrate refbase within my latex writting workflow. There are still a few bells and whistles I'd like to have before I can get rid of my old bibtex file and have it generated on-demand by refbase.

    The current issue I am facing is title capitalization. Below is a description of what happens in bibtex. Citing from http://www.racai.ro/online/bibtex-html/bibtx-24.html:

    The bibliography style determines whether or not a title is capitalized; the titles of books usually are, the title of articles usually are not. You type a title the way it should appear if it is capitalized (you should capitalize everything but articles and unstressed conjunctions and prepositions, and even these should be capitalized as the first word or the first after a colon):

    TITLE = "The Agony and the Ecstasy"

    BibTeX will change uppercase letters to lowercase if appropriate. Uppercase letters that should not be changed are enclosed in braces. The following two titles are equivalent; the "A" of "Africa" will not be made lowercase.

    "The Gnats and Gnus of {Africa}" "The Gnats and Gnus of {A}frica"

    So my question is: Is there a way to make refbase output "The Gnats and Gnus of {A}frica" in bibtex but output "The Gnats and Gnus of Africa" in html?

    I have heard about the markup syntax (http://wiki.refbase.net/index.php/Refbase_markup_syntax) but I don't see any markup for capitalization.

    Am I missing something?

    Regards,
    Tom

     
    • Hi Tom, your feedback is welcome!

      > I am trying to integrate refbase within my latex writting
      > workflow. There are still a few bells and whistles I'd like to
      > have before I can get rid of my old bibtex file and have it
      > generated on-demand by refbase.

      Btw, some days ago, I've started a wiki page about how to use refbase with BibTeX and LaTeX. You may interested in this section:

      http://wiki.refbase.net/index.php/BibTeX/LaTeX_integration#Keeping_a_local_BibTeX_file_in_sync_with_a_refbase_online_database

      > Is there a way to make refbase output "The Gnats and Gnus of
      > {A}frica" in bibtex but output "The Gnats and Gnus of Africa" in
      > html?

      Not currently but it probably wouldn't be too difficult to implement. The 'transtab_refbase_*.inc.php' files in the 'includes' directory contain format-specific search & replace patterns which could be used to generate appropriate output for the different formats.

      > I have heard about the markup syntax but I don't see any markup
      > for capitalization.

      ATM, there isn't any markup syntax for capitalization. Also I'm not sure whether this would be the right approach. And the curly brackets in BibTeX titles don't really say "capitalize!" but "don't mess with the existing capitalization!", which, obviously are two different things.

      What if you'd enter the capitalization in refbase exactly as desired (for output to HTML etc), and then have a search & replace pattern that adds the curly brackets for BibTeX output on-the-fly.

      Function 'standardizeBibtexOutput()' (defined in 'includes/export.inc.php') could be used for this. The only tricky bit might be to restrict the search/replace action to the title field. Do you how BibTeX handles curly brackets (like in "{A}frica") in non-title fields?

      Matthias

       
      • Hi Matthias,

        Thanks for the super fast answer!

        > Btw, some days ago, I've started a wiki page about how to use refbase with BibTeX
        > and LaTeX. You may interested in this section:
        >
        http://wiki.refbase.net/index.php/BibTeX/LaTeX_integration#Keeping_a_local_BibT
        > eX_file_in_sync_with_a_refbase_online_database

        Thanks for the pointer, it looks interesting.

        >> Is there a way to make refbase output "The Gnats and Gnus of
        >> {A}frica" in bibtex but output "The Gnats and Gnus of Africa" in
        >> html?
        >
        > Not currently but it probably wouldn't be too difficult to implement. The
        > 'transtab_refbase_*.inc.php' files in the 'includes' directory contain
        > format-specific search & replace patterns which could be used to generate appropriate
        > output for the different formats.
        >
        >> I have heard about the markup syntax but I don't see any markup
        >> for capitalization.
        >
        > ATM, there isn't any markup syntax for capitalization. Also I'm not sure whether
        > this would be the right approach. And the curly brackets in BibTeX titles don't
        > really say "capitalize!" but "don't mess with the existing capitalization!",
        > which, obviously are two different things.

        Indeed.

        Thanks to your suggestion, I actually found a convenient solution. In my refbase database, no curly braces seem to be used. I can therefore use them as I would in bibtex, ie enter "The Gnats and Gnus of {A}frica" in the title field and have the curly braces removed when converting to html.

        Adding
                "/\\{(.+?)\\}/"        =>  "\\1",
        to transtab_refbase_html.inc.php (and other transtab_refbase_*.inc.php exluding  transtab_refbase_bibtex.inc.php)  seems to do the trick.

        But then, searching for "Africa" in the "Quick Search" would return "The Gnats and Gnus of Africa" anymore. Nevertheless using "The Gnats and Gnus of {Africa}" seems OK.

        Is there any potential issue I am missing with this approach?

        Now I am starting to worry about keeping up with refbase updates. As I am patching my refbase installation more and more, it will get harder to merge.

        > What if you'd enter the capitalization in refbase exactly as desired (for output
        > to HTML etc), and then have a search & replace pattern that adds the curly brackets
        > for BibTeX output on-the-fly.

        That would be a solution, but fixing the few entries that require specific capitalization is easier than checking all entries (existing and new).

        > Function 'standardizeBibtexOutput()' (defined in 'includes/export.inc.php')
        > could be used for this. The only tricky bit might be to restrict the search/replace
        > action to the title field. Do you how BibTeX handles curly brackets (like in
        > "{A}frica") in non-title fields?

        Nope, never tried that.

        Tom

         
    • Hi Tom,

      > In my refbase database, no curly braces seem to be used. I can
      > therefore use them as I would in bibtex, ie enter "The Gnats and
      > Gnus of {A}frica" in the title field and have the curly braces
      > removed when converting to html.

      > Is there any potential issue I am missing with this approach?

      Not that I'm aware of -- except for the potential issues with searching (which you've already mentioned).

      I think your modification should be fine, but ideally, the approach that I outlined in my previous post would be more desirable.

      Btw, I'm also using refbase with BibTeX, but I'm in the lucky position of being able to choose the BibTeX style to my liking -- so I simply made a style that disables this whole case transformation thing.

      > Now I am starting to worry about keeping up with refbase updates.
      > As I am patching my refbase installation more and more, it will
      > get harder to merge.

      I understand your concerns. Ideally, important changes (that are potentially useful for everyone) would be merged into the core code so you don't need to worry about patching after each update.

      In the absence of that, make sure that you have diffs for all of your patches, or at least keep notes about your local changes.

      Matthias