[Tex/LaTex] Underline different authors in the bibliography by hacking BST file

bibliographiesbibtexmoderncv

I am updating my CV (moderncv) and I am including a list of all my communications (oral and poster) using multibib (I use different .bib files for each one).

The final output should display my name in bold and the presenting author underlined.

So far I have figured out how to do the first bit but have not find solution for the last part.
Because the presenting author is not always the same person I was thinking in using the "comment field" to tell BibTeX/LaTex who I want to underline in that specific entry.

Because I do not have enough skills to do that I wonder if anyone can give me a help.

EDITED

I am using a .bst file.

Best Answer

By following a previous example I was able to fulfill my question when using the plain.bst file.

First, I've added a comment field in .bib file as a easier way to referrence which was the speaker/presenting author and declared this new field in plain.bst file:

ENTRY{  
...  
...  
chapter  
comment  
...  
}

Second, I've created a new function (speaker.author) to set the name in the same format as this style uses in format.names:

FUNCTION {speaker.author}  
{
  comment empty$  
    { "" }  
    { comment nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ }  
    if$  
}

Third, a new function (highlight) is created to highlight a text, in our case a name. In this case I opt to underline the text/name but you can set whatever text style you want.

FUNCTION {highlight}  
{ duplicate$ empty$  
      { pop$ "" }  
      { "\underline{" swap$ * "}" * }  
   if$  
}

Fourth, a new function (highlight.if.speaker.author) is created to run highlight if the author on the stack (see next) is the same as speaker.author.

FUNCTION {highlight.if.speaker.author}  
{ duplicate$ purify$ speaker.author purify$ =  
    { highlight }  
    'skip$  
  if$  
}

Last, insert a call to highlight.if.speaker.author to FUNCTION{format.names} right after the format.names$.

FUNCTION{format.names}  
{...  
format.names$ highlight.if.speaker.author  
...  
}

NOTE: step 2-4 should be placed before FUNCTION{format.names}. The only flaw in this method (which arises from the fact that plain.bst style does not abbreviate names) is that you have to make sure that the way you type the author name in author field is the same as in comment because "Doe, John" and "Doe, J" will be seen as different names, although "Doe, J", "Doe, J." or "J Doe" will be seen as equal.


EDITED

In some particular cases you may want to have your name in bold together with the previous style (if you are the speaker AND the author of the CV). In that case use the following two new functions:

FUNCTION {cv.author}
{ "Doe, John" nameptr  "{vv~}{ll}{, jj}{, f{.}.}" format.name$ }

FUNCTION{double.highlight}
{ duplicate$ empty$
      { pop$ "" }
      { "\textbf{\underline{" swap$ * "}}" * }
   if$
}

And then, change FUNCTION{highlight.if.speaker.author} to this:

FUNCTION {highlight.if.speaker.author}
{ duplicate$ purify$ speaker.author purify$ =
        { speaker.author cv.author =
    { double.highlight }
    {highlight}
    if$
    }
    'skip$
  if$
}