如何使用 BibLaTeX 省略 \printbibliography 中的一个特定引用?

如何使用 BibLaTeX 省略 \printbibliography 中的一个特定引用?

在我的博士论文中,如果该章节已经发布,我需要声明“本章已作为以下内容发布:......”。

使用命令来做这件事很方便\fullcite{}。但问题是这\fullcite{}也会出现在每个章节的参考书目中,这对读者来说毫无意义。

有没有办法指定一个引用不应该出现在参考书目中?(就像的反义词\nocite

MWE(我的真实.bib 文件是我的整个库):

    \documentclass{book}
    \usepackage[style=authoryear-comp]{biblatex}
    \addbibresource{\jobname.bib}
    \usepackage{filecontents}

    \begin{filecontents}{\jobname.bib}
    @book{key1,
      author = {Myself, Me.},
      year = {2001},
      title = {Title1},
      publisher = {Publisher1},
    }
    @book{key2,
        author = {Author, B.},
        year = {2002},
        title = {Title2},
        publisher = {Publisher2},
    }
    \end{filecontents}

    \begin{document}
    \chapter{A}
    This chapter has been published as :\\ 
    %(This \fullcite should not be in the reference list)
    \fullcite{key1}

    \section{section1}
    In text cite: \cite{key2}
    \printbibliography[segment=\therefsegment,heading=subbibliography]

    \end{document}

答案1

这是另一种方法,它创建一个具有自解释名称的命令\DontIncludeNextCite,并且不会影响同一 bibentry 的其他潜在引用。也就是说,这排除了特定的引文来自参考书目,但不是比本特利如果它在其他地方被引用。它还允许您使用refsegments(或refsections如果经过改编)。此外,它可以与任何 cite 命令一起使用,而不仅仅是\fullcite

\documentclass{book}

\usepackage{filecontents}
\usepackage[style=authoryear-comp,refsegment=chapter]{biblatex}
\usepackage{etoolbox}

\newtoggle{includeentry}
\toggletrue{includeentry}

\DeclareBibliographyCategory{entriesinbib1,entriesinbib2,entriesinbib3} % you need as many as the number of refsegments in your document

\AtEveryCitekey{%
    \iftoggle{includeentry}{%
        \addtocategory{entriesinbib\therefsegment}{\thefield{entrykey}}}%
        {}%
    }

\newcommand{\DontIncludeNextCite}{\AtNextCite{\togglefalse{includeentry}}}

\begin{filecontents}{\jobname.bib}
@book{key1,
  author = {Myself, Me.},
  year = {2001},
  title = {Title1},
  publisher = {Publisher1},
}
@book{key2,
    author = {Author, B.},
    year = {2002},
    title = {Title2},
    publisher = {Publisher2},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\chapter{A}

This chapter has been published as: \DontIncludeNextCite\fullcite{key1}. % This cite will not include key1 in the bibliography 

In text cite \parencite{key2}.

Another cite \parencite{key1}. % But this one will

\printbibliography[category=entriesinbib1,heading=subbibliography]

\chapter{B}

Now, in a second refsegment.

This chapter has been published as :\\ 
\DontIncludeNextCite\fullcite{key1}. % This cite will not include key1 in the bibliography 

In text cite \parencite{key2}.

\printbibliography[category=entriesinbib2,heading=subbibliography]

\chapter{C}

Now, in a third refsegment.

This chapter has been published as :\\ 
\DontIncludeNextCite\fullcite{key1}. % This cite will not include key1 in the bibliography 

In text cite \parencite{key2}.

Another cite \parencite{key1}. % But this one will

\printbibliography[category=entriesinbib3,heading=subbibliography]

\end{document}

答案2

Biblatex 可让您打印参考书目,既可以不打印 .bib 文件中条目中包含特定关键字的所有项目,也可以只打印包含此关键字的项目。此操作的语法为\printbibliography[notkeyword=<keyword>]\printbibliography[keyword=<keyword>]。您应该按如下方式调整文件:

\documentclass{book}
\usepackage[style=authoryear-comp]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book{key1,
  author = {Myself, Me.},
  year = {2001},
  title = {Title1},
  publisher = {Publisher1},
  keyword = {donotinclude}
}
@book{key2,
    author = {Author, B.},
    year = {2002},
    title = {Title2},
    publisher = {Publisher2},
}
\end{filecontents}

\begin{document}
\chapter{A}
This chapter has been published as :\\ 
%(This \fullcite should not be in the reference list)
\fullcite{key1}

\section{section1}
In text cite: \cite{key2}
\printbibliography[segment=\therefsegment,heading=subbibliography,notkeyword=donotinclude]

\end{document}

答案3

由于您已经在使用多个refsection环境来获取每个章节的参考书目,并且fullcite您想要避免的参考文献位于可预测的位置,因此我将创建一个新的宏,如下所示:

\newcommand{\prevPub}[1]{%
    \begin{refsection}%
    This chapter has been published as :\\%
    \fullcite{#1}%
    \end{refsection}%
}

你的 MWE 看起来像

   \documentclass{book}
    \usepackage[style=authoryear-comp]{biblatex}
    \addbibresource{\jobname.bib}
    \usepackage{filecontents}

    \begin{filecontents}{\jobname.bib}
    @book{key1,
      author = {Myself, Me.},
      year = {2001},
      title = {Title1},
      publisher = {Publisher1},
    }
    @book{key2,
        author = {Author, B.},
        year = {2002},
        title = {Title2},
        publisher = {Publisher2},
    }
    \end{filecontents}

\newcommand{\prevPub}[1]{%
    \begin{refsection}%
    This chapter has been published as :\\%
    \fullcite{#1}%
    \end{refsection}%
}
    \begin{document}
    \chapter{A}
    \prevPub{key1}

    \section{section1}
    In text cite: \cite{key2}
    \printbibliography[segment=\therefsegment,heading=subbibliography]

    \end{document}

相关内容