2

I am trying to have different styles (alphabetic and numeric for two separate bibliographies in my work like in here).

I compile the file twice: once with Biber, once without it. After several tries it works but what I get is that for the second bibliography, it is numbered alphabetically (a, b, c, etc.). Is there a way to have it in style alpha with part of the author name and year, example: [Ein05]

1
  • Note that the answer to the other question does not actually attempt to make the second bibliography alphabetic in the sense of style=alphabetic, but rather uses an alphabetic counter for what is still essentially a numeric style.
    – moewe
    Mar 30 '16 at 6:43
2

Let's assume all the entries you want numeric have the keyword primary, while all the other entries should be given with alphabetic labels.

Then you can use

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[style=alphabetic,labelnumber,defernumbers,backend=biber]{biblatex}

\addbibresource{biblatex-examples.bib}

\renewbibmacro*{cite}{%
  \printtext[bibhyperref]{%
    \printfield{prefixnumber}%
    \ifkeyword{primary}
      {\printfield{labelnumber}}
      {\printfield{labelalpha}%
       \printfield{extraalpha}}}}

\defbibenvironment{numericbib}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{prefixnumber}%
        \printfield{labelnumber}}}
     {\setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}
\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}

\begin{document}
\cite{aristotle:physics,sigfridsson,worman,aristotle:poetics}
\printbibheading
\printbibliography[heading=subbibliography,title={Numeric Bib},keyword=primary,env=numericbib]
\printbibliography[heading=subbibliography,title={Alphabetic Bib},notkeyword=primary,omitnumbers]
\end{document}

example output

The idea is to branch the cite bibmacro on the keyword. We also need to request numeric citations (via the labelnumber option), but we drop the numbers for the alphabetic bibliography with omitnumbers. The numeric bibliography gets its own format so it can display the labels properly.

For biblatex versions >= 3.4 (not yet released, but can be tested as a development version) you will need to change prefixnumber to labelprefix in the above.

6
  • Thanks a lot, this is exactly what I wanted. But I still have a problem. If i don't put \printbibheading, I get the header of the last chapter for the bibliographie. If I put it , I get an empty page with just the title BIBLIOGRAPHIE then the header BIBLIOGRAPHIE Bibliographie for both types of referencesAlso I am getting a footer also with BIBLIOGRAPHIE which I don't need. I want for the first type to have Numeric Bib and Alphabetic Bib in the header and no footer or extra page . Mar 30 '16 at 12:15
  • Had to remove heading=subbibliographyfrom \printbibliography[heading=subbibliography,title={Numeric Bib},keyword=primary,env=numericbib] and the next one. Now it works fine for the header and footer but I still get the empty page with only the title bibliographie (references) in it. Mar 30 '16 at 12:27
  • @etudiant_is That probably has to do with your documentclass, you can open a new question with an MWE about it.
    – moewe
    Mar 30 '16 at 13:08
  • Ok, but I was not getting that page before. But I was not using either the \printbibheading either Mar 30 '16 at 13:48
  • @etudiant_is It will have to do with how your documentclass interacts with biblatex's heading commands, as you can see in the MWE above it is not just that biblatex randomly adds blank pages. So to investigate this further we need to see the code you actually use.
    – moewe
    Mar 30 '16 at 13:56

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.