4

This is a follow-up question to Make specific author bold using biblatex.

Using biblatex and biber and either XeLaTeX or LuaTeX, would it be possible to extract all names from the \author command, which is mainly used for \maketitle, and automatically highlight (or “lowlight”) them in citations and bibliographies?

Basically this is “just” asking how to extract names from \author (multiple ones split by and), parse for first/given names and last/family name and finally put these in the \boldname macro from the aforementioned answer.

%% \boldname{family name}{given name}{initials}
\newcommand*{\boldname}[3]{%
  \def\lastname{#1}%
  \def\firstname{#2}%
  \def\firstinit{#3}}

\boldname{}{}{}
4
  • 1
    Can't you replace \author by another command which puts the real \author with a pre-defined variable, which will be set beforehand? Then you will have a variable with your desired author...
    – yoki
    Feb 25 '14 at 9:54
  • 1
    You should look at titling which lets you continue to use the values of assigned in \author etc. after \maketitle.
    – cfr
    Feb 26 '14 at 4:30
  • @cfr: titling helps, but is not yet a solution, because I would still have to split up its \theauthor into first and last name at least. Does biblatex do this by itself – which could be copied easily – or is that the responsibility of the backend (biber/BibTeX)?
    – Crissov
    Feb 26 '14 at 7:36
  • @ido: You mean like \newcommand*\authorname[3][]{\author{#2 #3} \boldname{#3}{#2}{#1}} where #1 is the optional initials, #2 the given name and #3 the family name? That should work, indeed, but only for a single author.
    – Crissov
    Feb 26 '14 at 9:42
0

Building upon @ido’s suggestion, this should (almost) work, but requires a different workflow, which is something I wanted to avoid actually.

\newcommand*\authors{}
\newcommand*\addauthor[1]{%
  \let\oldauthors\authors
  \renewcommand*\authors{%
    \ifempty{\oldauthors}{}{\oldauthors{} and }#1%
  }
}
\newcommand*\authorname[3][]{%
  \addauthor{#2 #3}
  \boldname{#3}{#2}{#1}
}

\authorname[J.]{John}{Doe}
\authorname[J.]{Jane}{Doe}

\author{\authors}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.