4

I am looking for a solution to reset the spacing between the label and the entry block in a biblatex bibliography but until now I did not find a way to do it.

I have two different bibliographies in my document. One is for standards which have a pretty long key and the other one is for everything else with the standard definition of the labelalpha key.

The automatically calculated spacing between key and entry block is okay for the bibliography with the standards but will lead to very large empty space in the bibliography for the other entries.

Is there a way to reset the spaceing between bibliographies so it can be automatically adapted to the different bibliographies needs?

Here is a MWE:

\documentclass{article}

\begin{filecontents}{Biblio.bib}
@standard{ASI1234_1,
 year = {1999},
 title = {somethings special in the world, that has to be defined},
 urldate = {2012-09-10},
 number = {1234-1},
 date = {1999-04},
 type = {ASI BZN},
 version = {1999-04},
 organization = {{ASI BZN}}
}

@book{Asendorpf15,
 author = {Asendorpf, Jens B.},
 year = {2015},
 title = {Persönlichkeitspsychologie für Bachelor},
 edition = {3., aktualisierte Auflage},
 publisher = {{Springer Berlin Heidelberg}},
 isbn = {978-3-662-46454-0},
 language = {ger},
 location = {Berlin, Heidelberg, s.l.},
 series = {Springer-Lehrbuch},
 doi = {10.1007/978-3-662-46454-0}
}
\end{filecontents}

%%Definition einer Normenklasse für Biblatex
\begin{filecontents}{standards.dbx}
%Modifikation für Normen in Biblatex
\DeclareDatamodelEntryfields[standard]{number,type}
\end{filecontents}

%Pakete für das Literaturverzeichnis mit BibLatex und Einstellung
\usepackage[
    style=alphabetic,
%   style=draft,
    backend=biber,
    datamodel=standards]{biblatex}
\addbibresource{Biblio.bib}
\DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}} %et al. statt u.a.
%\DefineBibliographyStrings{ngerman}{and={\&}} % und zu & machen
\renewcommand*{\labelalphaothers}{} %Zeichen für mehrere Authoren in Abkürzung löschen

%Label für Standard
    \DeclareLabelalphaTemplate[standard]{
     \labelelement{ %
      \field{type} %
      } %
      \labelelement{ %
        \field{number} %
      } %
      \labelelement{ %
        \literal{:} %
      } %
      \labelelement{ %
        \field{year} %
      } %
    } %
%Eintrag Bibliographie    
    \DeclareBibliographyDriver{standard}{%
      \usebibmacro{bibindex}%
      \usebibmacro{begentry}%
      \printfield{type}%
      \setunit{\addspace}\newblock%
      \printfield{number}%
      \setunit{\addcolon}\newblock%
      \printfield{year}%
      \iffieldundef{month}{%
        \setunit{\addspace}\newblock}%
        {\setunit{\addperiod}}%
      \printfield{month} %
      \setunit*{\addspace}\newblock %
      \usebibmacro{title}%
   \usebibmacro{finentry}}


\begin{document}
Blablablabba \textcite{ASI1234_1} Blababab \textcite{Asendorpf15} 
\printbibliography[type=standard,title=Standards]
\printbibliography[nottype=standard]
\end{document}

This is the result: Large Spacing within bibliography

4

This is a feature introduced version 3.11 of biblatex: https://github.com/plk/biblatex/pull/723. You can enable this globally using locallabelwidth=true as global option or locally for specific bibliographies by passing the option to that \printbibliography commands directly.

See the edit history for older versions.

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@standard{ASI1234_1,
 year = {1999},
 title = {somethings special in the world, that has to be defined},
 urldate = {2012-09-10},
 number = {1234-1},
 date = {1999-04},
 type = {ASI BZN},
 version = {1999-04},
 organization = {{ASI BZN}}
}

@book{Asendorpf15,
 author = {Asendorpf, Jens B.},
 year = {2015},
 title = {Persönlichkeitspsychologie für Bachelor},
 edition = {3., aktualisierte Auflage},
 publisher = {{Springer Berlin Heidelberg}},
 isbn = {978-3-662-46454-0},
 language = {ger},
 location = {Berlin, Heidelberg, s.l.},
 series = {Springer-Lehrbuch},
 doi = {10.1007/978-3-662-46454-0}
}
\end{filecontents}

\begin{filecontents}{standards.dbx}
\DeclareDatamodelEntryfields[standard]{number,type}
\end{filecontents}

\usepackage[
    style=alphabetic,
    backend=biber,
    locallabelwidth,
    datamodel=standards]{biblatex}
\addbibresource{\jobname.bib}
\DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}}
\renewcommand*{\labelalphaothers}{}

    \DeclareLabelalphaTemplate[standard]{
     \labelelement{ %
      \field{type} %
      } %
      \labelelement{ %
        \field{number} %
      } %
      \labelelement{ %
        \literal{:} %
      } %
      \labelelement{ %
        \field{year} %
      } %
    } %

    \DeclareBibliographyDriver{standard}{%
      \usebibmacro{bibindex}%
      \usebibmacro{begentry}%
      \printfield{type}%
      \setunit{\addspace}\newblock%
      \printfield{number}%
      \setunit{\addcolon}\newblock%
      \printfield{year}%
      \iffieldundef{month}{%
        \setunit{\addspace}\newblock}%
        {\setunit{\addperiod}}%
      \printfield{month} %
      \setunit*{\addspace}\newblock %
      \usebibmacro{title}%
   \usebibmacro{finentry}}

\begin{document}
Blablablabba \textcite{ASI1234_1} Blababab \textcite{Asendorpf15}
\printbibliography[type=standard,title=Standards]
\printbibliography[nottype=standard]
\end{document}

The screenshot shows two bibliographies with different left margins

  • This next release is indeed full of goodies! – gusbrs Feb 26 '18 at 21:30
  • 2
    @gusbrs I'm feeling a bit stupid by now that I keep telling people how great it is and then things get delayed by me waiting a bit too long before deciding that as far as I am concerned we can release, then SourceForge going down, Biber builds not coming in, ... I don't even know if we are going to be able to make it before the TeX live freeze :-( – moewe Feb 26 '18 at 21:36
  • Well, I guess we have to be patient... The care with the commits is obviously granted and to be praised. And sometimes things are not in our hands. :-( But, the advertising is well deserved. I probably know only half of the story, and am really impressed. And anxious to put my hands on it! – gusbrs Feb 26 '18 at 23:25

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.