In the solution I found, you need to modify your bibtex style file for this and implement a new TeX macro. Suppose you use the plain bibliography style. Locate plain.bst
(you can use the command kpsewhich plain.bst
for that) and copy it to your local tex directory as, say, myplain.bst
. In myplain.bst
locate the function format.names
. In this function replace the line
{ s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
by
{ "\FormatName{" s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ * "}" * 't :=
Now in your tex file, first change the style to myplain.bst
and insert the following macro definitions:
\def\FormatName#1{%
\def\myname{Elmar Zander}%
\edef\name{#1}%
\ifx\name\myname
\textbf{#1}%
\else
#1%
\fi
}
This should work now. (And, of course, don't forget do replace my name by yours ;-)
Note1: format.name$
is a builtin function that takes the preceding three arguments, which are: a string with the author names (s
), the number of the name to be formatted (nameptr
) and a formatting string ("{ff~..."
) and formats the author name according to this format string. As bibtex is stack oriented the arguments need to be pushed first on the stack, then format.name$
pops them off the stack, computes the result and pushes it back onto the stack. The "ff,ll,vv,jj" in the format string stand for first name(s), last name, stuff like "von" or "de", and stuff like "jr./junior" respectively (see btxhak.pdf included in the bibtex distribution). The single letter versions "f", "l" etc. would give you abbreviated forms. The *
operator in bibtex concatenates two strings. Again, the strings need to be on the stack first, and the result is pushed back on the top of the stack.
Note2: You can have the FormatName macro in your bst file: modify the begin.bib
function in myplain.bst
in the following way
FUNCTION {begin.bib}
{
"\def\FormatName#1{%" write$
" \edef\name{#1}%" write$
" \ifx\name\myname" write$
" \textbf{#1}%" write$
" \else%" write$
" #1%" write$
" \fi" write$
"}" write$
preamble$ empty$
'skip$
{ preamble$ write$ newline$ }
if$
"\begin{thebibliography}{" longest.label * "}" * write$ newline$
}
Just keep the \def\myname{...}
macro in your tex file. So that you can change the name to be highlighted (if any) easily.
Note3: the FormatName command can have problems with the spaces between a first name and last name, and it will also not find both 'Elmar Zander' and 'E. Zander'. If the above does not work for you, you can use the xstring package and then define FormatName as follows:
\def\FormatName#1{%
\IfSubStr{#1}{Zander}{\textbf{#1}}{#1}%
}
.bib
database to change your name to be a macro and use\providecommand
to provide a default value for the macro.\documentclass
so that those trying to help don't have to recreate it.