[Tex/LaTex] Underline the own name in the publication list created with bibentry

bibentrybibliographiesbibtexformatting

I create my list of publications using \bibentry. As in some of the publications I'm only the fifth author (or there around) I would like to highlight my name by underlining it. I found solutions doing this in the complete bibliography e.g. here or here. Is there a possibility to apply the underlining just locally for the "chapter" where I create the publication list using \bibentry? I'm also open to alternatives to \bibentry however I would prefer not to make the list completely by hand. I'm using BibTeX and the bibliographystyle statto.

Best Answer

EDIT Answer updated with step-by-step instructions on how to modify the .bst file according to this answer.

It is possible to use the solution provided in this answer to Make one author's name bold every time it shows up in the bibliography as follows:

Create a command \myref that takes an argument, and use such command to wrap your name in the bibliography using the solutions above. This means that in the .bbl file one has something like

\bibitem[Author and M{\"u}ller(2013)]{A}
A~Author and \myref{M~M{\"}ller}.
\newblock Title, 2013.

\bibitem[M{\"u}ller(2013)]{B}
\myref{M~M{\"u}ller}.
\newblock Title, 2013.

\bibitem[Cuthor(2013)]{C}
C~Cuthor.
\newblock Title, 2013.

The command \myref is defined to simply print its content in a normal bibliography and print the underlined argument in the list of publication. This is achieved in the following way (using toolbox package toggle facilities)

\newtoggle{myrefs}

\newcommand{\myref}[1]{\iftoggle{myrefs}{\underline{#1}}{#1}}

then set myrefs to false before the normal bibliography (\togglefalse{myrefs}) and true for the list of publications (\toggletrue{myrefs}).

Here is the complete example (the \jobname.bbl file is included to demonstrate the solution). Also the step-by-step modifications to the .bst file, according to this solution are included

Include the following functions in the .bst file (as usual create a copy of the style and rename it).

FUNCTION {cv.author}
{ "M Muller" }

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

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

Then locate the function FUNCTION {format.names} in the .bst file (it is around line 550 in my copy). Change

  format.name$
  bib.name.font

in

  format.name$
  highlight.if.cv.author
  bib.name.font

namely, add highlight.if.cv.author immediately after format.name$.

At this point you are ready to use the modified .bst file.

\documentclass{article}
\usepackage{natbib}
\usepackage{bibentry}
\usepackage{etoolbox}
\usepackage{filecontents}

\begin{filecontents}{bib.bib}
  @Misc{A,
    author       = {A Author and M M{\"u}ller},
    title        = {Title},
    year         = 2013,
  }

  @Misc{B,
    author       = {M M{\'}ller},
    title        = {Title},
    year         = 2013,
  }

  @Misc{C,
    author       = {C Cuthor},
    title        = {Title},
    year         = 2013,
  }
\end{filecontents}

\newtoggle{myrefs}

\newcommand{\myref}[1]{\iftoggle{myrefs}{\underline{#1}}{#1}}

\begin{document}

\nocite{*}

\togglefalse{myrefs}
\bibliographystyle{mystatto}
\bibliography{bib}

\section*{My Publications}
\toggletrue{myrefs}
\nobibliography*
\begin{itemize}
\item\bibentry{A}
\item\bibentry{B}
\end{itemize}

\end{document}

The MWE yields

enter image description here

Related Question