单独的 biblatex 书目、降序编号、“检查”过滤器

单独的 biblatex 书目、降序编号、“检查”过滤器

我想在简历中制作多个参考书目,将没有日期的论文与有日期的论文分开(一种判断它们是“正在审查”还是“已发布”的方法 - 我知道还有其他方法可以做到这一点,例如关键字等)。会议论文也一样。

随着 的更改biblatex,我的旧代码不再有效。我设法使用解决方案取得了一些进展这里即,我确实有按降序编号的期刊论文和会议的单独书目,如果我没有过滤空日期条目。

我正在使用“检查”过滤生成的条目\printbibligraphy,这种方法有效,但与用于降序编号的计数器不兼容(即,它不排除“过滤”的论文)。

我该如何修改下面的代码来修复计数器?

先感谢您!

\documentclass[10pt, a4paper]{article}
\usepackage[czech,english]{babel}  
\usepackage[backend=biber,style=ieee,defernumbers=true,sorting=keysort]{biblatex}


%%%%%%%%%%%%
% From https://tex.stackexchange.com/questions/367163/separate-biblatex-bibliographies-with-newest-entry-and-highest-reference-number:
% does not work correctly due to 'check' in bibliographies...

% Count total number of entries in each refsection
\AtDataInput{%
  \ifcsundef{bbx@processedentries:\therefsection}
    {\csgdef{bbx@processedentries:\therefsection}{}}
    {}%
  \xifinlistcs{\thefield{entrykey}}{bbx@processedentries:\therefsection}{}{%
    \listcsxadd{bbx@processedentries:\therefsection}{\thefield{entrykey}}%
    \csnumgdef{bbx@entrycount:\therefsection:\thefield{entrytype}}{%
      \csuse{bbx@entrycount:\therefsection:\thefield{entrytype}}+1}}}

% Print the labelnumber as the total number of entries in the
% current refsection, minus the actual labelnumber, plus one
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}    
\newrobustcmd*{\mkbibdesc}[1]{%
  \number\numexpr\csuse{bbx@entrycount:\therefsection:\thefield{entrytype}}+1-#1\relax}

%%%%%%%%%%%%
\DeclareSortingScheme{keysort}{
\sort[direction=descending]{\field{entrykey}  }
}

\addbibresource{pubs1.bib}
\addbibresource{pubs2.bib}

\begin{document}

\defbibcheck{confnoyear}{ \ifentrytype{inproceedings} {\iffieldundef{year}{}{\skipentry}} {\skipentry} }
\defbibcheck{journoyear}{ \ifentrytype{article}       {\iffieldundef{year}{}{\skipentry}} {\skipentry} }
\defbibcheck{confwyear}{  \ifentrytype{inproceedings} {\iffieldundef{year}{\skipentry}{}} {\skipentry} }
\defbibcheck{jourwyear}{  \ifentrytype{article}       {\iffieldundef{year}{\skipentry}{}} {\skipentry} }

% Journal papers under review (w/out years)
\newrefcontext[labelprefix=JS,sorting=keysort]
\printbibliography[check=journoyear]   \nocite{*}

% Journals published
\newrefcontext[labelprefix=J,sorting=keysort]
\printbibliography[check=jourwyear] \nocite{*}

% Conf papers under review (w/out years)
\newrefcontext[labelprefix=CS,sorting=keysort]
\printbibliography[check=confnoyear] \nocite{*}

% Conf papers published 
\newrefcontext[labelprefix=C,sorting=keysort]
\printbibliography[check=confwyear] \nocite{*}


\end{document}

答案1

此答案写于 2018 年,在较新的系统上可能不再起作用。请参阅使用自定义 bibchecks 在 biblatex 中反向编号biblatex寻找适用于v3.16 (2020-12-31)的答案。

答案将最新条目和最高参考编号放在顶部,形成单独的 Biblatex 书目奥黛丽的回答Multibib 反向标签或排序顺序,从中得出,计算每个引用部分中的项目数,然后从中计算反向标签数。正如您正确指出的那样,您的 bibchecks 跳过了仍属于引用部分的几个条目,因此这种方法会导致不连续的编号。

这是一个完全不同的方法。您的设置解决方案必须基于特定的书目环境,因为我们需要计算每个书目环境中的最大项目数,以便能够在每个书目中向后计数。

对于每个书目环境,我们计算列表中的项目数并将其写入文件.aux,以便在下次运行时在列表开头可用。然后,如果列表开头的项目数可用,我们将根据当前labelnumber书目中的最大项目数重新计算。最后,必须将该新项目labelnumber注册为labelnumber当前项目的官方项目。

\documentclass[10pt, a4paper]{article}
\usepackage[czech,english]{babel}  
\usepackage[backend=biber,style=ieee,defernumbers=true,sorting=keysort]{biblatex}

\makeatletter
\newcounter{bibenvcounter}
\newcounter{bibitemcounter}[bibenvcounter]

\newcommand*{\auxkacz@envmax}[2]{%
  \csgdef{blxkacz@envmax@#1}{#2}}

\defbibenvironment{bibliography}
  {\stepcounter{bibenvcounter}%
   \list
     {\ifcsundef{blxkacz@envmax@\the\value{bibenvcounter}}
        {}
        {\numdef\abx@field@localnumber{%
           \csuse{blxkacz@envmax@\the\value{bibenvcounter}}%
             -\value{bibitemcounter}}%
         \csundef{blx@defer@\the\c@refsection
            @\blx@refcontext@context
            @\abx@field@entrykey}%
         \blx@thelabelnumber}%
      \stepcounter{bibitemcounter}%
      \printtext[labelnumberwidth]{%
        \printfield{labelprefix}%
        \printfield{labelnumber}}}
     {\setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist
   \blx@auxwrite\@mainaux{}{%
     \string\auxkacz@envmax
       {\the\value{bibenvcounter}}
       {\the\value{bibitemcounter}}}}
  {\item}
\makeatother

\defbibcheck{confnoyear}{ \ifentrytype{inproceedings} {\iffieldundef{year}{}{\skipentry}} {\skipentry} }
\defbibcheck{journoyear}{ \ifentrytype{article}       {\iffieldundef{year}{}{\skipentry}} {\skipentry} }
\defbibcheck{confwyear}{  \ifentrytype{inproceedings} {\iffieldundef{year}{\skipentry}{}} {\skipentry} }
\defbibcheck{jourwyear}{  \ifentrytype{article}       {\iffieldundef{year}{\skipentry}{}} {\skipentry} }

\DeclareSortingScheme{keysort}{
  \sort[direction=descending]{\field{entrykey}}
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@inproceedings{a,
  author  = {Author, A.},
  title   = {A Title},
  date    = {1980},
}
@inproceedings{b,
  author  = {Buthor, B.},
  title   = {B Title},
  date    = {1980},
}
@inproceedings{c,
  author  = {Buthor, C.},
  title   = {C Title},
  date    = {1980},
}
@inproceedings{d,
  author  = {Duthor, D.},
  title   = {A Title},
}
@inproceedings{e,
  author  = {Euthor, E.},
  title   = {B Title},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\newrefcontext[labelprefix=CS,sorting=keysort]
\printbibliography[check=confnoyear] \nocite{*}

\newrefcontext[labelprefix=C,sorting=keysort]
\printbibliography[check=confwyear] \nocite{*}
\end{document}

参考书目 1 显示“[CS2] E. Euthor,“B 标题”//[CS1] D. Duthor,“A 标题”。” 参考书目 2 有“[C3] C. Buthor,“C 标题”,1980。//[C2] B. Buthor,“B 标题”,1980。//[C1] A. Author,“A 标题”,1980。”

相关内容