From 862662afc49fc4e41e7316b790cd8153911911a9 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Thu, 2 Apr 2020 18:04:23 +0100 Subject: [PATCH] Tweak hlblx implementation Move the patch point from prior to name:delim to after, using the upstream name:hook macros. This avoids applying formatting to delimiters (and so avoids the need to patch name:delim) and so eases more expressive fomatting, including coloration, e.g.: \makeatletter \renewcommand*{\hlblx@format}{\color{blue}} \makeatother --- academic.sty | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/academic.sty b/academic.sty index 6337dd1..d293400 100644 --- a/academic.sty +++ b/academic.sty @@ -280,13 +280,19 @@ \fi } -\def\hlblx@bibfile@name{\jobname.bib} +\def\hlblx@bibfile@name{\jobname-hlblx.bib} \newwrite\hlblx@bibfile \immediate\openout\hlblx@bibfile=\hlblx@bibfile@name \newcounter{hlblx@name} \setcounter{hlblx@name}{0} +% Ensure that the generated bib file isn't empty, because that causes some +% tools to croak. +\immediate\write\hlblx@bibfile{% + @misc{hlblx-dummy, options={dataonly=true},}% +} + \newcommand*{\hlblx@writenametobib}[1]{% \stepcounter{hlblx@name}% \edef\hlblx@tmp@nocite{% @@ -318,21 +324,12 @@ {} {} -\newbibmacro*{name:bold}[2]{% - \def\do##1{\iffieldequalstr{hash}{##1}{\bfseries\listbreak}{}}% +\newcommand*{\hlblx@format}{\bfseries} +\newbibmacro*{name:hlblx}[1]{% + \def\do##1{\iffieldequalstr{hash}{##1}{\hlblx@format\listbreak}{}}% \dolistloop{\hlbxl@boldhashes}% } - -\xpretobibmacro{name:family}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{} -\xpretobibmacro{name:given-family}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{} -\xpretobibmacro{name:family-given}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{} -\xpretobibmacro{name:delim}{\begingroup\normalfont}{}{} - -\xapptobibmacro{name:family}{\endgroup}{}{} -\xapptobibmacro{name:given-family}{\endgroup}{}{} -\xapptobibmacro{name:family-given}{\endgroup}{}{} -\xapptobibmacro{name:delim}{\endgroup}{}{} - +\xpretobibmacro{name:hook}{\usebibmacro{name:hlblx}{#1}}{}{} % User macros \newcommand*{\addboldnames}{\forcsvlist\hlblx@writenametobib} -- 2.50.1