I want to use a personal macro for citing with biblatex that comes from this example. But I have two issues with it.
When I do not use the personal macro
\defbibentrysetlabel, I get from biber the errorERROR - Data file 'test-msets.bib' cannot be read in encoding 'utf8'. I think that is linked to the fact that the file is empty.When I use this command in an embedded file with
standalone, I get the error! Emergency stop., that I do not know how to solve.
Here is an example, made of 3 files:
The first file is the common preamble named preamble.tex
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[style=alphabetic,
mcite=true,
subentry,
maxcitenames=3,
backend=biber
]{biblatex}
\makeatletter
% warning the file called \blxmset@bibfile@name will be
% overwritten without warning
\def\blxmset@bibfile@name{\jobname -msets.bib}
\newwrite\blxmset@bibfile
\immediate\openout\blxmset@bibfile=\blxmset@bibfile@name
\AtEndDocument{%
\closeout\blxmset@bibfile}
\newrobustcmd*{\defbibentrysetlabel}[3]{%
\@bsphack
\begingroup
\immediate\write\blxmset@bibfile{%
@set{#1, entryset = {\unexpanded{#3}}, %
shorthand = {\unexpanded{#2}},}%
}%
\nocite{#1}%
\@esphack}
\addbibresource{\blxmset@bibfile@name}
\makeatother
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{Yvon_1935,
title = {La Th\'eorie Statistique Des Fluides et l'\'equation d'\'etat},
series = {Actualit\'es Scientifiques et Industrielles ; {Th\'eories} M\'ecaniques (Hydrodynamique-Acoustique)},
publisher = {Hermann \& cie},
date = {1935},
author = {Yvon, Jacques},
lccn = {37018772}
}
@article{Born_1946,
title = {A General Kinetic Theory of Liquids {I}. {The} Molecular Distribution Functions},
volume = {188},
issn = {2053-9169},
doi = {10.1098/rspa.1946.0093},
number = {1012},
journaltitle = {Proceedings of the Royal Society of London. Series A. Mathematical and Physical Sciences},
date = {1946-12-31},
pages = {10-18},
author = {Born, Max and Green, Herbert Sydney},
}
@article{Kirkwood_1946,
title = {The Statistical Mechanical Theory of Transport Processes {I}. {General} Theory},
volume = {14},
url = {http://aip.scitation.org/doi/10.1063/1.1724117},
doi = {10.1063/1.1724117},
number = {3},
journaltitle = {The Journal of Chemical Physics},
urldate = {2019-01-16},
date = {1946-03},
pages = {180-201},
author = {Kirkwood, John Gamble},
}
@article{Bogolioubov_1945,
title = {Kinetic Equations},
volume = {10},
number = {3},
journaltitle = {Journal of Physics USSR},
date = {1945},
pages = {265-274},
author = {Bogolioubov, Nikola\"i Nikola\"ievitch}
}
@article{Boncella_1984,
author = {Boncella, James M. and Andersen, Richard A.},
journal = {Inorg. Chem.},
pages = {432--437},
volume = {23},
year = {1984},
}
\end{filecontents}
\addbibresource[datatype=bibtex]{\jobname.bib}
Then the embedded file test_include.tex :
\documentclass{article}
\input{preamble.tex}
\begin{document}
A first citation~\cite{Boncella_1984}.
And another that I want to cite as a set BBGKY45 \defbibentrysetlabel{setBBGKY}{BBGKY45}{Yvon_1935,Bogolioubov_1945,Born_1946,Kirkwood_1946}\cite{setBBGKY}.
\printbibliography
\end{document}
and the main test_main.tex:
\documentclass{article}
\input{preamble.tex}
\usepackage{standalone}
\begin{document}
test3 \cite{Boncella_1984}
\input{./test_include.tex}
\end{document}
In this example I can compile test_include.tex without any problem.
But when I try to compile test_main.tex as it I get the 2nd problem at first compilation. And if I comment the line \input{./test_include.tex}, I get the 1st problem at biber compilation.
standaloneis a tricky beast, in particular when used withbiblatex, see for example also https://tex.stackexchange.com/q/267727/35864 – moewe Jan 22 '19 at 16:00group=falsefrom thestandalonepackage seems to solve the 2nd problem. – R. N Jan 22 '19 at 16:31