如何僅列印參考書目子條目中父條目的編輯者和標題

如何僅列印參考書目子條目中父條目的編輯者和標題

在我的參考書目中,我想要如果父項至少有兩個子項,則僅在子項中列印編輯者的姓名和父項作品的標題,而我現在得到的是每個子項中的完整父項。然後,父條目應在編輯者姓名下完整列印。所以而不是

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}}}

筆記:這對於你的問題來說非常具體。當 labelname 不引用編輯器(例如,翻譯器)時,需要更多的自訂來處理情況。

這是完整的 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}

作者,測試。 “測試第二個標題”。請參閱:Editor and Editora,我的論文集,第 10-20 頁。

這並沒有給出“eds”。在簡短的引文中,因為它只是反映了正常的引文。 “編輯。”可以透過稍微修改 bibmacro 來新增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}

作者,測試。 “測試第二個標題”。請參閱:Editor 和 Editora,編輯,我的論文集,第 10-20 頁。

相關內容