1

I am trying to generate a numbered list of publications where some publications should be highlighted by using an "S" prefix, such as [S1]. The other publications should be normal. So far I have been unsuccessful in achieving this using BibLateX as I can only get the highlighted papers in the bibliography list.

MWE

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=numeric,backend=biber]{biblatex} 
\begin{filecontents*}{\jobname.bib}
@ARTICLE{art2,
author={John Doe and Jane Roe},
journal={Journal of Teamwork},
title={Some title},
year={2007},
month={Dec},
volume={11},
number={8}
}
@ARTICLE{art3,
author={John Doe},
journal={Some Journal},
title={A great paper},
year={2009},
month={Jan},
volume={45},
number={1},
keywords={first}
}
@ARTICLE{art3,
author={Jane Roe},
journal={Journal of Articles},
title={An Article by Jane},
year={2010},
month={Feb},
volume={46},
number={2}
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\begin{document}
\assignrefcontextkeyws[labelprefix=S]{keyword=first}
\assignrefcontextkeyws[labelprefix={}]{notkeyword=first}

\nocite{*}
\printbibliography[keyword=first,notkeyword=first,heading=none]
\end{document}

And I would like this code to produce something like this:

 [1] John Doe and Jane Roe, "Some title", Journal of teamwork 11 (2007).
[S2] John Doe, "A great paper", Some Journal 45 (2009).
 [3] Jane Roe, "An article by Jane", Journal of Articles 46 (2010).
  • So you are OK with the numbering ignoring the 'S'? – moewe Jul 25 '17 at 16:00
  • Yes I am. In fact, that is required. – Paul Jul 25 '17 at 16:01
  • Good. Then that should be possible even without refcontexts. – moewe Jul 25 '17 at 16:02
2

For citations use

\renewbibmacro*{cite}{%
  \printtext[bibhyperref]{%
    \printfield{labelprefix}%
    \ifkeyword{first}{S}{}%
    \printfield{labelnumber}%
    \ifbool{bbx:subentry}
      {\printfield{entrysetcount}}
      {}}}

For the bibliography

\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
      \printfield{labelprefix}%
      \ifkeyword{first}{S}{}%
      \printfield{labelnumber}}}
     {\setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}

You won't need any \assignrefcontextkeyws. (The correct syntax would have been \assignrefcontextkeyws[labelprefix=S]{first} and there is no notkeyword version.)

MWE

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=numeric,backend=biber]{biblatex} 
\begin{filecontents*}{\jobname.bib}
@ARTICLE{art2,
author={John Doe and Jane Roe},
journal={Journal of Teamwork},
title={Some title},
year={2007},
month={Dec},
volume={11},
number={8}
}
@ARTICLE{art1,
author={John Doe},
journal={Some Journal},
title={A great paper},
year={2009},
month={Jan},
volume={45},
number={1},
keywords={first}
}
@ARTICLE{art3,
author={Jane Roe},
journal={Journal of Articles},
title={An Article by Jane},
year={2010},
month={Feb},
volume={46},
number={2}
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\renewbibmacro*{cite}{%
  \printtext[bibhyperref]{%
    \printfield{labelprefix}%
    \ifkeyword{first}{S}{}%
    \printfield{labelnumber}%
    \ifbool{bbx:subentry}
      {\printfield{entrysetcount}}
      {}}}

\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
      \printfield{labelprefix}%
      \ifkeyword{first}{S}{}%
      \printfield{labelnumber}}}
     {\setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}

\begin{document}
\cite{art1} \cite{art2} \cite{art3}
\printbibliography
\end{document}

gives S1 2 3

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.