1

I use labels before entries in the bibliography, just as in the solution given in Bibliography styles like authordate2 in biblatex or natbib?, which works like a charm. However, I need to limit the labels to just the first part of the bibliography (being the second dedicated to online sources without author) which I manage with filters as per MWE. I'm using biblatex, biber, APA style, italian. I edit on Sharelatex.com.

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}    
\usepackage[italian]{babel}
\usepackage[babel]{csquotes}
\usepackage[style=apa,backend=biber]{biblatex}         
\DeclareLanguageMapping{italian}{italian-apa}

%LABELS
\defbibenvironment{bibliography}
  {\list
     {
        \printtext[]{%
            \begingroup
            \defcounter{maxnames}{\value{mymaxcitenames}}%
            \printnames{labelname}%
            \setunit{\nameyeardelim}%
            \printfield{labelyear}% 
            \printfield{extrayear}%
            \endgroup
            }%
        }
     {\setlength{\labelwidth}{100pt}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hfill##1\hss}
      }
  {\endlist}
  {\item}


\defbibfilter{online}{
    type=online
}

\defbibfilter{offline}{
    type=book or
    type=article or
    type=report
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}

@online{cit1,
  title = {Title},
  url = {http://www.website.com},
  timestamp = {2013-04-11T17:20:44Z},
  titleaddon = {Example},
  urldate = {2013-04-10},
  date = {2004}
}

@report{cit2,
  author = {BBBAuthor, Name},
  title = {Title Title Title},
  url = {http://www.example.com},
  timestamp = {2013-04-11T17:20:44Z},
  titleaddon = {Website Name},
  urldate = {2013-04-10},
  date = {2004}
}

@book{cit3,
  location = {Location},
  title = {Title Title},
  timestamp = {2016-02-01T21:50:03Z},
  langid = {english},
  publisher = {Publisher},
  author = {Author, Name},
  date = {2001}
}

\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}

\begin{minipage}{\textwidth}

Bla bla\footnote{\cite[]{cit1}, \url{http://www.website.com}}.
Bla\footnote{\cite[]{cit2}, \url{http://www.example.com}}.
Blaaa blaa bla\footcite[]{cit3}.

\printbibliography[heading=bibintoc,filter=offline,title={Bibliography}]
\printbibliography[title={Online},filter=online,heading=subbibliography]

\end{minipage}

\end{document}
1
1

That should be as easy as renaming your new bibliography environment to bibwithlabels, say.

\defbibenvironment{bibliography}
  {\list
     {
        \printtext[]{%
            \begingroup
            \defcounter{maxnames}{\value{mymaxcitenames}}%
            \printnames{labelname}%
            \setunit{\nameyeardelim}%
            \printfield{labelyear}% 
            \printfield{extrayear}%
            \endgroup
            }%
        }
     {\setlength{\labelwidth}{100pt}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hfill##1\hss}
      }
  {\endlist}
  {\item}

and use that for the offline bibliography with the env option

\printbibliography[heading=bibintoc,filter=offline,title={Bibliography},env=bibwithlabels]
\printbibliography[title={Online},filter=online,heading=subbibliography]

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.