I read the following post on how to add an author-year block to each bibliography entry: Adding an [AuthorYear] block at the beginning of bibliography entries. My code looks just like it does in the solution.
At the moment my bibliography looks like this:
It comes very close to what my bibliography should look like. However I would like to change the indentation of the second line of each bibliography entry, so that it is in line with the fist line of the bibliography entry.
Alternatively it would also work to create a fixed block for the bibliography entries similar to this: Creating a bibliography with fixed indention and authoryear labels using biblatex and biber. That solution doesn't work for me, because it uses the horizontal space between label and bibliography entry.
If I use this solution, it looks like this:
From what I understand, it isn't possible to customize a label so that it looks like the author year block. That's why it was added additionally. As we can see, the second entry seems to have a label additionally to the author year block.
I would like to have a similar look with an author year block instead of a label.
The solution by moewe looks like this: (note: I only used moewe's new code without the code from Adding an [AuthorYear] block at the beginning of bibliography entries)
SOLUTION: For everyone interested, the missing label was due to two lines of additional code needed if you use the authoryear-icomp style.
This is my code with moewes solution:
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[
backend=biber,
citestyle=authoryear-icomp,
bibstyle=authortitle,
sorting=nyt,
firstinits=true,
sortlocale=de_DE,
hyperref=true,
url=true,
doi=false,
eprint=false,
maxcitenames=1,
useprefix=true
]{biblatex}
\DeclareNameAlias{sortname}{last-first}
\addbibresource{Literatur.bib}
\makeatletter
\setlength{\bibitemsep}{0.5\baselineskip plus 0.5\baselineskip}
\newsavebox\ay@labelbox
\newlength{\labwidthsameline}
\setlength{\labwidthsameline}{6em}
\newbibmacro{labelwidthbib}{%
\begingroup
\DeclareFieldFormat{bibhyperref}{##1}%
\csuse{blx@hook@cite}%
\csuse{blx@hook@citekey}%
\global\undef\cbx@lasthash
\global\undef\cbx@lastyear
\citetrackerfalse\pagetrackerfalse\backtrackerfalse
\defcounter{maxnames}{\blx@maxcitenames}%
\printtext[brackets]{\usebibmacro{cite}}%
\endgroup
}
%-----------------------
\newbibmacro{kicklabel}{%
\sbox\ay@labelbox{\usebibmacro{labelwidthbib}}%
\global\togglefalse{blx@insert}%
\ifdim\wd\ay@labelbox>\labwidthsameline
\leavevmode\newline
\fi
}
\defbibenvironment{bibliography}%
{\list
{\usebibmacro{labelwidthbib}}%
{\setlength{\labelwidth}{\labwidthsameline}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}%
\renewcommand*{\makelabel}[1]{##1\hss}}}%
{\endlist}%
{\item\usebibmacro{kicklabel}}
\makeatother
\DefineBibliographyStrings{ngerman}{andothers = {{et\,al\adddot}},}%et al statt u.a.
\begin{document}
%Testcitation
\textcite{Gluck.1991}
\parencite{Best.2016a}
\newpage
\printbibliography
\end{document}
This is the .bib file:
@misc{Best.2016a,
author = {Best, Isabelle and Orozaliev, Janybek},
title = {{Renewable Low-Temperature District Heating for a New Housing Area in Kassel, Germany -- A Case Study of IEA EBC Annex 64}},
abstract = {},
date = {2016-05-25},
pagerange = {14},
}
@book{Gluck.1991,
author = {Gl{\"u}ck, Bernd},
year = {1991},
title = {{Zustands- und Stoffwerte}},
edition = {2., bearb. u. erw. Aufl.},
publisher = {{Verlag f{\"u}r Bauwesen GmbH}},
isbn = {3-345-00487-9},
subtitle = {{Wasser, Dampf, Luft ; Verbrennungsrechnung}},
location = {Berlin},
series = {{Bausteine der Heizungstechnik}},
abstract = {},
pagetotal = {140},
}
\setlength{\bibhang}{0pt}
. If you want space between the entries increase\bibitemsep
.