4

I searched for the answer to my question a lot and I seem to always come very close to it but not quite getting there. Imagine I have an author called "Tarcisio F. Maciel" that I find somewhat special and I would like to mark him with an asterisk in my reference list. With the following code (found in this forum) I can make him bold but appending an asterisk didn't work for me (please not that you need a fairly new distribution of Miktex or Texlive to compile correctly). Do you have an idea? I would like to change as little as possible with the example because I really like the idea of identifying authors by their hash (I have multiple references with him and they should always be highlighted).

\documentclass{article}
\usepackage[backend=biber,style=numeric]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
  @incollection{Silva:2014a,
  title={Radio Resource Management for Device-to-Device Communications in Long Term Evolution Networks},
  author={Carlos F. M. Silva and Silva, Jr., Jos\'{e} Mairton B. and Tarcisio F. Maciel},
  booktitle={Resource Allocation and {MIMO} for {4G} and Beyond},
  publisher={Springer Science+Business Media},
  year=2014,
  address={New York, USA},
  editor={Francisco Rodrigo Porto Cavalcanti},
  pages={105-156},
  doi={10.1007/978-1-4614-8057-0_3},
  isbn={978-1-4614-8056-3},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\usepackage{xpatch}% or use https://tex.stackexchange.com/a/40705

\newbibmacro*{name:bold}[2]{%
  \def\do##1{\iffieldequalstr{hash}{##1}{\bfseries\listbreak}{}}%
  \dolistloop{\boldnames}%
}

\newcommand*{\boldnames}{}

\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}{}{}

\renewcommand*{\boldnames}{}
\forcsvlist{\listadd\boldnames}
  {{3288e5f9be7ec7c330203382f4e8d8ed}}

\begin{document}
\cite{Silva:2014a}

\printbibliography
\end{document}

Current output:

Current output

Desired output (reproduced with MS Word):

Desired output

4

An asterisk is easier than bold, actually. The basic idea is the same, but this time we only need to hook into the end of the macros (we only append code), where we add an asterisk if needed. No need for complicated grouping.

\documentclass{article}
\usepackage[backend=biber,style=numeric]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
  @incollection{Silva:2014a,
  title={Radio Resource Management for Device-to-Device Communications in Long Term Evolution Networks},
  author={Carlos F. M. Silva and Tarcisio F. Maciel and Silva, Jr., Jos\'{e} Mairton B.},
  booktitle={Resource Allocation and {MIMO} for {4G} and Beyond},
  publisher={Springer Science+Business Media},
  year=2014,
  address={New York, USA},
  editor={Francisco Rodrigo Porto Cavalcanti},
  pages={105-156},
  doi={10.1007/978-1-4614-8057-0_3},
  isbn={978-1-4614-8056-3},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\usepackage{xpatch}% or use https://tex.stackexchange.com/a/40705

\newbibmacro*{name:ast}[2]{%
  \def\do##1{\iffieldequalstr{hash}{##1}{*\listbreak}{}}%
  \dolistloop{\astnames}}

\xapptobibmacro{name:family}{\usebibmacro{name:ast}}{}{}
\xapptobibmacro{name:given-family}{\usebibmacro{name:ast}}{}{}
\xapptobibmacro{name:family-given}{\usebibmacro{name:ast}}{}{}

\newcommand*{\astnames}{}
\forcsvlist{\listadd\astnames}
  {{3288e5f9be7ec7c330203382f4e8d8ed}}

\begin{document}
\cite{Silva:2014a}

\printbibliography
\end{document}

enter image description here

The asterisk really does not stand out as much as boldface would.

3

You can change the MWE by adding the following code

\newtoggle{addasterisk}

\newbibmacro*{name:bold}[2]{%
  \def\do##1{\iffieldequalstr{hash}{##1}{\toggletrue{addasterisk}}{}}%
  \dolistloop{\boldnames}%
}

\newcommand{\myast}{\iftoggle{addasterisk}{*\togglefalse{addasterisk}}{}}

This use you current code to determine if a name has to be highlighted; if so a switch is activated, and then based on the switch the asterisk is printed of not (changing what you append to the macro based on the following lines)

\xapptobibmacro{name:family}{\myast\endgroup}{}{}
\xapptobibmacro{name:given-family}{\myast\endgroup}{}{}
\xapptobibmacro{name:family-given}{\myast\endgroup}{}{}

enter image description here

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.