That's perfect, thank you!
On 2018-07-23 06:32 PM, Hans Hagen wrote:
\startsetups
btx:list:author:normalshort
\fastsetup{btx:list:author:concat}
\begingroup
\ctxluacode{document.CheckMeB("\currentbtxdataset","\currentbtxtag",\number\currentbtxauthorindex)}
\ifx\currentbtxinitials\empty \else
\currentbtxinitials
\btxparameter{separator:initials}
\fi
\ifx\currentbtxvons\empty \else
\currentbtxvons
\ifx\currentbtxsurnames\empty \else
\btxparameter{separator:vons}
\fi
\fi
\ifx\currentbtxsurnames\empty \else
\currentbtxsurnames
\ifx\currentbtxjuniors\empty \else
\btxparameter{separator:juniors}
\currentbtxjuniors
\fi
\fi
\endgroup
\fastsetup{btx:list:author:others}
\stopsetups
I went with the following little extension to match and make bold
multiple names:
\startbuffer[ref]
@article{solo,
author = {MyLast, MyFirst},
title = {Solo work},
journal = {Journal},
year = {2000},
month = {1},
volume = {1}
}
@article{co,
author = {OtherLast, OtherFirst and MyLast, MyFirst and CoLast, CoFirst},
title = {Joint work},
journal = {Journal},
month = {1},
year = {2000},
volume = {1}
}
\stopbuffer
\usebtxdataset[ref][ref.buffer]
\setupbtx[dataset=ref]
\definebtxrendering[ref][dataset=ref]
\setupbtx[default:cite]
[alternative=authoryear,
etallimit=1,
authorconversion=normalshort]
\startluacode
BoldNames = {
{firstnames = "MyFirst",
surnames = "MyLast"},
{initials = "C",
surnames = "CoLast"},
}
function document.CompareNames(reference, targets)
-- Loop over targets
for _, target in pairs(targets) do
-- Loop over fields
for key, value in pairs(target) do
if reference[key] == nil then
break
end
full_entry = ''
for _, part in ipairs(reference[key]) do
full_entry = full_entry .. ' ' .. part
end
full_entry = string.sub(full_entry, 2)
if full_entry == value then
return(true)
end
end
end
return(false)
end
function document.BoldNames(set, tag, aut)
local c = publications.getcasted(set, tag, "author")
if document.CompareNames(c[aut], BoldNames) then
context("\\bf")
end
end
\stopluacode
\startsetups btx:list:author:normalshort
\fastsetup{btx:list:author:concat}
\begingroup
\ctxluacode{document.BoldNames("\currentbtxdataset","\currentbtxtag",\number\currentbtxauthorindex)}
\ifx\currentbtxinitials\empty \else
\currentbtxinitials
\btxparameter{separator:initials}
\fi
\ifx\currentbtxvons\empty \else
\currentbtxvons
\ifx\currentbtxsurnames\empty \else
\btxparameter{separator:vons}
\fi
\fi
\ifx\currentbtxsurnames\empty \else
\currentbtxsurnames
\ifx\currentbtxjuniors\empty \else
\btxparameter{separator:juniors}
\currentbtxjuniors
\fi
\fi
\endgroup
\fastsetup{btx:list:author:others}
\stopsetups
\starttext
Citations: \cite[solo] \cite[co]
\startsubject[title=Bibliography]
\placelistofpublications[ref][method=dataset]
\stopsection
\stoptext
Cheers,
Stan