0

I have a document which I need multiple bibliographies for: one for my own publications in chronological order and with numeric citations and one for the other publications with alphabetic citations ordered by authors' names.

It seems to be a typical scenario for biblatex, so I tried using multiple categories and multiple refcontexts:

% !TeX TS-program = pdflatex
% !TeX encoding = UTF-8
% !TeX spellcheck = en_US
% !TeX TXS-program:bibliography = txs:///biber
% !BIB program = biber

\documentclass{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{csquotes}

\usepackage[backend=biber, safeinputenc=true, style=alphabetic, labelnumber=true, defernumbers=true, maxbibnames=99]{biblatex}

\addbibresource{references.bib}

% Filter categories by author
% https://tex.stackexchange.com/questions/28509/biblatex-filter-out-publications-from-a-specific-author-in-the-references-dynam
\DeclareBibliographyCategory{mine}
\DeclareIndexNameFormat{mine}{%
  \nameparts{#1}%
  \ifdefstring{\namepartfamily}{\"{A}}{%
    \addtocategory{mine}{\thefield{entrykey}}}{}
}

\AtDataInput{%
  \indexnames[mine]{author}}

% Different citation styles for own and other publictions
% https://tex.stackexchange.com/questions/299064/biblatex-two-bibliographies-with-different-styles-and-sortings
\renewbibmacro*{cite}{%
  \printtext[bibhyperref]{%
    \printfield{labelprefix}%
    \ifcategory{mine}
    {\printfield{labelnumber}}
    {\printfield{labelalpha}%
     \printfield{extraalpha}}}}

\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}
\defbibenvironment{mineenv}
{\list
  {\printtext[labelnumberwidth]{%
      \printfield{prefixnumber}%
      \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}

\usepackage{hyperref}

\begin{document}

  \cite{othersZ}
  \cite[8]{mineB}
  \cite{othersY}
  \cite{mineA, mineAErratum}
  \cite{othersX}

  \printbibheading
  \newrefcontext[sorting=ynt]
  \printbibliography[category=mine, heading=subbibliography, env=mineenv, title={My Publications (chronologically)}]
  \newrefcontext[sorting=nty]
  \printbibliography[notcategory=mine, heading=subbibliography, title={Other References (alphabetically)}]

\end{document}

Bibliography file references.bib:

@article{mineA,
  title={A},
  author={Guy, Some Other and Ä, Myself},
  journal={Some Journal},
  date={2020-02-12},
  addendum={Corrected in \cite{mineAErratum}},
}

@article{mineAErratum,
  title={Erratum to \enquote{A}},
  author={Guy, Some Other and Ä, Myself},
  journal={Unpublished},
  year={2020},
  addendum={Erratum to \cite{mineA}},
}

@article{mineB,
  title={B},
  author={Else, Someone and Ä, Myself},
  journal={Another Journal},
  date={2020-02-24},
  volume={123},
}

@article{mineC,
  title={C},
  author={Again, Someone and Ä, Myself},
  journal={YAJ},
  year={2018},
}

@article{othersX,
  author="A, B and X, y",
  title="Important work",
  year="2018",
  journal="Important Journal",
}

@article{othersY,
  author="Zz, Aa",
  title="Also Important work",
  year="1998",
  journal="Also Important Journal",
}

@article{othersZ,
  author="A, B and Zz, Aa",
  title="Not so important work",
  year="2000",
  journal="Not So Important Journal",
}

The problem is that all numeric references appear as [0], except those within the bibliography. I think that the problem is that the second refcontext is overwriting the numbers assigned by the first refcontext.

This problem exists with biblatex 2016/03/03 v3.3 (TeX Live 2015)

Update: It was pointed out in the comments (by moewe) that this behavior is fixed in newer version of TeX Live.

Originally, I thought Ubuntu 16.04 LTS was running TeX Live 2016. However, it turns out that it actually uses TeX Live 2015. When I run the above example with TeX Live 2016, it works just fine. So I hope it will also work on the arXiv eventually.

I am leaving this question open because somebody might have insights into how to mitigate the problem in TeX Live 2015 and, maybe, somebody comes across the same problem.

JPW
  • 721
  • 1
    The document must be compiled with the sequence LaTeX, Biber, LaTeX, LaTeX. You must not give up before the third LaTeX run. I don't know how many LaTeX runs the arXiv usually does, so this could be an issue. The problem is not present with a current version of biblatex/Biber if the document is compiled with LaTeX, Biber, LaTeX, LaTeX. I will check back later if this is an issue that can be reproduced with an older version of biblatex. For arXiv submissions note that biblatex 3.3 is not the biblatex version on the arXiv. See https://tex.stackexchange.com/q/415703/ – moewe Apr 08 '20 at 16:09
  • Off-topic: You don't need to manually put the p.~ in \cite[p.~8]{mineB}: \cite[8]{mineB} will automatically add "p."/"pp." as appropriate. – moewe Apr 08 '20 at 16:10
  • @moewe Thank you, I didn't know that. I have updated the question. – JPW Apr 09 '20 at 07:43
  • @moewe Regarding the version: I can confirm that everything works fine with biblatex 2019/08/31 v3.13a. I will look further into which versions are affected. – JPW Apr 09 '20 at 07:44
  • If this is a Biber bug, you are pretty much out of luck, because those can usually only be resolved via updating. If this is a biblatex bug, it may be possible to come up with a solution, but it may be really messy. In any case biblatex submissions to the arXiv are going to be tricky (see the link in my first comment and the links in the answer there), so have you thought about an alternative? (As I said above, I doubt you can upload a .bbl generated for biblatex 3.3 to the arXiv anyway.) – moewe Apr 09 '20 at 07:47
  • Are there any errors in the .log file when you run the MWE on your old biblatex version? – moewe Apr 09 '20 at 07:49
  • @moewe I have created a gist for the .log with the old version: https://gist.github.com/waechtjn/a566e1f9bfeff9e1976b5ce561de342a I cannot see any errors. – JPW Apr 09 '20 at 07:56

1 Answers1

1

This was an issue in biblatex v3.3 that is fixed in v3.4. Some related bug reports: https://github.com/plk/biblatex/issues/386, https://github.com/plk/biblatex/issues/396.

Unfortunately, the fix for this issue that went into v3.4 consisted of some serious reworking of refcontext internals, so there is no simple one-line fix that we could copy from the commit logs.

I don't doubt that it would be possible to fix up v3.3, but given that this version of biblatex is more than four years old and not supported by the arXiv anyway, I don't really see the point.

moewe
  • 175,683