Friday, June 04, 2010

bibtex style question

I have a BibTeX style hacking question, and am hoping the community at large can help me out.

Here's the problem: I have a set of names of authors. I wish to make two bibtex style files, such that
  • In style file 1 (S1) any paper including someone in this set of authors will be rendered normally
  • In style file 2 (S2) any paper including someone in this set of authors will be rendered with the author name underlined. 
My current hack was to do the following. I created two versions of a 'names.bib' file. In both files, the names are stored as @strings, and in the second version, the strings are encoded as underlined i.e using \underline{name}.

In my master bib file, the names are entered merely as the string value, so if I stored a name as
@string{me = "Suresh Venkat"}  or @string{me = "\underline{Suresh Venkat}"}
I merely enter the author name as
author = {..other names... # me # .. other names}
While this works, the problem is that bibtex doesn't know (obviously) that the string 'me' needs to be formatted as a name, and so I get ugliness like
"Author, A., Author, B., Suresh Venkat and Author, C. " 
in the final bbl instead of
"Author, A., Author, B., Venkat, S. and Author, C. "
 Now I didn't expect my solution to work, but I don't know what will. Any ideas ?

5 comments:

  1. Unfortunately, I don't think there's any way to get bibtex to do what you want.

    The thing you have to remember is that bibtex can't parse (la)tex commands at all. It uses its own ridiculously primitive parser, which is nowhere near sophisticated enough to untangle the string "\underline{Suresh Venkat}". Thanks to the braces, bibtex interprets this string as a single word; everything between the braces should be output verbatim into the .bbl file, exactly like "{van Emde Boas}" or "{Colin de Verdi\`{e}re}".

    I see only two solutions. One: Manually format the abbreviations to reflect the style you want: @string{me = "\underline{S. Venkat}"}. Two: post-process the .bbl file, either by hand or by script.

    ReplyDelete
  2. You can write your own bibtex style to change how it parses names. Oren Palahniuk once helped me write a CV style that would omit my name and put "with..." for co-authors. Search for his "Designing bibtex styles".

    ReplyDelete
  3. Jack, the problem is that the style file would need to be able to look up some kind of table to realize that for specific names it had to do something different. I don't know if bst files can do that

    ReplyDelete
  4. I have a script to add links to authors webpages that is post processing the bibtex output. It seems it could be easily modified to do what you want. If you are interested I can dig it and figure out how I did it (I did not touch it in the last 2-5 years since it just works). --S

    ReplyDelete
  5. That script sounds like it's just what I need ! Do send it over - thanks !

    ReplyDelete

Disqus for The Geomblog