Edit. I edit my question in order to make it clearer.
Preamble. Thanks to filecontents environment, the compilation of the following with pdflatex generates two subfiles:
- a bibliographic file:
subfile.bib, - a complete
.texfile:subfile.tex, that can eventually be processed bypdflatex(+biber, etc.) in order to get a nicesubfile.pdfwith the bibliography provided bysubfile.bib.
Note that, thanks to the standalone package with its sort option, the main.tex file \inputs the complete subfile.tex without any problem: its compilation with pdflatex (+ biber, etc.) goes smoothly and we also get a nice main.pdf with the bibliography provided by subfile.bib.
% Generates subfile.bib
\begin{filecontents}{subfile.bib}
@book{foo,
title = {Foo},
author = {Bar},
date = {2015-01-01}
}
\end{filecontents}
%
% Generates subfile.tex
\begin{filecontents}{subfile}
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{subfile.bib}
\begin{document}
Look at \autocite{foo}.
\printbibliography
\end{document}
\end{filecontents}
%
% Main file `main.tex`
\documentclass{article}
\usepackage[%
sort
% ,group=false
]{standalone}
\usepackage[backend=biber]{biblatex}
\begin{document}
\input{subfile}
\end{document}
The point is, if group=false is commented out in main.tex, then its pdflatex compilation is still okay, but its biber compilation fails with the error:
INFO - This is Biber 2.1
INFO - Logfile is 'main.blg'
INFO - Reading 'main.bcf'
:2239: parser error : Premature end of data in tag section line 2237
^
:2239: parser error : Premature end of data in tag controlfile line 2
and indeed, the two corresponding XML tags in this main.bcf file are not closed.
The standalone package stipulates that:
if
group=true(default), thedocumentenvironment of the subfile is turned into an environment which does nothing, besides adding the usual group. If set tofalsethis environment made transparent, so that no group is added.
Do you see why group=false (no group is added around the content of the subfile) gives this biber error?
Here is my file list:
*File List*
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
standalone.sty 2015/07/15 v1.2 Package to include TeX sub-files with preambl
es
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
xkeyval.sty 2014/12/03 v2.7a package option processing (HA)
xkeyval.tex 2014/05/09 v2.6d key=value parser (HA)
currfile.sty 2013/02/01 v0.7b Provides the file path elements of the current
input file
kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO)
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
filehook.sty 2011/10/12 v0.5d Hooks for input files
main.sta
gincltex.sty 2011/09/04 v0.3 Include external LaTeX files like graphics
svn-prov.sty 2010/04/24 v3.1862 Package Date/Version from SVN Keywords
adjustbox.sty 2012/05/21 v1.0 Adjusting TeX boxes (trim, clip, ...)
adjcalc.sty 2012/05/16 v1.1 Provides advanced setlength with multiple back-
ends (calc, etex, pgfmath)
trimclip.sty 2012/05/16 v1.0 Trim and clip general TeX material
graphicx.sty 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
collectbox.sty 2012/05/17 v0.4b Collect macro arguments as boxes
tc-pdftex.def 2012/05/13 v1.0 Clipping driver for pdftex
ifoddpage.sty 2011/09/13 v1.0 Conditionals for odd/even page detection
varwidth.sty 2009/03/30 ver 0.92; Variable-width minipages
filemod-expmin.sty 2011/09/19 v1.2 Get and compare file modification times (
expandable; minimal)
biblatex.sty 2015/04/19 v3.0 programmable bibliographies (PK/JW/AB)
biblatex2.sty 2015/04/19 v3.0 programmable bibliographies (biber) (PK/JW/AB)
etoolbox.sty 2015/08/02 v2.2a e-TeX tools for LaTeX (JAW)
logreq.sty 2010/08/04 v1.0 xml request logger
logreq.def 2010/08/04 v1.0 logreq spec v1.0
ifthen.sty 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
blx-dm.def
biblatex-dm.cfg
blx-compat.def 2015/04/19 v3.0 biblatex compatibility (PK/JW/AB)
biblatex.def
standard.bbx 2015/04/19 v3.0 biblatex bibliography style (PK/JW/AB)
numeric.bbx 2015/04/19 v3.0 biblatex bibliography style (PK/JW/AB)
numeric.cbx 2015/04/19 v3.0 biblatex citation style (PK/JW/AB)
biblatex.cfg
filecontents.sty 2011/10/08 v1.3 Create an external file from within a LaTeX
document
english.lbx 2015/04/19 v3.0 biblatex localization (PK/JW/AB)
main.sta
supp-pdf.mkii
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
epstopdf-base.sty 2010/02/09 v2.5 Base part for package epstopdf
grfext.sty 2010/08/19 v1.1 Manage graphics extensions (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
subfile.tex
***********
filecontentsenvironments before\documentclassto ensure that their contents is created exactly. I'm not saying that's the problem here, but it will cause problems at some point. – cfr Sep 16 '15 at 00:30filecontentsin the correct place doesn't solve the error you report, though. – cfr Sep 16 '15 at 00:59filecontentspackage to allowfilecontentsenvironment to be used after\documentclass. But I will edit my question for using it before\documentclassin order to not scramble the message. – Denis Bitouzé Sep 16 '15 at 05:19biblatexhooks into the document environment to add those closing XML tags, and that is prevented by overriding the document environment to an empty group. Do you need top usegroup=falseor is this a question just out of interest? Indeed you will find\AfterEndDocument{% \blx@auxwrite\blx@bcfout{}{% \blx@xml@endsection\blx@nl \csuse{blx@xml@slistsbib}% \blx@xml@endfile}% \immediate\closeout\blx@bcfout}}inbiblatex2.styso at least the</bcf:controlfile>tag is closed after\end{document}– moewe Sep 16 '15 at 06:06standalonepackage to be loaded with both optionssortand (because of http://tex.stackexchange.com/q/232185/18401)group=false. – Denis Bitouzé Sep 16 '15 at 06:20\AfterEndDocumentseems to work at least to some extend with bothgroup=falseandgroup=true(\AfterEndDocument{\typeout{foo}}works fine with both settings). But it really looks as if the\AfterEndDocument{hook is ignored ... – moewe Sep 16 '15 at 06:35etoolboxbefore thestandalonepackage in the main file. – moewe Sep 16 '15 at 08:03biblatexloads itselfetoolboxand needs, in my context to be loaded afterstandalone. So I guessed such a (silent) reload ofetoolboxafterstandalonewould overwrite the benefit of explicitly loading the former before the latter... but I was wrong :) Maybe such a trick reflects thatetoolbox/standaloneinteraction could be improved. Anyway, I let you the precedence of the answer :) – Denis Bitouzé Sep 16 '15 at 08:30biblatexbeforestandalonewas my first try, but that does not work (because of the whole subfile procedure) so we have to loadetoolboxexplicitly beforestandalone. – moewe Sep 16 '15 at 08:53etoolboxtag. Hence, my question being tagged with bothetoolboxandstandalone, their authors should be warned. – Denis Bitouzé Sep 16 '15 at 09:13filecontentsdoes is overwrites even an existing file. egreg told me thatfilecontentsshould always come before\documentclass. Especially if you use any special characters, the contents is not written correctly otherwise. – cfr Sep 16 '15 at 10:08