通过自定义引用命令细分参考书目

通过自定义引用命令细分参考书目

我正在使用自定义引用命令,并希望参考书目仅包含使用自定义引用命令引用的条目。我有一个使用未引用项目的参考列表,notcategory=cited并希望使用我的引用条目有类似的内容\customcite。我查看了 biblatex 文档,但我无法弄清楚。

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage[backend=biber]{biblatex}
\begin{filecontents}{\jobname.bib}
@BOOK{customciteentry,
  author    = {Customcite},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2003,
  keywords  = {hello},
}
@BOOK{BookB02,
  author    = {John Doe},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2002,
}
@MISC{LinkC04,
  author    = {Author Ccc},  
  title     = {Some Title},
  year      = 2004,
  url       = {www.test1.com/bild.jpg},
  keywords  = {bye},
}
\end{filecontents}
\addbibresource{\jobname.bib}

% Bibliography, allows section 'uncited references'
\DeclareBibliographyCategory{cited}
\AtEveryCitekey{\addtocategory{cited}{\thefield{entrykey}}}

% Cite, \customcite
\DeclareCiteCommand{\customcite}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}%
      \indexfield{indextitle}}
     {}%
   \printtext[bibhyperref]{%
       \printnames{labelname}%
       \space 
       \printfield{year}%
       \addcolon\space%\setunit{\labelnamepunct}%
       \printfield[citetitle]{labeltitle}%
     }%
   }
  {\multicitedelim}
  {\usebibmacro{postnote}}
  

\begin{document}

\cite{BookB02}

\customcite{customciteentry}

\nocite{*}
\printbibliography[title={Not cited},notcategory=cited]
\printbibliography[title={Cited},category=cited]
\printbibliography[title={Customcited}]
\end{document}

答案1

您也可以在自定义引用命令中将键添加到类别中,例如:

\DeclareBibliographyCategory{customcited}
% Cite, \customcite
\DeclareCiteCommand{\customcite}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}%
      \indexfield{indextitle}}
     {}%
   \addtocategory{customcited}{\thefield{entrykey}}%
   \printtext[bibhyperref]{%
       \printnames{labelname}%
       \space
       \printfield{year}%
       \addcolon\space%\setunit{\labelnamepunct}%
       \printfield[citetitle]{labeltitle}%
     }%
   }
  {\multicitedelim}
  {\usebibmacro{postnote}}

那么问题就是您希望这个类别与那个cited类别如何关联。在下面的 MWE 中,我假设您希望将这些customcited类别从其他cited书目中排除。

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage[backend=biber,defernumbers=true]{biblatex}
\begin{filecontents}{\jobname.bib}
@BOOK{customciteentry,
  author    = {Customcite},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2003,
  keywords  = {hello},
}
@BOOK{BookB02,
  author    = {John Doe},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2002,
}
@MISC{LinkC04,
  author    = {Author Ccc},
  title     = {Some Title},
  year      = 2004,
  url       = {www.test1.com/bild.jpg},
  keywords  = {bye},
}
\end{filecontents}
\addbibresource{\jobname.bib}

% Bibliography, allows section 'uncited references'
\DeclareBibliographyCategory{cited}
\AtEveryCitekey{\addtocategory{cited}{\thefield{entrykey}}}

\DeclareBibliographyCategory{customcited}
% Cite, \customcite
\DeclareCiteCommand{\customcite}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}%
      \indexfield{indextitle}}
     {}%
   \addtocategory{customcited}{\thefield{entrykey}}%
   \printtext[bibhyperref]{%
       \printnames{labelname}%
       \space
       \printfield{year}%
       \addcolon\space%\setunit{\labelnamepunct}%
       \printfield[citetitle]{labeltitle}%
     }%
   }
  {\multicitedelim}
  {\usebibmacro{postnote}}


\begin{document}

\cite{BookB02}

\customcite{customciteentry}

\nocite{*}
\printbibliography[title={Not cited},notcategory=cited]
\printbibliography[title={Cited},category=cited,notcategory=customcited]
\printbibliography[title={Customcited},category=customcited]
\end{document}

在此处输入图片描述

相关内容