0

I try to get rid of the hanging indent in my bibliography. The biblatex manual suggests \setlength{\bibhang}{0pt}, but it does not work in this case.

MWE:

\documentclass{article}

% arara: pdflatex
% arara: biber
% arara: pdflatex

\usepackage[
    backend=biber,
    style=chem-angew,
    articletitle=true,
    defernumbers=true
]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{D04,
  author = {Duthor, D.},
  year = {2004},
  volume = {1},
  pages = {2},
  title = {Nanoscale magnetic skyrmions in metallic films and multilayers: a new twist for spintronics Nanoscale magnetic skyrmions in metallic films and multilayers: a new twist for spintronics},
}

\end{filecontents}

\addbibresource{\jobname.bib}

\setlength{\bibhang}{0pt}

\begin{document}

Some text \cite{D04}.

\printbibliography

\end{document}

How do I avoid the indentation for the second (and third) line of the reference?

enter image description here

4

The bibliography environment for numeric and alphabetic styles does not use \bibhang, because they work more like an enumerate. In those lists, all lines have the same indentation, but additionally there is a label on the first line.

So you if you want to use \bibhang you need something like this

\documentclass{article}
\usepackage[
    backend=biber,
    style=chem-angew,
    articletitle=true,
    defernumbers=true
]{biblatex}

\addbibresource{biblatex-examples.bib}

\setlength{\bibhang}{0pt}
\defbibenvironment{bibliography}
  {\list
     {}
     {\setlength{\leftmargin}{\bibhang}%
      \setlength{\itemindent}{-\leftmargin}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}}
  {\endlist}
  {\item
   \printtext[labelnumberwidth]{%
     \printfield{labelprefix}%
      \printfield{labelnumber}}%
   \addspace}

\begin{document}
Some text \cite{sigfridsson,cicero,worman}.

\printbibliography
\end{document}

A simpler solution is

\defbibenvironment{bibliography}
  {\trivlist}
  {\endtrivlist}
  {\item
   \printtext[labelnumberwidth]{%
     \printfield{labelprefix}%
      \printfield{labelnumber}}%
   \addspace}
  • 1
    Yes. Could you tell me, why 'bibhang' does not work? – Andy Nov 10 '17 at 14:00
  • 1
    @Andy The definition of \defbibenvironment{bibliography} does not include \bibhang for the numeric styles. That is because the numeric styles work more like an enumerate list, where the indentation is automatically determined by the label number. We had to change the entire bibliography environment to get things to work here. – moewe Nov 10 '17 at 14:06
2

A solution consists in redefining the bibenvironment:

\documentclass{article}
\usepackage[showframe]{geometry}
% arara: pdflatex
% arara: biber
% arara: pdflatex

\usepackage[
    backend=biber,
    style=chem-angew,
    articletitle=true,
    defernumbers=true
]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{D04,
  author = {Duthor, D.},
  year = {2004},
  volume = {1},
  pages = {2},
  title = {Nanoscale magnetic skyrmions in metallic films and multilayers: a new twist for spintronics Nanoscale magnetic skyrmions in metallic films and multilayers: a new twist for spintronics},
}

\end{filecontents}

\addbibresource{\jobname.bib}

\defbibenvironment{bibliography}
 {\list
 {\printtext[labelnumberwidth]{%
    \printfield{labelprefix}%
    \printfield{labelnumber}}}
 {\setlength{\labelwidth}{\labelnumberwidth}%
 \setlength{\leftmargin}{0pt}%{\labelwidth}%
 \setlength{\labelsep}{\biblabelsep}%
 %\addtolength{\leftmargin}{\labelsep}%
 \setlength{\itemsep}{\bibitemsep}%
 \setlength{\parsep}{\bibparsep}}%
 \renewcommand*{\makelabel}[1]{\hss\hspace{\dimexpr\labelnumberwidth+\labelsep}##1}}
 {\endlist}
 {\item}

\begin{document}

Some text \cite{D04}.

\printbibliography

\end{document} 

enter image description here

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.