从 biblatex 获取 ibid 的数字引用

从 biblatex 获取 ibid 的数字引用

当连续使用相同的引文时,我希望引用同上。

因此,它不会读作 Apple is this [1]. This is a pear [1]. 而是 Apple is this [1]. This is a pear [ibid]. 但是,我还没有找到如何使用数字样式来实现这一点。使用authoryear也只是打印了整个参考文献。如何使用 ibid 获取数字引用?

我的代码:

\documentclass[a4paper,oneside, 11pt, openany]{memoir}
\usepackage[english]{babel}
\usepackage[T1]{fontenc} 
\usepackage{txfonts}
\usepackage[utf8]{inputenc}
\usepackage{wallpaper}
\usepackage{palatino}
\setlength{\parindent}{2.5em}
\usepackage[backend=biber, style= numeric-comp, ibidpage=true]{biblatex}
\addbibresource{biblio.bib}
\usepackage{rotating}
\usepackage[inner=2.5cm,outer=2.5cm,  tmargin=2.5cm, bmargin=2.5cm]{geometry}
\setcounter{secnumdepth}{2}
\usepackage{titlesec}
\usepackage{color}
\titleformat{\chapter}[display]

示例文本:编码能力被认为超越了人类基因组\cite{Vipperla2012}。与特定物种相关的特定分类群有能力影响宿主的健康\cite{Vipperla2012}

答案1

标准数字样式没有附带版本-ibid,因此我们必须构建自己的样式。请注意,这些样式不存在的原因是它们非常不寻常,重复的数字引用通常比“ibid”更短。(我认为这只是为了避免通过一遍又一遍地重复长引用标签来使文本混乱)。

无论如何,对于numeric-comp样式,我们只需插入一个ibid-testcite:comp并定义必要的宏

\makeatletter
\renewbibmacro*{cite:comp}{%
  \addtocounter{cbx@tempcntb}{1}%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifbool{bbx:subentry}
          {\iffieldundef{entrysetcount}
             {\usebibmacro{cite:comp:comp}}
             {\usebibmacro{cite:comp:inset}}}
          {\usebibmacro{cite:comp:comp}}}}
    {\usebibmacro{cite:comp:shand}}}

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

为了使其工作,您需要加载biblatex选项ibidtracker=constrict(该选项ibidpage不被numeric类似样式识别并且会引发错误)。

然后是完整的 MWE

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[british]{babel}
\usepackage{csquotes} 
\usepackage[style=numeric-comp, backend=biber, ibidtracker=constrict]{biblatex}

\addbibresource{biblatex-examples.bib}

\makeatletter
\renewbibmacro*{cite:comp}{%
  \addtocounter{cbx@tempcntb}{1}%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifbool{bbx:subentry}
          {\iffieldundef{entrysetcount}
             {\usebibmacro{cite:comp:comp}}
             {\usebibmacro{cite:comp:inset}}}
          {\usebibmacro{cite:comp:comp}}}}
    {\usebibmacro{cite:comp:shand}}}

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


\begin{document}
  \cite{sigfridsson} and \cite{sigfridsson} and \cite{worman} and \cite{sigfridsson}

  \printbibliography
\end{document}

给出

[1]及[同上]及[2]及[1]

相关内容