11

I have a problem with my three subbibliographies. I am using two styles numeric and alphabetic. In one of the subbibliographies I would like to use a prefixnumber. Unfortunately this affects also the other two in the way, that the margin is being shifted by the length of the prefixnumber. Here is a MWE of my problem.

  \documentclass[a4paper,oneside]{article}

  \usepackage{filecontents}
  \begin{filecontents*}{bib.bib}
  @Article{aksin,
    author       = {Aks{\i}n, {\"O}zge and T{\"u}rkmen, Hayati and Artok, Levent
                    and {\k{C}}etinkaya, Bekir and Ni, Chaoying and
                    B{\"u}y{\"u}kg{\"u}ng{\"o}r, Orhan and {\"O}zkal, Erhan},
    title        = {Effect of immobilization on catalytic characteristics of
                    saturated Pd-N-heterocyclic carbenes in Mizoroki-Heck
                    reactions},
    journaltitle = jomch,
    date         = 2006,
    volume       = 691,
    number       = 13,
    pages        = {3027-3036},
    indextitle   = {Effect of immobilization on catalytic characteristics},
  }

  @Article{angenendt,
    author       = {Angenendt, Arnold},
    title        = {In Honore Salvatoris~-- Vom Sinn und Unsinn der
                    Patrozinienkunde},
    journaltitle = {Revue d'Histoire Eccl{\'e}siastique},
    date         = 2002,
    volume       = 97,
    pages        = {431--456, 791--823},
    hyphenation  = {ngerman},
    indextitle   = {In Honore Salvatoris},
    shorttitle   = {In Honore Salvatoris},
    annotation   = {A German article in a French journal. Apart from that, a
                    typical \texttt{article} entry. Note the \texttt{indextitle}
                    field},
  }

  @Article{baez/article,
    author       = {Baez, John C. and Lauda, Aaron D.},
    title        = {Higher-Dimensional Algebra V: 2-Groups},
    journaltitle = {Theory and Applications of Categories},
    date         = 2004,
    volume       = 12,
    pages        = {423-491},
    version      = 3,
    eprint       = {math/0307200v3},
    eprinttype   = {arxiv},
    hyphenation  = {english},
    annotation   = {An \texttt{article} with \texttt{eprint} and
                    \texttt{eprinttype} fields. Note that the arXiv reference is
                    transformed into a clickable link if \texttt{hyperref} support
                    has been enabled.  Compare \texttt{baez\slash online}, which
                    is the same item given as an \texttt{online} entry},
  }
  \end{filecontents*}


  \usepackage[T1]{fontenc}

  \usepackage[polish,ngerman,english]{babel}
  \usepackage[babel,german=quotes]{csquotes}
  \usepackage[style=numeric,sorting=none,defernumbers,labelalpha,babel=other,backend=biber]{biblatex}
  \addbibresource{bib.bib}

  \DeclareBibliographyCategory{student_works}
  \DeclareBibliographyCategory{own_pubs}
  \addtocategory{student_works}{angenendt}
  \addtocategory{own_pubs}{baez/article}


  \DeclareCiteCommand{\cite}[\mkbibbrackets]
    {\usebibmacro{prenote}}
     {\ifcategory{student_works}
       {{\usebibmacro{citeindex}%
           \printtext[bibhyperref]{%
             \printfield{prefixnumber}%
             \printfield{labelalpha}}}}
       {{\usebibmacro{citeindex}%
           \printtext[bibhyperref]{%
             \printfield{prefixnumber}%
             \printfield{labelnumber}}}}}%
    {\multicitedelim}%
    {\usebibmacro{postnote}}%


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


  \begin{document}

  \cite{aksin}
  \cite{angenendt}
  \cite{baez/article}

  \printbibliography[notcategory=student_works,notcategory=own_pubs,heading=bibintoc]

  \printbibliography[title=Second Bib,category=student_works,heading=bibintoc,sorting=ynt,env=student_works_env]

  \printbibliography[title=Third Bib,category=own_pubs,heading=bibintoc,sorting=ynt,prefixnumbers={VERYLONGPREFIX--}]

  \end{document}

The result looks like this enter image description here

I would appreciate any help!

  • 5
    This is by design. If you want different margins, use custom bibliography environments for the first two sub-bibliographies that set \labelwidth to something other than \labelnumberwidth or \labelalphawidth. – Audrey Sep 5 '13 at 20:57
  • @Audrey Make that an answer, please. – lockstep Dec 5 '13 at 13:24
3

biblatex 3.11 introduces the locallabelwdith option that calculates the width of labels not globally for all entries, but locally for each \printbibliography separately. See also Reset spacing between label and entry in different bibliographies

Modernising the code for biblatex 3.11 we end up with.

\documentclass[a4paper,oneside]{article}
\usepackage[T1]{fontenc}
\usepackage[polish,ngerman,english]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[style=numeric,sorting=none,defernumbers,labelalpha,backend=biber,locallabelwidth]{biblatex}
\addbibresource{biblatex-examples.bib}

\DeclareBibliographyCategory{student_works}
\DeclareBibliographyCategory{own_pubs}
\addtocategory{student_works}{angenendt}
\addtocategory{own_pubs}{baez/article}


\DeclareCiteCommand{\cite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
   {\ifcategory{student_works}
     {\usebibmacro{citeindex}%
      \printtext[bibhyperref]{%
        \printfield{labelprefix}%
        \printfield{labelalpha}%
        \printfield{extraalpha}}}
     {\usebibmacro{citeindex}%
      \printtext[bibhyperref]{%
        \printfield{labelprefix}%
        \printfield{labelnumber}}}}%
  {\multicitedelim}%
  {\usebibmacro{postnote}}%


\defbibenvironment{student_works_env}
  {\list
     {\printtext[labelalphawidth]{%
        \printfield{labelprefix}%
        \printfield{labelalpha}%
        \printfield{extraalpha}}}
     {\setlength{\labelwidth}{\labelalphawidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}
\DeclareFieldFormat{labelalphawidth}{\mkbibbrackets{#1}}


\begin{document}
\cite{aksin}
\cite{angenendt}
\cite{baez/article}

\printbibliography[notcategory=student_works,notcategory=own_pubs,heading=bibintoc]

\newrefcontext[sorting=ynt]
\printbibliography[title=Second Bib,category=student_works,heading=bibintoc,env=student_works_env]

\newrefcontext[sorting=ynt,labelprefix={VERYLONGPREFIX--}]
\printbibliography[title=Third Bib,category=own_pubs,heading=bibintoc]
\end{document}

The left margin in all bibliographies is different.

2

As @Audrey noted, setting \labelwidth different from \labelalphawidth or \labelnumberwidth allows fixing the indentation of the entries.

The following sets the \labelwidth to something that should usually be sufficient for standard labels, but might need to be adjusted manually in some cases:

output

  \documentclass[a4paper,oneside]{article}

  \usepackage{filecontents}
  \begin{filecontents*}{bib.bib}
  @Article{aksin,
    author       = {Aks{\i}n, {\"O}zge and T{\"u}rkmen, Hayati and Artok, Levent
                    and {\k{C}}etinkaya, Bekir and Ni, Chaoying and
                    B{\"u}y{\"u}kg{\"u}ng{\"o}r, Orhan and {\"O}zkal, Erhan},
    title        = {Effect of immobilization on catalytic characteristics of
                    saturated Pd-N-heterocyclic carbenes in Mizoroki-Heck
                    reactions},
    journaltitle = jomch,
    date         = 2006,
    volume       = 691,
    number       = 13,
    pages        = {3027-3036},
    indextitle   = {Effect of immobilization on catalytic characteristics},
  }

  @Article{angenendt,
    author       = {Angenendt, Arnold},
    title        = {In Honore Salvatoris~-- Vom Sinn und Unsinn der
                    Patrozinienkunde},
    journaltitle = {Revue d'Histoire Eccl{\'e}siastique},
    date         = 2002,
    volume       = 97,
    pages        = {431--456, 791--823},
    hyphenation  = {ngerman},
    indextitle   = {In Honore Salvatoris},
    shorttitle   = {In Honore Salvatoris},
    annotation   = {A German article in a French journal. Apart from that, a
                    typical \texttt{article} entry. Note the \texttt{indextitle}
                    field},
  }

  @Article{baez/article,
    author       = {Baez, John C. and Lauda, Aaron D.},
    title        = {Higher-Dimensional Algebra V: 2-Groups},
    journaltitle = {Theory and Applications of Categories},
    date         = 2004,
    volume       = 12,
    pages        = {423-491},
    version      = 3,
    eprint       = {math/0307200v3},
    eprinttype   = {arxiv},
    hyphenation  = {english},
    annotation   = {An \texttt{article} with \texttt{eprint} and
                    \texttt{eprinttype} fields. Note that the arXiv reference is
                    transformed into a clickable link if \texttt{hyperref} support
                    has been enabled.  Compare \texttt{baez\slash online}, which
                    is the same item given as an \texttt{online} entry},
  }
  \end{filecontents*}


  \usepackage[T1]{fontenc}

  \usepackage[polish,ngerman,english]{babel}
  \usepackage[babel,german=quotes]{csquotes}
  \usepackage[style=numeric,sorting=none,defernumbers,labelalpha,babel=other,backend=biber]{biblatex}
  \addbibresource{bib.bib}

  \DeclareBibliographyCategory{student_works}
  \DeclareBibliographyCategory{own_pubs}
  \addtocategory{student_works}{angenendt}
  \addtocategory{own_pubs}{baez/article}


  \DeclareCiteCommand{\cite}[\mkbibbrackets]
    {\usebibmacro{prenote}}
     {\ifcategory{student_works}
       {{\usebibmacro{citeindex}%
           \printtext[bibhyperref]{%
             \printfield{prefixnumber}%
             \printfield{labelalpha}}}}
       {{\usebibmacro{citeindex}%
           \printtext[bibhyperref]{%
             \printfield{prefixnumber}%
             \printfield{labelnumber}}}}}%
    {\multicitedelim}%
    {\usebibmacro{postnote}}%


  \defbibenvironment{student_works_env}
    {\list
       {\printtext[labelalphawidth]{%
        \printfield{prefixnumber}%
         \printfield{labelalpha}}}
       {\settowidth{\labelwidth}{Www8888}%
        %\setlength{\labelwidth}{\labelalphawidth}%
        \setlength{\leftmargin}{\labelwidth}%
        \setlength{\labelsep}{\biblabelsep}%
        \addtolength{\leftmargin}{\labelsep}%
        \setlength{\itemsep}{\bibitemsep}%
        \setlength{\parsep}{\bibparsep}}%
        \renewcommand*{\makelabel}[1]{\hss##1}}
    {\endlist}
    {\item}
  \DeclareFieldFormat{labelalphawidth}{\mkbibbrackets{#1}}

    \defbibenvironment{bibnumeric}
        {\list
            {\printtext[labelnumberwidth]{%
                \printfield{prefixnumber}%
                \printfield{labelnumber}}}
            { \settowidth{\labelwidth}{8888}%
                %\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}


  \begin{document}

  \cite{aksin}
  \cite{angenendt}
  \cite{baez/article}

  \printbibliography[notcategory=student_works,notcategory=own_pubs,heading=bibintoc,env=bibnumeric]

  \printbibliography[title=Second Bib,category=student_works,heading=bibintoc,sorting=ynt,env=student_works_env]

  \printbibliography[title=Third Bib,category=own_pubs,heading=bibintoc,sorting=ynt,prefixnumbers={VERYLONGPREFIX--}]

  \end{document}
  • I'm posting this for reference although the question is over a year old since I had a similar question here and was pointed to this - hopefully if someone runs into the same problem either of those questions will be found. – greyshade Aug 31 '14 at 13:09

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.