biblatex + \mcite;在带有子条目的参考文献中添加任意文本

biblatex + \mcite;在带有子条目的参考文献中添加任意文本

在化学中,给文献添加前缀甚至给参考文献添加注释是很常见的。查看文献中的一些例子可以让你了解我的意思。它不是用 LaTeX 创建的!

我尝试了 biblatex + biber 和\mciteand\bibnote命令,但没有找到解决方案。我想在 bibitem 之前的子条目中添加某些参考文献中的文本。

我创建了这个MWE:

\documentclass[english]{article}
\usepackage{selinput}
\SelectInputMappings{adieresis={ä},germandbls={ß},Euro={€}}
\usepackage{babel}
\usepackage[T1]{fontenc}

\usepackage[%
  citestyle=numeric-comp,
  bibstyle=chem-angew,
  sorting=none,
  backend=biber,
  mcite=true,
  subentry,
]{biblatex}
\usepackage{notes2bib}
\usepackage{filecontents}

\begin{filecontents}{example.bib}
@article{Boncella1984,
author = {Boncella, James M. and Andersen, Richard A.},
journal = {Inorg. Chem.},
pages = {432--437},
volume = {23},
year = {1984}
}

@article{Tilley1982,
author = {Tilley, T. Don and Andersen, Richard},
journal = {J. Am. Chem. Soc.},
pages = {1772--1774},
volume = {104},
year = {1982}
}
\end{filecontents}

\addbibresource{example.bib} 

\begin{document}
\section{sec1}

This is some nice text I want to cite.\mcite{set1,*Boncella1984,*Tilley1982}
I want to add this note in references.\bibnote{test note}
Here I cite a single paper from the previous set.\cite{Tilley1982} This is how it should look like with included note.\bibnote{See, for example: \fullcite{set1}}

\printbibliography
\end{document} 

我对参考文献 1 中创建的子条目很满意:

\mcite{set1,*Boncella1984,*Tilley1982}

并通过引用预定义 set1 中的一个键来引用集合的成员:

 \cite{Tilley1982}

我也很乐意将注释添加到参考文献部分,例如参考文献 2 中:

\bibnote{test note}

但我还需要在某个参考文献的 bibitem 前添加一些文本。这应该看起来像参考文献 3。然而,

\bibnote{See, for example: \fullcite{set1}}

只给我一个尾注,后面跟着参考文献 1 的副本。这不适用,因为我必须set1\mcite之前定义,这当然会导致 2 个参考文献。参考文献 3 仅用于演示它应该是什么样子。我无法获得一个看起来像参考文献 3 的参考文献。类似

\bibnote{See, for example:\mcite{set1,*Boncella1984,*Tilley1982}}

不起作用。它给了我 2 个参考。

我如何创建带有文本和子条目的参考文献?我还想有机会在其他地方引用该集合的单个成员,例如在参考文献 1b 中。

编辑1:

This is some nice text I want to cite.\bibnote{some added text:\mcite{set1,*Boncella1984,*Tilley1982}}
I want to add this note in references.\bibnote{test note}
Here I cite a single paper from the previous set.\cite{Tilley1982} This is how it should look like with included note.\bibnote{more added text: \fullcite{set1}}

给出以下内容:

\bibnote{some added text:\mcite{set1,*Boncella1984,*Tilley1982}}

只需添加文本,然后使用括号括起引用,如您在第二个示例中的引用 1 中看到的那样。我只想创建一个带有子条目的引用,其中某些文本后面是子条目 (a)。它应该看起来像引用 3。但是,引用 3 只是为了给您看而构建的。它不能作为“独立”引用创建,只能与第二个引用结合使用。

编辑2:

因为似乎还不清楚。仅应用此:

\begin{document}
\section{sec1}

This is some nice text I want to cite.\bibnote{some added text:\mcite{set1,*Boncella1984,*Tilley1982}}

\printbibliography
\end{document} 

给出以下输出: 在此处输入图片描述

其中创建了 2 个引用而不是所需的 1 个,并且没有一个符合我的要求。

编辑3:

受此启发问题我创建了一个示例。但是,添加的注释当然是在引用的问题中相应的 bibitem 之后。如何才能将添加的注释放在 bibitem 之前,但仍在参考编号 [X] 之后?我有一个巨大的文档,其中每一章都有自己的参考文献。添加注释似乎可行,但并不优雅。由于我的注释与工作(章节)相关,所以我不想编辑我的 *.bbl。但是,选择的方式loadfiles不是很优雅。但我仍然可以将我的注释放在\cite命令附近。将所有注释放在文档的序言或其他地方是不合适的。

重复我的问题:如何才能在我的 bibiem 前面添加注释,并应用\loadfiles选项让它们看起来像上面例子中的 ref 3?

\documentclass[english]{article}
\usepackage{selinput}
\SelectInputMappings{adieresis={ä},germandbls={ß},Euro={€}}
\usepackage{babel}
\usepackage[T1]{fontenc}

\usepackage[%
 citestyle=numeric-comp,
   bibstyle=chem-angew,
   sorting=none,
  backend=biber,
  mcite=true,
  subentry,
  loadfiles=true,
]{biblatex}
\usepackage{notes2bib}
\usepackage{filecontents}

\begin{filecontents}{example.bib}
@article{Boncella1984,
author = {Boncella, James M. and Andersen, Richard A.},
journal = {Inorg. Chem.},
pages = {432--437},
volume = {23},
year = {1984}
}

@article{Tilley1982,
author = {Tilley, T. Don and Andersen, Richard},
journal = {J. Am. Chem. Soc.},
pages = {1772--1774},
volume = {104},
year = {1982}
}
\end{filecontents}

\DeclareFieldFormat{annotation}{#1}
\renewbibmacro*{annotation}{
  \IfFileExists{notes/note-\thefield{entrykey}.tex}{\par}{}
  \printfile[annotation]{notes/note-\thefield{entrykey}.tex}
}

\AtEveryBibitem{
\csappto{blx@bbx@\thefield{entrytype}}{\usebibmacro{annotation}}
}

\addbibresource{example.bib} 

\begin{document}
\section{sec1}
\begin{refsection}
This is some text I want to cite.\mcite{set1,*Boncella1984,*Tilley1982}
\begin{filecontents}{notes/note-set1.tex}
hello world
\endinput
\end{filecontents}
\printbibliography
\end{refsection}

\section{sec2}
\begin{refsection}

This is even more text I want to cite.\mcite{set2,*Boncella1984,*Tilley1982}

\begin{filecontents}{notes/note-set2.tex}
hello again
\endinput
\end{filecontents}
\printbibliography
\end{refsection}
\end{document}

在此处输入图片描述

答案1

更新

据我了解,您希望能够添加一条注释,该注释将在开始书目条目(与您的领域的使用一致,其中书目似乎包含在其他领域可能出现在脚注或尾注中的材料)。

今天我尝试了好几次,每次都更接近目标。我认为最好的解决方案可能是这样的:

  1. 我们定义一个\prenotation{key}{text}写入.aux文件的命令。这样做的原因是我们需要使用\AtEveryBibitem,它只能在序言中使用;但在序言中给出所有这些符号是不方便的(尽管它可以工作)。

  2. 实际写入.aux文件的是一个内部命令,该命令设置了对每个 bibitem 进行的检查。如果您有大量此类注释,这可能会减慢速度,但我认为这不会成为问题。我已经改进了检查,这样如果某个给定的密钥偶然被使用多次(如果有多个参考书目,可能会出现这种情况),注释只会在第一次使用时打印出来。

  3. 然后,我们需要进行一些内部处理来取消定义这个内部命令(或者,更确切地说,阉割它),这样我们就不会\AtEveryBibitem.aux文件最后再次读入时尝试使用它。

\documentclass[english]{article}
\usepackage{selinput}
\SelectInputMappings{adieresis={ä},germandbls={ß},Euro={€}}
\usepackage{babel}
\usepackage[T1]{fontenc}

\usepackage[%
 citestyle=numeric-comp,
   bibstyle=chem-angew,
   sorting=none,
  backend=biber,
  mcite=true,
  subentry,
  loadfiles=true,
]{biblatex}
\usepackage{notes2bib}
\usepackage{filecontents}

\begin{filecontents}{example.bib}
@article{Boncella1984,
author = {Boncella, James M. and Andersen, Richard A.},
journal = {Inorg. Chem.},
pages = {432--437},
volume = {23},
year = {1984}
}

@article{Tilley1982,
author = {Tilley, T. Don and Andersen, Richard},
journal = {J. Am. Chem. Soc.},
pages = {1772--1774},
volume = {104},
year = {1982}
}
\end{filecontents}

\makeatletter
\newcommand{\prenotation}[2]{%
  \write\@mainaux{\noexpand\bl@makeprenotation{#1}{#2}}}
\newcommand{\bl@makeprenotation}[2]{%
  \AtEveryBibitem{%
    \ifcsdef{bl@prenote#1}
      {}
      {\iffieldequalstr{entrykey}{#1}
         {\expandafter\gdef\csname bl@prenote#1\endcsname{}%
          #2}
         {}}}}
\AtBeginDocument{\let\bl@makeprenotation\@gobbletwo}
\makeatother

\addbibresource{example.bib} 

\begin{document}

\section{sec1}
\begin{refsection}
This is some text I want to cite.\mcite{set1,*Tilley1982,*Boncella1984}
\prenotation{set1}{Here is an introductory text for set 1: }%

\printbibliography
\end{refsection}

\section{sec2}
\begin{refsection}

This is even more text I want to cite \mcite{set2,*Tilley1982,*Boncella1984}, with a note \bibnote{And here is a bibnote.}. 

\prenotation{set2}{Here is an introductory text for set 2: }%

\printbibliography
\end{refsection}
\end{document}

在此处输入图片描述

相关内容