同一作者的多个书籍条目的书目特定格式

同一作者的多个书籍条目的书目特定格式

我有一本书包含多个参考书目。我的编辑希望对其中一个参考书目进行特殊格式处理。下面是 MWE,MWE 下方是解释:

梅威瑟:

\documentclass[]{book}


\usepackage[style=authortitle-dw,
edsuper=true,
namefont=smallcaps,
useprefix=true,
ibidemfont=smallcaps,
idemfont=smallcaps,
idembibformat=dash,
shorthandibid=true,
backref=false,
backrefstyle=none,
hyperref=true,
isbn=false,
backend=biber,
citereset=chapter,
edstringincitations=false,
bibencoding=utf8]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{quellen.bib}
@incollection{inproc1,
    Author = {Test Author},
    crossref = {proc},
    Pages = {1--10},
    Title = {Testing the Title}}

@incollection{inproc2,
    Author = {Test Author},
    crossref = {proc},
    Pages = {10--20},
    Title = {Testing the second Title}}
@incollection{inproc4,
    Author = {Test Author},
    crossref = {proc},
    Pages = {10--20},
    Title = {Testing the third Title}}
@incollection{inproc5,
    Author = {Test Author},
    crossref = {proc},
    Pages = {10--20},
    Title = {Testing the forth Title}}
@incollection{inproc6,
    Author = {Test Author},
    crossref = {proc},
    Pages = {10--20},
    Title = {Testing the fifth Title}}
@collection{proc,
    Editor = {Senor Editor and Senora Editora},
    Publisher = {Any Publisher},
    Title = {My Proceedings},
    Year = {2013},
    shorttitle = {Shorttitle}}

@inproceedings{inproc3,
    Author  = {Nother Author},
    Publisher = {Nother Publisher},
    Title   = {In Some Other Proceedings},
    Maintitle = {Main Title of Other Proceedings},
    Year     = {2001},
}
\end{filecontents}

\begin{filecontents}{literatur.bib}
    @incollection{inproc12,
        Author = {Test Author},
        crossref = {proc},
        Pages = {1--10},
        Title = {Testing the Title}}

    @incollection{inproc22,
        Author = {Test Author},
        crossref = {proc},
        Pages = {10--20},
        Title = {Testing the second Title}}

    @incollection{inproc42,
        Author = {Test Author},
        crossref = {proc},
        Pages = {10--20},
        Title = {Testing the third Title}}

    @incollection{inproc52,
        Author = {Test Author},
        crossref = {proc},
        Pages = {10--20},
        Title = {Testing the forth Title}}

    @incollection{inproc62,
        Author = {Test Author},
        crossref = {proc},
        Pages = {10--20},
        Title = {Testing the fifth Title}}

    @collection{proc2,
        Editor = {Senor Editor and Senora Editora},
        Publisher = {Any Publisher},
        Title = {My Proceedings},
        Year = {2013},
        shorttitle = {Shorttitle}}

    @inproceedings{inproc32,
        Author  = {Nother Author},
        Publisher = {Nother Publisher},
        Title   = {In Some Other Proceedings},
        Maintitle = {Main Title of Other Proceedings},
        Year     = {2001},
    }
\end{filecontents}

\addbibresource{literatur.bib}
\addbibresource{quellen.bib}

\pagestyle{empty}
\begin{document}
\cite{inproc42}\cite{inproc52}\cite{inproc62}
Test \cite{inproc12} and \cite{inproc22} and \cite{inproc32}
\cite{inproc4}\cite{inproc5}\cite{inproc6}
Test \cite{inproc1} and \cite{inproc2} and \cite{inproc3}
\printbibliography[keyword=literatur,title=Specially formatted bibliography]
\printbibliography[keyword=quellen,title=Plain old'n sturdy bibliography]
\end{document}

我的 biber.conf 看起来像

<?xml version="1.0" encoding="UTF-8"?>
<config>
<sourcemap>
  <maps datatype="bibtex" bmap_overwrite="1">
    <map>
      <per_datasource>literatur.bib</per_datasource>
      <map_step map_field_set="KEYWORDS" map_field_value="literatur"/>
    </map>
    <map>
      <per_datasource>quellen.bib</per_datasource>
      <map_step map_field_set="KEYWORDS" map_field_value="quellen"/>
    </map>        
  </maps>
</sourcemap>
</config>

特殊格式的参考书目目前如下所示:

在此处输入图片描述

列表中针对一位作者的第一个条目也应以与第二、第三...相同的格式出现,即它应从作者下方的行开始,并在其前面有一个破折号

Author, Test:
  - Testing the fifth title ...
  - Testing the forth title ...

答案1

哇。我不敢相信这居然有效……

这是一种可能的前进方式。

设置biblatex选项minxrefs=2(希望您还没有使用它)。

我们使用一组复杂的源映射来完成繁重的工作。我们keywords根据文件进行设置。我们为 中的每个条目bib类型创建一个specialauthor仅包含author和字段的新条目类型。我们设置为 指向 中的每个项目的这个新条目。keywordliteratur.bibxrefliteratur.bib

我们创建一个新的驱动程序来处理类型的条目specialauthor

在特殊书目打印时,我们关闭了editor和字符串的打印。translator\bibnamedash

它没有经过彻底测试,所以我会小心谨慎。如果你使用自定义名称字符串,它肯定会产生奇怪的结果。但至少它不需要你对数据进行任何更改bib

综合起来:

\documentclass{article}

\usepackage[style=authortitle-dw,
edsuper=true,
namefont=smallcaps,
useprefix=true,
ibidemfont=smallcaps,
idemfont=smallcaps,
idembibformat=dash,
shorthandibid=true,
backref=false,
backrefstyle=none,
isbn=false,
backend=biber,
edstringincitations=false,
bibencoding=utf8,
minxrefs=2]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{quellen.bib}
@incollection{inproc1,
    Author = {Test Author},
    crossref = {proc},
    Pages = {1--10},
    Title = {Testing the Title}}

@incollection{inproc2,
    Author = {Test Author},
    crossref = {proc},
    Pages = {10--20},
    Title = {Testing the second Title}}
@incollection{inproc4,
    Author = {Test Author},
    crossref = {proc},
    Pages = {10--20},
    Title = {Testing the third Title}}
@incollection{inproc5,
    Author = {Test Author},
    crossref = {proc},
    Pages = {10--20},
    Title = {Testing the forth Title}}
@incollection{inproc6,
    Author = {Test Author},
    crossref = {proc},
    Pages = {10--20},
    Title = {Testing the fifth Title}}
@collection{proc,
    Editor = {Senor Editor and Senora Editora},
    Publisher = {Any Publisher},
    Title = {My Proceedings},
    Year = {2013},
    shorttitle = {Shorttitle}}

@inproceedings{inproc3,
    Author  = {Nother Author},
    Publisher = {Nother Publisher},
    Title   = {In Some Other Proceedings},
    Maintitle = {Main Title of Other Proceedings},
    Year     = {2001},
}
\end{filecontents}

\begin{filecontents}{literatur.bib}
@incollection{inproc12,
    Author = {Test Author},
    crossref = {proc},
    Pages = {1--10},
    Title = {Testing the Title}}

@incollection{inproc22,
    Author = {Test Author},
    crossref = {proc},
    Pages = {10--20},
    Title = {Testing the second Title}}

@incollection{inproc42,
    Author = {Test Author},
    crossref = {proc},
    Pages = {10--20},
    Title = {Testing the third Title}}

@incollection{inproc52,
    Author = {Test Author},
    crossref = {proc},
    Pages = {10--20},
    Title = {Testing the forth Title}}

@incollection{inproc62,
    Author = {Test Author},
    crossref = {proc},
    Pages = {10--20},
    Title = {Testing the fifth Title}}

@collection{proc2,
    Editor = {Editor, Senor and Editora, Senora},
    Publisher = {Any Publisher},
    Title = {My Proceedings},
    Year = {2013},
    shorttitle = {Shorttitle}}

@collection{proc3,
    Editor = {Editor, Senor and Editora, Senora},
    Publisher = {Any Publisher},
    Title = {Your Proceedings},
    Year = {2013},
    shorttitle = {Shorttitle}}

@inproceedings{inproc32,
    Author  = {Nother Author},
    Publisher = {Nother Publisher},
    Title   = {In Some Other Proceedings},
    Maintitle = {Main Title of Other Proceedings},
    Year     = {2001},
}
\end{filecontents}

\addbibresource{literatur.bib}
\addbibresource{quellen.bib}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \perdatasource{quellen.bib}
      \step[fieldset=keywords, fieldvalue={quellen}]
    }
    \map{
      \perdatasource{literatur.bib}
      \step[fieldset=keywords, fieldvalue={literatur}]
      \step[fieldset=options, fieldvalue={,}, append]
      \step[fieldsource=options, notmatch=\regexp{.*useauthor\s*=\s*false.*}, final]
      \step[fieldsource=author, match=\regexp{(.*)}, final]
      \step[entrynew={$1}, entrynewtype=specialauthor]
      \step[entrytarget={$1}, fieldset={author}, fieldvalue={$1}]
      \step[entrytarget={$1}, fieldset={keywords}, fieldvalue={literatur}]
      \step[fieldset=xref, fieldvalue={$1}]
    }
    \map{
      \perdatasource{literatur.bib}
      \step[notfield=author, final]
      \step[fieldset=options, fieldvalue={,}, append]
      \step[fieldsource=options, notmatch=\regexp{.*useeditor\s*=\s*false.*}, final]
      \step[fieldsource=editor, match=\regexp{(.*)}, final]
      \step[entrynew={$1}, entrynewtype=specialauthor]
      \step[entrytarget={$1}, fieldset={editor}, fieldvalue={$1}]
      \step[entrytarget={$1}, fieldset={keywords}, fieldvalue={literatur}]
      \step[fieldset=xref, fieldvalue={$1}]
    }
    \map{
      \perdatasource{literatur.bib}
      \step[notfield=author, final]
      \step[notfield=editor, final]
      \step[fieldset=options, fieldvalue={,}, append]
      \step[fieldsource=options, notmatch=\regexp{.*usetranslator\s*=\s*false.*}, final]
      \step[fieldsource=options, match=\regexp{.*usetranslator.*}, final]
      \step[fieldsource=translator, match=\regexp{(.*)}, final]
      \step[entrynew={$1}, entrynewtype=specialauthor]
      \step[entrytarget={$1}, fieldset={translator}, fieldvalue={$1}]
      \step[entrytarget={$1}, fieldset={options}, fieldvalue={usetranslator=true}]
      \step[entrytarget={$1}, fieldset={keywords}, fieldvalue={literatur}]
      \step[fieldset=xref, fieldvalue={$1}]
    }
  }
}

\DeclareBibliographyDriver{specialauthor}{%
  \renewcommand*{\finentrypunct}{\addcolon}%
  \ifbool{cbx:idemfull}
    {}
    {\usebibmacro{author/editor+others/translator+others}%
     \ifnameundef{labelname}
       {}
       {\setunit{\labelnamepunct}\newblock}}%
  \usebibmacro{finentry}}

\makeatletter
\AtEveryBibitem{%
  \ifboolexpr{
    test {\ifkeyword{literatur}}
    and
    not test {\ifentrytype{specialauthor}}
    and
    test {\iffieldequals{namehash}{\bbx@lasthash}}
    and
    not test {\iffirstonpage}
  }
    {\renewbibmacro*{translator+othersstrg}{}%
     \renewbibmacro*{editor+othersstrg}{}}
    {}}
\makeatother

\pagestyle{empty}
\begin{document}
\cite{inproc42}\cite{inproc52}\cite{inproc62}
Test \cite{inproc12} and \cite{inproc22} and \cite{inproc32}
\cite{inproc4}\cite{inproc5}\cite{inproc6}
Test \cite{inproc1} and \cite{inproc2} and \cite{inproc3}
\cite{proc2,proc3}
\printbibliography[keyword=literatur,title=Specially formatted bibliography]
\printbibliography[keyword=quellen,title=Plain old'n sturdy bibliography]
\end{document}

在此处输入图片描述

相关内容