如何在参考书目中的子条目中仅打印父条目的编辑者和标题

如何在参考书目中的子条目中仅打印父条目的编辑者和标题

在我的参考书目中,我希望如果父条目至少有两个子条目,则在子条目中只打印编辑者的姓名和父作品的标题,而我现在得到的是每个子条目中的完整父条目。然后应该在编辑者的姓名下完整打印父条目。因此,

Test Author. “Testing the second Title”. In: My Proceedings. Ed. by Senor Editor and Senora Editora. Any Publisher, 2013, pp. 10–20.

Test Author. “Testing the Title”. In: My Proceedings. Ed. by Senor Editor and Senora Editora. Any Publisher, 2013, pp. 1–10.

Senor Editor and Senora Editora, eds. My Proceedings. Any Publisher, 2013.

我想要得到的是:

Test Author: “Testing the second Title”. In: Senor Editor and Senora Editora, eds., *My Proceedings*, pp. 10–20.

[Test Author. “Testing the Title”. In: Senor Editor and Senora Editora, eds., *My Proceedings*, pp. 1–10.

Senor Editor and Senora Editora, eds. *My Proceedings*. Any Publisher, 2013.

我知道类似的问题已经得到解答这里,但我就是搞不清楚如何操作那里建议的代码,以便打印编辑者和标题。我设法用合集(或论文集或书籍)的标题替换字母标签,方法是使用

\printfield{labeltitle}

代替

\printfield{labelalpha}

但都不是

\printfield{labelname}

也不

\printlist{labelname}

似乎可以获取编辑者的名字。知道这里出了什么问题吗?我添加了一个 MWE:

\documentclass[]{scrartcl}

\usepackage[backend=biber,style=authortitle-icomp]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{my.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}}

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

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


\DeclareBibliographyDriver{incollection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \iffieldundef{crossref}
    {\usebibmacro{crossref:full}}
    {\usebibmacro{crossref:label}}
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \iffieldundef{crossref}
    {\usebibmacro{crossref:extrainfo}}
    {}
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\newbibmacro{crossref:full}{%
    \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
  \usebibmacro{event+venue+date}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \printlist{organization}%
  \newunit
  \usebibmacro{publisher+location+date}}

\newbibmacro{crossref:label}{%
  \entrydata{\strfield{crossref}}
     {\printtext{
        {\printfield{labeltitle}\printfield{extratitle}}}}}

\addbibresource{my.bib}

\begin{document}

Test \cite{inproc1} and \cite{inproc2} and \cite{inproc3}
\printbibliography
\end{document}

而且,还有一件小事(对于额外的问题来说太过相关且次要),我怎样才能让集合的标题在子条目中以斜体显示?

感谢您的帮助 - 因为这是我在 TeX Stack Exchange 上的第一篇文章,如果我没有表达清楚或者违反了任何惯例,请随时纠正我!

答案1

打印您需要的姓名\printnames{labelname}

如果您想labelname打印全名,那么您需要\DeclareNameAlias{labelname}{given-family}

要在 后获得(ed./eds.)labelname,请添加\setunit*{\addspace}\printtext[parens]{editorstrg}

要在 entry 中的主编辑器后获取 (ed./eds.) proc,您需要bbx:editor使用 修补宏xpatch,如下所示:

\xpatchbibmacro{bbx:editor}
  {\usebibmacro{#1}}
  {\setunit{\addspace}\printtext[parens]{\usebibmacro{#1}}}
  {}{}

要获得斜体labeltitle,您可以使用,\printfield[title]{labeltitle}因为标题的默认格式是斜体。

因此你的crossref:label宏变成:

\newbibmacro{crossref:label}{%
  \entrydata{\strfield{crossref}}
     {\DeclareNameAlias{labelname}{given-family}%
      \printnames{labelname}%
      \setunit*{\addspace}%
      \printtext[parens]{\usebibmacro{editorstrg}}%
      \setunit*{\addcomma\space}%
      \printfield[title]{labeltitle}}}

笔记:这非常具体地针对您的问题。需要更多自定义来处理标签名称不指代编辑器(例如,翻译器)的情况。

以下是完整的 MWE 和输出:

\documentclass[]{scrartcl}

\usepackage{xpatch}
\usepackage[backend=biber,style=authortitle-icomp]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{my.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}}

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

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

\xpatchbibmacro{bbx:editor}
  {\usebibmacro{#1}}
  {\setunit{\addspace}\printtext[parens]{\usebibmacro{#1}}}
  {}{}

\DeclareBibliographyDriver{incollection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \iffieldundef{crossref}
    {\usebibmacro{crossref:full}}
    {\usebibmacro{crossref:label}}
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \iffieldundef{crossref}
    {\usebibmacro{crossref:extrainfo}}
    {}
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\newbibmacro{crossref:full}{%
    \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
  \usebibmacro{event+venue+date}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \printlist{organization}%
  \newunit
  \usebibmacro{publisher+location+date}}

\newbibmacro{crossref:label}{%
  \entrydata{\strfield{crossref}}
     {\DeclareNameAlias{labelname}{given-family}%
      \printnames{labelname}%
      \setunit*{\addspace}%
      \printtext[parens]{\usebibmacro{editorstrg}}%
      \setunit*{\addcomma\space}%
      \printfield[title]{labeltitle}}}

\newbibmacro{crossref:extrainfo}{%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}}

\addbibresource{my.bib}
\pagestyle{empty}
\begin{document}

Test \cite{inproc1} and \cite{inproc2} and \cite{inproc3}
\printbibliography
\end{document}

在此处输入图片描述

答案2

这是我最怀念的BibTeX功能。

使用 BibTeX,这一切都可以实现:简单、可靠而且强大。

在 Biblatex 中,每种条目类型都需要额外的代码,并且该代码必须根据所使用的参考书目和引用样式进行调整:这很困难、容易出错、维护起来很困难,因此极其脆弱。

Biblatex 显然比 BibTeX 更强大、更复杂。遗憾的是,与其前身相比,臃肿的参考书目是少数真正的倒退之一。


我想,尽管我不确定,你想要这样的东西:

减少臃肿的参考书目

以下是我使用的代码的改编,它本身改编自对 TeX SE 的各种问题的各种回答以及 Biblatex 标准代码的部分内容。这些内容在代码的注释中有所说明。

\begin{filecontents}{\jobname.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}}

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

@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}{biblatex.cfg}
\ProvidesFile{biblatex.cfg}
% solution adapted from moewe's answer at http://tex.stackexchange.com/a/267321/, standard.bbx based on answer by Denis at http://tex.stackexchange.com/a/118850/, manual
\newif\iffaxminell@biblatex@compcoll
\faxminell@biblatex@compcollfalse
\DeclareBibliographyOption[boolean]{comp-coll}[true]{%
  \edef\tempa{#1}%
  \edef\tempb{true}%
  \edef\tempc{false}%
  \ifx\tempa\tempb
    \faxminell@biblatex@compcolltrue
  \else
    \ifx\tempa\tempc
      \faxminell@biblatex@compcollfalse
    \fi
  \fi
}
\AtEndPreamble{%
  \iffaxminell@biblatex@compcoll
    \newbibmacro*{faxminell:incollection:coll}{% addaswyd o standard.bbx 2017-04-16
      \usebibmacro{maintitle+booktitle}%
      \newunit\newblock
      \usebibmacro{byeditor+others}%
      \newunit\newblock
      \printfield{edition}%
      \newunit
      \iffieldundef{maintitle}
        {\printfield{volume}%
          \printfield{part}}
        {}%
      \newunit
      \printfield{volumes}%
      \newunit\newblock
      \usebibmacro{series+number}%
      \newunit\newblock
      \printfield{note}%
      \newunit\newblock
      \usebibmacro{publisher+location+date}%
      \newunit\newblock
      \usebibmacro{chapter+pages}%
      \newunit\newblock
      \iftoggle{bbx:isbn}
        {\printfield{isbn}}
        {}%
      \newunit\newblock
      \usebibmacro{doi+eprint+url}%
      \newunit\newblock
      \usebibmacro{addendum+pubstate}%
    }%
    \newbibmacro*{faxminell:incollection:crossref}{%
      \ifentryinbib{\thefield{crossref}}{%
        \cite{\thefield{crossref}}%
        \newunit\newblock
        \usebibmacro{chapter+pages}%
      }{%
        \iffieldundef{xref}{%
          \usebibmacro{faxminell:incollection:coll}%
        }{%
          \usebibmacro{faxminell:incollection:xref}%
        }%
      }%
    }%
    \newbibmacro*{faxminell:incollection:xref}{%
      \ifentryinbib{\thefield{xref}}{%
        \cite{\thefield{xref}}%
        \newunit\newblock
        \usebibmacro{chapter+pages}%
      }{%
        \usebibmacro{faxminell:incollection:coll}%
      }%
    }%
    \DeclareBibliographyDriver{incollection}{% adapted from standard.bbx based on answer by Denis at http://tex.stackexchange.com/a/118850/
      \citereset%
      \usebibmacro{bibindex}%
      \usebibmacro{begentry}%
      \usebibmacro{author/translator+others}%
      \setunit{\printdelim{nametitledelim}}\newblock
      \usebibmacro{title}%
      \newunit
      \printlist{language}%
      \newunit\newblock
      \usebibmacro{byauthor}%
      \newunit\newblock
      \usebibmacro{bytranslator+others}%
      \newunit\newblock
      \usebibmacro{in:}%
      \iffieldundef{crossref}{%
        \iffieldundef{xref}{%
          \usebibmacro{faxminell:incollection:coll}%
        }{%
          \usebibmacro{faxminell:incollection:xref}%
        }%
      }{%
        \usebibmacro{faxminell:incollection:crossref}%
      }%
      \setunit{\bibpagerefpunct}\newblock
      \usebibmacro{pageref}%
      \newunit\newblock
      \iftoggle{bbx:related}
        {\usebibmacro{related:init}%
         \usebibmacro{related}}
        {}%
      \usebibmacro{finentry}%
    }%
  \fi
}
% END redefine handling of @incollection etc.
\endinput
\end{filecontents}

\documentclass{article}
\usepackage[backend=biber,style=authortitle-icomp,comp-coll]{biblatex}
\addbibresource{\jobname.bib}

\begin{document}

Test \cite{inproc1} and \cite{inproc2} and \cite{inproc3}
\printbibliography

\end{document}

如果您已经有biblatex.cfg,您显然可以将代码添加到您现有的自定义中。或者,您可以按照通常的方式将代码包含在您的序言中,即将其夹在 和\makeatletter之间\makeatother

如果您需要此功能用于诸如@inproceedings等条目类型,那么您应该能够以类似的方式修改它们。(我不清楚您是否需要此功能,所以我只做了案例@incollection,这是我迄今为止发现的唯一需要的案例。)

答案3

捆绑包的样式biblatex-ext有一个名为的选项citexref,允许稍微缩短参考书目条目。

只需替换style=authortitle-icomp,style=ext-authortitle-icomp,添加citexref=true到选项即可。

\documentclass[]{scrartcl}
\usepackage[backend=biber,style=ext-authortitle-icomp, citexref=true]{biblatex}

\begin{filecontents}{\jobname.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},
}
@collection{proc,
  editor    = {Senor Editor and Senora Editora},
  publisher = {Any Publisher},
  title     = {My Proceedings},
  year      = {2013},
}
@inproceedings{inproc3,
  author    = {Nother Author},
  publisher = {Nother Publisher},
  title     = {In Some Other Proceedings},
  maintitle = {Main Title of Other Proceedings},
  year      = {2001},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
Test \autocite{inproc1} and \autocite{inproc2}
and \autocite{inproc3}
\printbibliography
\end{document}

作者,Test。“测试第二个标题”。收录于:编辑和 Editora,My Proceedings,第 10-20 页。

这不会在简短引用中给出“eds。”因为它只是镜像普通引用。可以通过稍微修改 bibmacro 来添加“Eds。cite

\documentclass[]{scrartcl}
\usepackage[backend=biber,style=ext-authortitle-icomp, citexref=true]{biblatex}

\newbibmacro{cite:labelname}{%
  \printnames{labelname}%
  \iffieldequalstr{labelnamesource}{author}
    {\setunit{\printdelim{authortypedelim}}%
     \usebibmacro{authorstrg}}
    {\iffieldequalstr{labelnamesource}{editor}
       {\setunit{\printdelim{editortypedelim}}%
        \usebibmacro{editor+othersstrg}}
       {\iffieldequalstr{labelnamesource}{translator}
         {\setunit{\printdelim{editortypedelim}}%
          \usebibmacro{translator+othersstrg}}
         {}}}}

\makeatletter
\renewbibmacro*{bbx:inxrefcite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\iffieldequals{namehash}{\cbx@lasthash}
          {\setunit{\compcitedelim}}
          {\usebibmacro{cite:labelname}%
           \setunit*{\printdelim{nametitledelim}}%
           \savefield{namehash}{\cbx@lasthash}}%
        \usebibmacro{cite:title}}}%
    {\usebibmacro{cite:shorthand}%
     \usebibmacro{cite:reinit}}%
  \setunit{\multicitedelim}}
\makeatother

\begin{filecontents}{\jobname.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},
}
@collection{proc,
  editor    = {Senor Editor and Senora Editora},
  publisher = {Any Publisher},
  title     = {My Proceedings},
  year      = {2013},
}
@inproceedings{inproc3,
  author    = {Nother Author},
  publisher = {Nother Publisher},
  title     = {In Some Other Proceedings},
  maintitle = {Main Title of Other Proceedings},
  year      = {2001},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
Test \autocite{inproc1} and \autocite{inproc2}
and \autocite{inproc3}
\printbibliography
\end{document}

作者,Test。“测试第二个标题”。收录于:Editor and Editora,编辑,My Proceedings,第 10-20 页。

相关内容