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:
- Why does this not work?
- 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?
bibtexis run, it does not look at yourtexfile; it looks only at theauxfile for which bibitems are cited, and generates a correspondingbblfile from thebstfile. // 2. That is against the reason for abstfile: it defines a bibliographic style which is supposed to be usable by many differenttexfiles.bibtexinto doing something it would only reluctantly do, it may be a lot easier to just usebiblatex. You can use the samebibfile, but can program these kinds of operations as part of yourtexfile. See e.g. https://tex.stackexchange.com/q/73136/119 – Willie Wong Jul 11 '23 at 04:57