biblatex 中集合成员的缩进

biblatex 中集合成员的缩进

使用@set容器(至少是类似的东西,但对于这个问题应该@set这样做)我得到以下结果:

在此处输入图片描述

因为这有点难以阅读,所以我想改用这个:

在此处输入图片描述

我使用\hangindent/\hangafter\parindentitemize朋友尝试的所有操作都失败了。

还有其他可能性吗?

梅威瑟:

\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},
  title     = {Use, 'Abuse', Adverse Health Effects, and Addiction},%<-typo in book
  sorttitle = {09 Use, Abuse, Adverse Health Effects, and Addiction},
}
@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}

\addbibresource{\jobname.bib}

\begin{document}\parindent=0pt

\nocite{*}
\printbibliography

\end{document}

笔记:这个问题可能相关...

答案1

这是一个目前看来效果不错的解决方案。此解决方案使用列表enumerate作为集合成员。

主要问题不是我最初认为的标点符号跟踪器。事实上,所涉及的列表环境(整个参考书目环境通常也是一个列表)在各种宏的上下文中没有按照我的期望运行biblatex。主要是因为\leavevmode。以下代码禁用了where(可能相当)安全,并删除了一个无法手动禁用\leavevmode的效果,使用。虽然不漂亮,但有效。\leavevmode\vspace

\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},
  title     = {Use, 'Abuse', Adverse Health Effects, and Addiction},%<-typo in book
  sorttitle = {09 Use, Abuse, Adverse Health Effects, and Addiction},
}
@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}

\addbibresource{\jobname.bib}

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

屏幕截图显示了包含两个项目的参考书目。第二项是 <code>@set</code> 条目,并细分为 a) 和 b)。第二项的布局与通常的 <code>enumerate</code> 布局相同。

答案2

好吧,最后,在将这个问题与这个相关问题我找到了一种扩展@set类型以产生所需输出的方法。这有点棘手,但基本上很简单。

因此,a@set通过 -field 获取标头部分的密钥options。在重新定义的标头内setdriver打印标头。由于集合不包含任何值,因此entryset必须从(重新)加载的标头数据内运行命令:

\DeclareBibliographyDriver{set}{%
  \edef\xs@mv@set{\abx@field@entrykey}%
  \ifboolexpr{
    test {\ifundef{\xs@mv@head}}
    or
    test {\ifblank{\xs@mv@head}}
    }
    {\entryset{}{}%
     \newunit\newblock
     \usebibmacro{setpageref}%
     \finentry}
    {\entrydata*{\xs@mv@head}{\usedriver{}{\abx@field@entrytype}\finentrypunct%
       % 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}}

entryset-loop中entrytype,每个子项都会更改为新的驱动程序,仅打印标题块中未提供的内容。如果有驱动程序,multivolume<child-entrytype>则将使用此特殊驱动程序,如果没有,则multivolumechild启动通用后备 -driver。这允许在@set构造中混合条目类型。

你最终得到的是:

在此处输入图片描述

感谢 moewe 提供与此问题相关的所有提示(以及参与讨论的所有人)。

梅威瑟:

\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}}
\DeclareDelimFormat{editortypedelim}{\addspace}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DefineBibliographyStrings{german}{
  editor  = {Hrsg},
  editors = {Hrsg},
  volumes = {B\"ande},
}

\makeatletter
\DeclareEntryOption[string]{multivolumehead}{\def\xs@mv@head{#1}}
\define@key{xs@multivolume}{multivolumehead}{\def\xs@mv@head{#1}}

\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}}
    } {\setunit*{\addcomma\space}}%
      {\setunit*{\addcolon\space}%
       \printlist{publisher}%
       \setunit*{\addcomma\space}}%
  \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{
    test {\ifundef{\xs@mv@head}}
    or
    test {\ifblank{\xs@mv@head}}
    }
    {\entryset{}{}%
     \newunit\newblock
     \usebibmacro{setpageref}%
     \finentry}
    {\entrydata*{\xs@mv@head}{\usedriver{}{\abx@field@entrytype}\finentrypunct%
       % 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},
  options      = {multivolumehead=fish:drugs},
}
@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},
  title      = {Use, 'Abuse', Adverse Health Effects, and Addiction},
  pages      = {197-200},
  sorttitle  = {09 Use, Abuse, Adverse Health Effects, and Addiction},
  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},
  options     = {multivolumehead=A},
}
@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},
  title       = {Asterix als Gladiator},
  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},
  options   = {multivolumehead=DHS:base},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\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

相关内容