\ProvidesPackage{authorbold} \RequirePackage{etoolbox} % Ensure etoolbox is loaded for toggle commands \newtoggle{boldauthor} % Define a toggle for controlling bolding \togglefalse{boldauthor} \def\makenamesetup{% \def\bibnamedelima{~}% \def\bibnamedelimb{ }% \def\bibnamedelimc{ }% \def\bibnamedelimd{ }% \def\bibnamedelimi{ }% \def\bibinitperiod{.}% \def\bibinitdelim{~}% \def\bibinithyphendelim{.-}} \newcommand*{\makename}[2]{\begingroup\makenamesetup\xdef#1{#2}\endgroup} \newcommand*{\boldname}[3]{% \def\lastname{#1}% \def\firstname{#2}% \def\firstinit{#3}} \boldname{}{}{} % Patch new definitions \renewcommand{\mkbibnamegiven}[1]{% \ifboolexpr{ ( test {\ifdefequal{\firstname}{\namepartgiven}} or test {\ifdefequal{\firstinit}{\namepartgiven}} ) and test {\ifdefequal{\lastname}{\namepartfamily}} } {\iftoggle{boldauthor}{\textbf{#1}}{#1}}{#1}% } \renewcommand{\mkbibnamefamily}[1]{% \ifboolexpr{ ( test {\ifdefequal{\firstname}{\namepartgiven}} or test {\ifdefequal{\firstinit}{\namepartgiven}} ) and test {\ifdefequal{\lastname}{\namepartfamily}} } {\iftoggle{boldauthor}{\textbf{#1}}{#1}}{#1}% } \edef\dothesourcemap{ \noexpand\DeclareSourcemap{ \noexpand\maps[datatype=bibtex]{ \noexpand\map{ \noexpand\pertype{article} \noexpand\step[fieldsource=author, match=\noexpand\regexp{.* and .*\thesisnameregex.*}, final] \noexpand\step[fieldset=keywords, fieldvalue={mine_other}, append] } \noexpand\map{ \noexpand\pertype{inproceedings} \noexpand\step[fieldsource=author, match=\noexpand\regexp{.* and .*\thesisnameregex.*}, final] \noexpand\step[fieldset=keywords, fieldvalue={mine_other}, append] } \noexpand\map{ \noexpand\pertype{article} \noexpand\step[fieldsource=author, match=\noexpand\regexp{.*\thesisnameregex.*}, final] \noexpand\step[fieldsource=author, notmatch=\noexpand\regexp{.* and .*\thesisnameregex.*}, final] \noexpand\step[fieldset=keywords, fieldvalue={mine}, append] } \noexpand\map{ \noexpand\pertype{inproceedings} \noexpand\step[fieldsource=author, match=\noexpand\regexp{.*\thesisnameregex.*}, final] \noexpand\step[fieldsource=author, notmatch=\noexpand\regexp{.* and .*\thesisnameregex.*}, final] \noexpand\step[fieldset=keywords, fieldvalue={mine}, append] } } } } \dothesourcemap % Commands to enable or disable bolding as needed in the document \newcommand{\enableboldauthor}{\toggletrue{boldauthor}} \newcommand{\disableboldauthor}{\togglefalse{boldauthor}} % You can comment in the following code to also make the labels bold % \DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{\ifkeyword{mine}{\mkbibbold{#1}}{#1}}} % \DeclareFieldFormat{boldmine}{\ifkeyword{mine}{\mkbibbold{#1}}{#1}} % \makeatletter % \renewbibmacro*{cite:comp:comp}{% % \ifboolexpr{ % ( test {\iffieldundef{labelprefix}} and test {\ifundef\cbx@lastprefix} ) % or % test {\iffieldequals{labelprefix}{\cbx@lastprefix}} % } % {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}} % {\savefield{entrykey}{\cbx@lastkey}% % \savefield{labelnumber}{\cbx@lastnumber}% % \addtocounter{cbx@tempcnta}{1}} % {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}-1} % {} % {\usebibmacro{cite:dump}% % \ifnumgreater{\value{cbx@tempcntb}}{-1} % {\multicitedelim} % {}% % \printtext[bibhyperref]{% % \printtext[boldmine]{% % \printfield{labelprefix}% % \printfield{labelnumber}}}}}} % {\usebibmacro{cite:comp:end}}% % \setcounter{cbx@tempcntb}{\thefield{labelnumber}}% % \savefield{labelprefix}{\cbx@lastprefix}} % \renewbibmacro*{cite:comp:end}{% % \usebibmacro{cite:dump}% % \ifnumgreater{\value{cbx@tempcntb}}{-1} % {\multicitedelim} % {}% % \printtext[bibhyperref]{% % \printtext[boldmine]{% % \printfield{labelprefix}% % \printfield{labelnumber}}}} % \renewbibmacro*{cite:comp:inset}{% % \usebibmacro{cite:dump}% % \ifnumgreater{\value{cbx@tempcntb}}{-1} % {\multicitedelim} % {}% % \printtext[bibhyperref]{% % \printtext[boldmine]{% % \printfield{labelprefix}% % \printfield{labelnumber}% % \printfield{entrysetcount}}}% % \setcounter{cbx@tempcntb}{-1}} % \renewbibmacro*{cite:comp:shand}{% % \usebibmacro{cite:dump}% % \ifnumgreater{\value{cbx@tempcntb}}{-1} % {\multicitedelim} % {}% % \printtext[bibhyperref]{\printtext[boldmine]{\printfield{shorthand}}}% % \setcounter{cbx@tempcntb}{-1}} % \newbibmacro*{cite:dump}{% % \ifnumgreater{\value{cbx@tempcnta}}{0} % {\ifnumgreater{\value{cbx@tempcnta}}{1} % {\bibrangedash} % {\multicitedelim}% % \bibhyperref[\cbx@lastkey]{\printtext[boldmine]{% % \ifdef\cbx@lastprefix % {\printtext[labelprefix]{\cbx@lastprefix}} % {}% % \printtext[labelnumber]{\cbx@lastnumber}}}} % {}% % \setcounter{cbx@tempcnta}{0}% % \global\undef\cbx@lastprefix} % \makeatother