1

I have a complex document which contains a lot of citations. At the end of the document, the cited papers are printed using several bibliographies that are sorted differently (some by years, other by authors).

Below is a simpler example, three biblios the first two use the default sorting scheme (by years), and the third a different sorting scheme (by authors). All the biblios use a numeric scheme and the third citation are prefixed by a P.

When, this document is compiled, the first set of citations is printed as "mes articles [1, 2] et des autres [0] ou [0]." and the second (after the \newrefcontext) is printed as "mes articles [0] et des autres [P2] ou [P1].".

My problem is that I would like the best of both: "mes articles [1, 2] et des autres [P2] ou [P1].". I used to have this working with the previous sorting option to \printbibliography but I'm not able to get it working with refcontexts...

Does anyone know how to do this?

\documentclass[a4paper]{article}

\usepackage[T1]{fontenc}
\usepackage{lmodern} 

\usepackage{hyperref}

\usepackage[backend=biber,bibencoding=latin-1,citestyle=numeric-comp,defernumbers=true,maxnames=15,sorting=ydnt]{biblatex}

\begin{filecontents}{autres.bib}
@InProceedings{1988:Felleisen:Prompt,
  author =   {Matthias Felleisen},
  title =    {The theory and practice of first-class prompts},
  crossref =     {p:1988:POPL},
  pages =    {180--190},
  doi =      {10.1145/73560.73576}
}
@Article{1990:Conic,
  author =   {Jeff Kramer and Jeff Magee},
  title =    {The evolving philosophers problem: dynamic change
                  management},
  journal =  {IEEE Transaction on Software Engineering},
  year =     1990,
  volume =   16,
  number =   11,
  pages =    {1293--1306},
  month =    nov,
  doi =      {10.1109/32.60317}
}
@Proceedings{p:1988:POPL,
  title =    {Principles of Programming Languages},
  year =     1988,
  booktitle =    {Principles of Programming Languages},
  address =  {San Diego, California, USA},
  month =    jan
}
\end{filecontents}

\begin{filecontents}{mien.bib}
@Article{TELECOM_BRETAGNE-13940,
  author =   {Ali Koudri and Christophe Guychard and Sylvain
                  Guérin and Fabien Dagnat and Antoine Beugnard and
                  Joël Champeau},
  title =    {De la nécessité de fédérer des modèles dans une
                  chaîne d'outils},
  journal =  {Génie logiciel: le magazine de l'ingénierie du
                  logiciel et des systèmes},
  year =     2013,
  number =   {n\textsuperscript{o}105},
  pages =    {18 -- 23},
  month =    jun,
  langid =   {french}
}
@article{jss2016,
  TITLE =    {{Safe reconfiguration of Coqcots and Pycots
                  components}},
  AUTHOR =   {Buisson, J{\'e}r{\'e}my and Dagnat, Fabien and
                  Leroux, Elena and Martinez, S{\'e}bastien},
  JOURNAL =  {{Journal of Systems and Software}},
  PUBLISHER =    {{Elsevier}},
  YEAR =     2015,
  DOI =      {10.1016/j.jss.2015.11.039},
  KEYWORDS =     {Dynamic reconfiguration ; component model ; dynamic
                  software updating ; DSU ; Python ; Coq ; runtime
                  evolution},
  HAL_ID =   {hal-01235602},
}
\end{filecontents}

\bibliography{autres,mien}
\defbibheading{subsub}[\refname]{\subsection*{#1}}
\DeclareBibliographyCategory{perso}
\addtocategory{perso}{jss2016,TELECOM_BRETAGNE-13940}
\DeclareBibliographyCategory{french}
\addtocategory{french}{TELECOM_BRETAGNE-13940}
\renewcommand\multicitedelim{\addcomma\thinspace}

\begin{document}

mes articles~\cite{TELECOM_BRETAGNE-13940,jss2016} et des
autres~\cite{1990:Conic} ou~\cite{1988:Felleisen:Prompt}.

\section*{Publications personnelles}

\printbibliography[category=perso,heading=subsub,%
                    title={Articles de journal international},type=article,%
                    notcategory=french]

\printbibliography[category=perso,heading=subsub,%
                    title={Articles de journal francophone},type=article,%
                    category=french]

\newrefcontext[sorting=nyt]
mes articles~\cite{TELECOM_BRETAGNE-13940,jss2016} et des
autres~\cite{1990:Conic} ou~\cite{1988:Felleisen:Prompt}.

\printbibliography[notcategory=perso,heading=subbibliography,resetnumbers=true,%
                    title={Publications d'autres auteurs},prefixnumbers={P}]

\end{document}
2
  • You could try this: tex.stackexchange.com/a/291772/2388 (I did not test if it works in your case, don 't have the time now). – Ulrike Fischer Feb 29 '16 at 18:02
  • Please see the last answer from me in the question @UlrikeFischer references. This should work with biber 2.4/biblatex 3.3 just released. The internals which are referenced in your answer are no longer the same in biblatex 3.3. – PLK Mar 1 '16 at 14:25
1

Solved my problems reusing Ulrike link. It also worked for my big document. I just adapted it to my use of categories instead of keywords.

\documentclass[a4paper]{article}

\usepackage[T1]{fontenc}
\usepackage{lmodern} 

\usepackage{hyperref}

\usepackage[backend=biber,bibencoding=latin-1,citestyle=numeric-comp,defernumbers=true,maxnames=15,sorting=ydnt]{biblatex}

\makeatletter
\AtEveryCitekey{\ifcategory{perso}{%
    \def\blx@refcontext@sorting{ydnt}\csname blx@data@\the \c@refsection @\blx@refcontext@sorting @\abx@field@entrykey\endcsname%
  }{%
    \def\blx@refcontext@sorting{nyt}\csname blx@data@\the \c@refsection @\blx@refcontext@sorting @\abx@field@entrykey\endcsname%
  }}%
\makeatother

\begin{filecontents}{autres.bib}
@InProceedings{1988:Felleisen:Prompt,
  author =   {Matthias Felleisen},
  title =    {The theory and practice of first-class prompts},
  crossref =     {p:1988:POPL},
  pages =    {180--190},
  doi =      {10.1145/73560.73576}
}
@Article{1990:Conic,
  author =   {Jeff Kramer and Jeff Magee},
  title =    {The evolving philosophers problem: dynamic change
                  management},
  journal =  {IEEE Transaction on Software Engineering},
  year =     1990,
  volume =   16,
  number =   11,
  pages =    {1293--1306},
  month =    nov,
  doi =      {10.1109/32.60317}
}
@Proceedings{p:1988:POPL,
  title =    {Principles of Programming Languages},
  year =     1988,
  booktitle =    {Principles of Programming Languages},
  address =  {San Diego, California, USA},
  month =    jan
}
\end{filecontents}

\begin{filecontents}{mien.bib}
@Article{TELECOM_BRETAGNE-13940,
  author =   {Ali Koudri and Christophe Guychard and Sylvain
                  Guérin and Fabien Dagnat and Antoine Beugnard and
                  Joël Champeau},
  title =    {De la nécessité de fédérer des modèles dans une
                  chaîne d'outils},
  journal =  {Génie logiciel: le magazine de l'ingénierie du
                  logiciel et des systèmes},
  year =     2013,
  number =   {n\textsuperscript{o}105},
  pages =    {18 -- 23},
  month =    jun,
  langid =   {french}
}
@article{jss2016,
  TITLE =    {{Safe reconfiguration of Coqcots and Pycots
                  components}},
  AUTHOR =   {Buisson, J{\'e}r{\'e}my and Dagnat, Fabien and
                  Leroux, Elena and Martinez, S{\'e}bastien},
  JOURNAL =  {{Journal of Systems and Software}},
  PUBLISHER =    {{Elsevier}},
  YEAR =     2015,
  DOI =      {10.1016/j.jss.2015.11.039},
  KEYWORDS =     {Dynamic reconfiguration ; component model ; dynamic
                  software updating ; DSU ; Python ; Coq ; runtime
                  evolution},
  HAL_ID =   {hal-01235602},
}
\end{filecontents}

\bibliography{autres,mien}
\defbibheading{subsub}[\refname]{\subsection*{#1}}
\DeclareBibliographyCategory{perso}
\addtocategory{perso}{jss2016,TELECOM_BRETAGNE-13940}
\DeclareBibliographyCategory{french}
\addtocategory{french}{TELECOM_BRETAGNE-13940}
\renewcommand\multicitedelim{\addcomma\thinspace}

\begin{document}

mes articles~\cite{TELECOM_BRETAGNE-13940,jss2016} et des
autres~\cite{1990:Conic} ou~\cite{1988:Felleisen:Prompt}.

\section*{Publications personnelles}

\printbibliography[category=perso,heading=subsub,%
                    title={Articles de journal international},type=article,%
                    notcategory=french]

\printbibliography[category=perso,heading=subsub,%
                    title={Articles de journal francophone},type=article,%
                    category=french]

\newrefcontext[sorting=nyt]
mes articles~\cite{TELECOM_BRETAGNE-13940,jss2016} et des
autres~\cite{1990:Conic} ou~\cite{1988:Felleisen:Prompt}.

\printbibliography[notcategory=perso,heading=subbibliography,resetnumbers=true,%
                    title={Publications d'autres auteurs},prefixnumbers={P}]

\end{document}
1

With biber 2.4/biblatex 3.3, see the macros:

\assignrefcontextkeyws
\assignrefcontextcats
\assignrefcontextentries

which automatically retrieve entries with keywords, entries in a category or entrykeys themselves respectively from a refcontext.

4
  • ok I had also seen and tested your solution but it's more constraining as I need to track all cite commands and determine which refcontext they are defined in. For a pretty large document it is painful. – fabiendagnat Mar 1 '16 at 21:19
  • I agree. I will look into this to see about auto-switching the refcontext for cites. – PLK Mar 2 '16 at 9:54
  • I will add a user macro \assignrefcontext[sorting=nty]{Nopub1,Nopub2} to do this I think. This will automatically assign a refcontext to any cite. – PLK Mar 2 '16 at 14:02
  • Updated answer with the new biblatex 3.3 macros. – PLK Mar 3 '16 at 11:05

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.