Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My promoteur has a very unusual requirement: the bibliography needs to be sorted first by specific type of refered item, next by author and by year of publication.

I managed to get this custom sorting done by using makebst and manually editing bst, but now there is even greater problem for me: the bibliography itselft must be sectioned, so it shoud look something like this:


Sources

Aahn, A. 2008, whatever dude

Aahn, A. 2009, whatever dude, really

Dictionaries

Encyclopeadia of everythinga, 1999

Wikipaedia, 2000-today

Articles

Aahn, B. and Boss, C., 1889 This issue is not to our concern, good man

Other Materia

Bactera, E.C., 1987, How we totally not-wiped the whole earth.


Can this be done automagicly with bibtex? Or do I have to edit the generated file manually?

share|improve this question
1  
You could modify lockstep's excellent solution to this similar problem... –  Seamus Jun 8 '11 at 13:29
add comment

1 Answer 1

up vote 18 down vote accepted

There are several ways to have separate bibliographies by type of items cited. I'll describe here some of them, namely:

BibTeX

There are several, more or less complicated solutions to separate bibliographies by type with bibtex, but that's not "automagicly" at all...

Using splitbib

You can do that with the splitbib package, you have to define a bibliographic category and manually add the corresponding itens to it, something like this:

\begin{category}[A]{First category}
\SBentries{entry1,entry4}
\end{category}

Here's a MWE:

\documentclass{article}
\usepackage{splitbib}
\begin{category}[A]{First category}
  \SBentries{article-minimal,article-full}
\end{category}
\begin{category}[B]{Second category}
  \SBentries{book-minimal,book-full}
\end{category}
\begin{document}
\cite{article-minimal,article-full,book-minimal,book-full}
\bibliography{xampl.bib}
\bibliographystyle{plain}
\end{document}

splitbib example

Check splitbib documentation for more details.

Using bibtopic

As with splitbib, bibtopic aims at other possible usages besides separate bibliographies by type.

Since it requires separate databases for each bibliography section, it is more indicated when you already them as such (i.e., separate .bib files for each kind of item).

The usage is basically, e.g.:

\begin{btSect}{books}
\section{References from books}
\btPrintCited     % for cited references
\btPrintNotCited  % for references not cited
\end{btSect}

Here's a MWE:

\documentclass{article}
\usepackage{bibtopic}
\begin{filecontents}{books.bib}
@BOOK{book-minimal,
   author = {Donald E. Knuth},
   title = {Seminumerical Algorithms},
   publisher = {Addison-Wesley},
   year = {1981},
}
@BOOK{book-full,
   author = {Donald E. Knuth},
   title = {Seminumerical Algorithms},
   volume = 2,
   series = {The Art of Computer Programming},
   publisher = {Addison-Wesley},
   address = {Reading, Massachusetts},
   edition = {Second},
   month = {10~} # jan,
   year = {1981},
}
\end{filecontents}
\begin{filecontents}{articles.bib}
@ARTICLE{article-minimal,
   author = {L[eslie] A. Aamport},
   title = {The Gnats and Gnus Document Preparation System},
   journal = {\mbox{G-Animal's} Journal},
   year = 1986,
}
@ARTICLE{article-full,
   author = {L[eslie] A. Aamport},
   title = {The Gnats and Gnus Document Preparation System},
   journal = {\mbox{G-Animal's} Journal},
   year = 1986,
   volume = 41,
   number = 7,
   pages = {73+},
   month = jul,
   note = {This is a full ARTICLE entry},
}
@ARTICLE{article-notcited,
   author = {L[eslie] A. Aamport},
   title = {The Gnus and Gnats Document Preparation System},
   pages = "73+",
   journal = {\mbox{G-Animal's} Journal},
   year = 1987,
   volume = 42,
   number = 8,
   month = jul,
}
\end{filecontents}
\begin{document}
\bibliographystyle{alpha}
\section{Testing}
Let’s cite all the books: \cite{book-minimal,book-full}; and articles:
\cite{article-minimal,article-full}.
\begin{btSect}{books}
\section{References from books}
\btPrintCited
\end{btSect}
\begin{btSect}[plain]{articles}
\section{References from articles}
\btPrintCited
\section{Articles not cited}
\btPrintNotCited
\end{btSect}
\end{document}

bibtopic example

Notice that bibtopic requires a bibtex pass for each section, so you should compile it with

latex <file>
bibtex <file>1
bibtex <file>2
...
bibtex <file>n
latex <file>
latex <file>

Check bibtopic documentation for more details.

Using multibib

As with splitbib, and bibtopic, multibib aims at other possible usages besides separate bibliographies by type.

It does not require separate databases, but it creates a special citation command for each type of item you define in the preamble.

The basic usage is to create a new citation type in the preamble with:

\newcites{mytype}{A Header for your special bibliographic type(s)}

And then cite the entries that should be considered in the new type with a \cite<newcites-arg> command, e.g. \citemytype.

Here's a MWE:

\documentclass{article}
\usepackage{multibib}
\newcites{book}{Books}
\begin{document}
\citebook{book-full,book-minimal}

\cite{article-minimal,article-full}
\bibliographystylebook{alpha}
\bibliographybook{xampl}
\renewcommand{\refname}{Other References}
\bibliographystyle{plain}
\bibliography{xampl}
\end{document}

multibib example

Notice that (as with bibtopic) it requires special bibtex passes:

latex <file>
bibtex <file>
bibtex <mytype>
latex <file>
latex <file>

Check multibibdocumentation for more details.

Using biblatex

You can do this quite "automagicly" with the biblatex package! The usage is as simple as:

\printbibliography[type=book]
\printbibliography[type=collection]
\printbibliography[type=thesis]

or by adding a keywords field to your bib entry, and splitting it the bibliography with

\printbibliography[keyword=keyword1]
\printbibliography[keyword=keyword2]

or by creating categories like with the splitbib package, with something like

\DeclareBibliographyCategory{<category>}
\addtocategory{<category>}{<key>}

Here's a MWE using the first mentioned option:

\documentclass{article}
\usepackage[style=numeric]{biblatex}
\addbibresource{xampl.bib}
\begin{document}
\cite{article-minimal,article-full,book-minimal,book-full}
\printbibliography[type=article,title={Articles}]
\printbibliography[type=book,title={Books}]
\end{document}

biblatex example

Check biblatex documentation for more information.

To move to biblatex, I suggest you read the following questions:

share|improve this answer
    
Thanks @henriqe, that was the spot on answer I was looking for. now I just have to style splitbib an it's done. –  Johnny_Bit Jun 8 '11 at 15:24
1  
ok @johnny_bit, but i really suggest you consider using biblatex! –  henrique Jun 8 '11 at 16:25
    
Oh, thank you! That helped me a lot! –  user19502 Jul 1 '13 at 12:55
    
Are you sure this work? I'm using biblatex, added keywords = {keyword1} to my bib file, and then tired printing \printbibliography[keyword=keyword1]. Nothing happened, even after deleting auxiliary files and running everything again. I still got Keyword 'keyword1' not found on line.... error –  user19502 Jul 1 '13 at 15:09
1  
@user19502, I'm pretty positive it works. Perhaps you've mispelled the entry field (a very common mistake I do), since the field is keywords and the command option keyword? –  henrique Jul 1 '13 at 22:24
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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