从 biblatex 获取 apa 风格引文的 ibid

从 biblatex 获取 apa 风格引文的 ibid

目标:当同一来源被引用多次时,我想使用 biblatex-apa 样式进行引用,并添加 (ibid.) 扩展。


笔记:这是从 biblatex 获取 ibid 的数字引用

此外,我知道 ibidem 明确不是作为 APA 引用样式的一部分,有些人甚至认为它是老式的或过时的,但每个机构都有自己的要求,而且由于 biblatex-apa 在其他各个方面都符合我的要求,所以我想添加这个小扩展,而不是使用其他样式。

在上面链接的帖子中,他们使用 numeric-comp-style 做了类似的事情,但将建议的代码复制到我的序言中对我的情况没有帮助。由于我对这种“LaTeX 黑客”经验不足,如何才能得到与线上面寻找 biblatex-apa?

我的最小工作文档如下所示:

\documentclass[12pt,a4paper]{scrartcl}

% Bibliography entries:
\begin{filecontents}{literatur.bib}
@booklet{one,
author = {Author One},
title = {Testtitle 1.},
date = {2018},
}
@booklet{two,
author = {Author Two},
title = {Testtitle 2.},
date = {2018},
}
\end{filecontents}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 
\usepackage{lmodern}
\usepackage[ngerman]{babel}   
\usepackage[backend=biber,style=apa,sortlocale=de_DE]{biblatex}
\DeclareLanguageMapping{ngerman}{ngerman-apa}
\addbibresource{literatur.bib}

\begin{document}
First citation should be normal \parencite{one}, second time with ibidem 
\parencite{one}, but after a second citation \parencite{two} it should 
appear as usual \parencite{one}.    
\printbibliography
\end{document}

这是我得到的:

Document without ibidem

...这就是我想要得到的:

Document with ibidem

请注意,(ebd.)只是(ibid.)的德语版本。

非常感谢您的帮助和建议。:)

答案1

这需要一点代码,但对原始定义的实际改变.cbx并不大。

首先,我们需要定义一个宏来打印 ibidem cite:ibid(从 复制authoryear-ibid.cbx)。我们还使用 请求 ibidem 跟踪器ibidtracker=constrict并使用 页面跟踪(以避免在页面开头出现“ibid.”)pagetracker

然后只需在和宏\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}中的正确位置插入条件并添加对的调用即可。citetextcitecite:ibid

\documentclass[12pt,a4paper]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage[backend=biber, style=apa, pagetracker, ibidtracker=constrict]{biblatex}
\addbibresource{biblatex-examples.bib}

\makeatletter
\providecommand*{\mkibid}[1]{#1}

\newbibmacro*{cite:ibid}{%
  \printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}}

\renewbibmacro*{cite}{%
  \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
    {\usebibmacro{cite:ibid}}
    {\iffieldequals{fullhash}{\cbx@lasthash}
     % Multiple cites in one command
      {\setunit{\compcitedelim}%
       \usebibmacro{cite:plabelyear+extradate}}%
     % Single cite
      {\ifthenelse{\ifnameundef{labelname}\OR\iffieldequalstr{entrytype}{patent}}
     % No author/editor
         {\usebibmacro{cite:noname}%
          \setunit{\printdelim{nameyeardelim}}%
          \usebibmacro{cite:plabelyear+extradate}%
          \savefield{fullhash}{\cbx@lasthash}}
     % Normal cite
        {\ifnameundef{shortauthor}
           {\printnames[labelname][-\value{listtotal}]{labelname}}%
           {\cbx@apa@ifnamesaved
             {\printnames{shortauthor}}
             {\printnames[labelname][-\value{listtotal}]{author}%
              \addspace\printnames[sabrackets]{shortauthor}}}%
         \setunit{\printdelim{nameyeardelim}}%
         \usebibmacro{cite:plabelyear+extradate}%
         \savefield{fullhash}{\cbx@lasthash}}}}%
   \setunit{\multicitedelim}}

\renewbibmacro*{textcite}{%
  \iffieldequals{fullhash}{\cbx@lasthash}
   % Compact cite - more than one thing for same author
    {\setunit{\compcitedelim}%
     \usebibmacro{cite:plabelyear+extradate}}
   % New cite
    {%
    \ifbool{cbx:parens}
      {\bibcloseparen\global\boolfalse{cbx:parens}}
      {}%
      \setunit{\compcitedelim}%
      \ifthenelse{\ifnameundef{labelname}\OR\iffieldequalstr{entrytype}{patent}}
    % No author/editor or patent
       {\iffieldundef{shorthand}%
    % Cite using title
         {\usebibmacro{cite:noname}%
          \setunit{\ifbool{cbx:np}%
                   {\printdelim{nameyeardelim}}%
                   {\global\booltrue{cbx:parens}\addspace\bibopenparen}}%
          \usebibmacro{cite:plabelyear+extradate}}
    % Cite using shorthand
         {\usebibmacro{cite:shorthand}}}
    % Normal cite with author/editor
    % Normal full cite
       {\ifnameundef{shortauthor}%
    % Normal full cite
         {\printnames[labelname][-\value{listtotal}]{labelname}}
    % Cite using short author
         {\cbx@apa@ifnamesaved
           {\printnames{shortauthor}}
           {\printnames[labelname][-\value{listtotal}]{author}}}%
    % Year
        \setunit{\ifbool{cbx:np}
                  {\printdelim{nameyeardelim}}
                  {\global\booltrue{cbx:parens}\addspace\bibopenparen}}%
    % Put the shortauthor inside the year brackets if necessary
        \ifnameundef{shortauthor}
         {}
         {\cbx@apa@ifnamesaved
           {}
           {\printnames{shortauthor}\setunit{\printdelim{nameyeardelim}}}}%
    % Actual year printing
        \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
          {\usebibmacro{cite:ibid}}
          {\usebibmacro{cite:plabelyear+extradate}}%
    % Save name hash for checks later
        \savefield{fullhash}{\cbx@lasthash}}}}
\makeatother

\begin{document}
First citation should be normal \parencite{sigfridsson}, second time with ibidem
\parencite{sigfridsson}, but after a second citation \parencite{geer} it should
appear as usual \parencite{sigfridsson}.

\cite{nussbaum}

First citation should be normal \textcite{sigfridsson}, second time with ibidem
\textcite{sigfridsson}, but after a second citation \textcite{geer} it should
appear as usual \textcite{sigfridsson}.

\printbibliography
\end{document}

First citation should be normal (Sigfridsson & Ryde, 1998), second time with ibidem (ebd.), but after a second citation (Geer, 1985) it should appear as usual (Sigfridsson & Ryde, 1998). Nussbaum, 1978 First citation should be normal Sigfridsson und Ryde (1998), second time with ibidem Sigfridsson und Ryde (ebd.), but after a second citation Geer (1985) it should appear as usual Sigfridsson und Ryde (1998).

相关内容