如何在两个参考文献之间映射 bibentry 字段

如何在两个参考文献之间映射 bibentry 字段

我最初的问题是我有一本书,其中包含各种以前出版的文章的再版。

引用此类文章时,参考文献应该

文章信息。转载于:书籍信息,第 X-XX 页

其中 X-XX 对应于文章在书中的页码范围。大部分操作可以通过 biblatex 的相关选项完成。更准确地说,我的条目如下所示

@article{Author.1980,
 author = {Author, A},
 year = {1980/2001},
 title = {{Title article}},
 pages = {15--29},
 volume = {1},
 number = {1},
 journal = {{Journal Title}},
 related = {Author.2001},
 relatedstring = {Reprinted in:},
}


@book{Author.2001,
 year = {2001},
 title = {{Book Title}},
 address = {Book address},
 publisher = {{Book publisher}},
}

问题出在书的页码上。我可以在书中指定 pages={X-XX},但如果我只有一篇文章,这就可以了。

所以我的想法是在文章的注释字段中指定书的页码,即 note={pp. X-XX},然后使用\DeclareSourcemap这些值映射到书的附录。我认为这应该可以解决问题,但不幸的是,我无法做到这一点,因为我\DeclareSourcemap以前没有使用过。

我希望有人能帮助我解决这个问题...提前致谢

编辑:这是一个 MWE,用于说明我想要的内容:

\documentclass[12pt]{article}

\usepackage{filecontents}
\usepackage[backend=biber,alldates=long,dateabbrev=false,style=authoryear,sorting=nty,isbn=false,doi=false,
dashed=false,maxcitenames=2,maxbibnames=99,
bibencoding=utf8]{biblatex}

\begin{filecontents}{biblio.bib}

@article{Author.1980,
 author = {Author, A},
 year = {1980/2001},
 title = {{Title article A}},
 pages = {10--20},
 volume = {1},
 number = {1},
 journal = {{Journal Title A}},
 related = {Author.2001},
 relatedstring = {Reprinted in:},
}

@article{Author.1981,
 author = {Author, A},
 year = {1981/2001},
 title = {{Title article B}},
 pages = {40--50},
 volume = {1},
 number = {1},
 journal = {{Journal Title B}},
 related = {Author.2001},
 relatedstring = {Reprinted in:},
 }

@book{Author.2001,
 year = {2001},
 title = {{Book Title}},
 address = {Book address},
 publisher = {{Book publisher}},
}


\end{filecontents}

\addbibresource{biblio.bib}

\begin{document}

I have two articles that are reprinted in a book. I would like to add the pages of the reprints after the reference, i.e., 
if article A corresponds to pages 100-110 and article B corresponds to pages 200-210 in the reprint, these page numbers should be appended to the entry in the reference list.\vspace{1cm}

Test citation \textcite{Author.1980} and \textcite{Author.1981}.

\printbibliography

\end{document}

答案1

我想,实现这一点的一种方法是创建一个新的输入选项,并在自定义相关类型中使用它。

此代码创建了一个名为 的新条目选项,reprintpages您可以在条目中使用article。此选项的值保存在 中\frank@abx@field@reprintpages,然后恢复到(基于)宏pages内的字段。当您指定 时,将使用此宏。related:reprintedinrelated:defaultrelatedtype = {reprintedin}

\documentclass{article}

\begin{filecontents}[overwrite]{\jobname.bib}
@article{Author.1980,
  author = {Author, A},
  year = {1980/2001},
  title = {Title article A},
  pages = {10--20},
  volume = {1},
  number = {1},
  journal = {Journal Title A},
  related = {Author.2001},
  relatedtype = {reprintedin},
  relatedstring = {Reprinted in:},
  options = {reprintpages=100--110}
}
@article{Author.1981,
  author = {Author, A},
  year = {1981/2001},
  title = {Title article B},
  pages = {40--50},
  volume = {1},
  number = {1},
  journal = {Journal Title B},
  related = {Author.2001},
  relatedtype = {reprintedin},
  relatedstring = {Reprinted in:},
  options = {reprintpages=200--210},
}
@book{Author.2001,
  year = {2001},
  title = {Book Title},
  address = {Book address},
  publisher = {Book publisher}
}
\end{filecontents}

\usepackage[alldates=long, dateabbrev=false, style=authoryear, sorting=nty,
  isbn=false, doi=false, dashed=false, maxcitenames=2,
  maxbibnames=99]{biblatex}
\addbibresource{\jobname.bib}

\makeatletter
\DeclareEntryOption[string]{reprintpages}{%
  \def\frank@abx@field@reprintpages{#1}}

\newbibmacro*{related:reprintedin}[1]{%
  \entrydata*{#1}{%
    \usedriver
      {\restorefield{pages}{\frank@abx@field@reprintpages}%
       \ifnameundef{savedauthor}
         {\ifnameundef{savededitor}
            {}
            {\ifnamesequal{editor}{savededitor}
               {\clearname{editor}}
               {}}}
         {\ifnamesequal{author}{savedauthor}
            {\clearname{author}}
            {}}%
       \renewbibmacro*{related:init}{}%
       \DeclareNameAlias{sortname}{default}%
       \ifbibmacroundef{date+extradate}
         {}
         {\renewbibmacro*{date+extradate}{}%
          \renewbibmacro*{bbx:ifmergeddate}{\@secondoftwo}}%
       \renewbibmacro*{pageref}{}}
      {\thefield{entrytype}}}}
\makeatother


\begin{document}

I have two articles that are reprinted in a book. I would like to add the
pages of the reprints after the reference, i.e., if article A corresponds to
pages 100-110 and article B corresponds to pages 200-210 in the reprint, these
page numbers should be appended to the entry in the reference
list.

\vspace{1cm}

Test citation \textcite{Author.1980} and \textcite{Author.1981}.

\printbibliography

\end{document}

输出

相关内容