1

I'm creating a document that includes two separate bibliographies, which must be formatted differently. I found lockstep's excellent answer on question 10104 ( Two bibliographies with two different styles in the same document ), and I'm already using it.

I have loaded the authoryear bibliography style for the main bibliography. But the second bibliography must be formatted with the title before the author name.

Any suggestion on how to implement this?

  • This will require redefinition of the BibliographyDriver for each bib type in the style you desire. What is the base style of the second bibliography? Which types do you need (book, article...)? – cslstr May 22 '14 at 14:34
  • Also, it is best to include your own MWE (see here), even though you are branching off of a previous question. Your own needs are somewhat different than the original. – cslstr May 22 '14 at 14:36
  • Ah, ok, I'll keep that in mind. Thanks, @cslstr. – lclaudius May 22 '14 at 16:44
3

I haven't tested this exhaustively, and it probably doesn't work for some crazier titles with @inbook with booktitle or other extras that are similar.

Basically, I have added a flag that checks when we are in the bibliography where it is desired to have the title appear first. Then for those bibitems, we add a new title bibmacro to the beginning of the entry, and clear out the original title bibmacro. For other items with extra title fields, you may have to clear other fields out as well, depending on how you want it to work. (Some entry types don't use \usebibmacro{title}, but use \usebibmacro{maintitle+title}, for example; this does not take that into account.)

I added a few extra entries to demonstrate use.

Code

\documentclass{article}

\usepackage{biblatex}
\usepackage{etoolbox} % For boolean flags

\DeclareBibliographyCategory{cited}
\AtEveryCitekey{\addtocategory{cited}{\thefield{entrykey}}}

% Boolean flags to detect environment
\newbool{titlefirst}
% The following definition is copied from authortitle.bbx/authoryear.bbx
\defbibenvironment{nolabelbib}
  {\booltrue{titlefirst}\list
     {}
     {\setlength{\leftmargin}{\bibhang}%
      \setlength{\itemindent}{-\leftmargin}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}}
  {\endlist\boolfalse{titlefirst}}
  {\item}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
@misc{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
}
@misc{C03,
  author = {Cuthor, C.},
  year = {2003},
  title = {Charlie},
}
\end{filecontents}

\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\nocite{C03,companion,worman,piccato,aristotle:physics}

% Enable sort by title
\DeclareSortingScheme{titleauthor}{
\sort{\field{sorttitle}\field{title}}
\sort{\field{author}\field{editor}\field{translator}}}

% Redefine titlefirst to be the same as the original title from biblatex.def
\newbibmacro*{titlefirst}{%
  \ifboolexpr{
    test {\iffieldundef{title}}
    and
    test {\iffieldundef{subtitle}}
  }
    {}
    {\printtext[title]{%
       \printfield[titlecase]{title}%
       \setunit{\subtitlepunct}%
       \printfield[titlecase]{subtitle}}%
     \newunit}%
  \printfield{titleaddon}}

% Each bibitem, check if we're in titlefirst env
% If so, put a title at the beginning, clear original title bibmacro
\AtEveryBibitem{
  \ifbool{titlefirst}{
    \renewbibmacro*{begentry}{\usebibmacro{titlefirst}\newunit}
    \renewbibmacro*{title}{} % Clear original title bibmacro
  }
}

\begin{document}

\noindent Some text \autocite{A01,B02}.

\printbibliography[title={References},category=cited]

\printbibliography[env=nolabelbib,sorting=titleauthor,title={Further Reading},notcategory=cited]

% Print the first bibliography again to be sure we haven't ruined
% Something permanantly
\printbibliography[title={References},category=cited]

\end{document}

bibliography

  • Great! It worked like a charm. Thanks, @cslstr. – lclaudius May 22 '14 at 16:43

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.