2

This question already has an answer here:

I would like to generate a global bibliography with all the cited entries.

Problem: the same document uses also small bibliographies for chapters with refsection. The final \printbiblioraphy does not print anything because all citations are enclosed by refsection.

How to generate the whole bibliography while keeping the partial ones? (i.e. print all references regardless if they are inside a refsection or not)

MWE:

\documentclass{book}
\usepackage{biblatex}
\addbibresource{biblio.bib}

\begin{document}
\chapter{Test Chapter One}
\begin{refsection}

\cite{goossens93}, \cite{lamport94}, \cite{rahtz89}
\printbibliography[heading=subbibliography]
\end{refsection}

\chapter{Test Chapter Two}

\begin{refsection}
\cite{greenwade93}, \cite{patashnik88}, \cite{knuth79}
\printbibliography[heading=subbibliography]
\end{refsection}


\printbibliography[title=The whole bibliography]

\end{document}

biblio.bib

@book{goossens93,
    author = "Michel Goossens and Frank Mittlebach and Alexander Samarin",
    title = "The Latex Companion A",
    year = "1993",
    publisher = "Addison-Wesley",
    address = "Reading, Massachusetts"

}

@article{greenwade93, 
    author = "George D. Greenwade",
    title = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year = "1993",
    journal = "TUGBoat",
    volume = "14",
    number = "3",
    pages = "342--351",
           url=" www.ctan.org"
}

@book{knuth79,
    author = "Donald E. Knuth",
    title = "Tex and Metafont, New Directions in Typesetting",
    year = "1979",
    publisher = "American Mathematical Society and Digital Press",
    address = "Stanford"
}

@book{lamport94,
    author = "Leslie Lamport",
    title = "Latex: A Document Preparation System",
    year = "1994",
    edition = "Second",
    publisher = "Addison-Wesley",
    address = "Reading, Massachusetts"
}

@misc{patashnik88,
    author = "Oren Patashnik",
    title = "{B}ib{T}e{X}ing.  Documentation for General {B}ib{T}e{X} users",
    year = "1988",
    howpublished = "Electronic document accompanying BibTeX
distribution"
}

@techreport{rahtz89,
    author = "Sebastian Rahtz",
    title = "A Survey of {T}ex and graphics",
    year = "1989",
    institution = "Department of Electronics and Computer Science",
    address = "University of Southampton, UK",
    number = "CSTR 89-7"
}

marked as duplicate by Moriambar, TeXnician, CarLaTeX, ebosi, user36296 Jun 8 '17 at 14:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Did you try a \nocite{*}? – TeXnician Jun 8 '17 at 10:34
  • @TeXnician nocite would print also entries which are not cited but present in the .bib database. I just want the cited ones. – ppr Jun 8 '17 at 10:39
3

Given biblatex's documentation, I'm not really sure why using refsegment works, but apparently it does (credit to @pst here: https://tex.stackexchange.com/a/168728/105447)

Like:

\documentclass{book}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@book{goossens93,
    author = "Michel Goossens and Frank Mittlebach and Alexander Samarin",
    title = "The Latex Companion A",
    year = "1993",
    publisher = "Addison-Wesley",
    address = "Reading, Massachusetts"

}

@article{greenwade93, 
    author = "George D. Greenwade",
    title = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year = "1993",
    journal = "TUGBoat",
    volume = "14",
    number = "3",
    pages = "342--351",
           url=" www.ctan.org"
}

@book{knuth79,
    author = "Donald E. Knuth",
    title = "Tex and Metafont, New Directions in Typesetting",
    year = "1979",
    publisher = "American Mathematical Society and Digital Press",
    address = "Stanford"
}

@book{lamport94,
    author = "Leslie Lamport",
    title = "Latex: A Document Preparation System",
    year = "1994",
    edition = "Second",
    publisher = "Addison-Wesley",
    address = "Reading, Massachusetts"
}

@misc{patashnik88,
    author = "Oren Patashnik",
    title = "{B}ib{T}e{X}ing.  Documentation for General {B}ib{T}e{X} users",
    year = "1988",
    howpublished = "Electronic document accompanying BibTeX
distribution"
}

@techreport{rahtz89,
    author = "Sebastian Rahtz",
    title = "A Survey of {T}ex and graphics",
    year = "1989",
    institution = "Department of Electronics and Computer Science",
    address = "University of Southampton, UK",
    number = "CSTR 89-7"
}
\end{filecontents*}

\usepackage{biblatex}
\addbibresource{\jobname.bib}

\begin{document}
\chapter{Test Chapter One}
\begin{refsegment}

\cite{goossens93}, \cite{lamport94}, \cite{rahtz89}
\printbibliography[segment=\therefsegment,heading=subbibliography]
\end{refsegment}

\chapter{Test Chapter Two}

\begin{refsegment}
\cite{greenwade93}, \cite{patashnik88}, \cite{knuth79}
\printbibliography[segment=\therefsegment,heading=subbibliography]
\end{refsegment}


\printbibliography[title=The whole bibliography]

\end{document}

In any case, besides working for the purpose, the use of refsegment instead of refsection seems to be advisable for the case for, if you will have a global bibliography for the book, refsegment will produce globally unambiguous labels, while refsection won't.

  • 1
    If you are still inside the refsegment when you call \printbibliography, you can use refsegment=\therefsegment instead of giving the number manually. That saves trouble later on. – moewe Jun 8 '17 at 12:25
  • Nice, I edited the answer accordingly. Thanks! By the way, @moewe, would you care to explain why this works? As far as I could get from biblatex's documentation, refsegment and refsection differ in local/global labels, but not much more than that. But that's not really the case isn't it? Are there any other macros or options such as \therefsegment in this context, e.g. segment=\all or segment={2,4,5}? – gusbrs Jun 8 '17 at 19:32
  • 1
    refsection and refsegment differ 'only' in the local/global scope. (And in how \printbibliography handles them: by default \printbibliography prints all refsegments, but only the current refsection.) But that is a crucial difference. Local labels mean that you can't expect the same entry to have the same label across refsections. You can't even expect the entry to exist in other refsections. Refsegments, however, are more like filters: All entries still exists (and are disambiguated etc.), you can simply mark some entries as belonging to a section and print them accordingly. – moewe Jun 9 '17 at 5:50
  • 1
    A refsegment can see entries of other refsegments (and does all that is necessary to accommodate this fact); a refsection cannot see the entries of other refsections (it therefore does not need to 'sync' up with them). In a way segment=\all is the default, and I don't think you can say segment={2,4,5} (off the top of my head, why don't you just try it?), but you can use bibfilters and bibchecks for that. – moewe Jun 9 '17 at 5:51
  • @moewe, interesting. I get better how it works now. Ingenious indeed. Thanks! – gusbrs Jun 9 '17 at 10:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.