9

I have a @string definition stored in a file abrv.bib. I would like to combine this abbreviations file with a bib file 'entry.bib' containing an entry to create a list of references for a particular section of my document. I have been able to do this successfully with biblatex for one section, but am finding it quite difficult to do for multiple sections. I have included a small example that illustrates my problem.

My @string definition in abrv.bib is being used in entry1.bib and entry2.bib. The output from biber indicates that abrv.bib is found when processing section 1, but not for section 2. The resulting document will contain correct references for section 1, but contains the references with section 2 with blanks where the @string macros are supposed to expand.

How can I get abrv.bib to be used for both references sections? Am I doing something wrong? Is this a bug?

I am using pdflatex from TeX Live 2012, biber v1.6, and biblatex 2.6.

file.tex:

\documentclass{article}

\usepackage[backend=biber]{biblatex}

\addsectionbib[datatype=bibtex]{./abrv.bib}
\addsectionbib[datatype=bibtex]{./entry1.bib}
\addsectionbib[datatype=bibtex]{./entry2.bib}

\begin{document}

\section{Section 1}

\begin{refsection}[abrv,entry1]
  \nocite{*}
\end{refsection}
\printbibliography[section=1,title=\null]

\section{Section 2}

\begin{refsection}[abrv,entry2]
  \nocite{*}
\end{refsection}
\printbibliography[section=2,title=\null]

\end{document}

abrv.bib

@string{AUTHOR = "Author"}

entry1.bib

@book{ key1,
  author = AUTHOR,
  title = "Title1",
  publisher = "Publisher",
  year = 2013
}

entry2.bib

@book{ key2,
  author = AUTHOR,
  title = "Title2",
  publisher = "Publisher",
  year = 2013
}

Biber output:

INFO - This is Biber 1.6
INFO - Logfile is 'file.blg'
INFO - Reading 'file.bcf'
INFO - Found 0 citekeys in bib section 0
INFO - Using all citekeys in bib section 1
INFO - Found 0 citekeys in bib section 0
INFO - Using all citekeys in bib section 2
INFO - Found 0 citekeys in bib section 0
INFO - Processing section 1
INFO - Looking for bibtex format file 'abrv.bib' for section 1
INFO - Found BibTeX data source 'abrv.bib'
INFO - Looking for bibtex format file 'entry1.bib' for section 1
INFO - Found BibTeX data source 'entry1.bib'
INFO - Overriding locale 'en_US.UTF-8' default tailoring 'variable = shifted' with 'variable = non-ignorable'
INFO - Sorting 'entry' list 'nty' keys
INFO - No sort tailoring available for locale 'en_US.UTF-8'
INFO - Processing section 2
INFO - Looking for bibtex format file 'abrv.bib' for section 2
INFO - Looking for bibtex format file 'entry2.bib' for section 2
INFO - Found BibTeX data source 'entry2.bib'
WARN - BibTeX subsystem: /var/folders/q5/gq1zmtqd46b4fvqx73m25hw00000gn/T/SZ8HSBpKix/entry2.bib_8957.utf8, line 2, warning: undefined macro "AUTHOR"
WARN - The field 'author' in entry 'key2' cannot be null, deleting it
INFO - Overriding locale 'en_US.UTF-8' default tailoring 'variable = shifted' with 'variable = non-ignorable'
INFO - Sorting 'entry' list 'nty' keys
INFO - No sort tailoring available for locale 'en_US.UTF-8'
INFO - Writing 'file.bbl' with encoding 'ascii'
INFO - Output to file.bbl
INFO - WARNINGS: 2
  • 1
    It seems to me that your MWE is fine and possibly this is a bug in biber... In fact, if I change the backend to backend=bibtex and compile the bibliographies with bibtex, all is fine (your @string is seen in both of them). – karlkoeller Jun 13 '13 at 5:42
8

The problem here is that by default biber clears bibtex macros between refsections. I have changed this default and added a new option clrmacros for version 1.7 which you can get from the SF "development" folder.

EDIT: I have just updated biblatex 2.7 dev version with a fix which makes global bib resources work better with this so you can do (i.e. it fixes your case II).

\documentclass{article}
\usepackage{biblatex}
\addglobalbib{test3.bib}
\begin{document}

\section{Section 1}

\begin{refsection}[test3-1.bib]
  \nocite{*}
\end{refsection}
\printbibliography[section=1,title=\null]

\section{Section 2}

\begin{refsection}[test3-2.bib]
  \nocite{*}
\end{refsection}
\printbibliography[section=2,title=\null]

\end{document}
  • I'm not aware of what's happening underneath the refsection calls, but it seems that clearing the macros would be fine as long as the macros in abrv.bib were reprocessed for the next refsection (as it is specified as a resource in both calls to \begin{refsection}). However, to clarify your changes in 1.7: would I continue to specify abrv.bib as a resource in both calls to \begin{refsection}? Or, as an alternative, can I declare abrv.bib as a global resource that will now be used by both refsection? I appreciate the help! – Jeff Wildman Jun 13 '13 at 15:58
  • After trying out 1.7, my original MWE works as intended - thanks! Some additional notes with respect to the MWE for those curious. I) Excluding abrv.bib as a resource in the second refsection will also work, as the macros carry over from the first refsection. II) Specifying a global abrv.bib and not explicitly specifying it as a resource in refsections causes the first refsection to miss the macros. III) Specifying a global abrv.bib will work if at least the first refsection specifies abrv.bib as a resource. – Jeff Wildman Jun 13 '13 at 16:30
  • I have updated the solution with a note about a biblatex (not biber) fix which addresses another aspect of this (your case II - which should work). – PLK Jun 13 '13 at 17:48

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.