2

In my document, I am printing varies subbibliographies using biblatex. Since I cite some norms and would like to use their full number for a shorthand, I get really wide margins on the left side.

Is there a possibility to specify these margins to either

  • be set to the maximum width of citation shorthands in this subbibliography

  • be set to a manually chosen value.

One of this options would suffice.

My MWE looks as follows:

\documentclass{article}
\usepackage[style=alphabetic,   % Zitierstil
        maxbibnames=6,          % Anzahl an AUtoren, die in Bibliographie gezeigt werden
        minbibnames=2,
        sorting=anyt,
        backend=biber]{biblatex}

\addbibresource{test.bib}

\begin{document}
\nocite{*}

\printbibheading
\printbibliography[type=book,heading=subbibliography,title=Books]
\printbibliography[type=online,heading=subbibliography,title=Online]

\end{document}

With the following in the file test.bib:

@book{adams,
  author =   {Douglas Adams},
  title =    {The hitchhikers guide to the universe},
  publisher =    {Publisher},
  year =     {2042}
}

@online{myboringexamplewebpage,
  title = {My boring example webpage},
  url = {http://www.example.com},
  author = {{Myself}},
  urldate = {2015-02-04},
  shorthand = {myexamplewebpagefrom2015}
}

Here the online resource works as an example for the norms with long shorthands. So I would like the space between shorthand and reference in the first subbibliography to be smaller, according to the actual width of the shown shorthand.

enter image description here

  • 1
    Quick and dirty and relatively ad hoc: \begingroup \settowidth\labelalphawidth{[Ada42]} \printbibliography[type=book,heading=subbibliography,title=Books] \endgroup. – jon Feb 08 '15 at 19:06
  • @jon wow, thanks, that works nicely! In this case I prefer quick and dirty over laborious and clean. Feel free to post it as an answer – Paul Paulsen Feb 08 '15 at 19:36
  • Glad it suits your needs! – jon Feb 08 '15 at 20:33

2 Answers2

2

Here's the "manually chosen value" approach:

Set the relevant 'labelwidth' inside a group. If you know the 'exact' width you want -- e.g., the width of the string [Ada42] -- you can use the command \settowidth; otherwise a \setlength could be used.

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{adams,
  author =   {Douglas Adams},
  title =    {The hitchhikers guide to the universe},
  publisher =    {Publisher},
  year =     {2042}
}

@online{myboringexamplewebpage,
  title = {My boring example webpage},
  url = {http://www.example.com},
  author = {{Myself}},
  urldate = {2015-02-04},
  shorthand = {myexamplewebpagefrom2015}
}
\end{filecontents*}

\usepackage[style=alphabetic,   % Zitierstil
        maxbibnames=6,          % Anzahl an AUtoren, die in Bibliographie gezeigt werden
        minbibnames=2,
        sorting=anyt,
        backend=biber]{biblatex}

\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}

\printbibheading
\begingroup
% \labelalphawidth is the relevant value for the 'alphabetic' style
\settowidth\labelalphawidth{[Ada42]}% 
% \setlength\labelalphawidth{4em}% <-- easier to err on the side of caution this way; but make sure it is larger than the largest label...
\printbibliography[type=book,heading=subbibliography,title=Books]
\endgroup
\printbibliography[type=online,heading=subbibliography,title=Online]

\end{document}
jon
  • 22,325
2

The locallabelwdith option can help here. See Reset spacing between label and entry in different bibliographies.

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{adams,
  author    = {Douglas Adams},
  title     = {The hitchhikers guide to the universe},
  publisher = {Publisher},
  year      = {2042}
}

@online{myboringexamplewebpage,
  title     = {My boring example webpage},
  url       = {http://www.example.com},
  author    = {{Myself}},
  urldate   = {2015-02-04},
  shorthand = {myexamplewebpagefrom2015}
}
\end{filecontents*}

\usepackage[style=alphabetic,
        maxbibnames=6,
        minbibnames=2,
        sorting=anyt,
        locallabelwidth,
        backend=biber]{biblatex}

\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}

\printbibheading
\printbibliography[type=book,heading=subbibliography,title=Books]
\printbibliography[type=online,heading=subbibliography,title=Online]
\end{document}

Two bibliographies with different left indentations.

moewe
  • 175,683