I would like to automatically boldface a single author's entries in a bibliography generated with natbib. The bio.tex file looks like this (everything has been fictionalized):
\documentclass{bio} \updatebio{% name={Bob Digital}, title={Prof.}, dept={Department of Antics}, uni={University of Fable}, email={[email protected]}, tel={(123) 456-7890}, web={https://uof.edu/bobdigital} } \begin{document} \Products \end{document} The \Products command is the main command of interest, which automatically generates the bibliography from a BibTeX file. The bio.cls file looks like this:
\NeedsTeXFormat{LaTeX2e} \ProvidesClass{bio}[2018/01/11 Stay classy.] %% Declare article options \DeclareOption{10pt}{\OptionNotUsed} \DeclareOption{12pt}{\OptionNotUsed} \DeclareOption{a4paper}{\OptionNotUsed} \DeclareOption{a5paper}{\OptionNotUsed} \DeclareOption{b5paper}{\OptionNotUsed} \DeclareOption{executivepaper}{\OptionNotUsed} \DeclareOption{legalpaper}{\OptionNotUsed} \DeclareOption{draft}{\OptionNotUsed} \DeclareOption{twocolumn}{\OptionNotUsed} \DeclareOption{fleqn}{\OptionNotUsed} \DeclareOption{leqno}{\OptionNotUsed} \DeclareOption{landscape}{\OptionNotUsed} \DeclareOption{titlepage}{\OptionNotUsed} \DeclareOption{openright}{\OptionNotUsed} \DeclareOption{openany}{\OptionNotUsed} \DeclareOption{11pt}{ \PassOptionsToClass{\CurrentOption}{article} } \DeclareOption{letterpaper}{ \PassOptionsToClass{\CurrentOption}{article} } \DeclareOption*{% \ClassWarning{nsf}{Unknown option '\CurrentOption'} } \ExecuteOptions{11pt, letterpaper} \ProcessOptions{\relax} \LoadClassWithOptions{article} %% Load packages \RequirePackage[margin=1in]{geometry} \usepackage[utf8]{inputenc} \RequirePackage[T1]{fontenc} \RequirePackage{times} \RequirePackage{calc} \RequirePackage{lastpage} \RequirePackage{fancyhdr} \RequirePackage{xspace} \RequirePackage[shortlabels]{enumitem} \RequirePackage{graphicx} \RequirePackage{varioref} \RequirePackage[colorlinks=true,urlcolor=,pdfpagelabels=true,hypertexnames=true,plainpages=false,naturalnames=true,]{hyperref} \RequirePackage{doi} \RequirePackage{xifthen} \RequirePackage[numbers]{natbib} \RequirePackage{xparse} %% Body of the class, most of the declarations appear here \urlstyle{rm} \renewcommand\thesection{(\alph{section})} \renewcommand\thesubsection{(\alph{subsection})} %\newcommand{\pageoflastpage}{Page {\thepage} of \pageref*{LastPage}} %\newcommand{\pageoflastpage}{{\thepage} of \pageref*{LastPage}} \newcommand{\pageoflastpage}{} % Redefine the plain pagestyle for the title page \makeatletter \let\oldps@plain\ps@plain \renewcommand{\ps@plain}{\oldps@plain% \renewcommand{\@evenfoot}{\hfil\pageoflastpage\hfil}% \renewcommand{\@oddfoot}{\@evenfoot}} \makeatother % Use fancy for non-title pages \fancyhead{} \fancyfoot{} \cfoot{\pageoflastpage} \pagestyle{fancy} \newcommand{\ie}{i.e.,\xspace} \newcommand{\eg}{e.g.,\xspace} % Key-value property store for author \ExplSyntaxOn \NewDocumentCommand{\definename}{m} { \name_define:n { #1 } } \NewDocumentCommand{\makebold}{m} { \name_makebold:n { #1 } } \NewDocumentCommand{\updatebio}{+m} { \keys_set:nn {bio} {#1} \name_define:x { \prop_item:Nn \l_name_bio_prop { name } } } \cs_new:Npn \getvalue#1 { \prop_item:Nn \l_name_bio_prop {#1} } \prop_new:N \l_name_bio_prop \keys_define:nn {bio} {% name .code:n={ \prop_put:Nnn \l_name_bio_prop {name} {#1} }, title .code:n={ \prop_put:Nnn \l_name_bio_prop {title} {#1} }, dept .code:n={ \prop_put:Nnn \l_name_bio_prop {dept} {#1} }, uni .code:n={ \prop_put:Nnn \l_name_bio_prop {uni} {#1} }, email .code:n={ \prop_put:Nnn \l_name_bio_prop {email} {#1} }, tel .code:n={ \prop_put:Nnn \l_name_bio_prop {tel} {#1} }, web .code:n={ \prop_put:Nnn \l_name_bio_prop {web} {#1} }, } \tl_new:N \l_name_full_tl \tl_new:N \l_name_first_tl \tl_new:N \l_name_last_tl \tl_new:N \l_name_initials_tl \tl_new:N \l__name_input_tl \cs_new_protected:Nn \name_define:n { \tl_set:Nn \l_name_full_tl { #1 } \tl_set_eq:NN \l_name_first_tl \l_name_full_tl \tl_set_eq:NN \l_name_last_tl \l_name_full_tl \regex_replace_once:nnN { (.*)\s[^\s]*\Z } { \1 } \l_name_first_tl \regex_replace_once:nnN { .*\s([^\s]*)\Z } { \1 } \l_name_last_tl \tl_set_eq:NN \l_name_initials_tl \l_name_first_tl \regex_replace_all:nnN { ([[:alpha:]])[[:alpha:]]+ } { \1. } \l_name_initials_tl } \cs_generate_variant:Nn \name_define:n { x } \cs_new_protected:Nn \name_makebold:n { \tl_set:Nn \l__name_input_tl { #1 } % full name \regex_replace_all:nnN { ( \u{l_name_full_tl} % name surname | \u{l_name_initials_tl} \s \u{l_name_last_tl} % initials surname | \u{l_name_last_tl} , \s \u{l_name_first_tl} % surname, name | \u{l_name_last_tl} , \s \u{l_name_initials_tl} % surname, initials ) } { \c{textbf} \cB\{ \1 \cE\} } \l__name_input_tl % print \tl_use:N \l__name_input_tl } \ExplSyntaxOff % Default variable values %%%%%%%%%%%%%%%%%%%%%%%% FOR MODIFICATION %%%%%%%%%%%%%%%%%%%%%%%% \updatebio{% name={Billy Zane}, title={Dr.}, dept={Department of Fiction}, uni={University of Utopia}, email={[email protected]}, tel={(098) 765-4321}, web={https://uo.edu/billyzane} } %%%%%%%%%%%%%%%%%%%%%%%% FOR MODIFICATION %%%%%%%%%%%%%%%%%%%%%%%% % Modify hyperref PDF metadata settings \hypersetup{% pdfsubject={A Biographical Sketch of \getvalue{title}.~\getvalue{name}}, pdfauthor={\getvalue{title}.~\getvalue{name}}, pdftitle={A Biographical Sketch of \getvalue{title}.~\getvalue{name}}, pdfkeywords={} } \title{% \vspace{-2\baselineskip} \normalsize Biographical Sketch\\ {\large\textbf{\getvalue{title}.~\getvalue{name}}}\\ \vspace{0.5\baselineskip} \hrule \vspace{0.5\baselineskip} \getvalue{dept}, \getvalue{uni}, e-mail: \href{mailto:\getvalue{email}}{\getvalue{email}}, tel: \getvalue{tel}, website: \url{\getvalue{web}} \vspace{-1.5ex} } \author{} \date{} \renewcommand{\refname}{} \newcommand{\Products}{% \subsection{Products} \vspace{-1cm} \nocite{*} \bibliographystyle{bio} \bibliography{bio} } \newcommand{\product}[1]{\item{#1}} % Change bibliography number \renewcommand{\bibnumfmt}[1]{\textbf{{#1}.}} % Bold font author by name \let\originalbibitem\bibitem \def\bibitem#1#2\par{% \noexpandarg% \originalbibitem{#1}% \makebold{#2}% } %% Macros to run after \begin{document} \AtBeginDocument{% \maketitle \vspace{-4\baselineskip} } \endinput And last, an example references.bib file:
@article{Digital1968, author = {Bob Digital and Mister Roboto}, doi = {https://doi.org/10.1016/0022-5193(68)90079-9}, issn = {0022-5193}, journal = {Journal of Theoretical Theory}, number = {3}, pages = {280--299}, title = {{Some test title to use here just for fun}}, url = {http://www.sciencedirect.com/science/article/pii/0022519368900799}, volume = {18}, year = {1968} } @article{Roboto1948, author = {Mister Roboto and Bob Digital}, doi = {https://doi.org/10.1016/0022-5193(68)90079-9}, issn = {002-52323}, journal = {Utopiae}, number = {2}, pages = {1--19}, title = {{Another title to use here just for fun!}}, url = {http://www.sciencedirect.com/science/article/pii/0022519368900799}, volume = {1}, year = {1948} } I created a custom bio.bst file, which is too large to share here. The important thing to know is that it uses the AGU format, where the first author is shown as LASTNAME, FI. MI. and subsequent authors are shown as FI. MI. LASTNAME followed by a comma for additional names, where FI == First Initial and MI == Middle Initial. Here is a corresponding .bbl file:
\begin{thebibliography}{10} \bibitem{Digital1968} Digital, B. and M.~Roboto. \newblock {Some test title to use here just for fun}. \newblock \emph{Journal of Theoretical Theory}, 18(3):280--299, 1968. \newblock ISSN 022-5193 \newblock \doi{https://doi.org/10.1016/0022-5193(68)90079-9}. \bibitem{Roboto1948} Roboto, M. and B.~Digital. \newblock {Another title to use here just for fun!}. \newblock \emph{Utopiae}, 1(2):1--19, 1948. \newblock ISSN 002-5232. \newblock \doi{https://doi.org/10.1016/0022-5193(68)90079-9}. \end{thebibliography} In this test example, I would expect Digital, B. and B. Digital to be boldface, regardless of their position in the author list. The issue that I'm having is that citations of the form FI. MI. LASTNAME are not made boldface. I believe this may be due to the format of the spacing...?

.bblfile..bblfile.