1

I'm writing a bst file so that I could list my publications using bibtex inside moderncv class document, based on this article: https://www.sethajacobson.com/notes/2021/3/1/to-bold-and-italicize-specific-author-names-in-a-latex-generated-citation . Also note that my bst file is based on the following post: https://tex.stackexchange.com/a/85983/81910 .

Following exactly as described in the article did produce desired result; it indeed made my name boldface.

While replicating this article, I found that I need to put my name inside the bst file. This is quite undesirable if I want to change my name quickly. I tried adding

\newcommand{\myname}{I. M. Author}

into my tex file and modified the bold.if.imauthor function as

FUNCTION {bold.if.imauthor}
    { duplicate$ purify$ 
    "\myname"
    purify$ = { 
    "\textbf{"
    swap$ * "}" * } 'skip$ if$
}

But, this does not work.

Questions are:

  1. Why does this not work?
  2. How do I define my name in the main tex file so that I could change which name to be highlighted without editing the bst file?
Hojin Cho
  • 111
  • When bibtex is run, it does not look at your tex file; it looks only at the aux file for which bibitems are cited, and generates a corresponding bbl file from the bst file. // 2. That is against the reason for a bst file: it defines a bibliographic style which is supposed to be usable by many different tex files.
  • – Willie Wong Jul 11 '23 at 04:55
  • Instead of trying to hack bibtex into doing something it would only reluctantly do, it may be a lot easier to just use biblatex. You can use the same bib file, but can program these kinds of operations as part of your tex file. See e.g. https://tex.stackexchange.com/q/73136/119 – Willie Wong Jul 11 '23 at 04:57