# Indent of members of a set in biblatex

Using a @set container (at least something similar but for this question a @set should do it) I get the following:

Since this is a bit hard to read I would like to have this instead:

Everything I tried with \hangindent/\hangafter, \parindent or itemize and friends failed.

Any other possibility?

MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[doi=false,backend=biber,subentry,sorting=nyt,style=numeric-comp,sortsets=true]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{fish:drugs,
mainsubtitle = {Drugs and Society},
year         = {2006},
editor       = {{Fish, Jefferson M.}},
maintitle    = {U.S.~public policy},
publisher    = {Rowman \& Littlefield Publishers, Inc},
location     = {Lanham, Maryland},
}
@Set{set:fish:drugs,% related is not inherited...
entryset     = {fish:drugs:gable:alt,fish:drugs:cleveland:use},
}
@Inbook{fish:drugs:cleveland:use,
crossref  = {fish:drugs},
author    = {{Mary M.} Cleveland},
}
@Inbook{fish:drugs:gable:alt,
crossref  = {fish:drugs},
author    = {{Robert S.} Gable},
title     = {Acute Toxicity of Drugs vs.~Regulatory Status},
sorttitle = {07 Acute Toxicity of Drugs versus Regulatory Status},
}
\end{filecontents}

\renewcommand{\entrysetpunct}{\par\nobreak}
\DeclareFieldFormat{bibentrysetcount}{\makebox[1em][l]{\smash{\mknumalph{#1})}}\ignorespaces}

\begin{document}\parindent=0pt

\nocite{*}
\printbibliography

\end{document}


Note: this question might be related...

• This one may also be related: tex.stackexchange.com/q/409844/105447. If it is, my experience says it might be tricky... – gusbrs Dec 5 '18 at 12:55
• After your comments in tex.stackexchange.com/q/459759/35864 I tried to come up with a solution. It is fairly easy to have everything appear in a new line, but the hanging indent proved tricky. Every attempt with enumerate failed because of the delayed execution of punctuation commands in the punctuation tracker. I uncovered an undesired behaviour in the related punctuation handling, but didn't get anywhere. Maybe @set is easier ... – moewe Dec 5 '18 at 13:44
• Because I commented something to the same extend earlier today on another question: The braces in author = {{Mary M.} Cleveland}, and author = {{Robert S.} Gable}, should not be necessary. The braces in editor = {{Fish, Jefferson M.}}, look outright wrong. – moewe Dec 5 '18 at 13:48
• @moewe yep - the double braces around (the) fish have been forgotten to remove after fiddling around with other stuff... – AndiW Dec 5 '18 at 13:57
• @moewe If you, by any chance, come up with a sensible approach that is also applicable to tex.stackexchange.com/q/409844/105447, I'm still very interested in an approach less convoluted than the one I've then reached. – gusbrs Dec 5 '18 at 14:22

Here is a solution that seems to work fairly well so far. This solution uses an enumerate list for the set members.

The main issue was not, as I initially thought, the punctuation tracker. It was the fact that the involved list environments (the whole bibliography environment is usually a list as well) did not behave as desired (by me) in the context of all kinds of biblatex macros. Mainly because of \leavevmode. The following code disables \leavevmode where (probably reasonably) safe and removes the effect of one \leavevmode, which could not be disabled manually, with \vspace. Not pretty, but it works.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[backend=biber,style=numeric-comp,subentry,sorting=nyt,sortsets=true]{biblatex}

\makeatletter
\DeclareBibliographyDriver{set}{%
% don't issue \leavevmode inside here
\let\blx@leavevmode\relax
% get rid of the \leavevmode from the beginning of the entry
% this avoids an empty line before the enumerate
\vspace{-\dimexpr\baselineskip+\itemsep\relax}%
\begin{enumerate}
\entryset
{\ifbool{bbx:subentry}
{\item[\mknumalph{\thefield{entrysetcount}})]}
{}}
{}%
\finentry
\end{enumerate}
%\newunit\newblock
%\usebibmacro{setpageref}%
}
\makeatother

\renewcommand{\entrysetpunct}{\finentrypunct}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{fish:drugs,
mainsubtitle = {Drugs and Society},
year         = {2006},
editor       = {Fish, Jefferson M.},
maintitle    = {U.S.~public policy},
publisher    = {Rowman \& Littlefield Publishers, Inc},
location     = {Lanham, Maryland},
}
@Set{set:fish:drugs,% related is not inherited...
entryset     = {fish:drugs:gable:alt,fish:drugs:cleveland:use},
}
@Inbook{fish:drugs:cleveland:use,
crossref  = {fish:drugs},
author    = {Mary M. Cleveland},
}
@Inbook{fish:drugs:gable:alt,
crossref  = {fish:drugs},
author    = {Robert S. Gable},
title     = {Acute Toxicity of Drugs vs.~Regulatory Status},
sorttitle = {07 Acute Toxicity of Drugs versus Regulatory Status},
}
\end{filecontents}

\begin{document}
\nocite{*}
\printbibliography
\end{document}


• That's very nice! If I may suggest, I think some sort of support for nested listing within the bibliography environment would improve output for sets, multivolumes (related too?). In general, anywhere where some sort of grouping is trying to be conveyed. – gusbrs Dec 5 '18 at 22:05
• @gusbrs thumb up! – AndiW Dec 5 '18 at 23:29
• @gusbrs Feel free to open a feature request at GitHub. My attempts to solve this issue have shown me that it is quite tricky to get biblatex to print lists inside entries they way one would expect them to print. So I'm not at all hopeful that I'd be able to come up with something. Furthermore, the usual setup and at least the standard bibliography drivers are not really equipped to deal with lists inside entries. So the first question would have to be "what exactly are we looking for", then we need to discuss if and how this can be integrated into the standard styles ... – moewe Dec 6 '18 at 8:52
• The feature request is now at github.com/plk/biblatex/issues/844 – moewe Dec 9 '18 at 11:01
• @gusbrs Yes, the global shorthandwidth is only calculated if and when it is needed (i.e. in \printshorthands); locallabelwidth is not as careful and always produces the length, but it should not matter that much for the local labels. I'm not sure how exactly you tried to integrate \blx@leavevmode and \vspace into which list environment, but my tests have shown me that the entire thing is quite fragile if the order of executions of certain commands is changed. – moewe Dec 9 '18 at 22:31

Well, finally and after combining this question with this related problem I found a way to expand @set types to produce the desired output. Its a bit tricky but basically straight forward.

So a @set gets the key to the header part via the options-field. Within the redefined setdriver the header is printed. Since the set does not hold any values the entryset command has to be run from within the (re)loaded headerdata:

\DeclareBibliographyDriver{set}{%
\edef\xs@mv@set{\abx@field@entrykey}%
\ifboolexpr{
or
}
{\entryset{}{}%
\newunit\newblock
\usebibmacro{setpageref}%
\finentry}
% reload the set so we can access the header via saved
\entrydata*{\xs@mv@set}{
% don't issue \leavevmode inside here
\let\blx@leavevmode\relax
\setitemize{noitemsep,topsep=0pt,parsep=0pt,partopsep=0pt}%
\begin{itemize}[label={\printfield{entrysetcount})},labelindent=0.5\labelnumberwidth,labelsep=1ex,itemindent=0pt,leftmargin=*]
\entryset{\item \ifcsdef{blx@bbx@multivolume\abx@field@savedentrytype}
{\edef\abx@field@entrytype{multivolume\abx@field@savedentrytype}}
{\message{^^Jxs Warning: BibliographyDriver blx@bbx@multivolume@\abx@field@entrytype\space undefined
^^J** Using fallback driver multivolumechild
^^J** If you get unexpected entries in the bibliography consider to create a new BibliographyDriver multivolume@\abx@field@savedentrytype.}%
\def\abx@field@entrytype{multivolumechild}}}{}%
\finentrypunct\end{itemize}\nopunct}}%
\newunit\newblock
\usebibmacro{setpageref}%
\finentry}}


Within the entryset-loop the entrytype of each child is changed to a new driver printing only what was not provided in the header block. If there is a driver multivolume<child-entrytype> this special driver will be used, if not the generic fallback multivolumechild-driver kicks in. That allows to mix entrytypes within @set constructions.

What you get in the end is:

Thanx to moewe for all the hints related to this problem (and to all involved in the discussion).

MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[backend=biber,style=numeric-comp,mcite,subentry,sorting=nty,sortsets=true]{biblatex}
\usepackage{enumitem}
\usepackage{hyperref}

\DeclareNameAlias{sortname}{family-given}
\DeclareNameAlias{default}{family-given}
\DeclareFieldFormat{entrysetcount}{\mknumalph{#1}}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DefineBibliographyStrings{german}{
editor  = {Hrsg},
editors = {Hrsg},
volumes = {B\"ande},
}

\makeatletter

\DeclareBibliographyDriver{multivolumechild}{%
\ifboolexpr{
test {\ifnamesequal{author}{savedauthor}}
or
test {\ifnameundef{author}}
}
{\nopunct}
{\printnames{author}%
\newunit\newblock}%
\iffieldundef{volume}
{}
{\printfield{volume}%
\printfield{part}%
\newunit\newblock}%
\usebibmacro{title}%
\newunit\newblock
\ifboolexpr{
test {\ifnamesequal{editor}{savededitor}}
or
test {\ifnameundef{editor}}
}{}
{\usebibmacro{byeditor+others}%
\newunit\newblock}%
\ifboolexpr{
test {\iflistsequal{location}{savedlocation}}
or
test {\iflistundef{location}}
}{}
{\printlist{location}}%<- typo
\ifboolexpr{
test {\iflistsequal{publisher}{savedpublisher}}
or
test {\iflistundef{publisher}}
\printlist{publisher}%
\newunit\newblock%
\ifboolexpr{
test {\iffieldsequal{year}{savedyear}}
or
test {\iffieldundef{year}}
}{}
{\printdate%
\newunit\newblock}%
\ifboolexpr{
test {\iffieldsequal{isbn}{savedisbn}}
or
not togl {bbx:isbn}
}{}
{\printfield{isbn}}%
\newunit\newblock%
\usebibmacro{chapter+pages}%
}

\DeclareBibliographyDriver{set}{%
\edef\xs@mv@set{\abx@field@entrykey}%
\ifboolexpr{
or
}
{\entryset{}{}%
\newunit\newblock
\usebibmacro{setpageref}%
\finentry}
% reload the set so we can access the header via saved
\entrydata*{\xs@mv@set}{
% don't issue \leavevmode inside here
\let\blx@leavevmode\relax
\setitemize{noitemsep,topsep=0pt,parsep=0pt,partopsep=0pt}%
\begin{itemize}[label={\printfield{entrysetcount})},labelindent=0.5\labelnumberwidth,labelsep=1ex,itemindent=0pt,leftmargin=*]
\entryset{\item \ifcsdef{blx@bbx@multivolume\abx@field@savedentrytype}
{\edef\abx@field@entrytype{multivolume\abx@field@savedentrytype}}
{\message{^^Jxs Warning: BibliographyDriver blx@bbx@multivolume@\abx@field@entrytype\space undefined
^^J** Using fallback driver multivolumechild
^^J** If you get unexpected entries in the bibliography consider to create a new BibliographyDriver multivolume@\abx@field@savedentrytype.}%
\def\abx@field@entrytype{multivolumechild}}}{}%
\finentrypunct\end{itemize}\nopunct}}%
\newunit\newblock
\usebibmacro{setpageref}%
\finentry}}
\makeatother

\renewcommand{\entrysetpunct}{\finentrypunct}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{fish:drugs,
mainsubtitle = {Drugs and Society},
year         = {2006},
editor       = {Jefferson M. Fish},
maintitle    = {U.S.~public policy},
publisher    = {Rowman \& Littlefield Publishers, Inc},
location     = {Lanham, Maryland},
isbn         = {0-7425-4245-9},
sortname     = {Jefferson M. Fish},
sorttitle    = {U.S. public policy Drugs and Society},
options      = {dataonly},
}
@Set{set:fish:drugs,
entryset     = {fish:drugs:gable:alt,fish:drugs:cleveland:use,fish:drugs:evans:intro},
}
@Inbook{fish:drugs:evans:intro,
crossref   = {fish:drugs},
author     = {Richard M. Evans and Stanley Neustadter},
chapter    = {6},
title      = {Legalization: An Introduction},
pages      = {129-148},
sorttitle  = {06 Legalization: An Introduction},
options    = {dataonly},
}
@Inbook{fish:drugs:cleveland:use,
crossref   = {fish:drugs},
author     = {Mary M. Cleveland},
chapter    = {9a},
pages      = {197-200},
options    = {dataonly},
}
@Inbook{fish:drugs:gable:alt,
crossref   = {fish:drugs},
author     = {Robert S. Gable},
chapter    = {7},
title      = {Acute Toxicity of Drugs versus Regulatory Status},
pages      = {149-161},
sorttitle  = {07 Acute Toxicity of Drugs versus Regulatory Status},
}
@article{doody,
author       = {Terrence Doody},
title        = {Hemingway's Style and {Jake's} Narration},
year         = 1974,
volume       = 4,
number       = 3,
pages        = {212-225},
langid       = {english},
langidopts   = {variant=american},
related      = {matuz:doody},
relatedstring= {\autocap{e}xcerpt in},
journal      = {The Journal of Narrative Technique},
annotation   = {An \texttt{article} entry cited as an excerpt from a
\texttt{collection} entry. Note the format of the
\texttt{related} and \texttt{relatedstring} fields},
}
@collection{matuz:doody,
editor       = {Roger Matuz},
title        = {Contemporary Literary Criticism},
year         = 1990,
volume       = 61,
publisher    = {Gale},
location     = {Detroit},
pages        = {204-208},
langid       = {english},
langidopts   = {variant=american},
annotation   = {A \texttt{collection} entry providing the excerpt information
for the \texttt{doody} entry. Note the format of the
\texttt{pages} field},
}
@Book{A,
author      = {René Goscinny and Albert Uderzo},
maintitle   = {Asterix und Obelix},
year        = {1959--2018},
publisher   = {Dargaud},
location    = {Paris},
volumes     = {99},
options     = {dataonly},
}
@Set{set:A,
entryset    = {A:V1,A:V2,A:V3,A:V4,A:V5,A:V6},
}
@Book{A:V1,
crossref    = {A},
title       = {Asterix der Gallier},
sorttitle   = {Goscinny Rene Uderzo Albert Asterix und Obelix 01},
year        = {1959},
isbn        = {1234567890123},
volume      = {1},
}
@Book{A:V2,
crossref    = {A},
title       = {Asterix und Kleopatra},
sorttitle   = {Goscinny Rene Uderzo Albert Asterix und Obelix 02},
year        = {1968},
isbn        = {2345678901234},
volume      = {2},
}
@Book{A:V3,
crossref    = {A},
sorttitle   = {Goscinny Rene Uderzo Albert Asterix und Obelix 03},
year        = {1969},
isbn        = {3456789012345},
volume      = {3},
}
@Book{A:V4,
crossref    = {A},
title       = {Der Kampf der Häuptlinge},
sorttitle   = {Goscinny Rene Uderzo Albert Asterix und Obelix 04},
year        = {1969},
isbn        = {4567890123456},
volume      = {4},
}
@Book{A:V5,
crossref    = {A},
title       = {Die goldene Sichel},
sorttitle   = {Goscinny Rene Uderzo Albert Asterix und Obelix 05},
year        = {1970},
isbn        = {5678901234567},
volume      = {5},
}
@Book{A:V6,
crossref    = {A},
title       = {Tour de France},
sorttitle   = {Goscinny Rene Uderzo Albert Asterix und Obelix 06},
year        = {1970},
isbn        = {6789012345678},
volume      = {6},
}
@Book{DHS:base,
editor    = {{Deutsche Hauptstelle für Suchtfragen e.~V.}},
sortname  = {{Deutsche Hauptstelle für Suchtfragen}},
year      = {2017},
url       = {www.dhs.de},
urldate   = {2018-04-30},
maintitle = {Suchtmedizinische Reihe},
options   = {dataonly},
}
@Book{DHS:nik,
crossref  = {DHS:base},
title     = {Tabakabhängigkeit},
sorttitle = {Deutsche Hauptstelle für Suchtfragen Suchtmedizinische Reihe 01},
volume    = {1},
isbn      = {978-3-937587-00-4},
}
@Book{DHS:alk,
crossref  = {DHS:base},
title     = {Alkoholabhängigkeit},
sorttitle = {Deutsche Hauptstelle für Suchtfragen Suchtmedizinische Reihe 02},
volume    = {2},
isbn      = {978-3-937587-01-1},
}
@Book{DHS:drogen,
crossref  = {DHS:base},
title     = {Drogenabhängigkeit},
sorttitle = {Deutsche Hauptstelle für Suchtfragen Suchtmedizinische Reihe 04},
volume    = {4},
isbn      = {978-3-937587-03-5},
}
@Set{DHS:SMR,
crossref  = {DHS:base},
entryset  = {DHS:alk,DHS:nik,DHS:drogen},
}
\end{filecontents}

\begin{document}\parindent=0pt\relax\parskip=2ex\relax
\nocite{*}
\fullcite{fish:drugs}

Cleveland in \cite{set:fish:drugs} says\supercite{fish:drugs:gable:alt} something.\msupercite{fish:drugs:gable:alt,fish:drugs:cleveland:use,fish:drugs:evans:intro}

Be adviced that after heavy stuff like \mcite{DHS:nik,DHS:alk} you should relax\msupercite{set:A} a bit.

\fullcite{fish:drugs:gable:alt}

\printbibliography
\end{document}
\endinput
`