| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- \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
|