在 biblatex-ext 中合併兩個獨立的 biblatex 字段

在 biblatex-ext 中合併兩個獨立的 biblatex 字段

我想連接一個incollection項目的年份和頁數,以便在參考書目中將它們顯示為一個單元。在不同的情況下(期刊+項目中的頁碼article),我編寫了一個新的bibmacro並替換了article.但是,使用由biblatex-ext,我不確定如何實現此策略。在另一個問題這導致我使用biblatex-ext,我收到了這個代碼:

\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=ext-authoryear-ibid, citexref=true]{biblatex}

\usepackage{libertinus}

\begin{filecontents}{\jobname.bib}
@collection{EickerWolf2017,
  title    = {Ungleichheit in Deutschland – ein »gehyptes Problem«?},
  editor   = {Eicker-Wolf, Kai and Truger, Achim},
  location = {Marburg},
  year     = {2017},
}
@incollection{Schreiner2017,
  author   = {Schreiner, Patrick},
  title    = {Löhne und Verteilung},
  crossref = {EickerWolf2017},
  pages    = {47--78},
}
@incollection{Bosch2017,
  author   = {Bosch, Gerhard and Kalina, Thorsten},
  title    = {Die deutsche Mittelschicht aus der Arbeitsmarktperspektive},
  crossref = {EickerWolf2017},
  pages    = {111--142},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{Bosch2017,Schreiner2017}
\printbibliography
\end{document}

對於父條目的簡短引用,在給出編輯者姓名後,我想將年份和頁碼放在括號中,並用冒號和空格分隔[2017,p.17–46 → (2017: 17–46)]我會使用以下一些東西:

\newbibmacro*{year+pages}{%
  \space\printtext[parens]{\printfield{year}: \printfield{pages}}%
  \newunit}

在瀏覽了 moewe 的程式碼biblatex-ext並收到了一些指示後,我只是不知道應該將其放置在哪裡,因為涉及交叉引用和各種切換。有人可以給我提示嗎?

答案1

您可以修改 中的程式碼,biblatex-ext以便將 的頁面引用xrefcite直接列印在引用命令的後註中,並使用該功能\textcite

首先,我們必須從相關的 bibdriver 中刪除列印頁面的 bibmacro。然後我們修改crosscitebibmacro,以便它將pages欄位傳遞給引用命令。

\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=ext-authoryear-ibid, citexref=true]{biblatex}

\usepackage{libertinus}

\DeclareDelimFormat{postnotedelim}{\addcolon\space}
\DeclareFieldFormat{postnote}{\mknormrange{#1}}

\usepackage{xpatch}
\newcommand*{\removechapterpages}[1]{%
  \xpatchbibdriver{#1}
    {\newunit\newblock
     \usebibmacro{chapter+pages}}
    {}
    {}{}}
\removechapterpages{inbook}
\removechapterpages{incollection}
\removechapterpages{inproceedings}

\renewbibmacro*{crosscite}[1]{%
  \iftoggle{bbx:citexref}
    {\iffieldundef{crossref}
       {\iffieldundef{xref}
          {\usebibmacro{#1}%
           \newunit\newblock
           \usebibmacro{chapter+pages}}
          {\usebibmacro{xrefcitewithpages}{xref}}}
       {\usebibmacro{xrefcitewithpages}{crossref}}}
    {\usebibmacro{#1}%
     \newunit\newblock
     \usebibmacro{chapter+pages}}}

\makeatletter
\newbibmacro{xrefcitewithpages}[1]{%
  \printtext{%
    \iffieldundef{pages}
      {\bbx@xrefcite{\thefield{#1}}}
      {\expandafter\bbx@xrefcite\expandafter[\abx@field@pages]{\thefield{#1}}}}%
}

\renewcommand*{\bbx@xrefcite}{%
  \AtNextCite{%
    \boolfalse{citetracker}%
    \boolfalse{pagetracker}%
    \boolfalse{backtracker}}%
  \textcite}
\makeatother

\begin{filecontents}{\jobname.bib}
@collection{EickerWolf2017,
  title    = {Ungleichheit in Deutschland – ein »gehyptes Problem«?},
  editor   = {Eicker-Wolf, Kai and Truger, Achim},
  location = {Marburg},
  year     = {2017},
}
@incollection{Schreiner2017,
  author   = {Schreiner, Patrick},
  title    = {Löhne und Verteilung},
  crossref = {EickerWolf2017},
  pages    = {47--78},
}
@incollection{Bosch2017,
  author   = {Bosch, Gerhard and Kalina, Thorsten},
  title    = {Die deutsche Mittelschicht aus der Arbeitsmarktperspektive},
  crossref = {EickerWolf2017},
  pages    = {111--142},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{Bosch2017,Schreiner2017}
\printbibliography
\end{document}

博世、格哈德和托爾斯滕·卡利納 (2017)。 「德國工業市場透視」。參見:《艾克-狼與特魯格》(Eicker-Wolf und Truger)(2017:111-142)。

相關內容